Skip to content

Commit bfdc0e6

Browse files
authored
Fixed megamenu link to go to edit profile flow (#828)
* Fixed megamenu link to go to edit profile flow * Added view profile back to user menu * Added edit profile button to own profile
1 parent b69aa39 commit bfdc0e6

File tree

2 files changed

+31
-2
lines changed

2 files changed

+31
-2
lines changed

packages/web/components/MegaMenu.tsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,7 @@ type PlayerStatsProps = {
249249
const PlayerStats: React.FC<PlayerStatsProps> = ({ player }) => {
250250
const { disconnect } = useWeb3();
251251
const { pSeedBalance } = usePSeedBalance();
252+
252253
return (
253254
<Flex
254255
align="center"
@@ -311,11 +312,18 @@ const PlayerStats: React.FC<PlayerStatsProps> = ({ player }) => {
311312
<MenuList mt="8px" color="black" fontFamily="exo2">
312313
<MetaLink
313314
color="black"
314-
href={`/player/${getPlayerName(player)}`}
315+
href={`/player/${player.username}`}
315316
_hover={{ textDecoration: 'none' }}
316317
>
317318
<MenuItem>View Profile</MenuItem>
318319
</MetaLink>
320+
<MetaLink
321+
color="black"
322+
href="/profile/setup/username"
323+
_hover={{ textDecoration: 'none' }}
324+
>
325+
<MenuItem>Edit Profile</MenuItem>
326+
</MetaLink>
319327
<MenuItem onClick={disconnect}>Disconnect</MenuItem>
320328
</MenuList>
321329
</Menu>

packages/web/components/Player/Section/PlayerHero.tsx

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
import { Box, Flex, HStack, Link, Text, VStack } from '@metafam/ds';
1+
import { Box, Button, Flex, HStack, Link, Text, VStack } from '@metafam/ds';
22
import { PlayerAvatar } from 'components/Player/PlayerAvatar';
33
import { PlayerFragmentFragment } from 'graphql/autogen/types';
44
import { getPersonalityInfo } from 'graphql/getPersonalityInfo';
55
import { PersonalityOption } from 'graphql/types';
6+
import { useUser } from 'lib/hooks';
67
import React, { useEffect } from 'react';
78
import { getPlayerDescription, getPlayerName } from 'utils/playerHelpers';
89

@@ -17,6 +18,8 @@ const MAX_BIO_LENGTH = 240;
1718

1819
type Props = { player: PlayerFragmentFragment };
1920
export const PlayerHero: React.FC<Props> = ({ player }) => {
21+
const { user } = useUser();
22+
2023
const description = getPlayerDescription(player);
2124
const [show, setShow] = React.useState(description.length <= MAX_BIO_LENGTH);
2225
const [types, setTypes] = React.useState<{
@@ -33,9 +36,27 @@ export const PlayerHero: React.FC<Props> = ({ player }) => {
3336
loadTypes();
3437
}, []);
3538

39+
const isOwnProfile = player.username === user?.username;
40+
3641
return (
3742
<ProfileSection>
3843
<VStack spacing={8}>
44+
{isOwnProfile && (
45+
<Flex width="100%" justifyContent="end">
46+
<Button
47+
variant="outline"
48+
fontFamily="body"
49+
fontSize="14px"
50+
borderColor="purple.600"
51+
backgroundColor="blackAlpha.400"
52+
href="/profile/setup/username"
53+
mb="-4"
54+
_hover={{ backgroundColor: 'blackAlpha.500' }}
55+
>
56+
Edit Profile
57+
</Button>
58+
</Flex>
59+
)}
3960
<PlayerAvatar
4061
w={{ base: 32, md: 56 }}
4162
h={{ base: 32, md: 56 }}

0 commit comments

Comments
 (0)