diff --git a/packages/i18n/strings/en.json b/packages/i18n/strings/en.json index bd124f4a9..deba93510 100644 --- a/packages/i18n/strings/en.json +++ b/packages/i18n/strings/en.json @@ -6,6 +6,14 @@ }, "common": { + "grades": { + "0": "Unspecified grade", + "1": "Common", + "2": "Rare", + "3": "Epic", + "4": "Legendary" + }, + "units": { "m": "%s1m", "mm": "%s1mm", @@ -1260,10 +1268,21 @@ "seo_description": "All World of Tanks Blitz player profile avatars", "description": "Player profile avatars", + "no_description": "This avatar has no description.", + "download": "Download", + "hidden": "Hidden", "unnamed_avatars": "Unnamed avatars", "search": { "hint": "Search avatars...", "results": "%s1 avatars" + }, + "categories": { + "0": "Unspecified category", + "1": "Premium", + "2": "Special", + "3": "Accumulative", + "4": "Other", + "5": "Temporary" } }, diff --git a/packages/website-ue/src/components/Avatars/Group.tsx b/packages/website-ue/src/components/Avatars/Group.tsx index 4a0779512..a35ffe402 100644 --- a/packages/website-ue/src/components/Avatars/Group.tsx +++ b/packages/website-ue/src/components/Avatars/Group.tsx @@ -1,12 +1,19 @@ -import type { ProfileAvatarComponent } from '@protos/blitz_static_profile_avatar_component'; +import { + ProfileAvatarComponent_Category, + type ProfileAvatarComponent, +} from '@protos/blitz_static_profile_avatar_component'; import type { SellableComponent } from '@protos/blitz_static_sellable_component'; +import { Grade } from '@protos/blitz_static_standard_grades_enum'; import type { StuffUIComponent } from '@protos/blitz_static_stuff_ui_component'; +import { DownloadIcon, StarFilledIcon } from '@radix-ui/react-icons'; import { Badge, Box, + Button, Dialog, Flex, Text, + type BadgeProps, type FlexProps, } from '@radix-ui/themes'; import { literals } from 'packages/i18n/src'; @@ -22,30 +29,116 @@ interface AvatarGroupProps { }[]; } -const dx = '4px'; -const MAX_AVATARS_PREVIEW = 5; - -export function AvatarGroup({ name, avatars }: AvatarGroupProps) { +export function AvatarGroup(props: AvatarGroupProps) { return ( - + - asd + + + ); } +const CATEGORY_COLORS: Record< + ProfileAvatarComponent_Category, + BadgeProps['color'] +> = { + [ProfileAvatarComponent_Category.CATEGORY_UNSPECIFIED]: 'gray', + [ProfileAvatarComponent_Category.CATEGORY_PREMUM]: 'gray', + [ProfileAvatarComponent_Category.CATEGORY_SPECIAL]: 'gray', + [ProfileAvatarComponent_Category.CATEGORY_ACCUMULATIVE]: 'gray', + [ProfileAvatarComponent_Category.CATEGORY_OTHER]: 'gray', + [ProfileAvatarComponent_Category.CATEGORY_TEMPORARY]: 'gray', +}; +const GRADE_COLORS = { + [Grade.GRADE_UNSPECIFIED]: 'gray', + [Grade.GRADE_COMMON]: 'gray', + [Grade.GRADE_RARE]: 'blue', + [Grade.GRADE_EPIC]: 'purple', + [Grade.GRADE_LEGENDARY]: 'amber', +} satisfies Record; + +function Popup({ name, avatars }: AvatarGroupProps) { + const { strings, gameStrings } = useLocale(); + + return ( + <> + {name} + + + {avatars.map(({ avatar, stuff }, index) => ( + + + + {strings.common.grades[stuff.grade]} + + + + + + {gameStrings[stuff.description] ?? + (gameStrings[stuff.obtaining_methods] + ? undefined + : strings.website.tools.avatars.no_description)}{' '} + {gameStrings[stuff.obtaining_methods]} + + + + + + + + ))} + + + ); +} + +const dx = '4px'; +const MAX_AVATARS_PREVIEW = 5; + function Content({ avatars, name, ...props }: FlexProps & AvatarGroupProps) { const { strings } = useLocale(); - const avatarsReduced = [...avatars].reverse().slice(0, MAX_AVATARS_PREVIEW); + const avatarsReduced = [...avatars].slice(-MAX_AVATARS_PREVIEW); return ( {avatarsReduced.map((avatar, index) => ( - BlitzKit + + BlitzKit + {packageJson.version} + + {strings.website.footer.motto} {strings.website.footer.copyright} @@ -127,23 +131,4 @@ const strings = await getStrings(locale); - - - - BlitzKit - - - - - {packageJson.version} - - - - - - BlitzKit - - {packageJson.version} - - diff --git a/packages/website-ue/src/components/Navbar.astro b/packages/website-ue/src/components/Navbar.astro index 49cf8898b..f758f5941 100644 --- a/packages/website-ue/src/components/Navbar.astro +++ b/packages/website-ue/src/components/Navbar.astro @@ -13,11 +13,10 @@ import { Var } from '../core/radix/var'; import { LinkI18n } from './LinkI18n'; export interface Props { - integrated?: boolean; locale: string; } -const { integrated, locale } = Astro.props; +const { locale } = Astro.props; const toolsFiltered = tools.filter((tool) => tool.enabled); const branchName = resolveBranchName(); const isBranchNamed = branchName !== undefined; @@ -76,12 +75,6 @@ const strings = await getStrings(locale); }); -{ - !integrated && ( - - ) -} - diff --git a/packages/website-ue/src/constants/tools.ts b/packages/website-ue/src/constants/tools.ts index 254c7c709..1195eb807 100644 --- a/packages/website-ue/src/constants/tools.ts +++ b/packages/website-ue/src/constants/tools.ts @@ -38,6 +38,7 @@ export const chartsTool: Tool = { export const avatarsTool: Tool = { id: 'avatars', enabled: true, + significant: true, button: { color: 'gold' }, }; diff --git a/packages/website-ue/src/pages/[...locale]/avatars/_index.tsx b/packages/website-ue/src/pages/[...locale]/avatars/_index.tsx index ca133b2e9..117b1e068 100644 --- a/packages/website-ue/src/pages/[...locale]/avatars/_index.tsx +++ b/packages/website-ue/src/pages/[...locale]/avatars/_index.tsx @@ -16,10 +16,10 @@ import { useMemo } from 'react'; const allAvatars = await metadata .get('BlitzkitAllAvatarsEntity.blitzkit_all_avatars') - .then( - (entity) => - entity.get(BlitzkitAllAvatarsComponent, 'blitzkitAllAvatarsComponent') - .avatars, + .then((entity) => + entity + .get(BlitzkitAllAvatarsComponent, 'blitzkitAllAvatarsComponent') + .avatars.reverse(), ); export function Page({ localeData }: LocaleAcceptorProps) { @@ -71,7 +71,7 @@ function Content() { }, []); return ( - + {groups.map(([name, avatars]) => ( - + ))}