Skip to content

Open-source status page, incident response and uptime monitoring

feat: play checker (#990)

Maximilian Kaskecdc96d84f768
diff --git a/.vscode/settings.json b/.vscode/settings.json
index 366277501..fd6286385 100644
--- a/.vscode/settings.json
+++ b/.vscode/settings.json
@@ -1,5 +1,7 @@
{
- "editor.codeActionsOnSave": {},
+ "editor.codeActionsOnSave": {
+ "source.organizeImports.biome": "explicit"
+ },
"editor.defaultFormatter": "biomejs.biome",
"editor.formatOnSave": true,
"typescript.tsdk": "node_modules/typescript/lib",
diff --git a/apps/web/package.json b/apps/web/package.json
index 86b8f3cf0..f728605ba 100644
--- a/apps/web/package.json
+++ b/apps/web/package.json
@@ -75,6 +75,7 @@
"react-hook-form": "7.47.0",
"react-tweet": "3.1.1",
"reading-time": "1.5.0",
+ "recharts": "2.12.7",
"rehype-pretty-code": "0.10.0",
"rehype-react": "7.2.0",
"remark-parse": "10.0.2",
diff --git a/apps/web/public/assets/changelog/play-checker-improvements.png b/apps/web/public/assets/changelog/play-checker-improvements.png
new file mode 100644
index 000000000..97afa9280
Binary files /dev/null and b/apps/web/public/assets/changelog/play-checker-improvements.png differ
diff --git a/apps/web/src/app/play/_components/header-play.tsx b/apps/web/src/app/play/_components/header-play.tsx
deleted file mode 100644
index 1c051bdef..000000000
--- a/apps/web/src/app/play/_components/header-play.tsx
+++ /dev/null
@@ -1,11 +0,0 @@
-export function HeaderPlay({
- title,
- description,
-}: Record<"title" | "description", string>) {
- return (
- <div className="mx-auto grid max-w-md gap-4 text-center">
- <p className="mb-1 font-cal text-3xl">{title}</p>
- <p className="text-muted-foreground">{description}</p>
- </div>
- );
-}
diff --git a/apps/web/src/app/play/checker/[id]/page.tsx b/apps/web/src/app/play/checker/[id]/page.tsx
index f4c8df1c6..7a2235e41 100644
--- a/apps/web/src/app/play/checker/[id]/page.tsx
+++ b/apps/web/src/app/play/checker/[id]/page.tsx
@@ -3,7 +3,10 @@ import Link from "next/link";
import { redirect } from "next/navigation";
import * as z from "zod";
-import { monitorFlyRegionSchema } from "@openstatus/db/src/schema/constants";
+import {
+ flyRegions,
+ monitorFlyRegionSchema,
+} from "@openstatus/db/src/schema/constants";
import { Separator } from "@openstatus/ui";
import {
@@ -12,22 +15,29 @@ import {
twitterMetadata,
} from "@/app/shared-metadata";
import { Shell } from "@/components/dashboard/shell";
-import { BackButton } from "@/components/layout/back-button";
import { CopyLinkButton } from "@/components/ping-response-analysis/copy-link-button";
import { MultiRegionTabs } from "@/components/ping-response-analysis/multi-region-tabs";
-import { RegionInfo } from "@/components/ping-response-analysis/region-info";
-import { ResponseDetailTabs } from "@/components/ping-response-analysis/response-detail-tabs";
-import { SelectRegion } from "@/components/ping-response-analysis/select-region";
import {
getCheckerDataById,
timestampFormatter,
} from "@/components/ping-response-analysis/utils";
+import type { Region } from "@openstatus/tinybird";
/**
* allowed URL search params
*/
const searchParamsSchema = z.object({
- region: monitorFlyRegionSchema.optional(),
+ regions: z
+ .string()
+ .optional()
+ .transform(
+ (value) =>
+ value
+ ?.trim()
+ ?.split(",")
+ .filter((i) => flyRegions.includes(i as Region)) ?? flyRegions,
+ )
+ .pipe(monitorFlyRegionSchema.array().optional()),
});
interface Props {
@@ -38,19 +48,14 @@ interface Props {
export default async function CheckPage({ params, searchParams }: Props) {
const search = searchParamsSchema.safeParse(searchParams);
- const selectedRegion = search.success ? search.data.region : undefined;
+ const selectedRegions = search.success ? search.data.regions : undefined;
const data = await getCheckerDataById(params.id);
if (!data) redirect("/play/checker");
- const check =
- data.checks.find((i) => i.region === selectedRegion) || data.checks?.[0];
-
- const { region, headers, timing, status } = check;
-
return (
- <Shell className="my-8 flex flex-col gap-8 md:my-16">
+ <Shell className="flex flex-col gap-8">
<div className="flex justify-between gap-4">
<div className="flex max-w-[calc(100%-50px)] flex-col gap-1">
<h1 className="truncate text-wrap font-semibold text-lg sm:text-xl md:text-3xl">
@@ -64,23 +69,14 @@ export default async function CheckPage({ params, searchParams }: Props) {
<CopyLinkButton />
</div>
</div>
- <MultiRegionTabs regions={data.checks} />
- <Separator />
- <div className="flex flex-col gap-8">
- <div className="grid gap-8 md:grid-cols-2">
- <div>
- <SelectRegion defaultValue={region} />
- </div>
- <div>
- <RegionInfo check={check} />
- </div>
- </div>
- <ResponseDetailTabs {...{ timing, headers, status }} hideInfo={false} />
- </div>
+ <MultiRegionTabs
+ regions={data.checks}
+ selectedRegions={selectedRegions}
+ />
<Separator />
<p className="text-muted-foreground text-sm">
The data will be stored for{" "}
- <span className="text-foreground">1 day</span>. If you want to persist
+ <span className="text-foreground">7 days</span>. If you want to persist
the data,{" "}
<Link
href="/app/login"
@@ -95,7 +91,7 @@ export default async function CheckPage({ params, searchParams }: Props) {
}
export async function generateMetadata({ params }: Props): Promise<Metadata> {
- const title = "Speed Checker";
+ const title = "Global Speed Checker";
const description =
"Get speed insights for your api, website from multiple regions.";
return {
diff --git a/apps/web/src/app/play/checker/_components/checker-form.tsx b/apps/web/src/app/play/checker/_components/checker-form.tsx
index 06378526e..1f4a16856 100644
--- a/apps/web/src/app/play/checker/_components/checker-form.tsx
+++ b/apps/web/src/app/play/checker/_components/checker-form.tsx
@@ -1,15 +1,20 @@
"use client";
import { zodResolver } from "@hookform/resolvers/zod";
-import { useRouter } from "next/navigation";
-import { useTransition } from "react";
+import { usePathname, useRouter, useSearchParams } from "next/navigation";
+import { useMemo, useState, useTransition } from "react";
import { useForm } from "react-hook-form";
import * as z from "zod";
import {
+ Alert,
+ AlertDescription,
+ AlertTitle,
Button,
+ Checkbox,
Form,
FormControl,
+ FormDescription,
FormField,
FormItem,
FormLabel,
@@ -20,40 +25,184 @@ import {
SelectItem,
SelectTrigger,
SelectValue,
+ Table,
+ TableBody,
+ TableCaption,
+ TableCell,
+ TableHead,
+ TableHeader,
+ TableRow,
+ Tooltip,
+ TooltipContent,
+ TooltipProvider,
+ TooltipTrigger,
} from "@openstatus/ui";
+import { Icons } from "@/components/icons";
import { LoadingAnimation } from "@/components/loading-animation";
+import {
+ type RegionChecker,
+ is32CharHex,
+ latencyFormatter,
+ regionFormatter,
+} from "@/components/ping-response-analysis/utils";
+import useUpdateSearchParams from "@/hooks/use-update-search-params";
+import { toast } from "@/lib/toast";
+import { notEmpty } from "@/lib/utils";
+import { flyRegions } from "@openstatus/db/src/schema/constants";
+import { ChevronRight, FileSearch, Info, Loader } from "lucide-react";
+import dynamic from "next/dynamic";
+import Link from "next/link";
+
+const FloatingActionNoSSR = dynamic(
+ () =>
+ import("../_components/floating-action").then((mod) => mod.FloatingAction),
+ {
+ ssr: false,
+ loading: () => <></>,
+ },
+);
+
+/**
+ * IDEA we can create a list of last requests and show them in a list, but
+ * we will have to sync both expiration dates, for redis and localStorage
+ */
const METHODS = ["GET", "POST", "PUT", "DELETE"] as const;
const formSchema = z.object({
- url: z.string().url(), // add pattern and use InputWithAddon `https://`
+ url: z.string().url(),
method: z.enum(METHODS).default("GET"),
+ redirect: z.boolean().default(false),
});
type FormSchema = z.infer<typeof formSchema>;
-export function CheckerForm() {
+interface CheckerFormProps {
+ defaultValues?: FormSchema;
+ defaultData?: RegionChecker[];
+}
+
+export function CheckerForm({ defaultValues, defaultData }: CheckerFormProps) {
+ const pathname = usePathname();
const router = useRouter();
const [isPending, startTransition] = useTransition();
const form = useForm<FormSchema>({
resolver: zodResolver(formSchema),
- defaultValues: { method: "GET", url: "" },
+ defaultValues,
});
+ const [result, setResult] = useState<RegionChecker[]>(defaultData || []);
+ const updateSearchParams = useUpdateSearchParams();
+ const searchParams = useSearchParams();
+
+ const id = useMemo(() => {
+ return searchParams.get("id");
+ }, [searchParams]);
function onSubmit(data: FormSchema) {
startTransition(async () => {
- const { url, method } = data;
+ const { url, method, redirect } = data;
try {
- const res = await fetch("/play/checker/api", {
- method: "POST",
- body: JSON.stringify({ url, method }),
- });
- const { uuid } = (await res.json()) as { uuid?: string };
- if (typeof uuid === "string") {
- router.push(`/play/checker/${uuid}`);
+ async function fetchAndReadStream() {
+ // reset the array
+ setResult([]);
+
+ const toastId = toast.loading("Loading data from regions...", {
+ duration: Number.POSITIVE_INFINITY,
+ });
+
+ try {
+ const response = await fetch("/play/checker/api", {
+ method: "POST",
+ body: JSON.stringify({ url, method }),
+ });
+ const reader = response?.body?.getReader();
+ if (!reader) return;
+
+ const decoder = new TextDecoder();
+
+ let done = false;
+ let currentResult: RegionChecker[] = [];
+
+ while (!done) {
+ const { value, done: streamDone } = await reader.read();
+ done = streamDone;
+ if (value) {
+ const decoded = decoder.decode(value, { stream: true });
+ // REMINDER: validation
+
+ if (!decoded) continue;
+
+ const array = decoded.split("\n").filter(Boolean);
+
+ const _result = array
+ .map((item) => {
+ try {
+ if (is32CharHex(item)) {
+ if (redirect) {
+ router.push(`/play/checker/${item}`);
+ toast.success("Data is available! Redirecting...", {
+ id: toastId,
+ duration: 2000,
+ });
+ } else {
+ const searchParams = updateSearchParams({
+ id: item,
+ });
+ router.replace(`${pathname}?${searchParams}`);
+ toast.success("Data is available!", {
+ id: toastId,
+ duration: 3000,
+ description: "Click the button below to more.",
+ action: {
+ label: "Details",
+ onClick: () =>
+ router.push(`/play/checker/${item}`),
+ },
+ });
+ }
+ } else {
+ const parsed = JSON.parse(item) as RegionChecker;
+ return parsed;
+ }
+ return null;
+ } catch (e) {
+ console.error(e);
+ return null;
+ }
+ })
+ .filter(notEmpty);
+
+ if (!_result.length) continue;
+
+ currentResult = [...currentResult, ..._result];
+ // setResult((prev) => [...prev, ..._result]);
+ setResult(currentResult);
+
+ if (_result) {
+ toast.loading(
+ `Checking ${regionFormatter(_result[0].region, "long")} (${latencyFormatter(_result[0].latency)})`,
+ {
+ id: toastId,
+ },
+ );
+ }
+ }
+ }
+ } catch (e) {
+ console.log(e);
+ const searchParams = updateSearchParams({ id: null });
+ router.replace(`${pathname}?${searchParams}`);
+ toast.error("Something went wrong", {
+ description: "Please try again",
+ id: toastId,
+ duration: 2000,
+ });
+ }
}
- } catch {
+
+ await fetchAndReadStream();
+ } catch (_e) {
// TODO: better error handling, including e.g. toast
form.setError("url", { message: "Something went wrong" });
}
@@ -61,56 +210,205 @@ export function CheckerForm() {
}
return (
- <Form {...form}>
- <form onSubmit={form.handleSubmit(onSubmit)}>
- <div className="grid grid-cols-4 gap-2 sm:grid-cols-5">
- <FormField
- control={form.control}
- name="method"
- render={({ field }) => (
- <FormItem className="col-span-1">
- <FormLabel className="sr-only">Method</FormLabel>
- <Select
- onValueChange={field.onChange}
- defaultValue={field.value}
- >
+ <>
+ <Form {...form}>
+ <form onSubmit={form.handleSubmit(onSubmit)} className="grid gap-3">
+ <div className="grid grid-cols-4 gap-2 sm:grid-cols-5">
+ <FormField
+ control={form.control}
+ name="method"
+ render={({ field }) => (
+ <FormItem className="col-span-1">
+ <FormLabel className="sr-only">Method</FormLabel>
+ <Select
+ onValueChange={field.onChange}
+ defaultValue={field.value}
+ >
+ <FormControl>
+ <SelectTrigger>
+ <SelectValue />
+ </SelectTrigger>
+ </FormControl>
+ <SelectContent>
+ {METHODS.map((method) => (
+ <SelectItem key={method} value={method}>
+ {method}
+ </SelectItem>
+ ))}
+ </SelectContent>
+ </Select>
+ <FormMessage />
+ </FormItem>
+ )}
+ />
+ <FormField
+ control={form.control}
+ name="url"
+ render={({ field }) => (
+ <FormItem className="col-span-3">
+ <FormLabel className="sr-only">URL</FormLabel>
+ <FormControl>
+ <Input
+ placeholder="https://documenso.com"
+ className="bg-muted"
+ {...field}
+ />
+ </FormControl>
+ <FormMessage />
+ </FormItem>
+ )}
+ />
+ <div className="col-span-full mt-2 sm:col-span-1">
+ <Button disabled={isPending} className="h-10 w-full">
+ {isPending ? <LoadingAnimation /> : "Check"}
+ </Button>
+ </div>
+ </div>
+ <div>
+ <FormField
+ control={form.control}
+ name="redirect"
+ render={({ field }) => (
+ <FormItem className="flex flex-row items-start space-x-2 space-y-0">
<FormControl>
- <SelectTrigger>
- <SelectValue />
- </SelectTrigger>
+ <Checkbox
+ checked={field.value}
+ onCheckedChange={field.onChange}
+ />
</FormControl>
- <SelectContent>
- {METHODS.map((method) => (
- <SelectItem key={method} value={method}>
- {method}
- </SelectItem>
- ))}
- </SelectContent>
- </Select>
- <FormMessage />
- </FormItem>
- )}
- />
- <FormField
- control={form.control}
- name="url"
- render={({ field }) => (
- <FormItem className="col-span-3">
- <FormLabel className="sr-only">URL</FormLabel>
- <FormControl>
- <Input placeholder="https://documenso.com" {...field} />
- </FormControl>
- <FormMessage />
- </FormItem>
- )}
- />
- <div className="col-span-full mt-2 sm:col-span-1">
- <Button disabled={isPending} className="h-10 w-full">
- {isPending ? <LoadingAnimation /> : "Check"}
- </Button>
+ <div className="space-y-1 leading-none">
+ <FormLabel>Redirect to extended details</FormLabel>
+ <FormDescription className="max-w-md">
+ Get response header, timing phases and more.
+ </FormDescription>
+ </div>
+ </FormItem>
+ )}
+ />
</div>
+ </form>
+ </Form>
+ <div className="grid gap-4">
+ <TableResult result={result} loading={isPending} id={id} />
+ <DotLegend />
+ </div>
+
+ <FloatingActionNoSSR id={id} />
+ </>
+ );
+}
+
+function TableResult({
+ result,
+ loading,
+ id,
+}: {
+ loading: boolean;
+ result: RegionChecker[];
+ id: string | null;
+}) {
+ return (
+ <Table>
+ <TableHeader>
+ <TableRow>
+ <TableHead className="flex items-center gap-1">
+ <p className="w-[95px]">
+ Region{" "}
+ <span className="font-normal text-xs tabular-nums">
+ ({result.length}/{flyRegions.length})
+ </span>
+ </p>
+ {loading ? (
+ <Loader className="inline h-4 w-4 animate-spin" />
+ ) : result.length ? (
+ <Icons.check className="inline h-4 w-4 text-green-500" />
+ ) : null}
+ {id &&
+ !loading &&
+ result.length > 0 &&
+ result.length !== flyRegions.length ? (
+ <TooltipProvider>
+ <Tooltip>
+ <TooltipTrigger>
+ <Info className="h-4 w-4 text-muted-foreground" />
+ </TooltipTrigger>
+ <TooltipContent className="text-muted-foreground">
+ <p>Not all regions were hit.</p>
+ <p>
+ Still{" "}
+ <Link
+ href={`/play/checker/${id}`}
+ className="text-foreground underline underline-offset-4 hover:no-underline"
+ >
+ check the results
+ </Link>
+ ?
+ </p>
+ </TooltipContent>
+ </Tooltip>
+ </TooltipProvider>
+ ) : null}
+ </TableHead>
+ <TableHead className="w-[100px] text-right">Latency</TableHead>
+ </TableRow>
+ </TableHeader>
+ <TableBody>
+ {result.length > 0 ? (
+ result.map((item) => (
+ <TableRow key={item.region}>
+ <TableCell className="flex items-center gap-2 font-medium">
+ {regionFormatter(item.region, "long")}
+ <StatusDot value={item.status} />
+ </TableCell>
+ <TableCell className="text-right">
+ {latencyFormatter(item.latency)}
+ </TableCell>
+ </TableRow>
+ ))
+ ) : (
+ <TableRow>
+ <TableCell
+ colSpan={2}
+ className="border border-border border-dashed text-center"
+ >
+ No data available
+ </TableCell>
+ </TableRow>
+ )}
+ </TableBody>
+ </Table>
+ );
+}
+
+function DotLegend() {
+ return (
+ <div className="flex items-center justify-center gap-3 text-center">
+ {[1, 2, 3, 4, 5].map((i) => (
+ <div
+ key={i}
+ className="flex items-center justify-between gap-2 font-mono text-muted-foreground text-xs"
+ >
+ <StatusDot value={i * 100} />
+ <span>{i}xx</span>
</div>
- </form>
- </Form>
+ ))}
+ </div>
);
}
+
+function StatusDot({ value }: { value: number }) {
+ switch (String(value).charAt(0)) {
+ case "1":
+ return <div className="h-1.5 w-1.5 rounded-full bg-gray-500" />;
+ case "2":
+ return <div className="h-1.5 w-1.5 rounded-full bg-green-500" />;
+ case "3":
+ return <div className="h-1.5 w-1.5 rounded-full bg-blue-500" />;
+ case "4":
+ return <div className="h-1.5 w-1.5 rounded-full bg-yellow-500" />;
+ case "5":
+ return <div className="h-1.5 w-1.5 rounded-full bg-red-500" />;
+ default:
+ return <div className="h-1.5 w-1.5 rounded-full bg-gray-500" />;
+ }
+}
diff --git a/apps/web/src/app/play/checker/_components/checker-play.tsx b/apps/web/src/app/play/checker/_components/checker-play.tsx
index 89aa9b6f5..56beb116e 100644
--- a/apps/web/src/app/play/checker/_components/checker-play.tsx
+++ b/apps/web/src/app/play/checker/_components/checker-play.tsx
@@ -1,17 +1,43 @@
-import { Shell } from "@/components/dashboard/shell";
-import { HeaderPlay } from "../../_components/header-play";
+import {
+ CardContainer,
+ CardDescription,
+ CardHeader,
+ CardIcon,
+ CardTitle,
+} from "@/components/marketing/card";
+import type { CachedRegionChecker } from "@/components/ping-response-analysis/utils";
+import { Suspense } from "react";
import { CheckerForm } from "./checker-form";
-export default async function CheckerPlay() {
+export default async function CheckerPlay({
+ data,
+}: {
+ data: CachedRegionChecker | null;
+}) {
return (
- <Shell className="flex flex-col gap-8">
- <HeaderPlay
- title="Is your endpoint globally fast?"
- description="Test your website and API performance across all continents. "
- />
+ <CardContainer>
+ <CardHeader>
+ <CardIcon icon="gauge" />
+ <CardTitle>Global Speed Checker</CardTitle>
+ <CardDescription className="max-w-md">
+ Is your{" "}
+ <span className="text-foreground">endpoint globally fast</span>? Test
+ your website and API performance across all continents.
+ </CardDescription>
+ </CardHeader>
+
<div className="mx-auto grid w-full max-w-xl gap-6">
- <CheckerForm />
+ <Suspense fallback={null}>
+ <CheckerForm
+ defaultValues={
+ data
+ ? { redirect: false, ...data }
+ : { redirect: false, url: "", method: "GET" }
+ }
+ defaultData={data?.checks.sort((a, b) => a.latency - b.latency)}
+ />
+ </Suspense>
</div>
- </Shell>
+ </CardContainer>
);
}
diff --git a/apps/web/src/app/play/checker/_components/floating-action.tsx b/apps/web/src/app/play/checker/_components/floating-action.tsx
new file mode 100644
index 000000000..8ccb08bbb
--- /dev/null
+++ b/apps/web/src/app/play/checker/_components/floating-action.tsx
@@ -0,0 +1,24 @@
+"use client";
+
+import { Button } from "@openstatus/ui";
+import * as Portal from "@radix-ui/react-portal";
+import { ArrowRight, ChevronRight } from "lucide-react";
+import Link from "next/link";
+
+export function FloatingAction({ id }: { id: string | null }) {
+ if (!id) return null;
+
+ return (
+ <Portal.Root>
+ <div className="group fixed right-4 bottom-4 z-50 mx-auto w-fit">
+ <Button asChild>
+ <Link href={`/play/checker/${id}`}>
+ <span className="mr-1">Response Details</span>
+ <ArrowRight className="relative mb-[1px] inline h-4 w-0 transition-all group-hover:w-4" />
+ <ChevronRight className="relative mb-[1px] inline h-4 w-4 transition-all group-hover:w-0" />
+ </Link>
+ </Button>
+ </div>
+ </Portal.Root>
+ );
+}
diff --git a/apps/web/src/app/play/checker/_components/global-monitoring.tsx b/apps/web/src/app/play/checker/_components/global-monitoring.tsx
index 30d6a2944..b22137507 100644
--- a/apps/web/src/app/play/checker/_components/global-monitoring.tsx
+++ b/apps/web/src/app/play/checker/_components/global-monitoring.tsx
@@ -2,18 +2,14 @@ import Link from "next/link";
import { Button } from "@openstatus/ui/src/components/button";
-import { Shell } from "@/components/dashboard/shell";
import type { ValidIcon } from "@/components/icons";
import {
CardContainer,
- CardContent,
CardFeature,
- CardFeatureContainer,
CardHeader,
CardIcon,
CardTitle,
} from "@/components/marketing/card";
-import { Globe } from "@/components/marketing/monitor/globe";
const features: {
icon: ValidIcon;
@@ -21,40 +17,45 @@ const features: {
description: string;
}[] = [
{
- icon: "globe",
- catchline: "Latency Monitoring.",
+ icon: "gauge",
+ catchline: "Speed Test for Websites",
description:
- "Monitor the latency of your endpoints from all over the world. We support 35 regions.",
+ "Enter your URL and get a website speed check. Get insights on page load, header details and timing phases (DNS, Connect, TLS, TTFB) of the response.",
},
{
- icon: "play",
- catchline: "Monitor anything.",
+ icon: "globe",
+ catchline: "Global Latency",
description:
- "We can monitor your website, API, DNS, TCP or any other service you have running. ",
+ "Monitor performance in different regions to ensure quick load times for users across 35 regions around the world.",
},
{
- icon: "bot",
- catchline: "Synthetic Monitoring.",
- description: "Run your tests in your CI/CD pipeline, or on a schedule. ",
+ icon: "link",
+ catchline: "Share the Results",
+ description:
+ "Quickly share the results of your website speed test with your team or clients. We share the results for 7 days, so you can easily collaborate on performance.",
},
];
export const GlobalMonitoring = () => {
return (
- <Shell className="mx-auto">
+ <CardContainer>
<CardHeader>
- <CardIcon icon={"activity"} />
+ <CardIcon icon="activity" />
<CardTitle>Start monitoring your services</CardTitle>
</CardHeader>
- <>
- <div className="mt-12">
- <div className="list-none space-y-4">
- {features?.map((feature, i) => (
- // biome-ignore lint/suspicious/noArrayIndexKey: <explanation>
- <CardFeature key={i} {...feature} />
- ))}
- </div>
- </div>
- </>
- </Shell>
+ <ul className="grid grid-cols-1 gap-4 sm:grid-cols-3 sm:gap-6">
+ {features?.map((feature, i) => (
+ // biome-ignore lint/suspicious/noArrayIndexKey: <explanation>
+ <CardFeature key={i} {...feature} />
+ ))}
+ </ul>
+ <div className="order-first flex items-center justify-center gap-2 text-center md:order-none">
+ <Button variant="outline" className="rounded-full" asChild>
+ <Link href="/features/status-page">Status Page</Link>
+ </Button>
+ <Button className="rounded-full" asChild>
+ <Link href="/features/monitoring">Monitoring</Link>
+ </Button>
+ </div>
+ </CardContainer>
);
};
diff --git a/apps/web/src/app/play/checker/api/mock.ts b/apps/web/src/app/play/checker/api/mock.ts
new file mode 100644
index 000000000..e649aa727
--- /dev/null
+++ b/apps/web/src/app/play/checker/api/mock.ts
@@ -0,0 +1,1279 @@
+import type { RegionChecker } from "@/components/ping-response-analysis/utils";
+import { wait } from "@/lib/utils";
+import type { Region } from "@openstatus/tinybird";
+
+export async function mockCheckRegion(region: Region) {
+ const response = data.checks.find((check) => check.region === region);
+
+ if (!response) {
+ throw new Error("Region not found");
+ }
+
+ await wait(response.latency);
+
+ return response as RegionChecker;
+}
+
+export const data = {
+ url: "https://openstatus.dev",
+ time: 1724415466600,
+ method: "GET",
+ checks: [
+ {
+ status: 200,
+ latency: 889,
+ headers: {
+ Age: "0",
+ "Cache-Control":
+ "private, no-cache, no-store, max-age=0, must-revalidate",
+ "Content-Type": "text/html; charset=utf-8",
+ Date: "Fri, 23 Aug 2024 12:17:47 GMT",
+ Link: '</_next/static/media/162bf645eb375add-s.p.ttf>; rel=preload; as="font"; crossorigin=""; type="font/ttf", </_next/static/media/a34f9d1faa5f3315-s.p.woff2>; rel=preload; as="font"; crossorigin=""; type="font/woff2"',
+ Server: "Vercel",
+ "Set-Cookie":
+ "__Host-authjs.csrf-token=60f9ccb1cb9453b783b14b29eb9e43601eff00062d94b8c57fdaad37e6f10ce7%7C53949e7215f2a3d72af01e3f56727018ff57976e927e05aec83b795736fda2e7; Path=/; HttpOnly; Secure; SameSite=Lax",
+ "Strict-Transport-Security": "max-age=63072000",
+ Vary: "RSC, Next-Router-State-Tree, Next-Router-Prefetch",
+ "X-Matched-Path": "/",
+ "X-Powered-By": "Next.js",
+ "X-Vercel-Cache": "MISS",
+ "X-Vercel-Id": "fra1::fra1::82mqm-1724415466843-d608bd28fa1c",
+ },
+ time: 1724415466739,
+ timing: {
+ dnsStart: 1724415466810,
+ dnsDone: 1724415466812,
+ connectStart: 1724415466812,
+ connectDone: 1724415466813,
+ tlsHandshakeStart: 1724415466813,
+ tlsHandshakeDone: 1724415466833,
+ firstByteStart: 1724415466833,
+ firstByteDone: 1724415467629,
+ transferStart: 1724415467629,
+ transferDone: 1724415467629,
+ },
+ region: "ams",
+ },
+ {
+ status: 200,
+ latency: 1602,
+ headers: {
+ Age: "0",
+ "Cache-Control":
+ "private, no-cache, no-store, max-age=0, must-revalidate",
+ "Content-Type": "text/html; charset=utf-8",
+ Date: "Fri, 23 Aug 2024 12:17:48 GMT",
+ Link: '</_next/static/media/162bf645eb375add-s.p.ttf>; rel=preload; as="font"; crossorigin=""; type="font/ttf", </_next/static/media/a34f9d1faa5f3315-s.p.woff2>; rel=preload; as="font"; crossorigin=""; type="font/woff2"',
+ Server: "Vercel",
+ "Set-Cookie":
+ "__Host-authjs.csrf-token=25da392216bca70f47304c9c2eb42f471d91d7b118247a1d24dcb33e38e478b8%7Cf1d4e0f661eb0c8ba478cd5e7fa75d5b1e78f463e28f819c506f9a526f6e4412; Path=/; HttpOnly; Secure; SameSite=Lax",
+ "Strict-Transport-Security": "max-age=63072000",
+ Vary: "RSC, Next-Router-State-Tree, Next-Router-Prefetch",
+ "X-Matched-Path": "/",
+ "X-Powered-By": "Next.js",
+ "X-Vercel-Cache": "MISS",
+ "X-Vercel-Execution-Region": "fra1",
+ "X-Vercel-Id": "arn1::fra1::9855t-1724415466874-b441298d1373",
+ },
+ time: 1724415466771,
+ timing: {
+ dnsStart: 1724415466822,
+ dnsDone: 1724415466839,
+ connectStart: 1724415466839,
+ connectDone: 1724415466841,
+ tlsHandshakeStart: 1724415466841,
+ tlsHandshakeDone: 1724415466850,
+ firstByteStart: 1724415466850,
+ firstByteDone: 1724415468373,
+ transferStart: 1724415468373,
+ transferDone: 1724415468373,
+ },
+ region: "arn",
+ },
+ {
+ status: 200,
+ latency: 823,
+ headers: {
+ Age: "0",
+ "Cache-Control":
+ "private, no-cache, no-store, max-age=0, must-revalidate",
+ "Content-Type": "text/html; charset=utf-8",
+ Date: "Fri, 23 Aug 2024 12:17:47 GMT",
+ Link: '</_next/static/media/162bf645eb375add-s.p.ttf>; rel=preload; as="font"; crossorigin=""; type="font/ttf", </_next/static/media/a34f9d1faa5f3315-s.p.woff2>; rel=preload; as="font"; crossorigin=""; type="font/woff2"',
+ Server: "Vercel",
+ "Set-Cookie":
+ "__Host-authjs.csrf-token=ea47cff80032077dfa9caa8a7462eabe1ab0885848e7c5b3c2867d1245236cfc%7C751f839b3c6906deca1fc497bfcd09a88cbbd716d187b0da3d1b3cddf929a469; Path=/; HttpOnly; Secure; SameSite=Lax",
+ "Strict-Transport-Security": "max-age=63072000",
+ Vary: "RSC, Next-Router-State-Tree, Next-Router-Prefetch",
+ "X-Matched-Path": "/",
+ "X-Powered-By": "Next.js",
+ "X-Vercel-Cache": "MISS",
+ "X-Vercel-Execution-Region": "fra1",
+ "X-Vercel-Id": "iad1::fra1::knlx7-1724415466923-6d8a2defb96b",
+ },
+ time: 1724415466780,
+ timing: {
+ dnsStart: 1724415466872,
+ dnsDone: 1724415466874,
+ connectStart: 1724415466874,
+ connectDone: 1724415466875,
+ tlsHandshakeStart: 1724415466875,
+ tlsHandshakeDone: 1724415466914,
+ firstByteStart: 1724415466914,
+ firstByteDone: 1724415467603,
+ transferStart: 1724415467603,
+ transferDone: 1724415467603,
+ },
+ region: "atl",
+ },
+ {
+ status: 200,
+ latency: 1198,
+ headers: {
+ Age: "0",
+ "Cache-Control":
+ "private, no-cache, no-store, max-age=0, must-revalidate",
+ "Content-Type": "text/html; charset=utf-8",
+ Date: "Fri, 23 Aug 2024 12:17:47 GMT",
+ Link: '</_next/static/media/162bf645eb375add-s.p.ttf>; rel=preload; as="font"; crossorigin=""; type="font/ttf", </_next/static/media/a34f9d1faa5f3315-s.p.woff2>; rel=preload; as="font"; crossorigin=""; type="font/woff2"',
+ Server: "Vercel",
+ "Set-Cookie":
+ "__Host-authjs.csrf-token=b257a8d1854130d47bca81546e2b9f7b4ece148a7cfe12067b9ac8ffead17d86%7Cb55b9f314f742151aacdb968ff02b9fe974fff849b7f42edb542bbbb3f144c76; Path=/; HttpOnly; Secure; SameSite=Lax",
+ "Strict-Transport-Security": "max-age=63072000",
+ Vary: "RSC, Next-Router-State-Tree, Next-Router-Prefetch",
+ "X-Matched-Path": "/",
+ "X-Powered-By": "Next.js",
+ "X-Vercel-Cache": "MISS",
+ "X-Vercel-Execution-Region": "fra1",
+ "X-Vercel-Id": "iad1::fra1::zv2ml-1724415467303-bd78546dd164",
+ },
+ time: 1724415466805,
+ timing: {
+ dnsStart: 1724415467056,
+ dnsDone: 1724415467130,
+ connectStart: 1724415467130,
+ connectDone: 1724415467131,
+ tlsHandshakeStart: 1724415467131,
+ tlsHandshakeDone: 1724415467267,
+ firstByteStart: 1724415467267,
+ firstByteDone: 1724415468003,
+ transferStart: 1724415468003,
+ transferDone: 1724415468003,
+ },
+ region: "bog",
+ },
+ {
+ status: 200,
+ latency: 1423,
+ headers: {
+ Age: "0",
+ "Cache-Control":
+ "private, no-cache, no-store, max-age=0, must-revalidate",
+ "Content-Type": "text/html; charset=utf-8",
+ Date: "Fri, 23 Aug 2024 12:17:48 GMT",
+ Link: '</_next/static/media/162bf645eb375add-s.p.ttf>; rel=preload; as="font"; crossorigin=""; type="font/ttf", </_next/static/media/a34f9d1faa5f3315-s.p.woff2>; rel=preload; as="font"; crossorigin=""; type="font/woff2"',
+ Server: "Vercel",
+ "Set-Cookie":
+ "__Host-authjs.csrf-token=8a075b8d193fee6d0bb5b7b146a8091a4823b6fdcf130ccfe59c6ef3f0231503%7C576e86b7bc8fd6583eeec0e420fe6e24fad8236c48855c9cca71bc487d3cfc0d; Path=/; HttpOnly; Secure; SameSite=Lax",
+ "Strict-Transport-Security": "max-age=63072000",
+ Vary: "RSC, Next-Router-State-Tree, Next-Router-Prefetch",
+ "X-Matched-Path": "/",
+ "X-Powered-By": "Next.js",
+ "X-Vercel-Cache": "MISS",
+ "X-Vercel-Execution-Region": "fra1",
+ "X-Vercel-Id": "bom1::fra1::24p8d-1724415467151-89ab94155a7b",
+ },
+ time: 1724415466933,
+ timing: {
+ dnsStart: 1724415467117,
+ dnsDone: 1724415467144,
+ connectStart: 1724415467144,
+ connectDone: 1724415467145,
+ tlsHandshakeStart: 1724415467145,
+ tlsHandshakeDone: 1724415467152,
+ firstByteStart: 1724415467152,
+ firstByteDone: 1724415468356,
+ transferStart: 1724415468356,
+ transferDone: 1724415468356,
+ },
+ region: "bom",
+ },
+ {
+ status: 200,
+ latency: 1134,
+ headers: {
+ Age: "0",
+ "Cache-Control":
+ "private, no-cache, no-store, max-age=0, must-revalidate",
+ "Content-Type": "text/html; charset=utf-8",
+ Date: "Fri, 23 Aug 2024 12:17:47 GMT",
+ Link: '</_next/static/media/162bf645eb375add-s.p.ttf>; rel=preload; as="font"; crossorigin=""; type="font/ttf", </_next/static/media/a34f9d1faa5f3315-s.p.woff2>; rel=preload; as="font"; crossorigin=""; type="font/woff2"',
+ Server: "Vercel",
+ "Set-Cookie":
+ "__Host-authjs.csrf-token=790cc402a44b4a6fec5a32657bd549f2e70c0893007b1e799f9625039564b7dd%7C42453bba78875cf8010fe68ab340db0b3cf23c37eed94fe448566d143d25f579; Path=/; HttpOnly; Secure; SameSite=Lax",
+ "Strict-Transport-Security": "max-age=63072000",
+ Vary: "RSC, Next-Router-State-Tree, Next-Router-Prefetch",
+ "X-Matched-Path": "/",
+ "X-Powered-By": "Next.js",
+ "X-Vercel-Cache": "MISS",
+ "X-Vercel-Execution-Region": "fra1",
+ "X-Vercel-Id": "iad1::fra1::89mxf-1724415466920-c57e2b6af701",
+ },
+ time: 1724415466802,
+ timing: {
+ dnsStart: 1724415466872,
+ dnsDone: 1724415466885,
+ connectStart: 1724415466885,
+ connectDone: 1724415466885,
+ tlsHandshakeStart: 1724415466885,
+ tlsHandshakeDone: 1724415466912,
+ firstByteStart: 1724415466913,
+ firstByteDone: 1724415467936,
+ transferStart: 1724415467936,
+ transferDone: 1724415467936,
+ },
+ region: "bos",
+ },
+ {
+ status: 200,
+ latency: 812,
+ headers: {
+ Age: "0",
+ "Cache-Control":
+ "private, no-cache, no-store, max-age=0, must-revalidate",
+ "Content-Type": "text/html; charset=utf-8",
+ Date: "Fri, 23 Aug 2024 12:17:48 GMT",
+ Link: '</_next/static/media/162bf645eb375add-s.p.ttf>; rel=preload; as="font"; crossorigin=""; type="font/ttf", </_next/static/media/a34f9d1faa5f3315-s.p.woff2>; rel=preload; as="font"; crossorigin=""; type="font/woff2"',
+ Server: "Vercel",
+ "Set-Cookie":
+ "__Host-authjs.csrf-token=5dac3b94bba1f3cbefd8d50fb0fea119f159004d32847669434c86a5d8d54b15%7C1c00c016c8ba9f442c0c7aa616706c3f8b162c82d1f715aa49a51699637b7208; Path=/; HttpOnly; Secure; SameSite=Lax",
+ "Strict-Transport-Security": "max-age=63072000",
+ Vary: "RSC, Next-Router-State-Tree, Next-Router-Prefetch",
+ "X-Matched-Path": "/",
+ "X-Powered-By": "Next.js",
+ "X-Vercel-Cache": "MISS",
+ "X-Vercel-Execution-Region": "fra1",
+ "X-Vercel-Id": "cdg1::fra1::g7g65-1724415467776-ef2e03e01f49",
+ },
+ time: 1724415467743,
+ timing: {
+ dnsStart: 1724415467766,
+ dnsDone: 1724415467769,
+ connectStart: 1724415467769,
+ connectDone: 1724415467770,
+ tlsHandshakeStart: 1724415467770,
+ tlsHandshakeDone: 1724415467775,
+ firstByteStart: 1724415467775,
+ firstByteDone: 1724415468555,
+ transferStart: 1724415468555,
+ transferDone: 1724415468555,
+ },
+ region: "cdg",
+ },
+ {
+ status: 200,
+ latency: 1081,
+ headers: {
+ Age: "0",
+ "Cache-Control":
+ "private, no-cache, no-store, max-age=0, must-revalidate",
+ "Content-Type": "text/html; charset=utf-8",
+ Date: "Fri, 23 Aug 2024 12:17:48 GMT",
+ Link: '</_next/static/media/162bf645eb375add-s.p.ttf>; rel=preload; as="font"; crossorigin=""; type="font/ttf", </_next/static/media/a34f9d1faa5f3315-s.p.woff2>; rel=preload; as="font"; crossorigin=""; type="font/woff2"',
+ Server: "Vercel",
+ "Set-Cookie":
+ "__Host-authjs.csrf-token=58ff47d67b2d21ac08cb6c1d3b20eb12e29dd53aaa2051d90c6f364ab5e0d544%7C46683fe543ad2887543880291cd12267eeb2d82b956d3c59ff01e324fe846fd5; Path=/; HttpOnly; Secure; SameSite=Lax",
+ "Strict-Transport-Security": "max-age=63072000",
+ Vary: "RSC, Next-Router-State-Tree, Next-Router-Prefetch",
+ "X-Matched-Path": "/",
+ "X-Powered-By": "Next.js",
+ "X-Vercel-Cache": "MISS",
+ "X-Vercel-Execution-Region": "fra1",
+ "X-Vercel-Id": "sfo1::fra1::k8shj-1724415468145-cc12e589b9ec",
+ },
+ time: 1724415467973,
+ timing: {
+ dnsStart: 1724415468074,
+ dnsDone: 1724415468075,
+ connectStart: 1724415468075,
+ connectDone: 1724415468075,
+ tlsHandshakeStart: 1724415468075,
+ tlsHandshakeDone: 1724415468132,
+ firstByteStart: 1724415468133,
+ firstByteDone: 1724415469055,
+ transferStart: 1724415469055,
+ transferDone: 1724415469055,
+ },
+ region: "den",
+ },
+ {
+ status: 200,
+ latency: 1329,
+ headers: {
+ Age: "0",
+ "Cache-Control":
+ "private, no-cache, no-store, max-age=0, must-revalidate",
+ "Content-Type": "text/html; charset=utf-8",
+ Date: "Fri, 23 Aug 2024 12:17:49 GMT",
+ Link: '</_next/static/media/162bf645eb375add-s.p.ttf>; rel=preload; as="font"; crossorigin=""; type="font/ttf", </_next/static/media/a34f9d1faa5f3315-s.p.woff2>; rel=preload; as="font"; crossorigin=""; type="font/woff2"',
+ Server: "Vercel",
+ "Set-Cookie":
+ "__Host-authjs.csrf-token=76ffd678bc935c42a7dbca29fd4f0ba40698fa20d2554b224a581fa7f0f09853%7C44a90f79d338272da4630c8275f8c3b5571b5f8fb39de169ab11e25632d2c144; Path=/; HttpOnly; Secure; SameSite=Lax",
+ "Strict-Transport-Security": "max-age=63072000",
+ Vary: "RSC, Next-Router-State-Tree, Next-Router-Prefetch",
+ "X-Matched-Path": "/",
+ "X-Powered-By": "Next.js",
+ "X-Vercel-Cache": "MISS",
+ "X-Vercel-Execution-Region": "fra1",
+ "X-Vercel-Id": "cle1::fra1::sxq92-1724415468662-2cd7c277d058",
+ },
+ time: 1724415468380,
+ timing: {
+ dnsStart: 1724415468552,
+ dnsDone: 1724415468554,
+ connectStart: 1724415468554,
+ connectDone: 1724415468554,
+ tlsHandshakeStart: 1724415468554,
+ tlsHandshakeDone: 1724415468641,
+ firstByteStart: 1724415468641,
+ firstByteDone: 1724415469710,
+ transferStart: 1724415469710,
+ transferDone: 1724415469710,
+ },
+ region: "dfw",
+ },
+ {
+ status: 200,
+ latency: 380,
+ headers: {
+ Age: "0",
+ "Cache-Control":
+ "private, no-cache, no-store, max-age=0, must-revalidate",
+ "Content-Type": "text/html; charset=utf-8",
+ Date: "Fri, 23 Aug 2024 12:17:48 GMT",
+ Link: '</_next/static/media/162bf645eb375add-s.p.ttf>; rel=preload; as="font"; crossorigin=""; type="font/ttf", </_next/static/media/a34f9d1faa5f3315-s.p.woff2>; rel=preload; as="font"; crossorigin=""; type="font/woff2"',
+ Server: "Vercel",
+ "Set-Cookie":
+ "__Host-authjs.csrf-token=195d8721e93ff6a135dc1a2bf7c4c7b76961ddd3662e56815c7ec6a3ce1abd3d%7C2993b6c22635423908d6f2ec1a1aaced8ed391d05fc3125f31dac992d7428197; Path=/; HttpOnly; Secure; SameSite=Lax",
+ "Strict-Transport-Security": "max-age=63072000",
+ Vary: "RSC, Next-Router-State-Tree, Next-Router-Prefetch",
+ "X-Matched-Path": "/",
+ "X-Powered-By": "Next.js",
+ "X-Vercel-Cache": "MISS",
+ "X-Vercel-Execution-Region": "fra1",
+ "X-Vercel-Id": "iad1::fra1::8dpsb-1724415468744-2a4aa1e3d5ab",
+ },
+ time: 1724415468672,
+ timing: {
+ dnsStart: 1724415468716,
+ dnsDone: 1724415468721,
+ connectStart: 1724415468721,
+ connectDone: 1724415468722,
+ tlsHandshakeStart: 1724415468722,
+ tlsHandshakeDone: 1724415468740,
+ firstByteStart: 1724415468740,
+ firstByteDone: 1724415469052,
+ transferStart: 1724415469052,
+ transferDone: 1724415469052,
+ },
+ region: "ewr",
+ },
+ {
+ status: 200,
+ latency: 802,
+ headers: {
+ Age: "0",
+ "Cache-Control":
+ "private, no-cache, no-store, max-age=0, must-revalidate",
+ "Content-Type": "text/html; charset=utf-8",
+ Date: "Fri, 23 Aug 2024 12:17:49 GMT",
+ Link: '</_next/static/media/162bf645eb375add-s.p.ttf>; rel=preload; as="font"; crossorigin=""; type="font/ttf", </_next/static/media/a34f9d1faa5f3315-s.p.woff2>; rel=preload; as="font"; crossorigin=""; type="font/woff2"',
+ Server: "Vercel",
+ "Set-Cookie":
+ "__Host-authjs.csrf-token=4c6a43acbb9675aa48a54684ba789486dcdd8551b3cce40cc3089646627b9226%7C1ed25c2ef54680a28c75592c15f459c2b48bf294ec578191f9c1047a3b8ffe79; Path=/; HttpOnly; Secure; SameSite=Lax",
+ "Strict-Transport-Security": "max-age=63072000",
+ Vary: "RSC, Next-Router-State-Tree, Next-Router-Prefetch",
+ "X-Matched-Path": "/",
+ "X-Powered-By": "Next.js",
+ "X-Vercel-Cache": "MISS",
+ "X-Vercel-Execution-Region": "fra1",
+ "X-Vercel-Id": "gru1::fra1::g8pl7-1724415469119-c65e63554739",
+ },
+ time: 1724415468749,
+ timing: {
+ dnsStart: 1724415468984,
+ dnsDone: 1724415469043,
+ connectStart: 1724415469043,
+ connectDone: 1724415469043,
+ tlsHandshakeStart: 1724415469043,
+ tlsHandshakeDone: 1724415469103,
+ firstByteStart: 1724415469104,
+ firstByteDone: 1724415469552,
+ transferStart: 1724415469552,
+ transferDone: 1724415469552,
+ },
+ region: "eze",
+ },
+ {
+ status: 200,
+ latency: 615,
+ headers: {
+ Age: "0",
+ "Cache-Control":
+ "private, no-cache, no-store, max-age=0, must-revalidate",
+ "Content-Type": "text/html; charset=utf-8",
+ Date: "Fri, 23 Aug 2024 12:17:49 GMT",
+ Link: '</_next/static/media/162bf645eb375add-s.p.ttf>; rel=preload; as="font"; crossorigin=""; type="font/ttf", </_next/static/media/a34f9d1faa5f3315-s.p.woff2>; rel=preload; as="font"; crossorigin=""; type="font/woff2"',
+ Server: "Vercel",
+ "Set-Cookie":
+ "__Host-authjs.csrf-token=1cc1e9eb9bdc56c9b698df0afc275633753d12d06f312e353cc34f7a84531412%7Ce2e75b4bfba94809563f68e206c52f0389ac93aa31094b5b4db3771fd5c41781; Path=/; HttpOnly; Secure; SameSite=Lax",
+ "Strict-Transport-Security": "max-age=63072000",
+ Vary: "RSC, Next-Router-State-Tree, Next-Router-Prefetch",
+ "X-Matched-Path": "/",
+ "X-Powered-By": "Next.js",
+ "X-Vercel-Cache": "MISS",
+ "X-Vercel-Id": "fra1::fra1::kv28h-1724415468785-c9192137c9ed",
+ },
+ time: 1724415468739,
+ timing: {
+ dnsStart: 1724415468775,
+ dnsDone: 1724415468779,
+ connectStart: 1724415468779,
+ connectDone: 1724415468782,
+ tlsHandshakeStart: 1724415468782,
+ tlsHandshakeDone: 1724415468789,
+ firstByteStart: 1724415468789,
+ firstByteDone: 1724415469354,
+ transferStart: 1724415469354,
+ transferDone: 1724415469354,
+ },
+ region: "fra",
+ },
+ {
+ status: 200,
+ latency: 1481,
+ headers: {
+ Age: "0",
+ "Cache-Control":
+ "private, no-cache, no-store, max-age=0, must-revalidate",
+ "Content-Type": "text/html; charset=utf-8",
+ Date: "Fri, 23 Aug 2024 12:17:50 GMT",
+ Link: '</_next/static/media/162bf645eb375add-s.p.ttf>; rel=preload; as="font"; crossorigin=""; type="font/ttf", </_next/static/media/a34f9d1faa5f3315-s.p.woff2>; rel=preload; as="font"; crossorigin=""; type="font/woff2"',
+ Server: "Vercel",
+ "Set-Cookie":
+ "__Host-authjs.csrf-token=938d20933200b21638ed84e60832085dc135e3193a233720de87b0e41a24e2fd%7Cfcd423e5d8e965dc0e23728cf52a6f3e531cfe5a007942f6cb0a57fc90ac2bd8; Path=/; HttpOnly; Secure; SameSite=Lax",
+ "Strict-Transport-Security": "max-age=63072000",
+ Vary: "RSC, Next-Router-State-Tree, Next-Router-Prefetch",
+ "X-Matched-Path": "/",
+ "X-Powered-By": "Next.js",
+ "X-Vercel-Cache": "MISS",
+ "X-Vercel-Execution-Region": "fra1",
+ "X-Vercel-Id": "sfo1::fra1::jn45p-1724415470146-7160122c2733",
+ },
+ time: 1724415469619,
+ timing: {
+ dnsStart: 1724415469889,
+ dnsDone: 1724415469947,
+ connectStart: 1724415469947,
+ connectDone: 1724415469953,
+ tlsHandshakeStart: 1724415469953,
+ tlsHandshakeDone: 1724415470104,
+ firstByteStart: 1724415470104,
+ firstByteDone: 1724415471100,
+ transferStart: 1724415471100,
+ transferDone: 1724415471100,
+ },
+ region: "gdl",
+ },
+ {
+ status: 200,
+ latency: 768,
+ headers: {
+ Age: "0",
+ "Cache-Control":
+ "private, no-cache, no-store, max-age=0, must-revalidate",
+ "Content-Type": "text/html; charset=utf-8",
+ Date: "Fri, 23 Aug 2024 12:17:50 GMT",
+ Link: '</_next/static/media/162bf645eb375add-s.p.ttf>; rel=preload; as="font"; crossorigin=""; type="font/ttf", </_next/static/media/a34f9d1faa5f3315-s.p.woff2>; rel=preload; as="font"; crossorigin=""; type="font/woff2"',
+ Server: "Vercel",
+ "Set-Cookie":
+ "__Host-authjs.csrf-token=05ef42987dc7df7b05cee0541b776c2cd51eba97ba713153f215e8550ae0448c%7C3c1a941480a5c26bc3e7434709576dacc81ea4f05359505eebd2d195e63aeb74; Path=/; HttpOnly; Secure; SameSite=Lax",
+ "Strict-Transport-Security": "max-age=63072000",
+ Vary: "RSC, Next-Router-State-Tree, Next-Router-Prefetch",
+ "X-Matched-Path": "/",
+ "X-Powered-By": "Next.js",
+ "X-Vercel-Cache": "MISS",
+ "X-Vercel-Execution-Region": "fra1",
+ "X-Vercel-Id": "gru1::fra1::df9rf-1724415469769-16109f11a918",
+ },
+ time: 1724415469592,
+ timing: {
+ dnsStart: 1724415469639,
+ dnsDone: 1724415469748,
+ connectStart: 1724415469748,
+ connectDone: 1724415469748,
+ tlsHandshakeStart: 1724415469748,
+ tlsHandshakeDone: 1724415469765,
+ firstByteStart: 1724415469765,
+ firstByteDone: 1724415470358,
+ transferStart: 1724415470358,
+ transferDone: 1724415470360,
+ },
+ region: "gig",
+ },
+ {
+ status: 200,
+ latency: 662,
+ headers: {
+ Age: "0",
+ "Cache-Control":
+ "private, no-cache, no-store, max-age=0, must-revalidate",
+ "Content-Type": "text/html; charset=utf-8",
+ Date: "Fri, 23 Aug 2024 12:17:50 GMT",
+ Link: '</_next/static/media/162bf645eb375add-s.p.ttf>; rel=preload; as="font"; crossorigin=""; type="font/ttf", </_next/static/media/a34f9d1faa5f3315-s.p.woff2>; rel=preload; as="font"; crossorigin=""; type="font/woff2"',
+ Server: "Vercel",
+ "Set-Cookie":
+ "__Host-authjs.csrf-token=79dbfc2a5ba28ebb28864cdeee17cbc42ce9901946370dec247bcdb0f363cd5e%7Ca332b8cc3c8a8713af109bdbc5b9ef831e6302f86a2455c662d84c74e62b09b8; Path=/; HttpOnly; Secure; SameSite=Lax",
+ "Strict-Transport-Security": "max-age=63072000",
+ Vary: "RSC, Next-Router-State-Tree, Next-Router-Prefetch",
+ "X-Matched-Path": "/",
+ "X-Powered-By": "Next.js",
+ "X-Vercel-Cache": "MISS",
+ "X-Vercel-Execution-Region": "fra1",
+ "X-Vercel-Id": "gru1::fra1::ps6s8-1724415469878-6e2b2b9481e6",
+ },
+ time: 1724415469642,
+ timing: {
+ dnsStart: 1724415469762,
+ dnsDone: 1724415469871,
+ connectStart: 1724415469871,
+ connectDone: 1724415469872,
+ tlsHandshakeStart: 1724415469872,
+ tlsHandshakeDone: 1724415469877,
+ firstByteStart: 1724415469877,
+ firstByteDone: 1724415470304,
+ transferStart: 1724415470304,
+ transferDone: 1724415470304,
+ },
+ region: "gru",
+ },
+ {
+ status: 200,
+ latency: 1543,
+ headers: {
+ Age: "0",
+ "Cache-Control":
+ "private, no-cache, no-store, max-age=0, must-revalidate",
+ "Content-Type": "text/html; charset=utf-8",
+ Date: "Fri, 23 Aug 2024 12:17:51 GMT",
+ Link: '</_next/static/media/162bf645eb375add-s.p.ttf>; rel=preload; as="font"; crossorigin=""; type="font/ttf", </_next/static/media/a34f9d1faa5f3315-s.p.woff2>; rel=preload; as="font"; crossorigin=""; type="font/woff2"',
+ Server: "Vercel",
+ "Set-Cookie":
+ "__Host-authjs.csrf-token=f0b519b719c63760474410a3ae680668fbc06da25fddab90c3e5fb04e3dd5320%7C630e28ddd164b4c4107414be9daca7a65cee210ca88c355366ef7855a63efb0f; Path=/; HttpOnly; Secure; SameSite=Lax",
+ "Strict-Transport-Security": "max-age=63072000",
+ Vary: "RSC, Next-Router-State-Tree, Next-Router-Prefetch",
+ "X-Matched-Path": "/",
+ "X-Powered-By": "Next.js",
+ "X-Vercel-Cache": "MISS",
+ "X-Vercel-Execution-Region": "fra1",
+ "X-Vercel-Id": "hkg1::fra1::fxvwk-1724415469898-52ddb6281608",
+ },
+ time: 1724415469801,
+ timing: {
+ dnsStart: 1724415469859,
+ dnsDone: 1724415469892,
+ connectStart: 1724415469892,
+ connectDone: 1724415469893,
+ tlsHandshakeStart: 1724415469893,
+ tlsHandshakeDone: 1724415469898,
+ firstByteStart: 1724415469898,
+ firstByteDone: 1724415471344,
+ transferStart: 1724415471344,
+ transferDone: 1724415471344,
+ },
+ region: "hkg",
+ },
+ {
+ status: 200,
+ latency: 369,
+ headers: {
+ Age: "0",
+ "Cache-Control":
+ "private, no-cache, no-store, max-age=0, must-revalidate",
+ "Content-Type": "text/html; charset=utf-8",
+ Date: "Fri, 23 Aug 2024 12:17:50 GMT",
+ Link: '</_next/static/media/162bf645eb375add-s.p.ttf>; rel=preload; as="font"; crossorigin=""; type="font/ttf", </_next/static/media/a34f9d1faa5f3315-s.p.woff2>; rel=preload; as="font"; crossorigin=""; type="font/woff2"',
+ Server: "Vercel",
+ "Set-Cookie":
+ "__Host-authjs.csrf-token=e40f4b2e630f81375e79b742870729b7e008bf85b4523cd8c8b83a39fd31bb9f%7Ca062303e57c49fefa52f5bb256282d5b257bc8c98e8b34a1ededddfe77215003; Path=/; HttpOnly; Secure; SameSite=Lax",
+ "Strict-Transport-Security": "max-age=63072000",
+ Vary: "RSC, Next-Router-State-Tree, Next-Router-Prefetch",
+ "X-Matched-Path": "/",
+ "X-Powered-By": "Next.js",
+ "X-Vercel-Cache": "MISS",
+ "X-Vercel-Execution-Region": "fra1",
+ "X-Vercel-Id": "iad1::fra1::lpxzz-1724415470208-6564146436d5",
+ },
+ time: 1724415470173,
+ timing: {
+ dnsStart: 1724415470193,
+ dnsDone: 1724415470196,
+ connectStart: 1724415470196,
+ connectDone: 1724415470198,
+ tlsHandshakeStart: 1724415470198,
+ tlsHandshakeDone: 1724415470206,
+ firstByteStart: 1724415470206,
+ firstByteDone: 1724415470542,
+ transferStart: 1724415470542,
+ transferDone: 1724415470542,
+ },
+ region: "iad",
+ },
+ {
+ status: 200,
+ latency: 1264,
+ headers: {
+ Age: "0",
+ "Cache-Control":
+ "private, no-cache, no-store, max-age=0, must-revalidate",
+ "Content-Type": "text/html; charset=utf-8",
+ Date: "Fri, 23 Aug 2024 12:17:51 GMT",
+ Link: '</_next/static/media/162bf645eb375add-s.p.ttf>; rel=preload; as="font"; crossorigin=""; type="font/ttf", </_next/static/media/a34f9d1faa5f3315-s.p.woff2>; rel=preload; as="font"; crossorigin=""; type="font/woff2"',
+ Server: "Vercel",
+ "Set-Cookie":
+ "__Host-authjs.csrf-token=d4ad7992b9fd60115ddc589306804e8cd65d569d6afd66f95eec72045a0c74ed%7C0dcddba799b4a2e429448cea0f347886e730f2905e8a464d332889cf0dd2afc2; Path=/; HttpOnly; Secure; SameSite=Lax",
+ "Strict-Transport-Security": "max-age=63072000",
+ Vary: "RSC, Next-Router-State-Tree, Next-Router-Prefetch",
+ "X-Matched-Path": "/",
+ "X-Powered-By": "Next.js",
+ "X-Vercel-Cache": "MISS",
+ "X-Vercel-Execution-Region": "fra1",
+ "X-Vercel-Id": "cpt1::fra1::lnlth-1724415471275-cf922a128799",
+ },
+ time: 1724415470963,
+ timing: {
+ dnsStart: 1724415471216,
+ dnsDone: 1724415471218,
+ connectStart: 1724415471218,
+ connectDone: 1724415471218,
+ tlsHandshakeStart: 1724415471218,
+ tlsHandshakeDone: 1724415471262,
+ firstByteStart: 1724415471262,
+ firstByteDone: 1724415472228,
+ transferStart: 1724415472228,
+ transferDone: 1724415472228,
+ },
+ region: "jnb",
+ },
+ {
+ status: 200,
+ latency: 642,
+ headers: {
+ Age: "0",
+ "Cache-Control":
+ "private, no-cache, no-store, max-age=0, must-revalidate",
+ "Content-Type": "text/html; charset=utf-8",
+ Date: "Fri, 23 Aug 2024 12:17:51 GMT",
+ Link: '</_next/static/media/162bf645eb375add-s.p.ttf>; rel=preload; as="font"; crossorigin=""; type="font/ttf", </_next/static/media/a34f9d1faa5f3315-s.p.woff2>; rel=preload; as="font"; crossorigin=""; type="font/woff2"',
+ Server: "Vercel",
+ "Set-Cookie":
+ "__Host-authjs.csrf-token=7c255e198252b31b58e293332d0cea5198cd5d92acf2a3745214680530a48bae%7C15bfe39b4d88d60cb55d7e7e34ccff17ccb7bbe9a5c76200584c510cfd310586; Path=/; HttpOnly; Secure; SameSite=Lax",
+ "Strict-Transport-Security": "max-age=63072000",
+ Vary: "RSC, Next-Router-State-Tree, Next-Router-Prefetch",
+ "X-Matched-Path": "/",
+ "X-Powered-By": "Next.js",
+ "X-Vercel-Cache": "MISS",
+ "X-Vercel-Execution-Region": "fra1",
+ "X-Vercel-Id": "sfo1::fra1::tpm8t-1724415471358-ec064b0eab3d",
+ },
+ time: 1724415471269,
+ timing: {
+ dnsStart: 1724415471325,
+ dnsDone: 1724415471327,
+ connectStart: 1724415471327,
+ connectDone: 1724415471328,
+ tlsHandshakeStart: 1724415471328,
+ tlsHandshakeDone: 1724415471352,
+ firstByteStart: 1724415471352,
+ firstByteDone: 1724415471912,
+ transferStart: 1724415471912,
+ transferDone: 1724415471912,
+ },
+ region: "lax",
+ },
+ {
+ status: 200,
+ latency: 627,
+ headers: {
+ Age: "0",
+ "Cache-Control":
+ "private, no-cache, no-store, max-age=0, must-revalidate",
+ "Content-Type": "text/html; charset=utf-8",
+ Date: "Fri, 23 Aug 2024 12:17:51 GMT",
+ Link: '</_next/static/media/162bf645eb375add-s.p.ttf>; rel=preload; as="font"; crossorigin=""; type="font/ttf", </_next/static/media/a34f9d1faa5f3315-s.p.woff2>; rel=preload; as="font"; crossorigin=""; type="font/woff2"',
+ Server: "Vercel",
+ "Set-Cookie":
+ "__Host-authjs.csrf-token=399ab06338d52f31d31203af84d5f3657e380eb9317fd1a71bfd41d77abe27bb%7Cae0a0909fe500b07deb5867b0336f0176a501bb34460de004432aa7c3ccd1de2; Path=/; HttpOnly; Secure; SameSite=Lax",
+ "Strict-Transport-Security": "max-age=63072000",
+ Vary: "RSC, Next-Router-State-Tree, Next-Router-Prefetch",
+ "X-Matched-Path": "/",
+ "X-Powered-By": "Next.js",
+ "X-Vercel-Cache": "MISS",
+ "X-Vercel-Execution-Region": "fra1",
+ "X-Vercel-Id": "lhr1::fra1::7lf7n-1724415471374-7ef5cab51600",
+ },
+ time: 1724415471324,
+ timing: {
+ dnsStart: 1724415471360,
+ dnsDone: 1724415471366,
+ connectStart: 1724415471366,
+ connectDone: 1724415471368,
+ tlsHandshakeStart: 1724415471368,
+ tlsHandshakeDone: 1724415471373,
+ firstByteStart: 1724415471373,
+ firstByteDone: 1724415471952,
+ transferStart: 1724415471952,
+ transferDone: 1724415471952,
+ },
+ region: "lhr",
+ },
+ {
+ status: 200,
+ latency: 951,
+ headers: {
+ Age: "0",
+ "Cache-Control":
+ "private, no-cache, no-store, max-age=0, must-revalidate",
+ "Content-Type": "text/html; charset=utf-8",
+ Date: "Fri, 23 Aug 2024 12:17:52 GMT",
+ Link: '</_next/static/media/162bf645eb375add-s.p.ttf>; rel=preload; as="font"; crossorigin=""; type="font/ttf", </_next/static/media/a34f9d1faa5f3315-s.p.woff2>; rel=preload; as="font"; crossorigin=""; type="font/woff2"',
+ Server: "Vercel",
+ "Set-Cookie":
+ "__Host-authjs.csrf-token=d3c263dfb22b4a07fb9fde65227c2d3b97d969874b6c7a394a73a543c35d9364%7Cdea8ecc64ee8311f4a7904b6fea3aefeca1250b9c1ee9b3ae7efd23d9938d5bb; Path=/; HttpOnly; Secure; SameSite=Lax",
+ "Strict-Transport-Security": "max-age=63072000",
+ Vary: "RSC, Next-Router-State-Tree, Next-Router-Prefetch",
+ "X-Matched-Path": "/",
+ "X-Powered-By": "Next.js",
+ "X-Vercel-Cache": "MISS",
+ "X-Vercel-Execution-Region": "fra1",
+ "X-Vercel-Id": "cdg1::fra1::jszwl-1724415471627-5821aab52b06",
+ },
+ time: 1724415471373,
+ timing: {
+ dnsStart: 1724415471554,
+ dnsDone: 1724415471556,
+ connectStart: 1724415471556,
+ connectDone: 1724415471571,
+ tlsHandshakeStart: 1724415471571,
+ tlsHandshakeDone: 1724415471613,
+ firstByteStart: 1724415471613,
+ firstByteDone: 1724415472324,
+ transferStart: 1724415472324,
+ transferDone: 1724415472324,
+ },
+ region: "mad",
+ },
+ {
+ status: 200,
+ latency: 808,
+ headers: {
+ Age: "0",
+ "Cache-Control":
+ "private, no-cache, no-store, max-age=0, must-revalidate",
+ "Content-Type": "text/html; charset=utf-8",
+ Date: "Fri, 23 Aug 2024 12:17:52 GMT",
+ Link: '</_next/static/media/162bf645eb375add-s.p.ttf>; rel=preload; as="font"; crossorigin=""; type="font/ttf", </_next/static/media/a34f9d1faa5f3315-s.p.woff2>; rel=preload; as="font"; crossorigin=""; type="font/woff2"',
+ Server: "Vercel",
+ "Set-Cookie":
+ "__Host-authjs.csrf-token=6b10a5354dfa3d39ee556f78017e896e0bde4abe9e9583693044bf81f9af32ee%7Cea36450ea545200dc9a035d5b4c6ca6c8df7e88b1a4c71c97a9c9313ca39aebf; Path=/; HttpOnly; Secure; SameSite=Lax",
+ "Strict-Transport-Security": "max-age=63072000",
+ Vary: "RSC, Next-Router-State-Tree, Next-Router-Prefetch",
+ "X-Matched-Path": "/",
+ "X-Powered-By": "Next.js",
+ "X-Vercel-Cache": "MISS",
+ "X-Vercel-Execution-Region": "fra1",
+ "X-Vercel-Id": "iad1::fra1::jscbc-1724415472309-b6db76af787c",
+ },
+ time: 1724415472154,
+ timing: {
+ dnsStart: 1724415472239,
+ dnsDone: 1724415472240,
+ connectStart: 1724415472240,
+ connectDone: 1724415472266,
+ tlsHandshakeStart: 1724415472266,
+ tlsHandshakeDone: 1724415472296,
+ firstByteStart: 1724415472296,
+ firstByteDone: 1724415472963,
+ transferStart: 1724415472963,
+ transferDone: 1724415472963,
+ },
+ region: "mia",
+ },
+ {
+ status: 200,
+ latency: 1301,
+ headers: {
+ Age: "0",
+ "Cache-Control":
+ "private, no-cache, no-store, max-age=0, must-revalidate",
+ "Content-Type": "text/html; charset=utf-8",
+ Date: "Fri, 23 Aug 2024 12:17:53 GMT",
+ Link: '</_next/static/media/162bf645eb375add-s.p.ttf>; rel=preload; as="font"; crossorigin=""; type="font/ttf", </_next/static/media/a34f9d1faa5f3315-s.p.woff2>; rel=preload; as="font"; crossorigin=""; type="font/woff2"',
+ Server: "Vercel",
+ "Set-Cookie":
+ "__Host-authjs.csrf-token=3414880cc0d90ac4a648e9e8a1aad136d3db41001cfcb8fda20129777cae0449%7Cf971b35cc728fe0fc205ef61ca344be04e81e52e0b92067745fdd3b520a481cd; Path=/; HttpOnly; Secure; SameSite=Lax",
+ "Strict-Transport-Security": "max-age=63072000",
+ Vary: "RSC, Next-Router-State-Tree, Next-Router-Prefetch",
+ "X-Matched-Path": "/",
+ "X-Powered-By": "Next.js",
+ "X-Vercel-Cache": "MISS",
+ "X-Vercel-Execution-Region": "fra1",
+ "X-Vercel-Id": "hnd1::fra1::kxkwr-1724415472423-82ba874bb590",
+ },
+ time: 1724415472357,
+ timing: {
+ dnsStart: 1724415472405,
+ dnsDone: 1724415472410,
+ connectStart: 1724415472410,
+ connectDone: 1724415472412,
+ tlsHandshakeStart: 1724415472412,
+ tlsHandshakeDone: 1724415472420,
+ firstByteStart: 1724415472421,
+ firstByteDone: 1724415473658,
+ transferStart: 1724415473658,
+ transferDone: 1724415473658,
+ },
+ region: "nrt",
+ },
+ {
+ status: 200,
+ latency: 1079,
+ headers: {
+ Age: "0",
+ "Cache-Control":
+ "private, no-cache, no-store, max-age=0, must-revalidate",
+ "Content-Type": "text/html; charset=utf-8",
+ Date: "Fri, 23 Aug 2024 12:17:53 GMT",
+ Link: '</_next/static/media/162bf645eb375add-s.p.ttf>; rel=preload; as="font"; crossorigin=""; type="font/ttf", </_next/static/media/a34f9d1faa5f3315-s.p.woff2>; rel=preload; as="font"; crossorigin=""; type="font/woff2"',
+ Server: "Vercel",
+ "Set-Cookie":
+ "__Host-authjs.csrf-token=b840e2646e8198e2c657d1002914c88d6c5b93189b34ed82855975164b9675ac%7Cf35eda6a163c51d096d35e6c520d663115bfaa195889068885e68bd38b9f8ac7; Path=/; HttpOnly; Secure; SameSite=Lax",
+ "Strict-Transport-Security": "max-age=63072000",
+ Vary: "RSC, Next-Router-State-Tree, Next-Router-Prefetch",
+ "X-Matched-Path": "/",
+ "X-Powered-By": "Next.js",
+ "X-Vercel-Cache": "MISS",
+ "X-Vercel-Execution-Region": "fra1",
+ "X-Vercel-Id": "cle1::fra1::8zclb-1724415472414-c402d33465fc",
+ },
+ time: 1724415472323,
+ timing: {
+ dnsStart: 1724415472378,
+ dnsDone: 1724415472380,
+ connectStart: 1724415472380,
+ connectDone: 1724415472382,
+ tlsHandshakeStart: 1724415472382,
+ tlsHandshakeDone: 1724415472408,
+ firstByteStart: 1724415472408,
+ firstByteDone: 1724415473402,
+ transferStart: 1724415473402,
+ transferDone: 1724415473402,
+ },
+ region: "ord",
+ },
+ {
+ status: 200,
+ latency: 1349,
+ headers: {
+ Age: "0",
+ "Cache-Control":
+ "private, no-cache, no-store, max-age=0, must-revalidate",
+ "Content-Type": "text/html; charset=utf-8",
+ Date: "Fri, 23 Aug 2024 12:17:53 GMT",
+ Link: '</_next/static/media/162bf645eb375add-s.p.ttf>; rel=preload; as="font"; crossorigin=""; type="font/ttf", </_next/static/media/a34f9d1faa5f3315-s.p.woff2>; rel=preload; as="font"; crossorigin=""; type="font/woff2"',
+ Server: "Vercel",
+ "Set-Cookie":
+ "__Host-authjs.csrf-token=637d460fe50112a95818857adbea59b9cf1f184f57d90001eaefc2e3b613ad61%7Cfa046a39b9170382ba0a848d9ea21ad86f035d0ff11f677cf7cac182d2a8a744; Path=/; HttpOnly; Secure; SameSite=Lax",
+ "Strict-Transport-Security": "max-age=63072000",
+ Vary: "RSC, Next-Router-State-Tree, Next-Router-Prefetch",
+ "X-Matched-Path": "/",
+ "X-Powered-By": "Next.js",
+ "X-Vercel-Cache": "MISS",
+ "X-Vercel-Id": "fra1::fra1::tjkng-1724415472738-a6c3d672835c",
+ },
+ time: 1724415472487,
+ timing: {
+ dnsStart: 1724415472627,
+ dnsDone: 1724415472658,
+ connectStart: 1724415472658,
+ connectDone: 1724415472676,
+ tlsHandshakeStart: 1724415472676,
+ tlsHandshakeDone: 1724415472723,
+ firstByteStart: 1724415472723,
+ firstByteDone: 1724415473837,
+ transferStart: 1724415473837,
+ transferDone: 1724415473837,
+ },
+ region: "otp",
+ },
+ {
+ status: 200,
+ latency: 970,
+ headers: {
+ Age: "0",
+ "Cache-Control":
+ "private, no-cache, no-store, max-age=0, must-revalidate",
+ "Content-Type": "text/html; charset=utf-8",
+ Date: "Fri, 23 Aug 2024 12:17:53 GMT",
+ Link: '</_next/static/media/162bf645eb375add-s.p.ttf>; rel=preload; as="font"; crossorigin=""; type="font/ttf", </_next/static/media/a34f9d1faa5f3315-s.p.woff2>; rel=preload; as="font"; crossorigin=""; type="font/woff2"',
+ Server: "Vercel",
+ "Set-Cookie":
+ "__Host-authjs.csrf-token=d9b23db6a8a5c5d9cfee5f1803059ee708aca2e2bd43c9b59854ba3899acd6f0%7Cac93af4a4b2944ebd4bbdadbed95d64726f7e841c6ce75ba3d73d40516e1652b; Path=/; HttpOnly; Secure; SameSite=Lax",
+ "Strict-Transport-Security": "max-age=63072000",
+ Vary: "RSC, Next-Router-State-Tree, Next-Router-Prefetch",
+ "X-Matched-Path": "/",
+ "X-Powered-By": "Next.js",
+ "X-Vercel-Cache": "MISS",
+ "X-Vercel-Execution-Region": "fra1",
+ "X-Vercel-Id": "sfo1::fra1::jn45p-1724415473337-466a2679cdf6",
+ },
+ time: 1724415472895,
+ timing: {
+ dnsStart: 1724415473151,
+ dnsDone: 1724415473169,
+ connectStart: 1724415473169,
+ connectDone: 1724415473212,
+ tlsHandshakeStart: 1724415473212,
+ tlsHandshakeDone: 1724415473311,
+ firstByteStart: 1724415473311,
+ firstByteDone: 1724415473865,
+ transferStart: 1724415473865,
+ transferDone: 1724415473865,
+ },
+ region: "phx",
+ },
+ {
+ status: 200,
+ latency: 1539,
+ headers: {
+ Age: "0",
+ "Cache-Control":
+ "private, no-cache, no-store, max-age=0, must-revalidate",
+ "Content-Type": "text/html; charset=utf-8",
+ Date: "Fri, 23 Aug 2024 12:17:55 GMT",
+ Link: '</_next/static/media/162bf645eb375add-s.p.ttf>; rel=preload; as="font"; crossorigin=""; type="font/ttf", </_next/static/media/a34f9d1faa5f3315-s.p.woff2>; rel=preload; as="font"; crossorigin=""; type="font/woff2"',
+ Server: "Vercel",
+ "Set-Cookie":
+ "__Host-authjs.csrf-token=6c483b6918c385243a810bdfad2268d79f7a5501a45b2f12d5b073c10c1ebd96%7C56115dbd9537df4a9579c3bcb15ace5ea2265f679eac9f8ea1d0e850bf618f41; Path=/; HttpOnly; Secure; SameSite=Lax",
+ "Strict-Transport-Security": "max-age=63072000",
+ Vary: "RSC, Next-Router-State-Tree, Next-Router-Prefetch",
+ "X-Matched-Path": "/",
+ "X-Powered-By": "Next.js",
+ "X-Vercel-Cache": "MISS",
+ "X-Vercel-Execution-Region": "fra1",
+ "X-Vercel-Id": "sfo1::fra1::cfhm9-1724415474388-d835d118b121",
+ },
+ time: 1724415473741,
+ timing: {
+ dnsStart: 1724415474074,
+ dnsDone: 1724415474203,
+ connectStart: 1724415474203,
+ connectDone: 1724415474204,
+ tlsHandshakeStart: 1724415474204,
+ tlsHandshakeDone: 1724415474350,
+ firstByteStart: 1724415474350,
+ firstByteDone: 1724415475280,
+ transferStart: 1724415475280,
+ transferDone: 1724415475280,
+ },
+ region: "qro",
+ },
+ {
+ status: 200,
+ latency: 1347,
+ headers: {
+ Age: "0",
+ "Cache-Control":
+ "private, no-cache, no-store, max-age=0, must-revalidate",
+ "Content-Type": "text/html; charset=utf-8",
+ Date: "Fri, 23 Aug 2024 12:17:55 GMT",
+ Link: '</_next/static/media/162bf645eb375add-s.p.ttf>; rel=preload; as="font"; crossorigin=""; type="font/ttf", </_next/static/media/a34f9d1faa5f3315-s.p.woff2>; rel=preload; as="font"; crossorigin=""; type="font/woff2"',
+ Server: "Vercel",
+ "Set-Cookie":
+ "__Host-authjs.csrf-token=06921285d96e59b991fb4e99210f3d65e85d8f56adb67d3e722598ef8766ce33%7Cc197f92fb2deac3a9cce800c50c2be456fdd3e076f8e2faecbbf72c4bdae4559; Path=/; HttpOnly; Secure; SameSite=Lax",
+ "Strict-Transport-Security": "max-age=63072000",
+ Vary: "RSC, Next-Router-State-Tree, Next-Router-Prefetch",
+ "X-Matched-Path": "/",
+ "X-Powered-By": "Next.js",
+ "X-Vercel-Cache": "MISS",
+ "X-Vercel-Execution-Region": "fra1",
+ "X-Vercel-Id": "gru1::fra1::dtczd-1724415474697-bc49fc211c26",
+ },
+ time: 1724415474183,
+ timing: {
+ dnsStart: 1724415474470,
+ dnsDone: 1724415474578,
+ connectStart: 1724415474578,
+ connectDone: 1724415474578,
+ tlsHandshakeStart: 1724415474578,
+ tlsHandshakeDone: 1724415474676,
+ firstByteStart: 1724415474676,
+ firstByteDone: 1724415475530,
+ transferStart: 1724415475530,
+ transferDone: 1724415475530,
+ },
+ region: "scl",
+ },
+ {
+ status: 200,
+ latency: 400,
+ headers: {
+ Age: "0",
+ "Cache-Control":
+ "private, no-cache, no-store, max-age=0, must-revalidate",
+ "Content-Type": "text/html; charset=utf-8",
+ Date: "Fri, 23 Aug 2024 12:17:54 GMT",
+ Link: '</_next/static/media/162bf645eb375add-s.p.ttf>; rel=preload; as="font"; crossorigin=""; type="font/ttf", </_next/static/media/a34f9d1faa5f3315-s.p.woff2>; rel=preload; as="font"; crossorigin=""; type="font/woff2"',
+ Server: "Vercel",
+ "Set-Cookie":
+ "__Host-authjs.csrf-token=810c745c559dd6cd590e3ecf94d45604336ef8be9ffea1cde0c53e48da57347d%7C561ec5a1fb89b523d861a3d0da4f095a50ad8386ac6a67c1325a0fee483467de; Path=/; HttpOnly; Secure; SameSite=Lax",
+ "Strict-Transport-Security": "max-age=63072000",
+ Vary: "RSC, Next-Router-State-Tree, Next-Router-Prefetch",
+ "X-Matched-Path": "/",
+ "X-Powered-By": "Next.js",
+ "X-Vercel-Cache": "MISS",
+ "X-Vercel-Execution-Region": "fra1",
+ "X-Vercel-Id": "sfo1::fra1::wwf2m-1724415474188-b0c6f71df2db",
+ },
+ time: 1724415474161,
+ timing: {
+ dnsStart: 1724415474177,
+ dnsDone: 1724415474180,
+ connectStart: 1724415474180,
+ connectDone: 1724415474180,
+ tlsHandshakeStart: 1724415474180,
+ tlsHandshakeDone: 1724415474187,
+ firstByteStart: 1724415474187,
+ firstByteDone: 1724415474561,
+ transferStart: 1724415474561,
+ transferDone: 1724415474562,
+ },
+ region: "sjc",
+ },
+ {
+ status: 200,
+ latency: 883,
+ headers: {
+ Age: "0",
+ "Cache-Control":
+ "private, no-cache, no-store, max-age=0, must-revalidate",
+ "Content-Type": "text/html; charset=utf-8",
+ Date: "Fri, 23 Aug 2024 12:17:55 GMT",
+ Link: '</_next/static/media/162bf645eb375add-s.p.ttf>; rel=preload; as="font"; crossorigin=""; type="font/ttf", </_next/static/media/a34f9d1faa5f3315-s.p.woff2>; rel=preload; as="font"; crossorigin=""; type="font/woff2"',
+ Server: "Vercel",
+ "Set-Cookie":
+ "__Host-authjs.csrf-token=401b5b1bf92e519ea7487cbc10260464ed784af62dd6469cca701013a256a801%7C2b2e8fd45b7c29091dfe92642ea51a4473ec6f06af28181ce374a1db856b5d38; Path=/; HttpOnly; Secure; SameSite=Lax",
+ "Strict-Transport-Security": "max-age=63072000",
+ Vary: "RSC, Next-Router-State-Tree, Next-Router-Prefetch",
+ "X-Matched-Path": "/",
+ "X-Powered-By": "Next.js",
+ "X-Vercel-Cache": "MISS",
+ "X-Vercel-Execution-Region": "fra1",
+ "X-Vercel-Id": "pdx1::fra1::fdxft-1724415474318-e900cbf850a7",
+ },
+ time: 1724415474239,
+ timing: {
+ dnsStart: 1724415474291,
+ dnsDone: 1724415474294,
+ connectStart: 1724415474294,
+ connectDone: 1724415474294,
+ tlsHandshakeStart: 1724415474294,
+ tlsHandshakeDone: 1724415474315,
+ firstByteStart: 1724415474315,
+ firstByteDone: 1724415475122,
+ transferStart: 1724415475122,
+ transferDone: 1724415475122,
+ },
+ region: "sea",
+ },
+ {
+ status: 200,
+ latency: 825,
+ headers: {
+ Age: "0",
+ "Cache-Control":
+ "private, no-cache, no-store, max-age=0, must-revalidate",
+ "Content-Type": "text/html; charset=utf-8",
+ Date: "Fri, 23 Aug 2024 12:17:55 GMT",
+ Link: '</_next/static/media/162bf645eb375add-s.p.ttf>; rel=preload; as="font"; crossorigin=""; type="font/ttf", </_next/static/media/a34f9d1faa5f3315-s.p.woff2>; rel=preload; as="font"; crossorigin=""; type="font/woff2"',
+ Server: "Vercel",
+ "Set-Cookie":
+ "__Host-authjs.csrf-token=7f7ea0f4e87ec4aa383bf93a55a06f51cc8f94c6b47f1dd7a4fa64ddd30f7224%7Cfe689d60c5036e0b56e410d2422c0f96dca2039184d3bbc41f8e910fd7824bbc; Path=/; HttpOnly; Secure; SameSite=Lax",
+ "Strict-Transport-Security": "max-age=63072000",
+ Vary: "RSC, Next-Router-State-Tree, Next-Router-Prefetch",
+ "X-Matched-Path": "/",
+ "X-Powered-By": "Next.js",
+ "X-Vercel-Cache": "MISS",
+ "X-Vercel-Execution-Region": "fra1",
+ "X-Vercel-Id": "sin1::fra1::b8msv-1724415474849-b7ad6db342b4",
+ },
+ time: 1724415474736,
+ timing: {
+ dnsStart: 1724415474838,
+ dnsDone: 1724415474840,
+ connectStart: 1724415474840,
+ connectDone: 1724415474841,
+ tlsHandshakeStart: 1724415474841,
+ tlsHandshakeDone: 1724415474848,
+ firstByteStart: 1724415474848,
+ firstByteDone: 1724415475561,
+ transferStart: 1724415475561,
+ transferDone: 1724415475561,
+ },
+ region: "sin",
+ },
+ {
+ status: 200,
+ latency: 526,
+ headers: {
+ Age: "0",
+ "Cache-Control":
+ "private, no-cache, no-store, max-age=0, must-revalidate",
+ "Content-Type": "text/html; charset=utf-8",
+ Date: "Fri, 23 Aug 2024 12:17:55 GMT",
+ Link: '</_next/static/media/162bf645eb375add-s.p.ttf>; rel=preload; as="font"; crossorigin=""; type="font/ttf", </_next/static/media/a34f9d1faa5f3315-s.p.woff2>; rel=preload; as="font"; crossorigin=""; type="font/woff2"',
+ Server: "Vercel",
+ "Set-Cookie":
+ "__Host-authjs.csrf-token=9fafdef83adf38bf4b48c801e2b1d5c2ce04858dcddbe69ca576e6d9945f2d9a%7Ced402758800ee1c6dee8fd49119ef549b0a4ecbbccd9f178c87ac32c26d29433; Path=/; HttpOnly; Secure; SameSite=Lax",
+ "Strict-Transport-Security": "max-age=63072000",
+ Vary: "RSC, Next-Router-State-Tree, Next-Router-Prefetch",
+ "X-Matched-Path": "/",
+ "X-Powered-By": "Next.js",
+ "X-Vercel-Cache": "MISS",
+ "X-Vercel-Execution-Region": "fra1",
+ "X-Vercel-Id": "syd1::fra1::p48zw-1724415475067-dce86bb55ee4",
+ },
+ time: 1724415475023,
+ timing: {
+ dnsStart: 1724415475058,
+ dnsDone: 1724415475059,
+ connectStart: 1724415475059,
+ connectDone: 1724415475060,
+ tlsHandshakeStart: 1724415475060,
+ tlsHandshakeDone: 1724415475065,
+ firstByteStart: 1724415475065,
+ firstByteDone: 1724415475549,
+ transferStart: 1724415475549,
+ transferDone: 1724415475549,
+ },
+ region: "syd",
+ },
+ {
+ status: 200,
+ latency: 869,
+ headers: {
+ Age: "0",
+ "Cache-Control":
+ "private, no-cache, no-store, max-age=0, must-revalidate",
+ "Content-Type": "text/html; charset=utf-8",
+ Date: "Fri, 23 Aug 2024 12:17:56 GMT",
+ Link: '</_next/static/media/162bf645eb375add-s.p.ttf>; rel=preload; as="font"; crossorigin=""; type="font/ttf", </_next/static/media/a34f9d1faa5f3315-s.p.woff2>; rel=preload; as="font"; crossorigin=""; type="font/woff2"',
+ Server: "Vercel",
+ "Set-Cookie":
+ "__Host-authjs.csrf-token=7c97710f74a86e1e01522a7b84e73f02099553eb09a1b3f6bb2bdaad009b2dbd%7C5e26b720c7c54a98dc858077c2496989dfaf4f24b129ad9ecce09136c1bc1d4f; Path=/; HttpOnly; Secure; SameSite=Lax",
+ "Strict-Transport-Security": "max-age=63072000",
+ Vary: "RSC, Next-Router-State-Tree, Next-Router-Prefetch",
+ "X-Matched-Path": "/",
+ "X-Powered-By": "Next.js",
+ "X-Vercel-Cache": "MISS",
+ "X-Vercel-Id": "fra1::fra1::dlk76-1724415475594-7c5b9c827a3d",
+ },
+ time: 1724415475389,
+ timing: {
+ dnsStart: 1724415475504,
+ dnsDone: 1724415475527,
+ connectStart: 1724415475527,
+ connectDone: 1724415475545,
+ tlsHandshakeStart: 1724415475545,
+ tlsHandshakeDone: 1724415475582,
+ firstByteStart: 1724415475582,
+ firstByteDone: 1724415476259,
+ transferStart: 1724415476259,
+ transferDone: 1724415476259,
+ },
+ region: "waw",
+ },
+ {
+ status: 200,
+ latency: 1133,
+ headers: {
+ Age: "0",
+ "Cache-Control":
+ "private, no-cache, no-store, max-age=0, must-revalidate",
+ "Content-Type": "text/html; charset=utf-8",
+ Date: "Fri, 23 Aug 2024 12:17:56 GMT",
+ Link: '</_next/static/media/162bf645eb375add-s.p.ttf>; rel=preload; as="font"; crossorigin=""; type="font/ttf", </_next/static/media/a34f9d1faa5f3315-s.p.woff2>; rel=preload; as="font"; crossorigin=""; type="font/woff2"',
+ Server: "Vercel",
+ "Set-Cookie":
+ "__Host-authjs.csrf-token=c00e54372624088fced657d119128dc6d43eee5d5ea8209d16655f4cc67d930a%7Cfff1ca52bcf8e9cd9b92ac4de667991ffa5b445b8c77aad31cfa38c6e86a3d14; Path=/; HttpOnly; Secure; SameSite=Lax",
+ "Strict-Transport-Security": "max-age=63072000",
+ Vary: "RSC, Next-Router-State-Tree, Next-Router-Prefetch",
+ "X-Matched-Path": "/",
+ "X-Powered-By": "Next.js",
+ "X-Vercel-Cache": "MISS",
+ "X-Vercel-Execution-Region": "fra1",
+ "X-Vercel-Id": "iad1::fra1::dc8tg-1724415476028-5d259d762ec1",
+ },
+ time: 1724415475892,
+ timing: {
+ dnsStart: 1724415475952,
+ dnsDone: 1724415475978,
+ connectStart: 1724415475978,
+ connectDone: 1724415475979,
+ tlsHandshakeStart: 1724415475979,
+ tlsHandshakeDone: 1724415476020,
+ firstByteStart: 1724415476020,
+ firstByteDone: 1724415477025,
+ transferStart: 1724415477025,
+ transferDone: 1724415477025,
+ },
+ region: "yul",
+ },
+ {
+ status: 200,
+ latency: 447,
+ headers: {
+ Age: "0",
+ "Cache-Control":
+ "private, no-cache, no-store, max-age=0, must-revalidate",
+ "Content-Type": "text/html; charset=utf-8",
+ Date: "Fri, 23 Aug 2024 12:17:56 GMT",
+ Link: '</_next/static/media/162bf645eb375add-s.p.ttf>; rel=preload; as="font"; crossorigin=""; type="font/ttf", </_next/static/media/a34f9d1faa5f3315-s.p.woff2>; rel=preload; as="font"; crossorigin=""; type="font/woff2"',
+ Server: "Vercel",
+ "Set-Cookie":
+ "__Host-authjs.csrf-token=aca1d19c78d030efdcedc23883f78d9bc1f2d6d21bd5e2a8ac0026560f3d7f17%7Cf87108886605e4a306ce630f3b322c83fd8cab2dc49c709be5b4a59f5c22b4d0; Path=/; HttpOnly; Secure; SameSite=Lax",
+ "Strict-Transport-Security": "max-age=63072000",
+ Vary: "RSC, Next-Router-State-Tree, Next-Router-Prefetch",
+ "X-Matched-Path": "/",
+ "X-Powered-By": "Next.js",
+ "X-Vercel-Cache": "MISS",
+ "X-Vercel-Execution-Region": "fra1",
+ "X-Vercel-Id": "cle1::fra1::bckhc-1724415476215-f3c71058df41",
+ },
+ time: 1724415476081,
+ timing: {
+ dnsStart: 1724415476155,
+ dnsDone: 1724415476157,
+ connectStart: 1724415476157,
+ connectDone: 1724415476158,
+ tlsHandshakeStart: 1724415476158,
+ tlsHandshakeDone: 1724415476204,
+ firstByteStart: 1724415476204,
+ firstByteDone: 1724415476529,
+ transferStart: 1724415476529,
+ transferDone: 1724415476529,
+ },
+ region: "yyz",
+ },
+ ],
+};
diff --git a/apps/web/src/app/play/checker/api/route.ts b/apps/web/src/app/play/checker/api/route.ts
index 5230ce17e..bf5da7354 100644
--- a/apps/web/src/app/play/checker/api/route.ts
+++ b/apps/web/src/app/play/checker/api/route.ts
@@ -1,17 +1,66 @@
-import { setCheckerData } from "@/components/ping-response-analysis/utils";
+import {
+ type Method,
+ checkRegion,
+ storeBaseCheckerData,
+ storeCheckerData,
+} from "@/components/ping-response-analysis/utils";
+import { iteratorToStream, yieldMany } from "@/lib/stream";
+import { flyRegions } from "@openstatus/db/src/schema/constants";
+import { mockCheckRegion } from "./mock";
export const runtime = "edge";
+const encoder = new TextEncoder();
+
+async function* makeIterator({
+ url,
+ method,
+ id,
+}: { url: string; method: Method; id: string }) {
+ // Create an array to store all the promises
+ const promises = flyRegions.map(async (region, index) => {
+ try {
+ // Perform the fetch operation
+ const check =
+ process.env.NODE_ENV === "production"
+ ? await checkRegion(url, region, { method })
+ : await mockCheckRegion(region);
+
+ if ("body" in check) {
+ check.body = undefined; // Drop the body to avoid storing it in Redis Cache
+ }
+
+ storeCheckerData({ check, id });
+
+ return encoder.encode(
+ `${JSON.stringify({
+ ...check,
+ index,
+ })}\n`,
+ );
+ } catch (error) {
+ console.error(error);
+ return encoder.encode("");
+ }
+ });
+
+ yield* yieldMany(promises);
+ // return the id as the last value
+ yield* generator(id);
+}
+
+async function* generator(id: string) {
+ yield await Promise.resolve(encoder.encode(id));
+}
+
export async function POST(request: Request) {
const json = await request.json();
-
const { url, method } = json;
- try {
- const uuid = await setCheckerData(url, { method });
- return new Response(JSON.stringify({ uuid }));
- } catch (e) {
- console.log(e);
- return new Response("Internal Server Error", { status: 500 });
- }
+ const uuid = crypto.randomUUID().replace(/-/g, "");
+ storeBaseCheckerData({ url, method, id: uuid });
+
+ const iterator = makeIterator({ url, method, id: uuid });
+ const stream = iteratorToStream(iterator);
+ return new Response(stream);
}
diff --git a/apps/web/src/app/play/checker/page.tsx b/apps/web/src/app/play/checker/page.tsx
index cc2f352e2..ad36688d5 100644
--- a/apps/web/src/app/play/checker/page.tsx
+++ b/apps/web/src/app/play/checker/page.tsx
@@ -1,26 +1,44 @@
import type { Metadata } from "next";
-import { BackButton } from "@/components/layout/back-button";
import { BottomCTA } from "@/components/marketing/in-between-cta";
+import { getCheckerDataById } from "@/components/ping-response-analysis/utils";
+import { redirect } from "next/navigation";
+import { z } from "zod";
import CheckerPlay from "./_components/checker-play";
import { GlobalMonitoring } from "./_components/global-monitoring";
import { Testimonial } from "./_components/testimonial";
export const metadata: Metadata = {
- title: "Speed Checker",
+ title: "Global Speed Checker",
description:
- "Test the performance your api, website from multiple regions. Get speed insights for free.",
+ "Test the performance of your api, website from multiple regions. Get speed insights for free.",
openGraph: {
- title: "Speed Checker",
+ title: "Global Speed Checker",
description:
- "Test the performance your api, website from multiple regions. Get speed insights for free.",
+ "Test the performance of your api, website from multiple regions. Get speed insights for free.",
},
};
-export default async function PlayPage() {
+const searchParamsSchema = z.object({
+ id: z.string().optional(),
+});
+
+export default async function PlayPage({
+ searchParams,
+}: {
+ searchParams: { [key: string]: string | string[] | undefined };
+}) {
+ const search = searchParamsSchema.safeParse(searchParams);
+
+ const id = search.success ? search.data.id : undefined;
+
+ const data = id ? await getCheckerDataById(id) : null;
+
+ if (id && !data) return redirect("/play/checker");
+
return (
- <div className="my-8 grid h-full w-full gap-12 md:my-16">
- <CheckerPlay />
+ <div className="grid h-full w-full gap-12">
+ <CheckerPlay data={data} />
<Testimonial />
<GlobalMonitoring />
<div className="mx-auto max-w-2xl lg:max-w-4xl">
diff --git a/apps/web/src/app/play/page.tsx b/apps/web/src/app/play/page.tsx
index 48e5abac2..ee77ce1bd 100644
--- a/apps/web/src/app/play/page.tsx
+++ b/apps/web/src/app/play/page.tsx
@@ -34,7 +34,7 @@ export const metadata: Metadata = {
export default async function PlayPage() {
return (
<>
- <div className="my-8 grid w-full grid-cols-1 gap-4 sm:grid-cols-2 md:my-16 md:grid-cols-3">
+ <div className="grid w-full grid-cols-1 gap-4 sm:grid-cols-2 md:grid-cols-3">
{playgrounds.map((play, i) => {
const isFirst = i === 0;
return (
@@ -53,7 +53,7 @@ export default async function PlayPage() {
const playgrounds: CardProps[] = [
{
href: "/play/checker",
- title: "Speed Checker",
+ title: "Global Speed Checker",
description:
"Get speed insights for your api, website from multiple regions. No account needed.",
icon: Gauge,
diff --git a/apps/web/src/app/play/status/_components/status-play.tsx b/apps/web/src/app/play/status/_components/status-play.tsx
index c0a323990..6cbbd81d1 100644
--- a/apps/web/src/app/play/status/_components/status-play.tsx
+++ b/apps/web/src/app/play/status/_components/status-play.tsx
@@ -1,10 +1,15 @@
import { OSTinybird } from "@openstatus/tinybird";
-import { Shell } from "@/components/dashboard/shell";
+import {
+ CardContainer,
+ CardDescription,
+ CardHeader,
+ CardIcon,
+ CardTitle,
+} from "@/components/marketing/card";
import { Tracker } from "@/components/tracker/tracker";
import { env } from "@/env";
import { getServerTimezoneFormat } from "@/lib/timezone";
-import { HeaderPlay } from "../../_components/header-play";
const tb = new OSTinybird({ token: env.TINY_BIRD_API_KEY });
@@ -21,12 +26,16 @@ export default async function StatusPlay() {
const formattedServerDate = getServerTimezoneFormat();
return (
- <Shell>
+ <CardContainer>
+ <CardHeader>
+ <CardIcon icon="panel-top" />
+ <CardTitle>Status Page</CardTitle>
+ <CardDescription className="max-w-md">
+ Gain the trust of your users by showing them the uptime of your API or
+ website.
+ </CardDescription>
+ </CardHeader>
<div className="relative grid gap-4">
- <HeaderPlay
- title="Status Page"
- description="Gain the trust of your users by showing them the uptime of your API or website."
- />
<div className="mx-auto w-full max-w-md">
{data && <Tracker data={data} name="Ping" description="Pong" />}
</div>
@@ -35,6 +44,6 @@ export default async function StatusPlay() {
</p>
{/* REMINDER: more playground component */}
</div>
- </Shell>
+ </CardContainer>
);
}
diff --git a/apps/web/src/app/play/status/page.tsx b/apps/web/src/app/play/status/page.tsx
index cebb36558..faf4c5b62 100644
--- a/apps/web/src/app/play/status/page.tsx
+++ b/apps/web/src/app/play/status/page.tsx
@@ -17,7 +17,7 @@ export const revalidate = 600;
export default async function PlayPage() {
return (
- <div className="my-8 md:my-16">
+ <div className="w-full">
<StatusPlay />
</div>
);
diff --git a/apps/web/src/components/content/changelog.tsx b/apps/web/src/components/content/changelog.tsx
index a4bf44cc5..b5cf5d2a2 100644
--- a/apps/web/src/components/content/changelog.tsx
+++ b/apps/web/src/components/content/changelog.tsx
@@ -17,7 +17,7 @@ export function ChangelogCard({ post }: { post: Changelog }) {
src={post.image}
fill={true}
alt={post.title}
- className="object-contain"
+ className="object-cover"
/>
</div>
</div>
diff --git a/apps/web/src/components/data-table/data-table-view-options.tsx b/apps/web/src/components/data-table/data-table-view-options.tsx
new file mode 100644
index 000000000..6e9cbe3c8
--- /dev/null
+++ b/apps/web/src/components/data-table/data-table-view-options.tsx
@@ -0,0 +1,56 @@
+"use client";
+
+import type { Table } from "@tanstack/react-table";
+import { Settings2 } from "lucide-react";
+
+import { Button } from "@openstatus/ui/src/components/button";
+import {
+ DropdownMenu,
+ DropdownMenuCheckboxItem,
+ DropdownMenuContent,
+ DropdownMenuLabel,
+ DropdownMenuSeparator,
+ DropdownMenuTrigger,
+} from "@openstatus/ui/src/components/dropdown-menu";
+
+interface DataTableViewOptionsProps<TData> {
+ table: Table<TData>;
+}
+
+export function DataTableViewOptions<TData>({
+ table,
+}: DataTableViewOptionsProps<TData>) {
+ return (
+ <DropdownMenu>
+ <DropdownMenuTrigger asChild>
+ <Button variant="outline" size="sm" className="shadow-none">
+ <Settings2 className="mr-2 h-4 w-4" />
+ View
+ </Button>
+ </DropdownMenuTrigger>
+ <DropdownMenuContent align="end" className="w-[150px]">
+ <DropdownMenuLabel>Display properties</DropdownMenuLabel>
+ <DropdownMenuSeparator />
+ {table
+ .getAllColumns()
+ .filter(
+ (column) =>
+ typeof column.accessorFn !== "undefined" && column.getCanHide(),
+ )
+ .map((column) => {
+ return (
+ <DropdownMenuCheckboxItem
+ key={column.id}
+ className={"capitalize"}
+ onSelect={(e) => e.preventDefault()}
+ checked={column.getIsVisible()}
+ onCheckedChange={(value) => column.toggleVisibility(!!value)}
+ >
+ {column.id}
+ </DropdownMenuCheckboxItem>
+ );
+ })}
+ </DropdownMenuContent>
+ </DropdownMenu>
+ );
+}
diff --git a/apps/web/src/components/marketing/card.tsx b/apps/web/src/components/marketing/card.tsx
index 6c3db4fa9..bde4ee924 100644
--- a/apps/web/src/components/marketing/card.tsx
+++ b/apps/web/src/components/marketing/card.tsx
@@ -39,8 +39,18 @@ export function CardTitle({ children }: { children: React.ReactNode }) {
);
}
-export function CardDescription({ children }: { children: React.ReactNode }) {
- return <p className="text-center text-muted-foreground">{children}</p>;
+export function CardDescription({
+ children,
+ className,
+}: {
+ children: React.ReactNode;
+ className?: string;
+}) {
+ return (
+ <p className={cn("text-center text-muted-foreground", className)}>
+ {children}
+ </p>
+ );
}
export function CardContent({
diff --git a/apps/web/src/components/marketing/hero.tsx b/apps/web/src/components/marketing/hero.tsx
index f262076a5..140dc1695 100644
--- a/apps/web/src/components/marketing/hero.tsx
+++ b/apps/web/src/components/marketing/hero.tsx
@@ -7,6 +7,7 @@ import { Button } from "@openstatus/ui/src/components/button";
import { getGitHubStars } from "@/lib/github";
import { cn, numberFormatter } from "@/lib/utils";
+import { SpeedCheckerButton } from "./speed-checker-button";
export function Hero() {
return (
@@ -58,6 +59,9 @@ export function Hero() {
</Link>
</Button>
</div>
+ <div className="col-span-full">
+ <SpeedCheckerButton variant="ghost" className="w-48 sm:w-auto" />
+ </div>
</div>
</div>
);
diff --git a/apps/web/src/components/marketing/monitor/card.tsx b/apps/web/src/components/marketing/monitor/card.tsx
index acbc387d4..755a49f76 100644
--- a/apps/web/src/components/marketing/monitor/card.tsx
+++ b/apps/web/src/components/marketing/monitor/card.tsx
@@ -12,6 +12,7 @@ import {
CardIcon,
CardTitle,
} from "../card";
+import { SpeedCheckerButton } from "../speed-checker-button";
import { Globe } from "./globe";
export function MonitoringCard() {
@@ -31,11 +32,9 @@ export function MonitoringCard() {
))}
<div className="order-first flex items-center justify-center gap-2 text-center md:order-none">
<Button variant="outline" className="rounded-full" asChild>
- <Link href="/play/checker">Playground</Link>
- </Button>
- <Button className="rounded-full" asChild>
<Link href="/features/monitoring">Learn more</Link>
</Button>
+ <SpeedCheckerButton />
</div>
</CardFeatureContainer>
</CardContent>
diff --git a/apps/web/src/components/marketing/speed-checker-button.tsx b/apps/web/src/components/marketing/speed-checker-button.tsx
new file mode 100644
index 000000000..7a9ae725c
--- /dev/null
+++ b/apps/web/src/components/marketing/speed-checker-button.tsx
@@ -0,0 +1,14 @@
+import { cn } from "@/lib/utils";
+import { Button, type ButtonProps } from "@openstatus/ui";
+import Link from "next/link";
+import { Icons } from "../icons";
+
+export function SpeedCheckerButton({ className, ...props }: ButtonProps) {
+ return (
+ <Button className={cn("rounded-full", className)} asChild {...props}>
+ <Link href="/play/checker">
+ Speed Checker <Icons.gauge className="ml-1 h-4 w-4" />
+ </Link>
+ </Button>
+ );
+}
diff --git a/apps/web/src/components/monitor-dashboard/region-preset.tsx b/apps/web/src/components/monitor-dashboard/region-preset.tsx
index fee8d6149..c319d15e4 100644
--- a/apps/web/src/components/monitor-dashboard/region-preset.tsx
+++ b/apps/web/src/components/monitor-dashboard/region-preset.tsx
@@ -5,7 +5,7 @@ import { usePathname, useRouter } from "next/navigation";
import * as React from "react";
import type { Region } from "@openstatus/tinybird";
-import { Button } from "@openstatus/ui/src/components/button";
+import { Button, type ButtonProps } from "@openstatus/ui/src/components/button";
import {
Command,
CommandEmpty,
@@ -29,16 +29,20 @@ import {
import useUpdateSearchParams from "@/hooks/use-update-search-params";
import { cn } from "@/lib/utils";
+interface RegionsPresetProps extends ButtonProps {
+ regions: Region[];
+ selectedRegions: Region[];
+}
+
export function RegionsPreset({
regions,
selectedRegions,
className,
-}: {
- regions: Region[];
- selectedRegions: Region[];
- className?: string;
-}) {
- const [selected, setSelected] = React.useState<Region[]>(selectedRegions);
+ ...props
+}: RegionsPresetProps) {
+ const [selected, setSelected] = React.useState<Region[]>(
+ selectedRegions.filter((r) => regions.includes(r)),
+ ); // REMINDER: init without regions that failed to load
const router = useRouter();
const pathname = usePathname();
const updateSearchParams = useUpdateSearchParams();
@@ -59,15 +63,20 @@ export function RegionsPreset({
(prev, curr) => {
const region = flyRegionsDict[curr];
- if (prev[region.continent]) {
- prev[region.continent].push(region);
+ const item = prev.find((r) => r.continent === region.continent);
+
+ if (item) {
+ item.data.push(region);
} else {
- prev[region.continent] = [region];
+ prev.push({
+ continent: region.continent,
+ data: [region],
+ });
}
return prev;
},
- {} as Record<Continent, RegionInfo[]>,
+ [] as { continent: Continent; data: RegionInfo[] }[],
);
return (
@@ -77,9 +86,10 @@ export function RegionsPreset({
size="lg"
variant="outline"
className={cn("px-3 shadow-none", className)}
+ {...props}
>
<Globe2 className="mr-2 h-4 w-4" />
- <span>
+ <span className="whitespace-nowrap">
<code>{selected.length}</code> Regions
</span>
<ChevronsUpDown className="ml-2 h-4 w-4 shrink-0 opacity-50" />
@@ -105,10 +115,10 @@ export function RegionsPreset({
</CommandItem>
</CommandGroup>
<CommandSeparator />
- {Object.entries(regionsByContinent).map(([key, regions]) => {
+ {regionsByContinent.map(({ continent, data }) => {
return (
- <CommandGroup key={key} heading={key}>
- {regions.map((region) => {
+ <CommandGroup key={continent} heading={continent}>
+ {data.map((region) => {
const { code, flag, location, continent } = region;
const isSelected = selected.includes(code);
return (
diff --git a/apps/web/src/components/ping-response-analysis/columns.tsx b/apps/web/src/components/ping-response-analysis/columns.tsx
index 12278ffe3..a4d59f03a 100644
--- a/apps/web/src/components/ping-response-analysis/columns.tsx
+++ b/apps/web/src/components/ping-response-analysis/columns.tsx
@@ -1,36 +1,70 @@
"use client";
import type { ColumnDef } from "@tanstack/react-table";
-import { type RegionChecker, latencyFormatter, regionFormatter } from "./utils";
+import {
+ type RegionChecker,
+ continentFormatter,
+ latencyFormatter,
+ regionFormatter,
+ timestampFormatter,
+} from "./utils";
+import { format } from "date-fns";
+import { utcToZonedTime } from "date-fns-tz";
import { DataTableColumnHeader } from "../data-table/data-table-column-header";
import { StatusCodeBadge } from "../monitor/status-code-badge";
export const columns: ColumnDef<RegionChecker>[] = [
+ {
+ id: "key",
+ accessorFn: (row) => row.region,
+ header: "Key",
+ cell: ({ row }) => {
+ return <div className="font-mono">{row.original.region}</div>;
+ },
+ enableHiding: false,
+ },
{
accessorKey: "region",
+ header: "Region",
cell: ({ row }) => {
- return <div>{regionFormatter(row.original.region)}</div>;
+ return (
+ <div className="text-muted-foreground">
+ {regionFormatter(row.original.region, "long")}
+ </div>
+ );
},
+ },
+ {
+ id: "continent",
+ accessorFn: (row) => continentFormatter(row.region),
header: ({ column }) => {
- return <DataTableColumnHeader column={column} title="Region" />;
+ return <DataTableColumnHeader column={column} title="Continent" />;
+ },
+ cell: ({ row }) => {
+ return <div>{row.getValue("continent")}</div>;
},
},
{
accessorKey: "status",
- header: ({ column }) => {
- return <DataTableColumnHeader column={column} title="Status" />;
- },
+ header: "Status",
cell: ({ row }) => {
return <StatusCodeBadge statusCode={row.original.status} />;
},
},
{
- id: "dns",
+ id: "DNS",
header: ({ column }) => {
return <DataTableColumnHeader column={column} title="DNS" />;
},
accessorFn: (row) => `${row.timing.dnsDone - row.timing.dnsStart}`,
+ cell: ({ row, column }) => {
+ return (
+ <div className="font-mono">
+ {latencyFormatter(row.getValue(column.id))}
+ </div>
+ );
+ },
},
{
id: "connect",
@@ -38,22 +72,44 @@ export const columns: ColumnDef<RegionChecker>[] = [
header: ({ column }) => {
return <DataTableColumnHeader column={column} title="Connect" />;
},
+ cell: ({ row, column }) => {
+ return (
+ <div className="font-mono">
+ {latencyFormatter(row.getValue(column.id))}
+ </div>
+ );
+ },
},
{
- id: "tls",
+ id: "TLS",
+
accessorFn: (row) =>
`${row.timing.tlsHandshakeDone - row.timing.tlsHandshakeStart}`,
header: ({ column }) => {
return <DataTableColumnHeader column={column} title="TLS" />;
},
+ cell: ({ row, column }) => {
+ return (
+ <div className="font-mono">
+ {latencyFormatter(row.getValue(column.id))}
+ </div>
+ );
+ },
},
{
- id: "ttfb",
+ id: "TTFB",
accessorFn: (row) =>
`${row.timing.firstByteDone - row.timing.firstByteStart}`,
header: ({ column }) => {
return <DataTableColumnHeader column={column} title="TTFB" />;
},
+ cell: ({ row, column }) => {
+ return (
+ <div className="font-mono">
+ {latencyFormatter(row.getValue(column.id))}
+ </div>
+ );
+ },
},
{
accessorKey: "latency",
@@ -61,7 +117,23 @@ export const columns: ColumnDef<RegionChecker>[] = [
return <DataTableColumnHeader column={column} title="Latency" />;
},
cell: ({ row }) => {
- return <div>{latencyFormatter(row.original.latency)}</div>;
+ return (
+ <div className="font-mono">
+ {latencyFormatter(row.original.latency)}
+ </div>
+ );
+ },
+ },
+ {
+ id: "Time (UTC)",
+ accessorFn: (row) => row.time,
+ cell: ({ row }) => {
+ const date = format(
+ utcToZonedTime(row.original.time, "UTC"),
+ "dd LLL hh:mm a",
+ );
+
+ return <div className="whitespace-nowrap">{date}</div>;
},
},
];
diff --git a/apps/web/src/components/ping-response-analysis/data-table-collapse-button.tsx b/apps/web/src/components/ping-response-analysis/data-table-collapse-button.tsx
new file mode 100644
index 000000000..a429ee2c7
--- /dev/null
+++ b/apps/web/src/components/ping-response-analysis/data-table-collapse-button.tsx
@@ -0,0 +1,27 @@
+"use client";
+
+import { Badge, Button } from "@openstatus/ui";
+import type { Table } from "@tanstack/react-table";
+import { ChevronsDownUp } from "lucide-react";
+
+interface DataTableCollapseButtonProps<TData> {
+ table: Table<TData>;
+}
+
+export function DataTableCollapseButton<TData>({
+ table,
+}: DataTableCollapseButtonProps<TData>) {
+ const isExpanded = Object.keys(table.getState().expanded).length;
+
+ if (!isExpanded) return null;
+
+ return (
+ <Button variant="ghost" size="sm" onClick={() => table.resetExpanded()}>
+ <ChevronsDownUp className="mr-2 h-4 w-4" />
+ Collapse
+ <Badge variant="secondary" className="ml-2">
+ {isExpanded}
+ </Badge>
+ </Button>
+ );
+}
diff --git a/apps/web/src/components/ping-response-analysis/multi-region-chart.tsx b/apps/web/src/components/ping-response-analysis/multi-region-chart.tsx
index 48426f4d6..d436157d7 100644
--- a/apps/web/src/components/ping-response-analysis/multi-region-chart.tsx
+++ b/apps/web/src/components/ping-response-analysis/multi-region-chart.tsx
@@ -1,19 +1,51 @@
"use client";
-import { BarChart } from "@tremor/react";
-
import type { RegionChecker } from "./utils";
-import { getTimingPhases, latencyFormatter, regionFormatter } from "./utils";
+import { getTimingPhases, regionFormatter } from "./utils";
+
+import { Bar, BarChart, CartesianGrid, XAxis } from "recharts";
+
+import {
+ type ChartConfig,
+ ChartContainer,
+ ChartLegend,
+ ChartLegendContent,
+ ChartTooltip,
+ ChartTooltipContent,
+} from "@openstatus/ui/src/components/chart";
+
+const chartConfig = {
+ dns: {
+ label: "DNS",
+ color: "hsl(var(--chart-1))",
+ },
+ connection: {
+ label: "Connection",
+ color: "hsl(var(--chart-2))",
+ },
+ tls: {
+ label: "TLS",
+ color: "hsl(var(--chart-3))",
+ },
+ ttfb: {
+ label: "TTFB",
+ color: "hsl(var(--chart-4))",
+ },
+ transfer: {
+ label: "Transfer",
+ color: "hsl(var(--chart-5))",
+ },
+} satisfies ChartConfig;
export function MultiRegionChart({ regions }: { regions: RegionChecker[] }) {
- const data = regions
- .sort((a, b) => a.latency - b.latency)
+ const chartData = regions
+ .sort((a, b) => a.latency - b.latency) // FIXME: seems to be off
.map((item) => {
const { dns, connection, tls, ttfb, transfer } = getTimingPhases(
item.timing,
);
return {
- region: regionFormatter(item.region),
+ region: item.region,
dns,
connection,
tls,
@@ -22,16 +54,59 @@ export function MultiRegionChart({ regions }: { regions: RegionChecker[] }) {
};
});
return (
- <BarChart
- data={data}
- index="region"
- categories={["dns", "connection", "tls", "ttfb", "transfer"]}
- colors={["blue", "teal", "amber", "slate", "indigo"]}
- valueFormatter={latencyFormatter}
- stack
- layout="vertical"
- yAxisWidth={65}
- className="h-[64rem] w-full"
- />
+ <div className="relative">
+ <ChartContainer config={chartConfig}>
+ <BarChart accessibilityLayer data={chartData}>
+ <CartesianGrid vertical={false} />
+ <XAxis
+ dataKey="region"
+ tickLine={false}
+ tickMargin={10}
+ axisLine={false}
+ interval={0}
+ tick={(props) => {
+ const { x, y, payload } = props;
+ return (
+ <g transform={`translate(${x},${y})`}>
+ <text
+ x={0}
+ y={0}
+ dy={2}
+ textAnchor="end"
+ fill="#666"
+ transform="rotate(-35)"
+ className="font-mono"
+ >
+ {payload.value}
+ </text>
+ </g>
+ );
+ }}
+ />
+ <ChartTooltip
+ content={
+ <ChartTooltipContent
+ labelFormatter={(label) => regionFormatter(label, "long")}
+ />
+ }
+ />
+ <ChartLegend content={<ChartLegendContent />} />
+ <Bar dataKey="dns" stackId="a" fill="var(--color-dns)" />
+ <Bar
+ dataKey="connection"
+ stackId="a"
+ fill="var(--color-connection)"
+ />
+ <Bar dataKey="tls" stackId="a" fill="var(--color-tls)" />
+ <Bar dataKey="ttfb" stackId="a" fill="var(--color-ttfb)" />
+ <Bar dataKey="transfer" stackId="a" fill="var(--color-transfer)" />
+ </BarChart>
+ </ChartContainer>
+ {regions.length ? null : (
+ <div className="absolute inset-0 flex w-full items-center justify-center bg-muted/50">
+ <div className="text-foreground">No results</div>
+ </div>
+ )}
+ </div>
);
}
diff --git a/apps/web/src/components/ping-response-analysis/multi-region-table.tsx b/apps/web/src/components/ping-response-analysis/multi-region-table.tsx
index a26a55b2f..6818ca2ab 100644
--- a/apps/web/src/components/ping-response-analysis/multi-region-table.tsx
+++ b/apps/web/src/components/ping-response-analysis/multi-region-table.tsx
@@ -12,81 +12,142 @@ import {
import {
type ColumnDef,
+ type ExpandedState,
+ type Row,
type SortingState,
+ type VisibilityState,
flexRender,
getCoreRowModel,
+ getExpandedRowModel,
getSortedRowModel,
useReactTable,
} from "@tanstack/react-table";
-import { useState } from "react";
+import { Fragment, useState } from "react";
+import { DataTableViewOptions } from "../data-table/data-table-view-options";
+import { DataTableCollapseButton } from "./data-table-collapse-button";
// TBD: add the popover infos about timing details
interface DataTableProps<TData, TValue> {
columns: ColumnDef<TData, TValue>[];
data: TData[];
+ renderSubComponent(props: { row: Row<TData> }): React.ReactElement;
+ getRowCanExpand(row: Row<TData>): boolean;
+ autoResetExpanded?: boolean;
}
export function MultiRegionTable<TData, TValue>({
columns,
data,
+ renderSubComponent,
+ getRowCanExpand,
+ autoResetExpanded,
}: DataTableProps<TData, TValue>) {
- const [sorting, setSorting] = useState<SortingState>([]);
+ const [sorting, setSorting] = useState<SortingState>([
+ { id: "latency", desc: false },
+ ]);
+ const [expanded, setExpanded] = useState<ExpandedState>({});
+ const [columnVisibility, setColumnVisibility] = useState<VisibilityState>({
+ DNS: false,
+ TLS: false,
+ TTFB: false,
+ connect: false,
+ });
const table = useReactTable({
data,
columns,
onSortingChange: setSorting,
+ onExpandedChange: setExpanded,
+ onColumnVisibilityChange: setColumnVisibility,
getCoreRowModel: getCoreRowModel(),
getSortedRowModel: getSortedRowModel(),
-
+ getExpandedRowModel: getExpandedRowModel(),
+ getRowCanExpand,
+ autoResetExpanded,
state: {
sorting,
+ expanded,
+ columnVisibility,
},
});
+
return (
- <Table>
- <TableCaption>Multi Regions</TableCaption>
- <TableHeader className="bg-muted/50">
- {table.getHeaderGroups().map((headerGroup) => (
- <TableRow key={headerGroup.id}>
- {headerGroup.headers.map((header) => {
- return (
- <TableHead key={header.id}>
- {header.isPlaceholder
- ? null
- : flexRender(
- header.column.columnDef.header,
- header.getContext(),
+ <div className="grid gap-4">
+ <div className="flex items-end justify-between gap-2">
+ <p className="text-muted-foreground text-xs">
+ Select a row to expand the response details.
+ </p>
+ <div className="flex items-center justify-end gap-2">
+ <DataTableCollapseButton table={table} />
+ <DataTableViewOptions table={table} />
+ </div>
+ </div>
+ <Table>
+ <TableCaption>Multi Regions</TableCaption>
+ <TableHeader className="bg-muted/50">
+ {table.getHeaderGroups().map((headerGroup) => (
+ <TableRow key={headerGroup.id}>
+ {headerGroup.headers.map((header) => {
+ return (
+ <TableHead
+ key={header.id}
+ className={header.column.columnDef.meta?.headerClassName}
+ >
+ {header.isPlaceholder
+ ? null
+ : flexRender(
+ header.column.columnDef.header,
+ header.getContext(),
+ )}
+ </TableHead>
+ );
+ })}
+ </TableRow>
+ ))}
+ </TableHeader>
+ <TableBody>
+ {table.getRowModel().rows?.length ? (
+ table.getRowModel().rows.map((row) => (
+ <Fragment key={row.id}>
+ <TableRow
+ data-state={
+ (row.getIsSelected() || row.getIsExpanded()) && "selected"
+ }
+ onClick={() => row.toggleExpanded()}
+ className="cursor-pointer"
+ >
+ {row.getVisibleCells().map((cell) => (
+ <TableCell key={cell.id}>
+ {flexRender(
+ cell.column.columnDef.cell,
+ cell.getContext(),
)}
- </TableHead>
- );
- })}
- </TableRow>
- ))}
- </TableHeader>
- <TableBody>
- {table.getRowModel().rows?.length ? (
- table.getRowModel().rows.map((row) => (
- <TableRow
- key={row.id}
- data-state={row.getIsSelected() && "selected"}
- >
- {row.getVisibleCells().map((cell) => (
- <TableCell key={cell.id}>
- {flexRender(cell.column.columnDef.cell, cell.getContext())}
- </TableCell>
- ))}
+ </TableCell>
+ ))}
+ </TableRow>
+ {row.getIsExpanded() && (
+ <TableRow
+ data-state="expanded"
+ className="hover:bg-muted/10 data-[state=expanded]:bg-muted/10"
+ >
+ {/* 2nd row is a custom 1 cell row */}
+ <TableCell colSpan={row.getVisibleCells().length}>
+ {renderSubComponent({ row })}
+ </TableCell>
+ </TableRow>
+ )}
+ </Fragment>
+ ))
+ ) : (
+ <TableRow>
+ <TableCell colSpan={columns.length} className="h-24 text-center">
+ No results.
+ </TableCell>
</TableRow>
- ))
- ) : (
- <TableRow>
- <TableCell colSpan={columns.length} className="h-24 text-center">
- No results.
- </TableCell>
- </TableRow>
- )}
- </TableBody>
- </Table>
+ )}
+ </TableBody>
+ </Table>
+ </div>
);
}
diff --git a/apps/web/src/components/ping-response-analysis/multi-region-tabs.tsx b/apps/web/src/components/ping-response-analysis/multi-region-tabs.tsx
index 62fad1335..4565176e8 100644
--- a/apps/web/src/components/ping-response-analysis/multi-region-tabs.tsx
+++ b/apps/web/src/components/ping-response-analysis/multi-region-tabs.tsx
@@ -1,23 +1,53 @@
+"use client";
+
import { Tabs, TabsContent, TabsList, TabsTrigger } from "@openstatus/ui";
+import type { Region } from "@openstatus/tinybird";
+import type { Row } from "@tanstack/react-table";
+import { RegionsPreset } from "../monitor-dashboard/region-preset";
import { columns } from "./columns";
import { MultiRegionChart } from "./multi-region-chart";
import { MultiRegionTable } from "./multi-region-table";
+import { ResponseDetailTabs } from "./response-detail-tabs";
import type { RegionChecker } from "./utils";
-export function MultiRegionTabs({ regions }: { regions: RegionChecker[] }) {
+export function MultiRegionTabs({
+ regions,
+ selectedRegions,
+}: {
+ regions: RegionChecker[];
+ selectedRegions?: Region[];
+}) {
return (
- <Tabs defaultValue="chart">
- <TabsList>
- <TabsTrigger value="chart">Chart</TabsTrigger>
- <TabsTrigger value="table">Table</TabsTrigger>
- </TabsList>
+ <Tabs defaultValue="table">
+ <div className="flex items-center justify-between">
+ <TabsList>
+ <TabsTrigger value="table">Table</TabsTrigger>
+ <TabsTrigger value="chart">Chart</TabsTrigger>
+ </TabsList>
+ <RegionsPreset
+ regions={regions.map((i) => i.region)}
+ selectedRegions={selectedRegions ?? []}
+ size="sm"
+ />
+ </div>
<TabsContent value="chart">
- <MultiRegionChart regions={regions} />
+ <MultiRegionChart
+ regions={regions.filter((i) => selectedRegions?.includes(i.region))}
+ />
</TabsContent>
<TabsContent value="table">
- <MultiRegionTable data={regions} columns={columns} />
+ <MultiRegionTable
+ data={regions.filter((i) => selectedRegions?.includes(i.region))}
+ columns={columns}
+ getRowCanExpand={() => true}
+ renderSubComponent={renderSubComponent}
+ />
</TabsContent>
</Tabs>
);
}
+
+function renderSubComponent({ row }: { row: Row<RegionChecker> }) {
+ return <ResponseDetailTabs {...row.original} />;
+}
diff --git a/apps/web/src/components/ping-response-analysis/utils.ts b/apps/web/src/components/ping-response-analysis/utils.ts
index c687b50ea..4c1cd7e54 100644
--- a/apps/web/src/components/ping-response-analysis/utils.ts
+++ b/apps/web/src/components/ping-response-analysis/utils.ts
@@ -6,7 +6,7 @@ import {
monitorFlyRegionSchema,
} from "@openstatus/db/src/schema/constants";
import type { MonitorFlyRegion } from "@openstatus/db/src/schema/constants";
-import { flyRegionsDict } from "@openstatus/utils";
+import { continentDict, flyRegionsDict } from "@openstatus/utils";
export function latencyFormatter(value: number) {
return `${new Intl.NumberFormat("us").format(value).toString()}ms`;
@@ -16,13 +16,18 @@ export function timestampFormatter(timestamp: number) {
return new Date(timestamp).toUTCString(); // GMT format
}
+export function continentFormatter(region: MonitorFlyRegion) {
+ const continent = flyRegionsDict[region].continent;
+ return continentDict[continent].code;
+}
+
export function regionFormatter(
region: MonitorFlyRegion,
type: "short" | "long" = "short",
) {
const { code, flag, location } = flyRegionsDict[region];
if (type === "short") return `${code} ${flag}`;
- return `${location}`;
+ return `${location} ${flag}`;
}
export function getTotalLatency(timing: Timing) {
@@ -114,6 +119,7 @@ export type Timing = z.infer<typeof timingSchema>;
export type Checker = z.infer<typeof checkerSchema>;
export type RegionChecker = Checker & { region: MonitorFlyRegion };
export type Method = "GET" | "POST" | "PUT" | "DELETE" | "HEAD";
+export type CachedRegionChecker = z.infer<typeof cachedCheckerSchema>;
export async function checkRegion(
url: string,
@@ -182,40 +188,89 @@ export async function checkAllRegions(url: string, opts?: { method: Method }) {
);
}
-export async function setCheckerData(url: string, opts?: { method: Method }) {
+export async function storeBaseCheckerData({
+ url,
+ method,
+ id,
+}: {
+ url: string;
+ method: Method;
+ id: string;
+}) {
const redis = Redis.fromEnv();
const time = new Date().getTime();
- const checks = await checkAllRegions(url, opts);
- const { method } = opts || {};
+ const cache = { url, method, time };
+
+ const parsed = cachedCheckerSchema
+ .pick({ url: true, method: true, time: true })
+ .safeParse(cache);
- const cache = { time, url, checks, method };
+ if (!parsed.success) {
+ throw new Error(parsed.error.message);
+ }
+
+ await redis.hset(`check:base:${id}`, parsed.data);
+ const expire = 60 * 60 * 24 * 7; // 7days
+ await redis.expire(`check:base:${id}`, expire);
+
+ return id;
+}
- const uuid = crypto.randomUUID().replace(/-/g, "");
+export async function storeCheckerData({
+ check,
+ id,
+}: {
+ check: RegionChecker;
+ id: string;
+}) {
+ const redis = Redis.fromEnv();
- const parsed = cachedCheckerSchema.safeParse(cache);
+ const parsed = cachedCheckerSchema
+ .pick({ checks: true })
+ .safeParse({ checks: [check] });
if (!parsed.success) {
throw new Error(parsed.error.message);
}
- await redis.set(uuid, JSON.stringify(parsed.data), { ex: 86_400 }); // 60 * 60 * 24 = 1d
+ const first = parsed.data.checks?.[0];
+
+ if (first) await redis.sadd(`check:data:${id}`, first);
- return uuid;
+ return id;
}
export async function getCheckerDataById(id: string) {
const redis = Redis.fromEnv();
- const cache = await redis.get(id);
+ const pipe = redis.pipeline();
+ pipe.hgetall(`check:base:${id}`);
+ pipe.smembers(`check:data:${id}`);
+
+ const res =
+ await pipe.exec<
+ [{ url: string; method: Method; time: number }, RegionChecker]
+ >();
- if (!cache) {
+ if (!res) {
return null;
}
- const parsed = cachedCheckerSchema.safeParse(cache);
+ const parsed = cachedCheckerSchema.safeParse({ ...res[0], checks: res[1] });
if (!parsed.success) {
- throw new Error(parsed.error.message);
+ // throw new Error(parsed.error.message);
+ return null;
}
return parsed.data;
}
+
+/**
+ * Simple function to validate crypto.randomUUID() format like "aec4e0ec3c4f4557b8ce46e55078fc95"
+ * @param uuid
+ * @returns
+ */
+export function is32CharHex(uuid: string) {
+ const hexRegex = /^[0-9a-fA-F]{32}$/;
+ return hexRegex.test(uuid);
+}
diff --git a/apps/web/src/config/features.ts b/apps/web/src/config/features.ts
index 9033af469..f97dda48d 100644
--- a/apps/web/src/config/features.ts
+++ b/apps/web/src/config/features.ts
@@ -10,7 +10,7 @@ export type Feature = {
export type FeatureDescription = {
icon: ValidIcon;
catchline: string;
- description: string;
+ description: React.ReactNode;
badge?: "Coming soon" | "New";
};
diff --git a/apps/web/src/content/changelog/play-checker-improvements.mdx b/apps/web/src/content/changelog/play-checker-improvements.mdx
new file mode 100644
index 000000000..b7bb8a280
--- /dev/null
+++ b/apps/web/src/content/changelog/play-checker-improvements.mdx
@@ -0,0 +1,10 @@
+---
+title: Speed Checker
+description: Improving the speed checker playground for a better experience.
+image: /assets/changelog/play-checker-improvements.png
+publishedAt: 2024-08-27
+---
+
+We've refreshed the Playground for a better experience. Now, access real-time data without leaving the page.
+
+Check out the [Speed Checker](/play/checker).
\ No newline at end of file
diff --git a/apps/web/src/lib/stream.ts b/apps/web/src/lib/stream.ts
new file mode 100644
index 000000000..bbbd9ee00
--- /dev/null
+++ b/apps/web/src/lib/stream.ts
@@ -0,0 +1,77 @@
+export async function* yieldMany(promises: Promise<unknown>[]) {
+ // Attach .then() handlers to the promises to remove them as soon as they resolve
+ // biome-ignore lint/complexity/noForEach: REMINDER: do not use for await (const p of promises) as it will not work as expected
+ promises.forEach((p) => {
+ p.then((value) => {
+ promises.splice(promises.indexOf(p), 1);
+ return value;
+ });
+ });
+
+ // Continue yielding the results of the promises as they resolve
+ while (promises.length > 0) {
+ yield await Promise.race(promises);
+ }
+
+ return "done";
+}
+
+export function iteratorToStream(iterator: AsyncGenerator) {
+ return new ReadableStream({
+ async pull(controller) {
+ try {
+ const { value, done } = await iterator.next();
+ if (done) {
+ controller.close();
+ } else {
+ controller.enqueue(value);
+ }
+ } catch (err) {
+ console.error("Stream error:", err);
+ controller.error(err);
+ }
+ },
+ });
+}
+
+const encoder = new TextEncoder();
+const decoder = new TextDecoder();
+
+/**
+ * HOW TO USE IT IN YOUR ROUTE
+ * @returns {Response}
+ */
+export async function POST(request: Request) {
+ // extract your params from the request
+ const _json = await request.json();
+
+ const generator = yieldMany([
+ new Promise((resolve) =>
+ setTimeout(() => resolve(encoder.encode("1")), 200),
+ ),
+ new Promise((resolve) => resolve(encoder.encode("2"))),
+ new Promise((resolve) =>
+ setTimeout(() => resolve(encoder.encode("3")), 500),
+ ),
+ ]);
+
+ const stream = iteratorToStream(generator);
+ return new Response(stream);
+}
+
+/**
+ * HOW TO USE IT IN YOUR CLIENT
+ */
+async function clientConsumeStream() {
+ const response = await POST(new Request("")); // fetch("/api/path/to/route", { method: "POST" });
+ const reader = response.body?.getReader();
+ if (!reader) return;
+
+ while (true) {
+ const { value, done } = await reader.read();
+ if (done) break;
+ console.log("Stream output:", decoder.decode(value));
+ }
+
+ console.log("Stream processing complete.");
+}
diff --git a/apps/web/src/styles/globals.css b/apps/web/src/styles/globals.css
index b4612ade1..6a9f3a0b0 100644
--- a/apps/web/src/styles/globals.css
+++ b/apps/web/src/styles/globals.css
@@ -35,6 +35,13 @@
--radius: 0.5rem;
+ /** Chart Colors */
+ --chart-1: 12 76% 61%;
+ --chart-2: 173 58% 39%;
+ --chart-3: 197 37% 24%;
+ --chart-4: 43 74% 66%;
+ --chart-5: 27 87% 67%;
+
/* Status Tracker Colors - Radix Color */
--status-degraded: 50 100% 52%; /* Amber 10 */
--status-operational: 131 39% 51%; /* Grass 10 */
@@ -72,11 +79,19 @@
--ring: 217.2 32.6% 17.5%;
+ /* Chart Colors */
+ --chart-1: 220 70% 50%;
+ --chart-2: 160 60% 45%;
+ --chart-3: 30 80% 55%;
+ --chart-4: 280 65% 60%;
+ --chart-5: 340 75% 55%;
+
/* Status Tracker Colors - Radix Color */
--status-degraded: 50 100% 52%; /* Amber 10 */
--status-operational: 131 39% 51%; /* Grass 10 */
--status-down: 11 82% 59%; /* Tomato 10 */
--status-monitoring: 210 100% 62%; /* Blue 10 */
+
}
}
diff --git a/biome.jsonc b/biome.jsonc
index 729147ad6..20515842e 100644
--- a/biome.jsonc
+++ b/biome.jsonc
@@ -17,7 +17,7 @@
"noUnusedVariables": "warn"
},
"nursery": {
- "useSortedClasses": "error"
+ "useSortedClasses": "warn"
}
},
"ignore": [
diff --git a/packages/ui/package.json b/packages/ui/package.json
index f417ea397..00a555f78 100644
--- a/packages/ui/package.json
+++ b/packages/ui/package.json
@@ -53,6 +53,7 @@
"react": "18.3.1",
"react-day-picker": "8.8.2",
"react-hook-form": "7.47.0",
+ "recharts": "^2.12.7",
"tailwind-merge": "1.14.0",
"tailwindcss-animate": "1.0.7",
"zod": "3.23.8"
diff --git a/packages/ui/src/components/chart.tsx b/packages/ui/src/components/chart.tsx
new file mode 100644
index 000000000..5d451bd45
--- /dev/null
+++ b/packages/ui/src/components/chart.tsx
@@ -0,0 +1,365 @@
+"use client";
+
+import * as React from "react";
+import * as RechartsPrimitive from "recharts";
+
+import { cn } from "@/lib/utils";
+
+// Format: { THEME_NAME: CSS_SELECTOR }
+const THEMES = { light: "", dark: ".dark" } as const;
+
+export type ChartConfig = {
+ [k in string]: {
+ label?: React.ReactNode;
+ icon?: React.ComponentType;
+ } & (
+ | { color?: string; theme?: never }
+ | { color?: never; theme: Record<keyof typeof THEMES, string> }
+ );
+};
+
+type ChartContextProps = {
+ config: ChartConfig;
+};
+
+const ChartContext = React.createContext<ChartContextProps | null>(null);
+
+function useChart() {
+ const context = React.useContext(ChartContext);
+
+ if (!context) {
+ throw new Error("useChart must be used within a <ChartContainer />");
+ }
+
+ return context;
+}
+
+const ChartContainer = React.forwardRef<
+ HTMLDivElement,
+ React.ComponentProps<"div"> & {
+ config: ChartConfig;
+ children: React.ComponentProps<
+ typeof RechartsPrimitive.ResponsiveContainer
+ >["children"];
+ }
+>(({ id, className, children, config, ...props }, ref) => {
+ const uniqueId = React.useId();
+ const chartId = `chart-${id || uniqueId.replace(/:/g, "")}`;
+
+ return (
+ <ChartContext.Provider value={{ config }}>
+ <div
+ data-chart={chartId}
+ ref={ref}
+ className={cn(
+ "flex aspect-video justify-center text-xs [&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground [&_.recharts-cartesian-grid_line[stroke='#ccc']]:stroke-border/50 [&_.recharts-curve.recharts-tooltip-cursor]:stroke-border [&_.recharts-dot[stroke='#fff']]:stroke-transparent [&_.recharts-layer]:outline-none [&_.recharts-polar-grid_[stroke='#ccc']]:stroke-border [&_.recharts-radial-bar-background-sector]:fill-muted [&_.recharts-rectangle.recharts-tooltip-cursor]:fill-muted [&_.recharts-reference-line_[stroke='#ccc']]:stroke-border [&_.recharts-sector[stroke='#fff']]:stroke-transparent [&_.recharts-sector]:outline-none [&_.recharts-surface]:outline-none",
+ className
+ )}
+ {...props}
+ >
+ <ChartStyle id={chartId} config={config} />
+ <RechartsPrimitive.ResponsiveContainer>
+ {children}
+ </RechartsPrimitive.ResponsiveContainer>
+ </div>
+ </ChartContext.Provider>
+ );
+});
+ChartContainer.displayName = "Chart";
+
+const ChartStyle = ({ id, config }: { id: string; config: ChartConfig }) => {
+ const colorConfig = Object.entries(config).filter(
+ ([_, config]) => config.theme || config.color
+ );
+
+ if (!colorConfig.length) {
+ return null;
+ }
+
+ return (
+ <style
+ dangerouslySetInnerHTML={{
+ __html: Object.entries(THEMES)
+ .map(
+ ([theme, prefix]) => `
+${prefix} [data-chart=${id}] {
+${colorConfig
+ .map(([key, itemConfig]) => {
+ const color =
+ itemConfig.theme?.[theme as keyof typeof itemConfig.theme] ||
+ itemConfig.color;
+ return color ? ` --color-${key}: ${color};` : null;
+ })
+ .join("\n")}
+}
+`
+ )
+ .join("\n"),
+ }}
+ />
+ );
+};
+
+const ChartTooltip = RechartsPrimitive.Tooltip;
+
+const ChartTooltipContent = React.forwardRef<
+ HTMLDivElement,
+ React.ComponentProps<typeof RechartsPrimitive.Tooltip> &
+ React.ComponentProps<"div"> & {
+ hideLabel?: boolean;
+ hideIndicator?: boolean;
+ indicator?: "line" | "dot" | "dashed";
+ nameKey?: string;
+ labelKey?: string;
+ }
+>(
+ (
+ {
+ active,
+ payload,
+ className,
+ indicator = "dot",
+ hideLabel = false,
+ hideIndicator = false,
+ label,
+ labelFormatter,
+ labelClassName,
+ formatter,
+ color,
+ nameKey,
+ labelKey,
+ },
+ ref
+ ) => {
+ const { config } = useChart();
+
+ const tooltipLabel = React.useMemo(() => {
+ if (hideLabel || !payload?.length) {
+ return null;
+ }
+
+ const [item] = payload;
+ const key = `${labelKey || item.dataKey || item.name || "value"}`;
+ const itemConfig = getPayloadConfigFromPayload(config, item, key);
+ const value =
+ !labelKey && typeof label === "string"
+ ? config[label as keyof typeof config]?.label || label
+ : itemConfig?.label;
+
+ if (labelFormatter) {
+ return (
+ <div className={cn("font-medium", labelClassName)}>
+ {labelFormatter(value, payload)}
+ </div>
+ );
+ }
+
+ if (!value) {
+ return null;
+ }
+
+ return <div className={cn("font-medium", labelClassName)}>{value}</div>;
+ }, [
+ label,
+ labelFormatter,
+ payload,
+ hideLabel,
+ labelClassName,
+ config,
+ labelKey,
+ ]);
+
+ if (!active || !payload?.length) {
+ return null;
+ }
+
+ const nestLabel = payload.length === 1 && indicator !== "dot";
+
+ return (
+ <div
+ ref={ref}
+ className={cn(
+ "grid min-w-[8rem] items-start gap-1.5 rounded-lg border border-border/50 bg-background px-2.5 py-1.5 text-xs shadow-xl",
+ className
+ )}
+ >
+ {!nestLabel ? tooltipLabel : null}
+ <div className="grid gap-1.5">
+ {payload.map((item, index) => {
+ const key = `${nameKey || item.name || item.dataKey || "value"}`;
+ const itemConfig = getPayloadConfigFromPayload(config, item, key);
+ const indicatorColor = color || item.payload.fill || item.color;
+
+ return (
+ <div
+ key={item.dataKey}
+ className={cn(
+ "flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5 [&>svg]:text-muted-foreground",
+ indicator === "dot" && "items-center"
+ )}
+ >
+ {formatter && item?.value !== undefined && item.name ? (
+ formatter(item.value, item.name, item, index, item.payload)
+ ) : (
+ <>
+ {itemConfig?.icon ? (
+ <itemConfig.icon />
+ ) : (
+ !hideIndicator && (
+ <div
+ className={cn(
+ "shrink-0 rounded-[2px] border-[--color-border] bg-[--color-bg]",
+ {
+ "h-2.5 w-2.5": indicator === "dot",
+ "w-1": indicator === "line",
+ "w-0 border-[1.5px] border-dashed bg-transparent":
+ indicator === "dashed",
+ "my-0.5": nestLabel && indicator === "dashed",
+ }
+ )}
+ style={
+ {
+ "--color-bg": indicatorColor,
+ "--color-border": indicatorColor,
+ } as React.CSSProperties
+ }
+ />
+ )
+ )}
+ <div
+ className={cn(
+ "flex flex-1 justify-between leading-none",
+ nestLabel ? "items-end" : "items-center"
+ )}
+ >
+ <div className="grid gap-1.5">
+ {nestLabel ? tooltipLabel : null}
+ <span className="text-muted-foreground">
+ {itemConfig?.label || item.name}
+ </span>
+ </div>
+ {item.value && (
+ <span className="font-mono font-medium tabular-nums text-foreground">
+ {item.value.toLocaleString()}
+ </span>
+ )}
+ </div>
+ </>
+ )}
+ </div>
+ );
+ })}
+ </div>
+ </div>
+ );
+ }
+);
+ChartTooltipContent.displayName = "ChartTooltip";
+
+const ChartLegend = RechartsPrimitive.Legend;
+
+const ChartLegendContent = React.forwardRef<
+ HTMLDivElement,
+ React.ComponentProps<"div"> &
+ Pick<RechartsPrimitive.LegendProps, "payload" | "verticalAlign"> & {
+ hideIcon?: boolean;
+ nameKey?: string;
+ }
+>(
+ (
+ { className, hideIcon = false, payload, verticalAlign = "bottom", nameKey },
+ ref
+ ) => {
+ const { config } = useChart();
+
+ if (!payload?.length) {
+ return null;
+ }
+
+ return (
+ <div
+ ref={ref}
+ className={cn(
+ "flex items-center justify-center gap-4",
+ verticalAlign === "top" ? "pb-3" : "pt-3",
+ className
+ )}
+ >
+ {payload.map((item) => {
+ const key = `${nameKey || item.dataKey || "value"}`;
+ const itemConfig = getPayloadConfigFromPayload(config, item, key);
+
+ return (
+ <div
+ key={item.value}
+ className={cn(
+ "flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3 [&>svg]:text-muted-foreground"
+ )}
+ >
+ {itemConfig?.icon && !hideIcon ? (
+ <itemConfig.icon />
+ ) : (
+ <div
+ className="h-2 w-2 shrink-0 rounded-[2px]"
+ style={{
+ backgroundColor: item.color,
+ }}
+ />
+ )}
+ {itemConfig?.label}
+ </div>
+ );
+ })}
+ </div>
+ );
+ }
+);
+ChartLegendContent.displayName = "ChartLegend";
+
+// Helper to extract item config from a payload.
+function getPayloadConfigFromPayload(
+ config: ChartConfig,
+ payload: unknown,
+ key: string
+) {
+ if (typeof payload !== "object" || payload === null) {
+ return undefined;
+ }
+
+ const payloadPayload =
+ "payload" in payload &&
+ typeof payload.payload === "object" &&
+ payload.payload !== null
+ ? payload.payload
+ : undefined;
+
+ let configLabelKey: string = key;
+
+ if (
+ key in payload &&
+ typeof payload[key as keyof typeof payload] === "string"
+ ) {
+ configLabelKey = payload[key as keyof typeof payload] as string;
+ } else if (
+ payloadPayload &&
+ key in payloadPayload &&
+ typeof payloadPayload[key as keyof typeof payloadPayload] === "string"
+ ) {
+ configLabelKey = payloadPayload[
+ key as keyof typeof payloadPayload
+ ] as string;
+ }
+
+ return configLabelKey in config
+ ? config[configLabelKey]
+ : config[key as keyof typeof config];
+}
+
+export {
+ ChartContainer,
+ ChartTooltip,
+ ChartTooltipContent,
+ ChartLegend,
+ ChartLegendContent,
+ ChartStyle,
+};
diff --git a/packages/ui/src/index.tsx b/packages/ui/src/index.tsx
index 5ea2c55d9..7f9d5d009 100644
--- a/packages/ui/src/index.tsx
+++ b/packages/ui/src/index.tsx
@@ -39,3 +39,4 @@ export * from "./components/sonner";
export * from "./components/sortable";
export * from "./components/navigation-menu";
export * from "./components/slider";
+export * from "./components/chart";
diff --git a/packages/utils/index.ts b/packages/utils/index.ts
index 2516ef859..845b41764 100644
--- a/packages/utils/index.ts
+++ b/packages/utils/index.ts
@@ -140,6 +140,16 @@ export type RegionInfo = {
continent: Continent;
};
+// TODO: we could think of doing the inverse and use "EU" as key
+export const continentDict: Record<Continent, { code: string }> = {
+ Europe: { code: "EU" },
+ "North America": { code: "NA" },
+ "South America": { code: "SA" },
+ Asia: { code: "AS" },
+ Africa: { code: "AF" },
+ Oceania: { code: "OC" },
+};
+
export const flyRegionsDict: Record<MonitorFlyRegion, RegionInfo> = {
ams: {
code: "ams",
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index bbae98fe4..b52f63023 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -428,6 +428,9 @@ importers:
reading-time:
specifier: 1.5.0
version: 1.5.0
+ recharts:
+ specifier: 2.12.7
rehype-pretty-code:
specifier: 0.10.0
version: 0.10.0([email protected])
@@ -1087,6 +1090,9 @@ importers:
react-hook-form:
specifier: 7.47.0
version: 7.47.0([email protected])
+ recharts:
+ specifier: ^2.12.7
sonner:
specifier: 1.3.1
@@ -9556,9 +9562,6 @@ packages:
resolution: {integrity: sha512-w89qg7PI8wAdvX60bMDP+bFoD5Dvhm9oLheFp5O4a2QF0cSBGsBX4qZmadPMvVqlLJBBci+WqGGOAPvcDeNSVg==}
- resolution: {integrity: sha512-AD5ih2NlSssTCwsMznbvwMZpJ1cbhkGd2uueNxzv2jDlEeZdU04JQfRnggJQ8DrcVBGjAsCKwFBbDlVNtEMlzw==}
-
resolution: {integrity: sha512-+FbBPE1o9QAYvviau/qC5SE3caw21q3xkvWKBtja5vgqOWIHHJ3ioaq1VPfn/Szqctz2bU/oYeKd9/z5BL+PVg==}
@@ -19923,7 +19926,7 @@ snapshots:
react-is: 16.13.1
recharts-scale: 0.4.5
- tiny-invariant: 1.3.1
+ tiny-invariant: 1.3.3
victory-vendor: 36.6.11
@@ -20774,8 +20777,6 @@ snapshots:
-