Made client/[name] generate static pages
All checks were successful
checks-impure / test (pull_request) Successful in 26s
checks / test (pull_request) Successful in 1m19s

This commit is contained in:
2024-01-23 00:17:24 +01:00
parent d54206f43c
commit 6f4bab98c1
7 changed files with 45 additions and 13 deletions

View File

@@ -2,9 +2,16 @@
const nextConfig = {
output: "export",
images: { unoptimized: true },
distDir: "build",
eslint: {
dirs: ["src"],
},
generateBuildId: async () => {
// This could be anything, using the latest git hash
return process.env.NEXT_BUILD_ID;
},
outputFileTracing: true,
reactStrictMode: true,
};
module.exports = nextConfig;

View File

@@ -70,6 +70,7 @@ in
# nextjs chaches some stuff in $HOME
built.override.preBuild = ''
export HOME=./home
export NEXT_BUILD_ID=$(git log -1 --pretty=format:"%H")
echo "----------- GENERATE API TS ------------"

View File

@@ -8,7 +8,7 @@ pkgs.mkShell {
fmod.config.floco.settings.nodePackage
];
shellHook = ''
ID=${pkg.built.tree}
export ID=${pkg.built.tree}
currID=$(cat .floco/.node_modules_id 2> /dev/null)
mkdir -p .floco
@@ -22,10 +22,11 @@ pkgs.mkShell {
ln -sf ${pkgs.roboto}/share/fonts ./src
export PATH="$PATH:$(realpath ./node_modules)/.bin"
export NEXT_BUILD_ID=$(git log -1 --pretty=format:"%H")
# re-generate the api code
rm -rf src/api openapi.json
rm -f openapi.json
rm -rf src/api
cp ${clanPkgs.clan-openapi}/openapi.json .
orval
'';

View File

@@ -0,0 +1,21 @@
import Client from "@/app/client/client";
import { menuEntityEntries } from "@/components/sidebar";
export const dynamic = "error";
export const dynamicParams = false;
/*
The generateStaticParams function can be used in combination with dynamic route segments
to statically generate routes at build time instead of on-demand at request time.
During next dev, generateStaticParams will be called when you navigate to a route.
During next build, generateStaticParams runs before the corresponding Layouts or Pages are generated.
https://nextjs.org/docs/app/api-reference/functions/generate-static-params
*/
export function generateStaticParams() {
return menuEntityEntries.map((entry) => ({
name: entry.label,
}));
}
export default function Page({ params }: { params: { name: string } }) {
return <Client params={params} />;
}

View File

@@ -105,14 +105,10 @@ const AttachButton = ({
);
};
export default function Client({
params,
}: {
params: { client_name: string };
}) {
const { client_name } = params;
export default function Client({ params }: { params: { name: string } }) {
const { name } = params;
const { entity: entity } = useGetEntityByNameOrDid(client_name);
const { entity: entity } = useGetEntityByNameOrDid(name);
const {
data: services,
isLoading: services_loading,

View File

@@ -33,7 +33,7 @@ type MenuEntry = {
subMenuEntries?: MenuEntry[];
};
const menuEntityEntries: MenuEntry[] = [
export const menuEntityEntries: MenuEntry[] = [
{
icon: <PersonIcon />,
label: "C1",
@@ -60,7 +60,7 @@ const menuEntityEntries: MenuEntry[] = [
},
];
const menuEntries: MenuEntry[] = [
export const menuEntries: MenuEntry[] = [
{
icon: <HomeIcon />,
label: "Home",

View File

@@ -25,6 +25,12 @@
"@API/*": ["./src/api/*"]
}
},
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
"include": [
"next-env.d.ts",
"**/*.ts",
"**/*.tsx",
".next/types/**/*.ts",
"build/types/**/*.ts"
],
"exclude": ["node_modules"]
}