diff --git a/app/components/InstrumentPage.tsx b/app/components/InstrumentPage.tsx index f67e588..7f1da68 100644 --- a/app/components/InstrumentPage.tsx +++ b/app/components/InstrumentPage.tsx @@ -26,6 +26,9 @@ function InstrumentData({ instrumentName }: { instrumentName: string }) { process.env.NEXT_PUBLIC_WS_URL || "ws://localhost:8080/pvws/pv"; const instName = instrumentName; + if (document != undefined) { + document.title = instName.toUpperCase() + " | IBEX Web Dashboard"; + } const { sendJsonMessage, diff --git a/app/instrument/layout.tsx b/app/instrument/layout.tsx new file mode 100644 index 0000000..486fea2 --- /dev/null +++ b/app/instrument/layout.tsx @@ -0,0 +1,11 @@ +import type { ReactNode } from "react"; +import type { Metadata, ResolvingMetadata } from "next"; + +export const metadata = { + // Default title, overridden later. + title: "Instrument Details | IBEX Web Dashboard", +}; + +export default function ClientLayout({ children }: { children: ReactNode }) { + return children; +} diff --git a/app/instrument/page.tsx b/app/instrument/page.tsx index 65acf85..0633191 100644 --- a/app/instrument/page.tsx +++ b/app/instrument/page.tsx @@ -4,22 +4,6 @@ const inter = Inter({ subsets: ["latin"] }); import { Suspense } from "react"; import type { Metadata, ResolvingMetadata } from "next"; -type Props = { - params: { id: string }; - searchParams: { [key: string]: string | string[] | undefined }; -}; - -export async function generateMetadata( - { params, searchParams }: Props, - parent: ResolvingMetadata, -): Promise { - const instrument = searchParams!["name"]; - - return { - title: instrument + " | IBEX Web Dashboard", - }; -} - export default function Instrument() { return (