diff --git a/apps/web/src/components/Avatar.tsx b/apps/web/src/components/Avatar.tsx
index c7ce28d4..f65daf20 100644
--- a/apps/web/src/components/Avatar.tsx
+++ b/apps/web/src/components/Avatar.tsx
@@ -1,47 +1,71 @@
+import Image from "next/image";
import { twMerge } from "tailwind-merge";
import { getInitialsFromName, inferInitialsFromEmail } from "~/utils/helpers";
+const sizeMap = {
+ xs: 20,
+ sm: 24,
+ md: 36,
+ lg: 48,
+} as const;
+
const Avatar = ({
size = "md",
name,
email,
icon,
+ imageUrl,
isLoading,
}: {
- size?: "sm" | "md" | "lg";
+ size?: "xs" | "sm" | "md" | "lg";
name: string;
email: string;
+ imageUrl?: string;
icon?: React.ReactNode;
- isLoading: boolean;
+ isLoading?: boolean;
}) => {
const initials = name
? getInitialsFromName(name)
: inferInitialsFromEmail(email ?? "");
return (
-
- {icon ? (
- {icon}
+ <>
+ {imageUrl ? (
+
) : (
- {initials}
+ {icon ? (
+ {icon}
+ ) : (
+
+ {initials}
+
+ )}
)}
-
+ >
);
};
diff --git a/apps/web/src/components/SideNavigation.tsx b/apps/web/src/components/SideNavigation.tsx
index 410f3270..86ca9cf9 100644
--- a/apps/web/src/components/SideNavigation.tsx
+++ b/apps/web/src/components/SideNavigation.tsx
@@ -1,4 +1,4 @@
-import { usePathname } from "next/navigation";
+import { useRouter } from "next/router";
import boardsIconDark from "~/assets/boards-dark.json";
import boardsIconLight from "~/assets/boards-light.json";
@@ -25,7 +25,10 @@ export default function SideNavigation({
user,
isLoading,
}: SideNavigationProps) {
- const pathname = usePathname();
+ const router = useRouter();
+
+ const { pathname } = router;
+
const { activeTheme } = useTheme();
const isDarkMode = activeTheme === "dark";
diff --git a/apps/web/src/components/UserMenu.tsx b/apps/web/src/components/UserMenu.tsx
index abdf48e2..b955b3a4 100644
--- a/apps/web/src/components/UserMenu.tsx
+++ b/apps/web/src/components/UserMenu.tsx
@@ -5,6 +5,7 @@ import { Fragment } from "react";
import { useTheme } from "~/providers/theme";
import createClient from "~/utils/supabase/client";
+import { getPublicUrl } from "~/utils/supabase/getPublicUrl";
interface UserMenuProps {
imageUrl: string | undefined;
@@ -31,9 +32,7 @@ export default function UserMenu({
router.push("/login");
};
- const avatarUrl = imageUrl
- ? db.storage.from("avatars").getPublicUrl(imageUrl).data.publicUrl
- : null;
+ const avatarUrl = imageUrl ? getPublicUrl(imageUrl) : null;
return (