Skip to content

Open-source status page, incident response and uptime monitoring

fix: default value and text wrap (#770)

Maximilian Kasked89db2083f4e
diff --git a/apps/web/src/components/monitor-dashboard/response-details.tsx b/apps/web/src/components/monitor-dashboard/response-details.tsx
index 7f874b280..979922a7e 100644
--- a/apps/web/src/components/monitor-dashboard/response-details.tsx
+++ b/apps/web/src/components/monitor-dashboard/response-details.tsx
@@ -25,6 +25,8 @@ export async function ResponseDetails(props: ResponseDetailsParams) {
const { timing, headers, message } = response;
+ const defaultValue = headers ? "headers" : timing ? "timing" : "message";
+
return (
<div className="grid gap-8">
<RegionInfo
@@ -35,7 +37,7 @@ export async function ResponseDetails(props: ResponseDetailsParams) {
time: response.cronTimestamp || 0,
}}
/>
- <Tabs defaultValue="headers">
+ <Tabs defaultValue={defaultValue}>
<TabsList>
<TabsTrigger value="headers" disabled={!headers}>
Headers
@@ -56,7 +58,13 @@ export async function ResponseDetails(props: ResponseDetailsParams) {
<TabsContent value="message">
{message ? (
<div>
- <pre className="bg-muted rounded-md p-4 text-sm">{message}</pre>
+ <pre
+ className="bg-muted text-wrap rounded-md p-4 text-sm"
+ // @ts-expect-error textWrap is not a valid prop even though it is
+ style={{ textWrap: "wrap" }}
+ >
+ {message}
+ </pre>
<p className="text-muted-foreground mt-4 text-center text-sm">
Response Message
</p>
diff --git a/apps/web/src/components/ping-response-analysis/response-detail-tabs.tsx b/apps/web/src/components/ping-response-analysis/response-detail-tabs.tsx
index a4d8b3816..04d9423d7 100644
--- a/apps/web/src/components/ping-response-analysis/response-detail-tabs.tsx
+++ b/apps/web/src/components/ping-response-analysis/response-detail-tabs.tsx
@@ -22,11 +22,16 @@ export async function ResponseDetailTabs({
message?: string | null;
assertions?: Assertion[] | null;
}) {
+ const defaultValue = headers ? "headers" : timing ? "timing" : "message";
return (
- <Tabs defaultValue="headers">
+ <Tabs defaultValue={defaultValue}>
<TabsList>
- <TabsTrigger value="headers">Headers</TabsTrigger>
- <TabsTrigger value="timing">Timing</TabsTrigger>
+ <TabsTrigger value="headers" disabled={!headers}>
+ Headers
+ </TabsTrigger>
+ <TabsTrigger value="timing" disabled={!timing}>
+ Timing
+ </TabsTrigger>
<TabsTrigger value="message" disabled={!message}>
Message
</TabsTrigger>
@@ -46,7 +51,13 @@ export async function ResponseDetailTabs({
<TabsContent value="message">
{message ? (
<div>
- <pre className="bg-muted rounded-md p-4 text-sm">{message}</pre>
+ <pre
+ className="bg-muted text-wrap rounded-md p-4 text-sm"
+ // @ts-expect-error textWrap is not a valid prop even though it is
+ style={{ textWrap: "wrap" }}
+ >
+ {message}
+ </pre>
<p className="text-muted-foreground mt-4 text-center text-sm">
Response Message
</p>