diff --git a/.gitea/workflows/ui_assets.yaml b/.gitea/workflows/ui_assets.yaml
index d4e1088..2b81123 100644
--- a/.gitea/workflows/ui_assets.yaml
+++ b/.gitea/workflows/ui_assets.yaml
@@ -58,7 +58,8 @@ jobs:
git commit -am "update ui-assets.nix"
echo "Current branch: $GITHUB_REF_NAME"
- git push origin HEAD:$GITHUB_REF_NAME
+ git push origin HEAD:"$GITHUB_REF_NAME"
+ echo "Done uploading"
fi
else
echo "No UI files changed. Skipping asset build and push"
diff --git a/pkgs/ui/next.config.js b/pkgs/ui/next.config.js
index 5b2d829..316bb41 100644
--- a/pkgs/ui/next.config.js
+++ b/pkgs/ui/next.config.js
@@ -5,6 +5,12 @@ const nextConfig = {
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;
diff --git a/pkgs/ui/nix/foverrides.nix b/pkgs/ui/nix/foverrides.nix
index 5fb91a3..f9356d8 100644
--- a/pkgs/ui/nix/foverrides.nix
+++ b/pkgs/ui/nix/foverrides.nix
@@ -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 ------------"
diff --git a/pkgs/ui/shell.nix b/pkgs/ui/shell.nix
index 44f89ea..5de28bc 100644
--- a/pkgs/ui/shell.nix
+++ b/pkgs/ui/shell.nix
@@ -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 --interactive=never openapi.json
+ rm -rf src/api
cp ${clanPkgs.clan-openapi}/openapi.json .
orval
'';
diff --git a/pkgs/ui/src/app/client/[name]/page.tsx b/pkgs/ui/src/app/client/[name]/page.tsx
new file mode 100644
index 0000000..1068f34
--- /dev/null
+++ b/pkgs/ui/src/app/client/[name]/page.tsx
@@ -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 ;
+}
diff --git a/pkgs/ui/src/app/client/[client_name]/page.tsx b/pkgs/ui/src/app/client/client.tsx
similarity index 97%
rename from pkgs/ui/src/app/client/[client_name]/page.tsx
rename to pkgs/ui/src/app/client/client.tsx
index 3e75111..c412d73 100644
--- a/pkgs/ui/src/app/client/[client_name]/page.tsx
+++ b/pkgs/ui/src/app/client/client.tsx
@@ -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,
diff --git a/pkgs/ui/src/components/sidebar/index.tsx b/pkgs/ui/src/components/sidebar/index.tsx
index 685930b..55bb214 100644
--- a/pkgs/ui/src/components/sidebar/index.tsx
+++ b/pkgs/ui/src/components/sidebar/index.tsx
@@ -33,7 +33,7 @@ type MenuEntry = {
subMenuEntries?: MenuEntry[];
};
-const menuEntityEntries: MenuEntry[] = [
+export const menuEntityEntries: MenuEntry[] = [
{
icon: ,
label: "C1",
@@ -60,7 +60,7 @@ const menuEntityEntries: MenuEntry[] = [
},
];
-const menuEntries: MenuEntry[] = [
+export const menuEntries: MenuEntry[] = [
{
icon: ,
label: "Home",
diff --git a/pkgs/ui/tsconfig.json b/pkgs/ui/tsconfig.json
index ebe4baa..e0d506e 100644
--- a/pkgs/ui/tsconfig.json
+++ b/pkgs/ui/tsconfig.json
@@ -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"]
}