diff --git a/apps/web/src/components/Sidebar/index.tsx b/apps/web/src/components/Sidebar/index.tsx index 481c0792..17dd4cd7 100644 --- a/apps/web/src/components/Sidebar/index.tsx +++ b/apps/web/src/components/Sidebar/index.tsx @@ -23,7 +23,6 @@ export default function Sidebar({ selectChange?: (selectedItem: string | null) => void; jwt: string; }) { - const { data: session } = useSession(); const [selectedItem, setSelectedItem] = useState(null); @@ -61,7 +60,7 @@ export default function Sidebar({ ), label: "Profile", - content: + content: , }, ]; @@ -89,7 +88,7 @@ export default function Sidebar({ setSelectedItem={setSelectedItem} />
- {/* + {/*
), - content: + content: , }} selectedItem={selectedItem} setSelectedItem={setSelectedItem} /> - {/* */} + {selectedItem && {Subbar}} @@ -181,102 +180,104 @@ export function SubSidebar({ children }: { children?: React.ReactNode }) { }} className="z-[10] flex h-full w-full min-w-full flex-col items-center opacity-0" > - - {children} - + {children} ); } export function ProfileTab({ open }: { open: boolean }) { + const { data: session } = useSession(); - const { data: session } = useSession() - - const [tweetStat, setTweetStat] = useState<[number, number] | null>(); - const [memoryStat, setMemoryStat] = useState<[number, number] | null>(); + const [tweetStat, setTweetStat] = useState<[number, number] | null>(); + const [memoryStat, setMemoryStat] = useState<[number, number] | null>(); - const [loading, setLoading] = useState(true) + const [loading, setLoading] = useState(true); - useEffect(() => { - fetch("/api/getCount").then(async resp => { - const data = await resp.json() as any; - setTweetStat([data.tweetsCount, data.tweetsLimit]) - setMemoryStat([data.pageCount, data.pageLimit]) - setLoading(false) - }) - }, [open]) + useEffect(() => { + fetch("/api/getCount").then(async (resp) => { + const data = (await resp.json()) as any; + setTweetStat([data.tweetsCount, data.tweetsLimit]); + setMemoryStat([data.pageCount, data.pageLimit]); + setLoading(false); + }); + }, [open]); - return ( -
+ return ( +

Profile

-
- { - (e.target as HTMLImageElement).src = "/icons/white_without_bg.png" - }} - /> -
-

{session?.user?.name}

- - {session?.user?.email} - - -
-
-
-
-

- - Storage -

- {loading ? ( -
-
-
-
- ) : ( - <> -
-

- Memories -
- {memoryStat?.join("/")} -
-

-
-
0 ? '5%' : '0%' - }} className="rounded-full h-full bg-rgray-5" /> -
-
-
-

- Tweets -
- {tweetStat?.join("/")} -
-

-
-
0 ? '5%' : '0%' - }} className="rounded-full h-full bg-rgray-5" /> -
-
- - )} -
-
- ) +
+ { + (e.target as HTMLImageElement).src = + "/icons/white_without_bg.png"; + }} + /> +
+

{session?.user?.name}

+ {session?.user?.email} + +
+
+
+
+

+ + Storage +

+ {loading ? ( +
+
+
+
+ ) : ( + <> +
+

+ Memories +
+ {memoryStat?.join("/")} +
+

+
+
0 ? "5%" : "0%", + }} + className="bg-rgray-5 h-full rounded-full" + /> +
+
+
+

+ Tweets +
+ {tweetStat?.join("/")} +
+

+
+
0 ? "5%" : "0%", + }} + className="bg-rgray-5 h-full rounded-full" + /> +
+
+ + )} +
+
+ ); }