diff options
author | Eric Bailey <git@esb.lol> | 2023-11-10 11:31:36 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-10 11:31:36 -0600 |
commit | 6513055d02c5f8981f38bface3514af3472474d9 (patch) | |
tree | 0d687d4ef59b20a0b75d8e42171c6fafd9e0d36c /src/view/shell/desktop/LeftNav.tsx | |
parent | 8d7475c13069f99170b40d696a7371c94020ef46 (diff) | |
parent | 436a14eabb4fe2238ff6048f41042433c0e07268 (diff) | |
download | voidsky-6513055d02c5f8981f38bface3514af3472474d9.tar.zst |
Merge pull request #1860 from bluesky-social/eric/startup
Web login/signup and shell
Diffstat (limited to 'src/view/shell/desktop/LeftNav.tsx')
-rw-r--r-- | src/view/shell/desktop/LeftNav.tsx | 57 |
1 files changed, 31 insertions, 26 deletions
diff --git a/src/view/shell/desktop/LeftNav.tsx b/src/view/shell/desktop/LeftNav.tsx index b85823b6f..0586323b4 100644 --- a/src/view/shell/desktop/LeftNav.tsx +++ b/src/view/shell/desktop/LeftNav.tsx @@ -41,18 +41,25 @@ import {router} from '../../../routes' import {makeProfileLink} from 'lib/routes/links' import {useLingui} from '@lingui/react' import {Trans, msg} from '@lingui/macro' +import {useProfileQuery} from '#/state/queries/profile' +import {useSession} from '#/state/session' const ProfileCard = observer(function ProfileCardImpl() { - const store = useStores() + const {currentAccount} = useSession() + const {isLoading, data: profile} = useProfileQuery({did: currentAccount!.did}) const {isDesktop} = useWebMediaQueries() const size = 48 - return store.me.handle ? ( + + return !isLoading && profile ? ( <Link - href={makeProfileLink(store.me)} + href={makeProfileLink({ + did: currentAccount!.did, + handle: currentAccount!.handle, + })} style={[styles.profileCard, !isDesktop && styles.profileCardTablet]} title="My Profile" asAnchor> - <UserAvatar avatar={store.me.avatar} size={size} /> + <UserAvatar avatar={profile.avatar} size={size} /> </Link> ) : ( <View style={[styles.profileCard, !isDesktop && styles.profileCardTablet]}> @@ -255,7 +262,7 @@ export const DesktopLeftNav = observer(function DesktopLeftNav() { pal.view, pal.border, ]}> - {store.session.hasSession && <ProfileCard />} + <ProfileCard /> <BackBtn /> <NavItem href="/" @@ -360,26 +367,24 @@ export const DesktopLeftNav = observer(function DesktopLeftNav() { } label="Moderation" /> - {store.session.hasSession && ( - <NavItem - href={makeProfileLink(store.me)} - icon={ - <UserIcon - strokeWidth={1.75} - size={isDesktop ? 28 : 30} - style={pal.text} - /> - } - iconFilled={ - <UserIconSolid - strokeWidth={1.75} - size={isDesktop ? 28 : 30} - style={pal.text} - /> - } - label="Profile" - /> - )} + <NavItem + href={makeProfileLink(store.me)} + icon={ + <UserIcon + strokeWidth={1.75} + size={isDesktop ? 28 : 30} + style={pal.text} + /> + } + iconFilled={ + <UserIconSolid + strokeWidth={1.75} + size={isDesktop ? 28 : 30} + style={pal.text} + /> + } + label="Profile" + /> <NavItem href="/settings" icon={ @@ -398,7 +403,7 @@ export const DesktopLeftNav = observer(function DesktopLeftNav() { } label="Settings" /> - {store.session.hasSession && <ComposeBtn />} + <ComposeBtn /> </View> ) }) |