Something went wrong. Try again.
[READ-ONLY] Mirror of https://github.com/openstatusHQ/openstatus. ๐ซ Status page with uptime monitoring & API monitoring as code ๐ซ openstatus.dev
bun drizzle-orm monitoring monitoring-as-code nextjs observability on-call open-source shadcn-ui status-page statuspage synthetic-monitoring tinybird turso uptime uptime-checker uptime-monitor
Something went wrong. Try again.
2.0 kB ยท 66 lines
TSX
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667"use client";
import type { RouterOutputs } from "@openstatus/api";import type { PrivateLocation } from "@openstatus/db/src/schema";import { Check, Copy } from "@openstatus/icons";import { Button } from "@openstatus/ui/components/ui/button";import { Separator } from "@openstatus/ui/components/ui/separator";import { useCopyToClipboard } from "@openstatus/ui/hooks/use-copy-to-clipboard";
import { DataTableSheet, DataTableSheetContent, DataTableSheetFooter, DataTableSheetHeader, DataTableSheetTitle,} from "@/components/data-table/data-table-sheet";
import { DataTableBasics } from "./data-table-basics";
type ResponseLog = RouterOutputs["tinybird"]["get"]["data"][number];
export function Sheet({ data, privateLocations, onClose, showCopyUrl = true,}: { data: ResponseLog | null; privateLocations?: PrivateLocation[]; onClose: () => void; showCopyUrl?: boolean;}) { const { copy, isCopied } = useCopyToClipboard(); if (!data) return null;
return ( <DataTableSheet defaultOpen onOpenChange={(open) => !open && onClose()}> <DataTableSheetContent className="sm:max-w-lg"> <DataTableSheetHeader className="px-2"> <DataTableSheetTitle>Response Logs</DataTableSheetTitle> </DataTableSheetHeader> <DataTableBasics data={data} privateLocations={privateLocations} /> {showCopyUrl ? ( <> <Separator /> <DataTableSheetFooter> <Button variant="outline" onClick={() => { if (typeof window !== "undefined") { copy(window.location.href, { withToast: false, }); } }} > Copy Request Log URL {isCopied ? <Check /> : <Copy />} </Button> </DataTableSheetFooter> </> ) : null} </DataTableSheetContent> </DataTableSheet> );}