From e05e2c63c2b7bfab5f4592f7cbef6f3aebfdfe0d Mon Sep 17 00:00:00 2001 From: Wahyu Kurniawan Date: Wed, 6 Mar 2024 08:25:29 +0700 Subject: [PATCH] =?UTF-8?q?=F0=9F=8E=A8=20style:=20adjust=20sidebar=20for?= =?UTF-8?q?=20mobile?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/components/shared/Sidebar/Sidebar.tsx | 194 +++++++++++------- 1 file changed, 121 insertions(+), 73 deletions(-) diff --git a/packages/frontend/src/components/shared/Sidebar/Sidebar.tsx b/packages/frontend/src/components/shared/Sidebar/Sidebar.tsx index b61b1fee..bcd44611 100644 --- a/packages/frontend/src/components/shared/Sidebar/Sidebar.tsx +++ b/packages/frontend/src/components/shared/Sidebar/Sidebar.tsx @@ -1,6 +1,6 @@ import React, { useCallback, useEffect, useState } from 'react'; import { NavLink, useNavigate, useParams } from 'react-router-dom'; -import { Organization } from 'gql-client'; +import { Organization, User } from 'gql-client'; import { Option } from '@material-tailwind/react'; import { useDisconnect } from 'wagmi'; @@ -12,11 +12,16 @@ import { FolderIcon, GlobeIcon, LifeBuoyIcon, + LogoutIcon, QuestionMarkRoundIcon, SettingsSlidersIcon, } from 'components/shared/CustomIcon'; import { Tabs } from 'components/shared/Tabs'; import { Logo } from 'components/Logo'; +import { Avatar } from 'components/shared/Avatar'; +import { formatAddress } from 'utils/format'; +import { getInitials } from 'utils/geInitials'; +import { Button } from 'components/shared/Button'; export const Sidebar = () => { const { orgSlug } = useParams(); @@ -24,6 +29,17 @@ export const Sidebar = () => { const client = useGQLClient(); const { disconnect } = useDisconnect(); + const [user, setUser] = useState(); + + const fetchUser = useCallback(async () => { + const { user } = await client.getUser(); + setUser(user); + }, []); + + useEffect(() => { + fetchUser(); + }, []); + const [selectedOrgSlug, setSelectedOrgSlug] = useState(orgSlug); const [organizations, setOrganizations] = useState([]); @@ -43,39 +59,21 @@ export const Sidebar = () => { }, [disconnect, navigate]); return ( -