Skip to content
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

New profile picture feature #7995

1 change: 1 addition & 0 deletions src/Common/hooks/useAuthUser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ type AuthContextType = {
user: UserModel | undefined;
signIn: (creds: LoginCredentials) => Promise<SignInReturnType>;
signOut: () => Promise<void>;
refetchUser: () => Promise<RequestResult<UserModel>>;
};

export const AuthUserContext = createContext<AuthContextType | null>(null);
Expand Down
13 changes: 10 additions & 3 deletions src/Components/Common/Sidebar/SidebarUserCard.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Link } from "raviger";
import { useTranslation } from "react-i18next";
import CareIcon from "../../../CAREUI/icons/CareIcon";
import { formatName } from "../../../Utils/utils";
import { classNames, formatName } from "../../../Utils/utils";
import useAuthUser, { useAuthContext } from "../../../Common/hooks/useAuthUser";

const SidebarUserCard = ({ shrinked }: { shrinked: boolean }) => {
Expand All @@ -15,8 +15,15 @@ const SidebarUserCard = ({ shrinked }: { shrinked: boolean }) => {
shrinked ? "mx-auto flex-col" : "mx-5"
} transition-all duration-200 ease-in-out`}
>
<Link href="/user/profile" className="flex-none py-3">
<CareIcon icon="l-user-circle" className="text-3xl text-white" />
<Link href="/user/profile">
<img
src={user.read_profile_picture_url || "/images/empty_avatar.jpg"}
alt="profile"
className={classNames(
"mb-3 size-10 rounded-full object-cover",
shrinked && "mb-2 mt-1",
)}
/>
</Link>
<div className="flex cursor-pointer justify-center" onClick={signOut}>
<CareIcon
Expand Down
Loading
Loading