fix: some static shit

This commit is contained in:
TrèsAbhi committed 2024-09-08 21:29:18 -05:00
1 parent d306b51c2c
commit 250b61b68d
8 files changed
+38 -46

No files matched your search

+2 -1
View File
@@ -200,5 +200,6 @@
"deno.enable": false,
"deno.unstable": false,
"cSpell.enableFiletypes": ["glsl", "proto3"],
"typescript.tsdk": "node_modules\\typescript\\lib"
"typescript.tsdk": "node_modules\\typescript\\lib",
"liveServer.settings.multiRootWorkspaceName": "blitzkit"
}
BIN
View File
Binary file not shown.
+2 -1
View File
@@ -35,10 +35,11 @@
"lodash": "^4.17.21"
},
"devDependencies": {
"@types/bun": "latest",
"@types/node": "^22.5.4",
"esbuild": "^0.19.12",
"prettier": "^3.3.3",
"prisma": "^5.19.1",
"@types/bun": "latest",
"typescript": "^5.5.4"
}
}
@@ -1,43 +1,28 @@
import { assertSecret } from '@blitzkit/core';
import { readdir } from 'fs/promises';
export async function generateStaticParams() {
return await fetch(
`https://api.github.com/repos/tresabhi/blitzkit/contents/docs?ref=${assertSecret(
process.env.NEXT_PUBLIC_ASSET_BRANCH,
)}`,
)
.then((response) => response.json() as Promise<{ name: string }[]>)
.then((directories) =>
Promise.all(
directories
.filter(
(directory) =>
!['.vitepress', 'public', 'index.md'].includes(directory.name),
)
.map((directory) =>
fetch(
`https://api.github.com/repos/tresabhi/blitzkit/contents/docs/${directory.name}?ref=${assertSecret(
process.env.NEXT_PUBLIC_ASSET_BRANCH,
)}`,
)
.then(
(response) => response.json() as Promise<{ name: string }[]>,
)
.then((docs) =>
docs
.map((document) => {
console.log(`${directory.name}/${document.name}`);
return document;
})
.map((document) => ({
document: document.name.split('.').slice(0, -1).join('.'),
directory: directory.name,
})),
),
return await readdir('../../docs').then((directories) =>
Promise.all(
directories
.filter(
(directory) =>
!['.vitepress', 'public'].includes(directory) &&
!directory.endsWith('.md'),
)
.map((directory) =>
readdir(`../../docs/${directory}`).then((files) =>
Promise.all(
files
.filter((file) => file.endsWith('.md'))
.map((file) => ({
directory,
document: file.replace(/\.md$/, ''),
})),
),
),
),
)
.then((docs) => docs.flat());
),
).then((directories) => directories.flat()),
);
}
export default function Layout({ children }: { children: React.ReactNode }) {
@@ -1,6 +1,7 @@
'use client';
import { Code, Heading } from '@radix-ui/themes';
import { useSearchParams } from 'next/navigation';
import { useMemo } from 'react';
import { PageWrapper } from '../../../../../components/PageWrapper';
import * as EmbedState from '../../../../../stores/embedState';
@@ -13,16 +14,17 @@ export interface EmbedPreviewControllerProps {
export default function Page({
params,
searchParams,
}: {
params: { embed: keyof typeof configurations };
searchParams: { state: string };
}) {
const searchParams = useSearchParams();
// TODO: check for this? idk lol
const stateParam = searchParams.get('state')!;
const config = configurations[params.embed];
const initialState = useMemo(
() => ({
...extractEmbedConfigDefaults(config),
...(JSON.parse(searchParams.state) as EmbedState.EmbedState),
...(JSON.parse(stateParam) as EmbedState.EmbedState),
}),
[params.embed],
);
@@ -44,7 +44,8 @@ export function Navbar() {
const pathname = usePathname();
const logins = App.use((state) => state.logins);
const mutateApp = App.useMutation();
const tools = [homeTool, ...TOOLS];
const toolsFiltered = TOOLS.filter((tool) => !('href' in tool));
const tools = [homeTool, ...toolsFiltered];
const isBranchNamed =
process.env.NEXT_PUBLIC_ASSET_BRANCH &&
BRANCH_NAMES[process.env.NEXT_PUBLIC_ASSET_BRANCH];
@@ -99,7 +100,7 @@ export function Navbar() {
justify="center"
className={styles.tools}
>
{TOOLS.map((tool, index) => {
{toolsFiltered.map((tool, index) => {
const unavailableOnBranch = tool.branches?.every(
(branch) =>
branch !==
+2 -1
View File
@@ -139,6 +139,7 @@ export const embedTool: Tool = {
},
image: 'Q0faRYg',
branches: ['main', 'dev', 'opentest'],
href: '',
};
export const homeTool: Tool = {
@@ -154,6 +155,6 @@ export const TOOLS: Tool[] = [
compareTool,
tankPerformanceTool,
sessionTool,
// embedTool,
embedTool,
ratingTool,
];
+2 -1
View File
@@ -10,6 +10,7 @@
"include": [
"src/**/*",
".next/types/**/*.ts",
"../../dist/website/types/**/*.ts"
"../../dist/website/types/**/*.ts",
"dist/website/types/**/*.ts"
]
}