Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion frontend/.prettierrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
prettier {
{
"tabWidth": 4,
"useTabs": false,
"singleQuote": false,
Expand Down
3 changes: 0 additions & 3 deletions frontend/src/app/@setup/[...catchAll]/page.tsx

This file was deleted.

12 changes: 0 additions & 12 deletions frontend/src/app/[...catchAll]/layout.tsx

This file was deleted.

77 changes: 77 additions & 0 deletions frontend/src/app/[[...catchAll]]/layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
import BaseBody from "@iot-portal/frontend/app/common/baseBody";
import { fetchAPI } from "@iot-portal/frontend/lib/api";
import { Metadata } from "next";
import React from "react";

export const dynamic = "force-dynamic";


type Props = {
params: { catchAll: string[] }
searchParams: { [key: string]: string | string[] | undefined }
}


export async function generateMetadata(
{ params }: Props
): Promise<Metadata> {

const pageQsPara = {
fields: "*",
populate: "*"
};

const genericPage = await (async () => {
const settings = await fetchAPI("/api/portal-einstellungen", pageQsPara);
return settings && settings.data ? settings.data.attributes : null;
})();


const data =
(
await fetchAPI("/api/pages", {
fields: "*",
filters: {
$or: [
{
url: { $eq: "/" + (params.catchAll || []).join("/") }
},
{
url: { $eq: "/" + (params.catchAll || []).join("/") + "/" }
}
]
}
})
)?.data || [];

if (Array.isArray(data) && data.length === 0) {
return {};
}


const page = data[0].attributes;


const titles = Array.of(genericPage.title, page.title);

return genericPage
? {
title: titles.join(" - "),
openGraph: {
title: titles.join(" - "),
type: "website",
description: genericPage.description
}
}
: {};
}

export default async function PortalLayout({ children }: { children: React.ReactNode }) {
return (
<BaseBody>
<div className="flex-auto rounded bg-white dark:bg-zinc-800 p-4 shadow max-h-full sticky top-0">
{children}
</div>
</BaseBody>
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,25 @@ import BlocksRenderer from "@iot-portal/frontend/app/common/BlocksRenderer";
import { fetchAPI } from "@iot-portal/frontend/lib/api";
import { notFound } from "next/navigation";


export const dynamic = "force-dynamic";


export default async function Page({ params }: { params: { catchAll: string[] } }) {

const data =
(
await fetchAPI("/api/pages", {
fields: "*",
filters: {
url: {
$eq: "/" + params.catchAll.join("/")
$or: [
{
url: { $eq: "/" + (params.catchAll || []).join("/") }
},
{
url: { $eq: "/" + (params.catchAll || []).join("/") + "/" }
}
]
}
})
)?.data || [];
Expand Down
3 changes: 0 additions & 3 deletions frontend/src/app/default.tsx

This file was deleted.

5 changes: 2 additions & 3 deletions frontend/src/app/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import AuthWrapper from "@iot-portal/frontend/app/common/AuthWrapper";
import Footer from "@iot-portal/frontend/app/common/Footer";
import Header from "@iot-portal/frontend/app/common/Header";
import PageBlockingSpinner, {
LoadingWrapper
} from "@iot-portal/frontend/app/common/pageBlockingSpinner";
import PageBlockingSpinner, { LoadingWrapper } from "@iot-portal/frontend/app/common/pageBlockingSpinner";
import PromptAreaComponent from "@iot-portal/frontend/app/common/promptArea";
import { fetchAPI } from "@iot-portal/frontend/lib/api";
import { Params } from "next/dist/shared/lib/router/utils/route-matcher";
Expand Down Expand Up @@ -36,6 +34,7 @@ export async function generateMetadata({ params }: { params: Params }) {
}
: {};
}

export default async function RootLayout(props: any) {
return (
<html lang="de" className={"dark"}>
Expand Down
43 changes: 0 additions & 43 deletions frontend/src/app/page.tsx

This file was deleted.

Loading