mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-24 03:59:50 +02:00
feat: data-driven tools
This commit is contained in:
1 parent
58b5ee7f83
commit
84dc5e4960
14 files changed
+118
-135
No files matched your search
@@ -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 (
|
||||
|
||||
Reference in new issue
Block a user