Openstatus www.openstatus.dev

fix: title name

authored by

Maximilian Kaske and committed by
Maximilian Kaske
540cbb10 71691b3b

+36 -10
+1
apps/web/src/app/status-page/[domain]/events/page.tsx
··· 5 5 import { notFound } from "next/navigation"; 6 6 import { searchParamsCache } from "./search-params"; 7 7 import { formatter } from "./utils"; 8 + import type { Metadata } from "next"; 8 9 9 10 export const metadata: Metadata = { 10 11 title: "Events",
+15 -4
apps/web/src/app/status-page/[domain]/events/report/[id]/page.tsx
··· 6 6 import { api } from "@/trpc/server"; 7 7 import { Badge } from "@openstatus/ui/src/components/badge"; 8 8 import { CopyLinkButton } from "./_components/copy-link-button"; 9 + import { Metadata } from "next"; 10 + 11 + export async function generateMetadata(props: { 12 + params: Promise<{ domain: string; id: string }>; 13 + }): Promise<Metadata> { 14 + const { domain, id } = await props.params; 15 + const report = await api.statusReport.getPublicStatusReportById.query({ 16 + slug: domain, 17 + id: Number(id), 18 + }); 9 19 10 - export const metadata: Metadata = { 11 - title: "Report", 12 - }; 20 + if (!report) return notFound(); 21 + 22 + return { title: report.title }; 23 + } 13 24 14 25 export default async function IncidentPage(props: { 15 26 params: Promise<{ domain: string; id: string }>; ··· 23 34 if (!report) return notFound(); 24 35 25 36 const affectedMonitors = report.monitorsToStatusReports.map( 26 - ({ monitor }) => monitor, 37 + ({ monitor }) => monitor 27 38 ); 28 39 29 40 const firstUpdate =
+3 -1
apps/web/src/app/status-page/[domain]/layout.tsx
··· 78 78 const params = await props.params; 79 79 const page = await api.page.getPageBySlug.query({ slug: params.domain }); 80 80 81 + if (!page) return notFound(); 82 + 81 83 return { 82 84 ...defaultMetadata, 83 85 title: { 84 - template: `%s | ${page?.title}`, 86 + template: `%s | ${page.title}`, 85 87 default: page?.title, 86 88 }, 87 89 description: page?.description,
+14 -3
apps/web/src/app/status-page/[domain]/monitors/[id]/page.tsx
··· 24 24 periods, 25 25 searchParamsCache, 26 26 } from "./search-params"; 27 + import type { Metadata } from "next"; 27 28 28 29 export const revalidate = 120; 29 30 30 - export const metadata: Metadata = { 31 - title: "Monitor", 32 - }; 31 + export async function generateMetadata(props: { 32 + params: Promise<{ domain: string; id: string }>; 33 + }): Promise<Metadata> { 34 + const { domain, id } = await props.params; 35 + const monitor = await api.monitor.getPublicMonitorById.query({ 36 + id: Number(id), 37 + slug: domain, 38 + }); 39 + 40 + if (!monitor) return notFound(); 41 + 42 + return { title: monitor.name }; 43 + } 33 44 34 45 export default async function Page(props: { 35 46 params: Promise<{ domain: string; id: string }>;
+3 -2
apps/web/src/app/status-page/[domain]/monitors/page.tsx
··· 11 11 import { prepareMetricByIntervalByPeriod } from "@/lib/tb"; 12 12 import { api } from "@/trpc/server"; 13 13 import { searchParamsCache } from "./search-params"; 14 + import type { Metadata } from "next"; 14 15 15 16 // Add loading page 16 17 ··· 42 43 const type = monitor.jobType as "http" | "tcp"; 43 44 const data = await prepareMetricByIntervalByPeriod( 44 45 period, 45 - type, 46 + type 46 47 ).getData({ 47 48 monitorId: String(monitor.id), 48 49 interval: 60, 49 50 }); 50 51 51 52 return { monitor, data }; 52 - }), 53 + }) 53 54 ) 54 55 : undefined; 55 56