Skip to content
Open
Show file tree
Hide file tree
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
4 changes: 4 additions & 0 deletions packages/shared/src/components/icons/Joystick/filled.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions packages/shared/src/components/icons/Joystick/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import type { ReactElement } from 'react';
import React from 'react';
import type { IconProps } from '../../Icon';
import Icon from '../../Icon';
import OutlinedIcon from './outlined.svg';
import FilledIcon from './filled.svg';

export const JoystickIcon = (props: IconProps): ReactElement => (
<Icon {...props} IconPrimary={OutlinedIcon} IconSecondary={FilledIcon} />
);
4 changes: 4 additions & 0 deletions packages/shared/src/components/icons/Joystick/outlined.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions packages/shared/src/components/icons/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ export * from './Italic';
export * from './JetBrains';
export * from './Job';
export * from './JobStatus';
export * from './Joystick';
export * from './Kaggle';
export * from './Key';
export * from './Label';
Expand Down
19 changes: 16 additions & 3 deletions packages/shared/src/components/profile/ProfileSettingsMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import {
TourIcon,
FeatherIcon,
GiftIcon,
JoystickIcon,
} from '../icons';
import { NavDrawer } from '../drawers/NavDrawer';
import {
Expand Down Expand Up @@ -188,6 +189,11 @@ const useAccountPageItems = ({ onClose }: { onClose?: () => void } = {}) => {
onClose?.();
},
},
gameCenter: {
title: 'Game Center',
icon: JoystickIcon,
href: `${webappUrl}game-center`,
},
trackAchievement: {
title: 'Track achievement',
icon: PinIcon,
Expand Down Expand Up @@ -438,7 +444,7 @@ export const InnerProfileSettingsMenu = ({
<ProfileSection
key={key}
withSeparator={!lastItem}
title={menuItem.title}
title={menuItem.title ?? undefined}
items={Object.entries(menuItem.items)
.filter(([itemKey, item]) => {
if (item.href === walletUrl && !hasAccessToCores) {
Expand All @@ -459,6 +465,13 @@ export const InnerProfileSettingsMenu = ({
return false;
}

if (
itemKey === 'gameCenter' &&
isQuestsFeatureEnabled !== true
) {
return false;
}

return true;
})
.map(([, item]: [string, ProfileSectionItemProps]) => {
Expand Down Expand Up @@ -491,15 +504,15 @@ export function ProfileSettingsMenuMobile({
shouldKeepOpen={shouldKeepOpen}
drawerProps={{
isOpen,
onClose,
onClose: onClose ?? (() => {}),
}}
>
<InnerProfileSettingsMenu className="p-4" onClose={onClose} />
</NavDrawer>
);
}

export function ProfileSettingsMenuDesktop(): ReactElement {
export function ProfileSettingsMenuDesktop(): ReactElement | null {
const { user } = useAuthContext();
const featureTheme = useFeatureTheme();

Expand Down
24 changes: 22 additions & 2 deletions packages/shared/src/components/sidebar/sections/MainSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
EyeIcon,
HomeIcon,
HotIcon,
JoystickIcon,
SquadIcon,
TerminalIcon,
YearInReviewIcon,
Expand All @@ -24,6 +25,7 @@ import { useConditionalFeature } from '../../../hooks';
import {
featurePlusCtaCopy,
featureYearInReview,
questsFeature,
} from '../../../lib/featureManagement';

export const MainSection = ({
Expand All @@ -42,6 +44,10 @@ export const MainSection = ({
feature: featureYearInReview,
shouldEvaluate: isLoggedIn,
});
const { value: showGameCenter } = useConditionalFeature({
feature: questsFeature,
shouldEvaluate: isLoggedIn,
});

const menuItems: SidebarMenuItem[] = useMemo(() => {
// this path can be opened on extension so it purposly
Expand All @@ -59,7 +65,7 @@ export const MainSection = ({
action: () =>
onNavTabClick?.(isCustomDefaultFeed ? SharedFeedPage.MyFeed : '/'),
icon: () => (
<ProfilePicture size={ProfileImageSize.XSmall} user={user} />
<ProfilePicture size={ProfileImageSize.XSmall} user={user!} />
),
}
: {
Expand Down Expand Up @@ -87,6 +93,18 @@ export const MainSection = ({
}
: undefined;

const gameCenter = showGameCenter
? {
icon: (active: boolean) => (
<ListIcon Icon={() => <JoystickIcon secondary={active} />} />
),
title: 'Game Center',
path: `${webappUrl}game-center`,
isForcedLink: true,
requiresLogin: true,
}
: undefined;

const yearInReview = showYearInReview
? {
icon: () => <ListIcon Icon={() => <YearInReviewIcon />} />,
Expand Down Expand Up @@ -137,15 +155,17 @@ export const MainSection = ({
isForcedLink: true,
requiresLogin: true,
},
gameCenter,
yearInReview,
plusButton,
].filter(Boolean);
].filter((item): item is SidebarMenuItem => !!item);
}, [
ctaCopy,
isCustomDefaultFeed,
isLoggedIn,
isPlus,
onNavTabClick,
showGameCenter,
showYearInReview,
user,
]);
Expand Down
Loading