Openstatus www.openstatus.dev

chore: add banner (#1034)

authored by

Maximilian Kaske and committed by
GitHub
c441b67b a07f01c9

+41 -7
+17 -7
apps/web/src/app/app/[workspaceSlug]/(dashboard)/incidents/(overview)/page.tsx
··· 4 4 import { columns } from "@/components/data-table/incident/columns"; 5 5 import { DataTable } from "@/components/data-table/incident/data-table"; 6 6 import { api } from "@/trpc/server"; 7 + import { ReportInfoBanner } from "./report-info-banner"; 7 8 8 9 export default async function IncidentPage() { 9 - const incidents = await api.incident.getIncidentsByWorkspace.query(); 10 + const [incidents, statusReports] = await Promise.all([ 11 + api.incident.getIncidentsByWorkspace.query(), 12 + api.statusReport.getStatusReportByWorkspace.query(), 13 + ]); 14 + 15 + console.log(statusReports); 10 16 11 17 if (incidents?.length === 0) 12 18 return ( 13 - <EmptyState 14 - icon="siren" 15 - title="No incidents" 16 - description="Hopefully you will see this screen for a long time." 17 - action={undefined} 18 - /> 19 + <> 20 + <EmptyState 21 + icon="siren" 22 + title="No incidents" 23 + description="Hopefully you will see this screen for a long time." 24 + action={undefined} 25 + /> 26 + {!statusReports.length ? <ReportInfoBanner /> : null} 27 + </> 19 28 ); 20 29 21 30 return ( 22 31 <> 23 32 <DataTable columns={columns} data={incidents} /> 33 + {!statusReports.length ? <ReportInfoBanner /> : null} 24 34 </> 25 35 ); 26 36 }
+24
apps/web/src/app/app/[workspaceSlug]/(dashboard)/incidents/(overview)/report-info-banner.tsx
··· 1 + import { Alert, AlertDescription, AlertTitle } from "@openstatus/ui"; 2 + import { Megaphone } from "lucide-react"; 3 + import Link from "next/link"; 4 + 5 + export function ReportInfoBanner() { 6 + return ( 7 + <Alert className="max-w-4xl"> 8 + <Megaphone className="h-4 w-4" /> 9 + <AlertTitle>Looking for Status Reports?</AlertTitle> 10 + <AlertDescription> 11 + The incidents will be created automatically if an endpoint fails. If you 12 + want to inform your users about a planned maintenance, or a current 13 + issue you can create a status report. Go to{" "} 14 + <Link 15 + className="underline underline-offset-4 hover:text-primary hover:no-underline" 16 + href="./status-pages" 17 + > 18 + Status Pages 19 + </Link>{" "} 20 + and select a page you want to report on. 21 + </AlertDescription> 22 + </Alert> 23 + ); 24 + }