Skip to content

one to one chat bug fixed #132

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: Development
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added public/document (2).pdf
Binary file not shown.
2 changes: 1 addition & 1 deletion src/components/Home/banner.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const Banner = () => {
const { user } = useContext(AuthContext);
return (
<div>
<div className="md:hidden relative bg-gradient-to-b from-[#73e9fe] to-[#78118f] text-[#0c01a1]">
<div className="md:hidden relative bg-gradient-to-b from-[#73e9fe] to-[#1d02b8] text-[#0c01a1]">
<div className="h-[85vh] flex flex-col justify-center items-center space-y-4 space-x-4 md:space-x-0">
<div>
<h1 className="text-center text-5xl font-bold ">
Expand Down
8 changes: 4 additions & 4 deletions src/components/Pages/Chat/ChatOnetoOne.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,20 +80,20 @@ const ChatOnetoOne = ({user, profile}) => {

return (
<div className="">
<button onClick={() => handleToggleChat(user.userId, profile.id)} className="font-bold px-4 py-4 rounded-full bg-[#0154a1] text-white ">
<button onClick={() => handleToggleChat(user?.userId, profile?.id)} className="font-bold px-4 py-4 rounded-full bg-[#0154a1] text-white ">
<RiChatSmile3Line className="text-4xl rounded-full " title="Chat Now"/>
</button>
{showChat && (
<div className="fixed bottom-10 right-4 w-96 h-96 bg-white dark:bg-gray-950 shadow-lg rounded-lg flex flex-col">
<div className="flex items-center justify-between p-4 bg-[#0154a1] text-white rounded-t-lg">
<div className="flex items-center">
<img
src={profile.image ? `${profile.image}` : `${profile.image}`}
alt={profile.first_name}
src={profile?.image ? `${profile?.image}` : `${profile?.image}`}
alt={profile?.get_full_name}
className="w-6 h-6 rounded-full mr-2"
/>
<span className="text-lg font-semibold">
{profile.first_name}
{profile?.get_full_name}
</span>
</div>
<button onClick={handleToggleChat}>
Expand Down
111 changes: 67 additions & 44 deletions src/components/User/DynamicProfile.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,8 @@
// </dialog>
// </div>



// </div>
// </div>
// </div>
Expand Down Expand Up @@ -249,12 +249,13 @@ import ProjectSlider from "./ProjectSlider";
import { Element, ScrollLink } from "react-scroll";
import axios from "axios";
import { useParams } from "react-router-dom";
import { toast } from "react-toastify";

const DynamicProfile = () => {
const { user } = useContext(AuthContext);
const { pId } = useParams();
const [profile, setProfile] = useState(null);
const [loading, setLoading ] = useState(true);
const [loading, setLoading] = useState(true);
const [reload, setReload] = useState(false);
const [showComponent, setShowComponent] = useState("Info");

Expand All @@ -264,24 +265,46 @@ const DynamicProfile = () => {
document.getElementById("UserEdit").close();
};


const handleAddUserEdit = async (e) => {

e.preventDefault();
const updateDesignation = {
designation: e.target.designation.value,
user: user?.userId
}
console.log({ updateDesignation });

try {
const result = await axios.post(`https://projectsyncifyapi.onrender.com/api/v1/profile/designation/`, updateDesignation)
console.log({ result })
handleCloseModal();
toast.success("Designation updated successfully")

setReload(!reload)
}
catch (error) {
console.log(error)
}


};
useEffect(() => {
const getProfileData = async() => {

const getProfileData = async () => {
setLoading(true)
try{
try {
const result = await axios.get(`https://projectsyncifyapi.onrender.com/api/v1/profile/${pId}/`)
console.log({result})
console.log({ result })
setProfile(result.data)
setLoading(false)
}
catch(error){
catch (error) {
console.log(error)
setLoading(false)
}
}

if(user && user.userId){
if (user && user.userId) {
getProfileData();
}
}, [user, reload]);
Expand All @@ -300,7 +323,7 @@ const DynamicProfile = () => {
alt={profile && profile.get_full_name}
className="w-28 md:w-40 h-28 md:h-40 rounded-full border-4 border-sky-900 dark:border-sky-300"
/>

</div>
<div className="flex flex-col justify-start">
<h1 className="text-xl md:text-3xl font-bold">
Expand All @@ -309,7 +332,7 @@ const DynamicProfile = () => {
</h1>
<h1 className="text-lg md:text-xl font-bold mt-2">
{" "}
{profile && profile?.designation?.designation }
{profile && profile?.designation?.designation}
</h1>
{/* <p className=""> {user && user.email}</p> */}
</div>
Expand All @@ -319,18 +342,16 @@ const DynamicProfile = () => {
<div className="flex flex-wrap gap-2 sm:items-center mt-10 md:mt-6 ml-10 md:ml-36 font-semibold ">
<button
onClick={() => setShowComponent("Info")}
className={`rounded py-1 px-2 text-sm hover:bg-sky-200 dark:hover:bg-sky-300 hover:text-sky-900 ${
showComponent === "Info" ? "bg-sky-50 dark:bg-sky-950 " : ""
}`}
className={`rounded py-1 px-2 text-sm hover:bg-sky-200 dark:hover:bg-sky-300 hover:text-sky-900 ${showComponent === "Info" ? "bg-sky-50 dark:bg-sky-950 " : ""
}`}
>
Info
</button>

<button
onClick={() => setShowComponent("Contact")}
className={`rounded py-1 px-2 text-sm hover:bg-sky-200 dark:hover:bg-sky-300 hover:text-sky-900 ${
showComponent === "Contact" ? "bg-sky-50 dark:bg-sky-950" : ""
}`}
className={`rounded py-1 px-2 text-sm hover:bg-sky-200 dark:hover:bg-sky-300 hover:text-sky-900 ${showComponent === "Contact" ? "bg-sky-50 dark:bg-sky-950" : ""
}`}
>
Contact
</button>
Expand Down Expand Up @@ -358,7 +379,7 @@ const DynamicProfile = () => {
Edit
</h3>
<form onSubmit={handleAddUserEdit}>
<div className="form-control">
{/* <div className="form-control">
<label className="label">
<span className="label-text dark:text-[#73e9fe] text-[#0c01a1]">
Name
Expand All @@ -370,7 +391,7 @@ const DynamicProfile = () => {
className="input input-bordered bg-slate-200 dark:bg-black"
required
/>
</div>
</div> */}

<div className="form-control">
<label className="label">
Expand All @@ -380,7 +401,7 @@ const DynamicProfile = () => {
</label>
<input
type="text"
name="position"
name="designation"
className="input input-bordered bg-slate-200 dark:bg-black"
required
/>
Expand All @@ -405,42 +426,44 @@ const DynamicProfile = () => {
{showComponent === "Info" ? (
<Info user={user} profile={profile} />
) : // ) : showComponent === "Work" ? (
// <Work />
// ) : showComponent === "Education" ? (
// <Education />
showComponent === "Contact" ? (
<UserContact user={user} contact={profile.contact} reload={reload} setReload={setReload} />
) : null}
// <Work />
// ) : showComponent === "Education" ? (
// <Education />
showComponent === "Contact" ? (
<UserContact user={user} contact={profile.contact} reload={reload} setReload={setReload} />
) : null}
</div>
{/* profile banner end */}

{/* add the chatting component here */}
<div className="fixed bottom-10 right-4">
<ChatOnetoOne />
</div>



<div>
{loading && <div className="flex items-center justify-center"><span className="loading loading-dots loading-lg"> </span>Profile loading ...</div>}
{loading && <div className="flex items-center justify-center"><span className="loading loading-dots loading-lg"> </span>Profile loading ...</div>}
</div>

{profile && <>


<div className="fixed bottom-10 right-4">
<ChatOnetoOne user={user} profile={profile} />
</div>

{/* about section start */}
<UserAbout user={user} about={profile.about} reload={reload} setReload={setReload}/>
<UserAbout user={user} about={profile.about} reload={reload} setReload={setReload} />

{/* portfolio section start */}
<UserPortfolio user={user} portfolio={profile.portfolio} reload={reload} setReload={setReload} />

{/* portfolio section start */}
<UserPortfolio user={user} portfolio={profile.portfolio} reload={reload} setReload={setReload} />
{/* skill section start */}
<UserSkills user={user} skills={profile.skills} reload={reload} setReload={setReload} />

{/* skill section start */}
<UserSkills user={user} skills={profile.skills} reload={reload} setReload={setReload}/>
{/* education section start */}

{/* education section start */}
<Education user={user} education={profile.education} reload={reload} setReload={setReload} />

<Education user={user} education={profile.education} reload={reload} setReload={setReload}/>
{/* work section start */}
<Work user={user} work={profile.work} reload={reload} setReload={setReload} />

{/* work section start */}
<Work user={user} work={profile.work} reload={reload} setReload={setReload}/>

</>}

{/* project in slider start */}
Expand Down
1 change: 1 addition & 0 deletions src/components/User/Profile.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ const Profile = () => {
<h1 className="text-xl md:text-3xl font-bold">
{" "}
{user && user?.name}
{}
</h1>
{/* <p className=""> {user && user.email}</p> */}
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/pages/shared/Navbar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ const Navbar = ({ handleThemeChange }) => {

const handleProfile = () => {
console.log("profile button clicked");
navigate("/profile");
navigate(`/profile/${user?.userId}`);
};
const [menuVisible, setMenuVisible] = useState(false);

Expand Down