Skip to content

Commit

Permalink
Merge pull request #24 from strkfarm/dev
Browse files Browse the repository at this point in the history
STARK profile integration
  • Loading branch information
akiraonstarknet authored Aug 18, 2024
2 parents 93b3a91 + 3c3d0bd commit 2421f62
Showing 1 changed file with 30 additions and 2 deletions.
32 changes: 30 additions & 2 deletions src/components/Navbar.tsx
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,12 @@ import { addressAtom } from '@/store/claims.atoms';
import { MyMenuItemProps, MyMenuListProps, shortAddress } from '@/utils';
import { useEffect } from 'react';
import { lastWalletAtom } from '@/store/utils.atoms';
import { useAccount, useConnect, useDisconnect } from '@starknet-react/core';
import {
useAccount,
useConnect,
useDisconnect,
useStarkProfile,
} from '@starknet-react/core';
import { CONNECTOR_NAMES, MYCONNECTORS } from '@/app/template';
import { isMobile } from 'react-device-detect';

Expand All @@ -39,6 +44,10 @@ export default function Navbar(props: NavbarProps) {
const { connect, connectors } = useConnect();
const { disconnectAsync } = useDisconnect();
const setAddress = useSetAtom(addressAtom);
const { data: starkProfile } = useStarkProfile({
address,
useDefaultPfp: true,
});
const [lastWallet, setLastWallet] = useAtom(lastWalletAtom);
const { starknetkitConnectModal: starknetkitConnectModal1 } =
useStarknetkitConnectModal({
Expand Down Expand Up @@ -241,7 +250,26 @@ export default function Navbar(props: NavbarProps) {
onClick={address ? undefined : connectWallet}
size="xs"
>
<Center>{address ? shortAddress(address) : 'Connect'}</Center>
<Center>
{address ? (
starkProfile ? (
<Box display="flex" alignItems="center" gap=".5rem">
<Image
src={starkProfile?.profilePicture}
alt="pfp"
width={30}
height={30}
rounded="full"
/>{' '}
<h3>{starkProfile?.name}</h3>
</Box>
) : (
shortAddress(address)
)
) : (
'Connect'
)}
</Center>
</MenuButton>
<MenuList {...MyMenuListProps}>
{address && (
Expand Down

0 comments on commit 2421f62

Please sign in to comment.