feat: simplify tools

This commit is contained in:
TrèsAbhi committed 2025-05-28 10:42:09 -05:00
1 parent 69b13fd33a
commit 64d12bba8b
6 files changed
+66 -141

No files matched your search

-3
View File
@@ -82,9 +82,6 @@
"@nanostores/react": "^0.7.3", "@nanostores/react": "^0.7.3",
"@nivo/bar": "^0.87.0", "@nivo/bar": "^0.87.0",
"@nivo/line": "^0.88.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/drei": "^9.115.0",
"@react-three/fiber": "^8.17.10", "@react-three/fiber": "^8.17.10",
"compare-versions": "^6.1.1", "compare-versions": "^6.1.1",
+1 -1
View File
@@ -30,7 +30,7 @@
"lint": "tsc", "lint": "tsc",
"lint:website": "cd packages/website && bun run lint", "lint:website": "cd packages/website && bun run lint",
"format": "prettier --write \"**/*.@(json|js|jsx|css|md|ts|tsx|html|xml|yml|gltf)\"", "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", "tunnel": "cloudflared tunnel --url http://localhost:3000",
"discoverids": "scripts/discoverIds.ts", "discoverids": "scripts/discoverIds.ts",
"build:protos": "bun packages/scripts/src/protos.ts", "build:protos": "bun packages/scripts/src/protos.ts",
+3
View File
@@ -8,6 +8,9 @@
"astro": "astro" "astro": "astro"
}, },
"dependencies": { "dependencies": {
"@radix-ui/colors": "^3.0.0",
"@radix-ui/react-icons": "^1.3.0",
"@radix-ui/themes": "^3.1.4",
"@blitzkit/core": "workspace:*", "@blitzkit/core": "workspace:*",
"@blitzkit/closed": "workspace:*", "@blitzkit/closed": "workspace:*",
"@astrojs/react": "^4.3.0", "@astrojs/react": "^4.3.0",
@@ -7,7 +7,7 @@ import {
HamburgerMenuIcon, HamburgerMenuIcon,
} from '@radix-ui/react-icons'; } from '@radix-ui/react-icons';
import { Box, Code, Flex, IconButton, Link } from '@radix-ui/themes'; 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 { resolveBranchName } from '../core/blitzkit/branches';
import { getStrings } from '../core/i18n/getStrings'; import { getStrings } from '../core/i18n/getStrings';
import { Var } from '../core/radix/var'; import { Var } from '../core/radix/var';
@@ -19,7 +19,7 @@ export interface Props {
} }
const { integrated, locale } = Astro.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 branchName = resolveBranchName(locale);
const isBranchNamed = branchName !== undefined; const isBranchNamed = branchName !== undefined;
const strings = await getStrings(locale); const strings = await getStrings(locale);
@@ -137,19 +137,13 @@ const strings = await getStrings(locale);
> >
{ {
toolsFiltered.map((tool) => { 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 selected = Astro.url.pathname.includes(`/${tool.id}`);
const toolStrings = const toolStrings =
strings.website.tools[ strings.website.tools[
(tool.stringsId ?? (tool.strings ??
tool.id) as keyof typeof strings.website.tools tool.id) as keyof typeof strings.website.tools
]; ];
if (unavailableOnBranch) return null;
return ( return (
<LinkI18n <LinkI18n
{locale} {locale}
@@ -209,17 +203,9 @@ const strings = await getStrings(locale);
> >
{ {
toolsFiltered.map((tool) => { toolsFiltered.map((tool) => {
const unavailableOnBranch = tool.branches?.every(
(branch) =>
branch !== assertSecret(import.meta.env.PUBLIC_ASSET_BRANCH),
);
if (unavailableOnBranch) return null;
const toolStrings = const toolStrings =
strings.website.tools[ strings.website.tools[
(tool.stringsId ?? (tool.strings ?? tool.id) as keyof typeof strings.website.tools
tool.id) as keyof typeof strings.website.tools
]; ];
return ( return (
+58 -114
View File
@@ -1,141 +1,85 @@
import { Button } from '@radix-ui/themes'; import type { ButtonProps } from '@radix-ui/themes';
import type { ComponentProps } from 'react';
export interface Tool { interface Tool {
id: string; id: string;
stringsId?: string; enabled: boolean;
disabled?: boolean; strings?: string;
href?: string;
button: {
highContrast?: boolean;
color: ComponentProps<typeof Button>['color'];
};
significant?: boolean; significant?: boolean;
branches?: string[]; button: { color: ButtonProps['color']; contrast?: boolean };
} }
export const tankopediaTool: Tool = { export const tanks: Tool = {
id: 'tanks', id: 'tanks',
stringsId: 'tankopedia', enabled: true,
button: { strings: 'tankopedia',
color: 'purple',
},
significant: true, significant: true,
branches: ['main', 'dev', 'opentest', 'preview'], button: { color: 'purple' },
}; };
// export const ratingTool: Tool = { export const compare: Tool = {
// id: 'rating',
// image: 'WEyMZH3',
// button: {
// color: 'orange',
// },
// branches: ['main', 'dev'],
// };
export const compareTool: Tool = {
id: 'compare', id: 'compare',
button: { enabled: true,
color: 'crimson', button: { color: 'crimson' },
},
branches: ['main', 'dev', 'opentest', 'preview'],
}; };
export const sessionTool: Tool = { export const performance: 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 = {
id: 'performance', id: 'performance',
button: { enabled: true,
color: 'jade', button: { color: 'jade' },
},
branches: ['main', 'dev'],
}; };
export const embedTool: Tool = { export const guess: Tool = {
id: 'embed', id: 'guess',
button: { enabled: false,
color: 'red', button: { color: 'bronze' },
},
branches: ['main', 'dev'],
}; };
export const homeTool: Tool = { export const charts: Tool = {
id: 'home', 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' }, button: { color: 'blue' },
}; };
export const galleryTool: Tool = { export const tierList: Tool = {
id: 'gallery',
button: {
color: 'gold',
},
branches: ['main', 'dev'],
};
export const tierListTool: Tool = {
id: 'tier-list', id: 'tier-list',
stringsId: 'tier_list', enabled: true,
button: { strings: 'tier_list',
color: 'orange', button: { color: 'orange' },
},
branches: ['main', 'dev', 'opentest', 'preview'],
}; };
export const chartsTool: Tool = { export const embed: Tool = {
id: 'charts', id: 'embed',
button: { enabled: true,
color: 'bronze',
},
branches: ['main', 'dev'],
};
export const guessTool: Tool = {
id: 'guess',
button: { color: 'cyan' }, button: { color: 'cyan' },
branches: ['main', 'dev', 'opentest', 'preview'],
}; };
export const TOOLS: Tool[] = [ export const rating: Tool = {
tankopediaTool, id: 'rating',
compareTool, enabled: false,
performanceTool, button: { color: 'orange' },
// guessTool, };
// chartsTool,
galleryTool, export const tools: Tool[] = [
sessionTool, tanks,
tierListTool, compare,
embedTool, performance,
// ratingTool, guess,
charts,
gallery,
session,
tierList,
embed,
rating,
]; ];
-5
View File
@@ -8,10 +8,5 @@
"build": "astro check && astro build", "build": "astro check && astro build",
"preview": "astro preview", "preview": "astro preview",
"astro": "astro" "astro": "astro"
},
"dependencies": {
},
"devDependencies": {
} }
} }