Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat:Integrated Starknet ID PFP and names #94

Merged
merged 2 commits into from
Aug 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading