mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-21 02:37:05 +02:00
feat: simplify tools
This commit is contained in:
1 parent
69b13fd33a
commit
64d12bba8b
6 files changed
+66
-141
No files matched your search
@@ -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",
|
||||
|
||||
+1
-1
@@ -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",
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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 (
|
||||
<LinkI18n
|
||||
{locale}
|
||||
@@ -209,17 +203,9 @@ const strings = await getStrings(locale);
|
||||
>
|
||||
{
|
||||
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 (
|
||||
|
||||
@@ -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<typeof Button>['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,
|
||||
];
|
||||
@@ -8,10 +8,5 @@
|
||||
"build": "astro check && astro build",
|
||||
"preview": "astro preview",
|
||||
"astro": "astro"
|
||||
},
|
||||
"dependencies": {
|
||||
},
|
||||
"devDependencies": {
|
||||
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user