From 64d12bba8baf8ef00aa44239fbc6902e0ebd64ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tr=C3=A8sAbhi?= <43380238+tresabhi@users.noreply.github.com> Date: Wed, 28 May 2025 10:42:09 -0500 Subject: [PATCH] feat: simplify tools --- _package.json | 3 - package.json | 2 +- packages/website-ue/package.json | 3 + .../website-ue/src/components/Navbar.astro | 22 +-- packages/website-ue/src/constants/tools.ts | 172 ++++++------------ packages/website/package.json | 5 - 6 files changed, 66 insertions(+), 141 deletions(-) diff --git a/_package.json b/_package.json index 0b48acc03..3bd098140 100644 --- a/_package.json +++ b/_package.json @@ -82,9 +82,6 @@ "@nanostores/react": "^0.7.3", "@nivo/bar": "^0.87.0", "@nivo/line": "^0.88.0", - "@radix-ui/colors": "^3.0.0", - "@radix-ui/react-icons": "^1.3.0", - "@radix-ui/themes": "^3.1.4", "@react-three/drei": "^9.115.0", "@react-three/fiber": "^8.17.10", "compare-versions": "^6.1.1", diff --git a/package.json b/package.json index cadab3e60..8e3bb4dc3 100644 --- a/package.json +++ b/package.json @@ -30,7 +30,7 @@ "lint": "tsc", "lint:website": "cd packages/website && bun run lint", "format": "prettier --write \"**/*.@(json|js|jsx|css|md|ts|tsx|html|xml|yml|gltf)\"", - "update": "yarn upgrade --latest", + "update": "yarn upgace --latest", "tunnel": "cloudflared tunnel --url http://localhost:3000", "discoverids": "scripts/discoverIds.ts", "build:protos": "bun packages/scripts/src/protos.ts", diff --git a/packages/website-ue/package.json b/packages/website-ue/package.json index 68a904a70..d4fbed284 100644 --- a/packages/website-ue/package.json +++ b/packages/website-ue/package.json @@ -8,6 +8,9 @@ "astro": "astro" }, "dependencies": { + "@radix-ui/colors": "^3.0.0", + "@radix-ui/react-icons": "^1.3.0", + "@radix-ui/themes": "^3.1.4", "@blitzkit/core": "workspace:*", "@blitzkit/closed": "workspace:*", "@astrojs/react": "^4.3.0", diff --git a/packages/website-ue/src/components/Navbar.astro b/packages/website-ue/src/components/Navbar.astro index 2f6789242..db324b894 100644 --- a/packages/website-ue/src/components/Navbar.astro +++ b/packages/website-ue/src/components/Navbar.astro @@ -7,7 +7,7 @@ import { HamburgerMenuIcon, } from '@radix-ui/react-icons'; import { Box, Code, Flex, IconButton, Link } from '@radix-ui/themes'; -import { TOOLS } from '../constants/tools'; +import { tools } from '../constants/tools'; import { resolveBranchName } from '../core/blitzkit/branches'; import { getStrings } from '../core/i18n/getStrings'; import { Var } from '../core/radix/var'; @@ -19,7 +19,7 @@ export interface Props { } const { integrated, locale } = Astro.props; -const toolsFiltered = TOOLS.filter((tool) => !('href' in tool)); +const toolsFiltered = tools.filter((tool) => tool.enabled); const branchName = resolveBranchName(locale); const isBranchNamed = branchName !== undefined; const strings = await getStrings(locale); @@ -137,19 +137,13 @@ const strings = await getStrings(locale); > { toolsFiltered.map((tool) => { - const unavailableOnBranch = tool.branches?.every( - (branch) => - branch !== assertSecret(import.meta.env.PUBLIC_ASSET_BRANCH), - ); const selected = Astro.url.pathname.includes(`/${tool.id}`); const toolStrings = strings.website.tools[ - (tool.stringsId ?? + (tool.strings ?? tool.id) as keyof typeof strings.website.tools ]; - if (unavailableOnBranch) return null; - return ( { toolsFiltered.map((tool) => { - const unavailableOnBranch = tool.branches?.every( - (branch) => - branch !== assertSecret(import.meta.env.PUBLIC_ASSET_BRANCH), - ); - - if (unavailableOnBranch) return null; - const toolStrings = strings.website.tools[ - (tool.stringsId ?? - tool.id) as keyof typeof strings.website.tools + (tool.strings ?? tool.id) as keyof typeof strings.website.tools ]; return ( diff --git a/packages/website-ue/src/constants/tools.ts b/packages/website-ue/src/constants/tools.ts index b7b548ae0..d6d97c79e 100644 --- a/packages/website-ue/src/constants/tools.ts +++ b/packages/website-ue/src/constants/tools.ts @@ -1,141 +1,85 @@ -import { Button } from '@radix-ui/themes'; -import type { ComponentProps } from 'react'; +import type { ButtonProps } from '@radix-ui/themes'; -export interface Tool { +interface Tool { id: string; - stringsId?: string; - disabled?: boolean; - href?: string; - button: { - highContrast?: boolean; - color: ComponentProps['color']; - }; + enabled: boolean; + strings?: string; significant?: boolean; - branches?: string[]; + button: { color: ButtonProps['color']; contrast?: boolean }; } -export const tankopediaTool: Tool = { +export const tanks: Tool = { id: 'tanks', - stringsId: 'tankopedia', - button: { - color: 'purple', - }, + enabled: true, + strings: 'tankopedia', significant: true, - branches: ['main', 'dev', 'opentest', 'preview'], + button: { color: 'purple' }, }; -// export const ratingTool: Tool = { -// id: 'rating', -// image: 'WEyMZH3', -// button: { -// color: 'orange', -// }, -// branches: ['main', 'dev'], -// }; - -export const compareTool: Tool = { +export const compare: Tool = { id: 'compare', - button: { - color: 'crimson', - }, - branches: ['main', 'dev', 'opentest', 'preview'], + enabled: true, + button: { color: 'crimson' }, }; -export const sessionTool: Tool = { - // TODO: rename to tracker - id: 'session', - button: { - color: 'blue', - }, - branches: ['main', 'dev'], -}; - -export const discordTool: Tool = { - id: 'discord', - href: 'https://discord.com/application-directory/1097673957865443370', - button: { - color: 'indigo', - }, -}; - -export const moreTool: Tool = { - id: 'more', - href: 'https://discord.gg/nDt7AjGJQH', - button: { - color: 'plum', - }, -}; - -export const playersTool: Tool = { - id: 'players', - button: { - color: 'blue', - }, - href: '_', // TODO: remove this to re-enable link - branches: ['main', 'dev'], -}; - -export const performanceTool: Tool = { +export const performance: Tool = { id: 'performance', - button: { - color: 'jade', - }, - branches: ['main', 'dev'], + enabled: true, + button: { color: 'jade' }, }; -export const embedTool: Tool = { - id: 'embed', - button: { - color: 'red', - }, - branches: ['main', 'dev'], +export const guess: Tool = { + id: 'guess', + enabled: false, + button: { color: 'bronze' }, }; -export const homeTool: Tool = { - id: 'home', +export const charts: Tool = { + id: 'charts', + enabled: false, + button: { color: 'bronze' }, +}; + +export const gallery: Tool = { + id: 'gallery', + enabled: true, + button: { color: 'gold' }, +}; + +export const session: Tool = { + id: 'session', + enabled: true, button: { color: 'blue' }, }; -export const galleryTool: Tool = { - id: 'gallery', - button: { - color: 'gold', - }, - branches: ['main', 'dev'], -}; - -export const tierListTool: Tool = { +export const tierList: Tool = { id: 'tier-list', - stringsId: 'tier_list', - button: { - color: 'orange', - }, - branches: ['main', 'dev', 'opentest', 'preview'], + enabled: true, + strings: 'tier_list', + button: { color: 'orange' }, }; -export const chartsTool: Tool = { - id: 'charts', - button: { - color: 'bronze', - }, - branches: ['main', 'dev'], -}; - -export const guessTool: Tool = { - id: 'guess', +export const embed: Tool = { + id: 'embed', + enabled: true, button: { color: 'cyan' }, - branches: ['main', 'dev', 'opentest', 'preview'], }; -export const TOOLS: Tool[] = [ - tankopediaTool, - compareTool, - performanceTool, - // guessTool, - // chartsTool, - galleryTool, - sessionTool, - tierListTool, - embedTool, - // ratingTool, +export const rating: Tool = { + id: 'rating', + enabled: false, + button: { color: 'orange' }, +}; + +export const tools: Tool[] = [ + tanks, + compare, + performance, + guess, + charts, + gallery, + session, + tierList, + embed, + rating, ]; diff --git a/packages/website/package.json b/packages/website/package.json index 08b6b83d7..8de11f4aa 100644 --- a/packages/website/package.json +++ b/packages/website/package.json @@ -8,10 +8,5 @@ "build": "astro check && astro build", "preview": "astro preview", "astro": "astro" - }, - "dependencies": { - }, - "devDependencies": { - } }