mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-23 19:49:50 +02:00
feat: some static params
This commit is contained in:
1 parent
8f44cdedd4
commit
d306b51c2c
10 files changed
+61
-8
No files matched your search
@@ -0,0 +1 @@
|
||||
export const PROVIDERS = ['wargaming', 'patreon'];
|
||||
@@ -1,5 +1,9 @@
|
||||
import { PROVIDERS } from './page';
|
||||
import { PROVIDERS } from './constants';
|
||||
|
||||
export async function generateStaticParams() {
|
||||
return PROVIDERS.map((provider) => ({ provider }));
|
||||
}
|
||||
|
||||
export default function Layout({ children }: { children: React.ReactNode }) {
|
||||
return children;
|
||||
}
|
||||
@@ -6,8 +6,6 @@ import { useEffect } from 'react';
|
||||
import { PageWrapper } from '../../../components/PageWrapper';
|
||||
import * as App from '../../../stores/app';
|
||||
|
||||
export const PROVIDERS = ['wargaming', 'patreon'];
|
||||
|
||||
export interface PatreonAuthResponse {
|
||||
access_token: string;
|
||||
expires_in: number;
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
import { assertSecret } from '@blitzkit/core';
|
||||
|
||||
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,
|
||||
})),
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
.then((docs) => docs.flat());
|
||||
}
|
||||
|
||||
export default function Layout({ children }: { children: React.ReactNode }) {
|
||||
return children;
|
||||
}
|
||||
@@ -3,6 +3,10 @@ import * as EmbedState from '../../../../stores/embedState';
|
||||
import { configurations } from '../configurations';
|
||||
import { extractEmbedConfigDefaults } from '../utilities';
|
||||
|
||||
export function generateStaticParams() {
|
||||
return Object.keys(configurations).map((embed) => ({ embed }));
|
||||
}
|
||||
|
||||
export default function Layout({
|
||||
params,
|
||||
children,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { PageWrapper } from '../../../components/PageWrapper';
|
||||
|
||||
export function Page() {
|
||||
export default function Page() {
|
||||
return <PageWrapper></PageWrapper>;
|
||||
}
|
||||
Reference in new issue
Block a user