feat: data-driven tools

This commit is contained in:
TrèsAbhi committed 2025-09-13 22:53:29 -05:00
1 parent 58b5ee7f83
commit 84dc5e4960
14 files changed
+118 -135

No files matched your search

+8 -10
View File
@@ -1,5 +1,4 @@
---
import { assertSecret } from "@blitzkit/core";
import {
Cross1Icon,
DiscordLogoIcon,
@@ -7,18 +6,20 @@ import {
HamburgerMenuIcon,
} from "@radix-ui/react-icons";
import { Box, Code, Flex, IconButton, Link } from "@radix-ui/themes";
import { TOOLS } from "../constants/tools";
import { resolveBranchName } from "../core/blitzkit/branches";
import { getStrings } from "../core/i18n/getStrings";
import { Var } from "../core/radix/var";
import { LinkI18n } from "./LinkI18n";
import { tools } from "../constants/tools";
export interface Props {
integrated?: boolean;
}
const { integrated = false } = Astro.props;
const toolsFiltered = TOOLS.filter((tool) => !tool.href && !tool.disabled);
const toolsFiltered = Object.entries(tools).filter(
([, tool]) => !tool.href && !tool.disabled
);
const { locale } = Astro.params;
const branchName = resolveBranchName(locale);
const isBranchNamed = branchName !== undefined;
@@ -137,16 +138,13 @@ const strings = getStrings(locale);
className="tools"
>
{
toolsFiltered.map((tool) => {
toolsFiltered.map(([id, tool]) => {
const selected = Astro.url.pathname.includes(`/${tool.id}`);
const toolStrings =
strings.website.tools[
(tool.strings ??
tool.id) as keyof typeof strings.website.tools
(tool.strings ?? id) as keyof typeof strings.website.tools
];
if (toolStrings === undefined) console.log(tool.id);
return (
<LinkI18n
{locale}
@@ -205,10 +203,10 @@ const strings = getStrings(locale);
display={{ initial: "flex", sm: "none" }}
>
{
toolsFiltered.map((tool) => {
toolsFiltered.map(([id, tool]) => {
const toolStrings =
strings.website.tools[
(tool.strings ?? tool.id) as keyof typeof strings.website.tools
(tool.strings ?? id) as keyof typeof strings.website.tools
];
return (