Skip to content

Open-source status page, incident response and uptime monitoring

chore: upgrade cmdk and improve region preset (#918)

Maximilian Kaske726db2f794b4
diff --git a/apps/web/package.json b/apps/web/package.json
index 4e04f4c11..8a061e895 100644
--- a/apps/web/package.json
+++ b/apps/web/package.json
@@ -56,7 +56,7 @@
"@vercel/blob": "0.23.3",
"class-variance-authority": "0.7.0",
"clsx": "2.0.0",
- "cmdk": "0.2.0",
+ "cmdk": "1.0.0",
"cobe": "0.6.3",
"contentlayer": "0.3.4",
"date-fns": "2.30.0",
diff --git a/apps/web/src/app/_components/input-search.tsx b/apps/web/src/app/_components/input-search.tsx
index b0319b083..e88f78ad6 100644
--- a/apps/web/src/app/_components/input-search.tsx
+++ b/apps/web/src/app/_components/input-search.tsx
@@ -11,6 +11,7 @@ import {
CommandEmpty,
CommandGroup,
CommandItem,
+ CommandList,
} from "@openstatus/ui";
// TODO: once stable, use the shallow route to store the search params inside of the search params
@@ -32,17 +33,14 @@ export function InputSearch({
const searchparams = inputValue
.trim()
.split(" ")
- .reduce(
- (prev, curr) => {
- const [name, value] = curr.split(":");
- if (value && name && curr !== currentWord) {
- // TODO: support multiple value with value.split(",")
- prev[name] = value;
- }
- return prev;
- },
- {} as Record<string, string>,
- );
+ .reduce((prev, curr) => {
+ const [name, value] = curr.split(":");
+ if (value && name && curr !== currentWord) {
+ // TODO: support multiple value with value.split(",")
+ prev[name] = value;
+ }
+ return prev;
+ }, {} as Record<string, string>);
onSearch(searchparams);
}, [onSearch, inputValue, currentWord]);
@@ -63,9 +61,9 @@ export function InputSearch({
status: (number | null)[];
limit: number[];
region: string[];
- },
+ }
),
- [events],
+ [events]
);
type SearchKey = keyof typeof search;
@@ -110,74 +108,76 @@ export function InputSearch({
<div className="relative mt-2">
{open ? (
<div className="absolute top-0 z-10 w-full animate-in rounded-md border bg-popover text-popover-foreground shadow-md outline-none">
- <CommandGroup className="max-h-64 overflow-auto">
- {Object.keys(search).map((key) => {
- if (
- inputValue.includes(`${key}:`) &&
- !currentWord.includes(`${key}:`)
- )
- return null;
- return (
- <React.Fragment key={key}>
- <CommandItem
- value={key}
- onMouseDown={(e) => {
- e.preventDefault();
- e.stopPropagation();
- }}
- onSelect={(value) => {
- setInputValue((prev) => {
- if (currentWord.trim() === "") {
- const input = `${prev}${value}`;
+ <CommandList>
+ <CommandGroup className="max-h-64 overflow-auto">
+ {Object.keys(search).map((key) => {
+ if (
+ inputValue.includes(`${key}:`) &&
+ !currentWord.includes(`${key}:`)
+ )
+ return null;
+ return (
+ <React.Fragment key={key}>
+ <CommandItem
+ value={key}
+ onMouseDown={(e) => {
+ e.preventDefault();
+ e.stopPropagation();
+ }}
+ onSelect={(value) => {
+ setInputValue((prev) => {
+ if (currentWord.trim() === "") {
+ const input = `${prev}${value}`;
+ return `${input}:`;
+ }
+ // lots of cheat
+ const isStarting = currentWord === prev;
+ const prefix = isStarting ? "" : " ";
+ const input = prev.replace(
+ `${prefix}${currentWord}`,
+ `${prefix}${value}`
+ );
return `${input}:`;
- }
- // lots of cheat
- const isStarting = currentWord === prev;
- const prefix = isStarting ? "" : " ";
- const input = prev.replace(
- `${prefix}${currentWord}`,
- `${prefix}${value}`,
- );
- return `${input}:`;
- });
- setCurrentWord(`${value}:`);
- }}
- className="group"
- >
- {key}
- <span className="ml-1 hidden truncate text-muted-foreground/90 group-aria-[selected=true]:block">
- {search[key as SearchKey]
- .map((str) => `[${str}]`)
- .join(" ")}
- </span>
- </CommandItem>
- {search[key as SearchKey].map((option) => {
- return (
- <SubItem
- key={option}
- value={`${key}:${option}`}
- onMouseDown={(e) => {
- e.preventDefault();
- e.stopPropagation();
- }}
- onSelect={(value) => {
- setInputValue((prev) => {
- const input = prev.replace(currentWord, value);
- return `${input.trim()} `;
- });
- setCurrentWord("");
- }}
- {...{ currentWord }}
- >
- {option}
- </SubItem>
- );
- })}
- </React.Fragment>
- );
- })}
- </CommandGroup>
- <CommandEmpty>No results found.</CommandEmpty>
+ });
+ setCurrentWord(`${value}:`);
+ }}
+ className="group"
+ >
+ {key}
+ <span className="ml-1 hidden truncate text-muted-foreground/90 group-aria-[selected=true]:block">
+ {search[key as SearchKey]
+ .map((str) => `[${str}]`)
+ .join(" ")}
+ </span>
+ </CommandItem>
+ {search[key as SearchKey].map((option) => {
+ return (
+ <SubItem
+ key={option}
+ value={`${key}:${option}`}
+ onMouseDown={(e) => {
+ e.preventDefault();
+ e.stopPropagation();
+ }}
+ onSelect={(value) => {
+ setInputValue((prev) => {
+ const input = prev.replace(currentWord, value);
+ return `${input.trim()} `;
+ });
+ setCurrentWord("");
+ }}
+ {...{ currentWord }}
+ >
+ {option}
+ </SubItem>
+ );
+ })}
+ </React.Fragment>
+ );
+ })}
+ </CommandGroup>
+ <CommandEmpty>No results found.</CommandEmpty>
+ </CommandList>
</div>
) : null}
</div>
diff --git a/apps/web/src/app/play/status/_components/timezone-combobox.tsx b/apps/web/src/app/play/status/_components/timezone-combobox.tsx
index 68fad1c4e..2a8f0396e 100644
--- a/apps/web/src/app/play/status/_components/timezone-combobox.tsx
+++ b/apps/web/src/app/play/status/_components/timezone-combobox.tsx
@@ -11,6 +11,7 @@ import {
CommandGroup,
CommandInput,
CommandItem,
+ CommandList,
Popover,
PopoverContent,
PopoverTrigger,
@@ -60,40 +61,42 @@ export function TimezoneCombobox({ defaultValue }: { defaultValue?: string }) {
<PopoverContent className="w-[300px] p-0">
<Command>
<CommandInput placeholder="Search timezone..." />
- <CommandEmpty>No timezone found.</CommandEmpty>
- <CommandGroup className="max-h-[300px] overflow-y-auto">
- {timezones.map((timezone) => (
- <CommandItem
- key={timezone.value}
- value={timezone.value}
- onSelect={(currentValue) => {
- setOpen(false);
+ <CommandList>
+ <CommandEmpty>No timezone found.</CommandEmpty>
+ <CommandGroup className="max-h-[300px] overflow-y-auto">
+ {timezones.map((timezone) => (
+ <CommandItem
+ key={timezone.value}
+ value={timezone.value}
+ onSelect={(currentValue) => {
+ setOpen(false);
- // update search params
- const searchParams = updateSearchParams({
- timezone:
- currentValue === value
- ? null // remove search param and use default timezone
- : timezones.find(
- (timezone) => timezone.value === currentValue,
- )?.label || null,
- });
+ // update search params
+ const searchParams = updateSearchParams({
+ timezone:
+ currentValue === value
+ ? null // remove search param and use default timezone
+ : timezones.find(
+ (timezone) => timezone.value === currentValue
+ )?.label || null,
+ });
- // refresh page with new search params
- router.replace(`${pathname}?${searchParams}`);
- router.refresh();
- }}
- >
- <Check
- className={cn(
- "mr-2 h-4 w-4",
- value === timezone.value ? "opacity-100" : "opacity-0",
- )}
- />
- {timezone.label}
- </CommandItem>
- ))}
- </CommandGroup>
+ // refresh page with new search params
+ router.replace(`${pathname}?${searchParams}`);
+ router.refresh();
+ }}
+ >
+ <Check
+ className={cn(
+ "mr-2 h-4 w-4",
+ value === timezone.value ? "opacity-100" : "opacity-0"
+ )}
+ />
+ {timezone.label}
+ </CommandItem>
+ ))}
+ </CommandGroup>
+ </CommandList>
</Command>
</PopoverContent>
</Popover>
diff --git a/apps/web/src/components/forms/monitor-form.tsx b/apps/web/src/components/forms/monitor-form.tsx
index 32004e1b3..dcb24cd54 100644
--- a/apps/web/src/components/forms/monitor-form.tsx
+++ b/apps/web/src/components/forms/monitor-form.tsx
@@ -32,6 +32,7 @@ import {
CommandGroup,
CommandInput,
CommandItem,
+ CommandList,
Dialog,
DialogContent,
DialogDescription,
@@ -505,47 +506,52 @@ export function MonitorForm({
<PopoverContent className="w-full p-0">
<Command>
<CommandInput placeholder="Select a region..." />
- <CommandEmpty>No regions found.</CommandEmpty>
- <CommandGroup className="max-h-[150px] overflow-y-scroll">
- {Object.keys(flyRegionsDict).map(
- (region) => {
- const { code, location } =
- flyRegionsDict[
- region as keyof typeof flyRegionsDict
- ];
- const isSelected =
- field.value?.includes(code);
- return (
- <CommandItem
- value={code}
- key={code}
- onSelect={() => {
- const currentRegions =
- form.getValues("regions") || [];
- form.setValue(
- "regions",
- currentRegions.includes(code)
- ? currentRegions.filter(
- (r) => r !== code
- )
- : [...currentRegions, code]
- );
- }}
- >
- <Check
- className={cn(
- "mr-2 h-4 w-4",
- isSelected
- ? "opacity-100"
- : "opacity-0"
- )}
- />
- {location}
- </CommandItem>
- );
- }
- )}
- </CommandGroup>
+ <CommandList>
+ <CommandEmpty>
+ No regions found.
+ </CommandEmpty>
+ <CommandGroup className="max-h-[150px] overflow-y-scroll">
+ {Object.keys(flyRegionsDict).map(
+ (region) => {
+ const { code, location } =
+ flyRegionsDict[
+ region as keyof typeof flyRegionsDict
+ ];
+ const isSelected =
+ field.value?.includes(code);
+ return (
+ <CommandItem
+ value={code}
+ key={code}
+ onSelect={() => {
+ const currentRegions =
+ form.getValues("regions") ||
+ [];
+ form.setValue(
+ "regions",
+ currentRegions.includes(code)
+ ? currentRegions.filter(
+ (r) => r !== code
+ )
+ : [...currentRegions, code]
+ );
+ }}
+ >
+ <Check
+ className={cn(
+ "mr-2 h-4 w-4",
+ isSelected
+ ? "opacity-100"
+ : "opacity-0"
+ )}
+ />
+ {location}
+ </CommandItem>
+ );
+ }
+ )}
+ </CommandGroup>
+ </CommandList>
</Command>
</PopoverContent>
</Popover>
diff --git a/apps/web/src/components/forms/status-page/section-monitor.tsx b/apps/web/src/components/forms/status-page/section-monitor.tsx
index e08f75373..0f8089986 100644
--- a/apps/web/src/components/forms/status-page/section-monitor.tsx
+++ b/apps/web/src/components/forms/status-page/section-monitor.tsx
@@ -13,6 +13,7 @@ import {
CommandGroup,
CommandInput,
CommandItem,
+ CommandList,
Popover,
PopoverContent,
PopoverTrigger,
@@ -64,43 +65,48 @@ export function SectionMonitor({ form, monitors }: Props) {
<PopoverContent side="bottom" className="w-[240px] p-0">
<Command>
<CommandInput placeholder="Select monitors..." className="h-9" />
- <CommandEmpty>No monitors found.</CommandEmpty>
- <CommandGroup>
- {monitors?.map((monitor) => (
- <CommandItem
- key={monitor.id}
- value={String(monitor.id)}
- onSelect={(currentValue) => {
- const monitorIndex = watchMonitors.findIndex(
- (m) => m.monitorId === Number.parseInt(currentValue),
- );
- if (monitorIndex !== -1) {
- remove(monitorIndex);
- } else {
- append({
- monitorId: monitor.id,
- order: fields.length + 1,
- });
- }
- }}
- >
- <div className="truncate">
- <p>{monitor.name}</p>
- {/* <p className="text-muted-foreground truncate text-xs">
+ <CommandList>
+ <CommandEmpty>No monitors found.</CommandEmpty>
+ <CommandGroup>
+ {monitors?.map((monitor) => (
+ <CommandItem
+ key={monitor.id}
+ value={`${monitor.name}-${String(monitor.id)}`}
+ keywords={[monitor.name]}
+ onSelect={(currentValue) => {
+ const splitValue = currentValue.split("-");
+ const id = splitValue?.[splitValue.length - 1];
+ const monitorIndex = watchMonitors.findIndex(
+ (m) => m.monitorId === Number.parseInt(id)
+ );
+ if (monitorIndex !== -1) {
+ remove(monitorIndex);
+ } else {
+ append({
+ monitorId: monitor.id,
+ order: fields.length + 1,
+ });
+ }
+ }}
+ >
+ <div className="truncate">
+ <p>{monitor.name}</p>
+ {/* <p className="text-muted-foreground truncate text-xs">
{monitor.url}
</p> */}
- </div>
- <CheckIcon
- className={cn(
- "ml-auto h-4 w-4 shrink-0",
- watchMonitors.some((m) => m.monitorId === monitor.id)
- ? "opacity-100"
- : "opacity-0",
- )}
- />
- </CommandItem>
- ))}
- </CommandGroup>
+ </div>
+ <CheckIcon
+ className={cn(
+ "ml-auto h-4 w-4 shrink-0",
+ watchMonitors.some((m) => m.monitorId === monitor.id)
+ ? "opacity-100"
+ : "opacity-0"
+ )}
+ />
+ </CommandItem>
+ ))}
+ </CommandGroup>
+ </CommandList>
</Command>
</PopoverContent>
</Popover>
@@ -120,7 +126,7 @@ export function SectionMonitor({ form, monitors }: Props) {
<div className="w-full space-y-2">
{fields.map((field) => {
const monitor = monitors?.find(
- ({ id }) => field.monitorId === id,
+ ({ id }) => field.monitorId === id
);
if (!monitor) return null;
return (
diff --git a/apps/web/src/components/monitor-dashboard/region-preset.tsx b/apps/web/src/components/monitor-dashboard/region-preset.tsx
index 981234013..c576d2fcc 100644
--- a/apps/web/src/components/monitor-dashboard/region-preset.tsx
+++ b/apps/web/src/components/monitor-dashboard/region-preset.tsx
@@ -1,19 +1,28 @@
"use client";
-import { Globe2 } from "lucide-react";
+import { Check, ChevronsUpDown, Globe2 } from "lucide-react";
import { usePathname, useRouter } from "next/navigation";
import * as React from "react";
import type { Region } from "@openstatus/tinybird";
import {
Button,
- DropdownMenu,
- DropdownMenuCheckboxItem,
- DropdownMenuContent,
- DropdownMenuSeparator,
- DropdownMenuTrigger,
+ Command,
+ CommandEmpty,
+ CommandGroup,
+ CommandInput,
+ CommandItem,
+ CommandList,
+ CommandSeparator,
+ Popover,
+ PopoverContent,
+ PopoverTrigger,
} from "@openstatus/ui";
-import { flyRegionsDict } from "@openstatus/utils";
+import {
+ type Continent,
+ type RegionInfo,
+ flyRegionsDict,
+} from "@openstatus/utils";
import useUpdateSearchParams from "@/hooks/use-update-search-params";
import { cn } from "@/lib/utils";
@@ -32,58 +41,112 @@ export function RegionsPreset({
const pathname = usePathname();
const updateSearchParams = useUpdateSearchParams();
- function onOpenChange(open: boolean) {
- if (!open) {
+ const allSelected = regions.every((r) => selected.includes(r));
+
+ React.useEffect(() => {
+ if (!allSelected) {
const searchParams = updateSearchParams({ regions: selected.join(",") });
router.replace(`${pathname}?${searchParams}`, { scroll: false });
+ } else if (allSelected) {
+ const searchParams = updateSearchParams({ regions: null });
+ router.replace(`${pathname}?${searchParams}`, { scroll: false });
}
- }
+ }, [allSelected, router, pathname, updateSearchParams, selected]);
- const allSelected = regions.every((r) => selected.includes(r));
+ const regionsByContinent = regions.reduce((prev, curr) => {
+ const region = flyRegionsDict[curr];
+
+ if (prev[region.continent]) {
+ prev[region.continent].push(region);
+ } else {
+ prev[region.continent] = [region];
+ }
+
+ return prev;
+ }, {} as Record<Continent, RegionInfo[]>);
return (
- <DropdownMenu onOpenChange={onOpenChange}>
- <DropdownMenuTrigger asChild>
+ <Popover>
+ <PopoverTrigger asChild>
<Button
size="lg"
variant="outline"
className={cn("px-3 shadow-none", className)}
>
- <span className="flex items-center gap-2">
- <Globe2 className="h-4 w-4" />
+ <Globe2 className="mr-2 h-4 w-4" />
+ <span>
<code>{selected.length}</code> Regions
</span>
+ <ChevronsUpDown className="ml-2 h-4 w-4 shrink-0 opacity-50" />
</Button>
- </DropdownMenuTrigger>
- <DropdownMenuContent>
- <DropdownMenuCheckboxItem
- checked={allSelected}
- onCheckedChange={(checked) => setSelected(checked ? regions : [])}
+ </PopoverTrigger>
+ <PopoverContent className="p-0" align="start">
+ <Command
+ // FIXME: keywords not taken - it would be great to search for "Europe"
+ // filter={(value, search, keywords) => {
+ // const extendValue = `${value} ${keywords?.join(" ") || ""}`;
+ // if (extendValue.includes(search)) return 1;
+ // return 0;
+ // }}
>
- All regions
- </DropdownMenuCheckboxItem>
- <DropdownMenuSeparator />
- {regions.map((region) => {
- const { code, flag } = flyRegionsDict[region];
- return (
- <DropdownMenuCheckboxItem
- key={region}
- onSelect={(e) => e.preventDefault()}
- checked={selected.includes(region)}
- onCheckedChange={(checked) => {
- setSelected((prev) =>
- checked
- ? [...prev, region]
- : prev.filter((r) => r !== region),
- );
- }}
- className="font-mono"
- >
- {flag} {code}
- </DropdownMenuCheckboxItem>
- );
- })}
- </DropdownMenuContent>
- </DropdownMenu>
+ <CommandInput placeholder="Search regions..." />
+ <CommandList className="max-h-64">
+ <CommandEmpty>No results found.</CommandEmpty>
+ <CommandGroup>
+ <CommandItem
+ onSelect={() => setSelected(allSelected ? [] : regions)}
+ >
+ {allSelected ? "Clear all" : "Select all"}
+ </CommandItem>
+ </CommandGroup>
+ <CommandSeparator />
+ {Object.entries(regionsByContinent).map(([key, regions]) => {
+ return (
+ <CommandGroup key={key} heading={key}>
+ {regions.map((region) => {
+ const { code, flag, location, continent } = region;
+ const isSelected = selected.includes(code);
+ return (
+ <CommandItem
+ key={code}
+ value={code}
+ keywords={[code, location, continent]}
+ onSelect={(checked) => {
+ setSelected((prev) =>
+ !prev.includes(checked as Region)
+ ? [...prev, code]
+ : prev.filter((r) => r !== code)
+ );
+ }}
+ >
+ <div
+ className={cn(
+ "mr-2 flex h-4 w-4 items-center justify-center rounded-sm border border-primary",
+ isSelected
+ ? "bg-primary text-primary-foreground"
+ : "opacity-50 [&_svg]:invisible"
+ )}
+ >
+ <Check className={cn("h-4 w-4")} />
+ </div>
+ <div className="flex w-full justify-between">
+ <span>
+ {code}{" "}
+ <span className="truncate text-muted-foreground">
+ {location}
+ </span>
+ </span>
+ <span>{flag}</span>
+ </div>
+ </CommandItem>
+ );
+ })}
+ </CommandGroup>
+ );
+ })}
+ </CommandList>
+ </Command>
+ </PopoverContent>
+ </Popover>
);
}
diff --git a/packages/ui/package.json b/packages/ui/package.json
index 6f688d1f1..8b2639d0f 100644
--- a/packages/ui/package.json
+++ b/packages/ui/package.json
@@ -44,7 +44,7 @@
"@radix-ui/react-tooltip": "1.0.7",
"class-variance-authority": "0.7.0",
"clsx": "2.0.0",
- "cmdk": "0.2.0",
+ "cmdk": "1.0.0",
"date-fns": "2.30.0",
"lucide-react": "0.279.0",
"luxon": "3.3.0",
diff --git a/packages/ui/src/components/command.tsx b/packages/ui/src/components/command.tsx
index c97dc64a3..da2732d2a 100644
--- a/packages/ui/src/components/command.tsx
+++ b/packages/ui/src/components/command.tsx
@@ -16,7 +16,7 @@ const Command = React.forwardRef<
ref={ref}
className={cn(
"bg-popover text-popover-foreground flex h-full w-full flex-col overflow-hidden rounded-md",
- className,
+ className
)}
{...props}
/>
@@ -47,7 +47,7 @@ const CommandInput = React.forwardRef<
ref={ref}
className={cn(
"placeholder:text-foreground-muted flex h-11 w-full rounded-md bg-transparent py-3 text-sm outline-none disabled:cursor-not-allowed disabled:opacity-50",
- className,
+ className
)}
{...props}
/>
@@ -90,7 +90,7 @@ const CommandGroup = React.forwardRef<
ref={ref}
className={cn(
"text-foreground [&_[cmdk-group-heading]]:text-muted-foreground overflow-hidden p-1 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium",
- className,
+ className
)}
{...props}
/>
@@ -117,8 +117,8 @@ const CommandItem = React.forwardRef<
<CommandPrimitive.Item
ref={ref}
className={cn(
- "aria-selected:bg-accent aria-selected:text-accent-foreground relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
- className,
+ "aria-selected:bg-accent aria-selected:text-accent-foreground relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[disabled='true']:pointer-events-none data-[disabled='true']:opacity-50",
+ className
)}
{...props}
/>
@@ -134,7 +134,7 @@ const CommandShortcut = ({
<span
className={cn(
"text-muted-foreground ml-auto text-xs tracking-widest",
- className,
+ className
)}
{...props}
/>
diff --git a/packages/ui/src/components/multi-select.tsx b/packages/ui/src/components/multi-select.tsx
index adbd0016d..8de5b0fdb 100644
--- a/packages/ui/src/components/multi-select.tsx
+++ b/packages/ui/src/components/multi-select.tsx
@@ -5,7 +5,7 @@ import { X } from "lucide-react";
import * as React from "react";
import { Badge } from "./badge";
-import { Command, CommandGroup, CommandItem } from "./command";
+import { Command, CommandGroup, CommandItem, CommandList } from "./command";
type Option = Record<"value" | "label", string | number>;
@@ -48,7 +48,7 @@ export const MultiSelect = ({
}
}
},
- [],
+ []
);
const selectables = options.filter((option) => !selected.includes(option));
@@ -102,26 +102,29 @@ export const MultiSelect = ({
<div className="relative mt-2">
{open && selectables.length > 0 ? (
<div className="bg-popover text-popover-foreground animate-in absolute top-0 z-10 w-full rounded-md border shadow-md outline-none">
- <CommandGroup className="h-full overflow-auto">
- {selectables.map((option) => {
- return (
- <CommandItem
- key={option.value}
- onMouseDown={(e) => {
- e.preventDefault();
- e.stopPropagation();
- }}
- onSelect={(_value) => {
- setInputValue("");
- setSelected((prev) => [...prev, option]);
- }}
- className={"cursor-pointer"}
- >
- {option.label}
- </CommandItem>
- );
- })}
- </CommandGroup>
+ <CommandList>
+ <CommandGroup className="h-full overflow-auto">
+ {selectables.map((option) => {
+ return (
+ <CommandItem
+ key={option.value}
+ onMouseDown={(e) => {
+ e.preventDefault();
+ e.stopPropagation();
+ }}
+ onSelect={(_value) => {
+ setInputValue("");
+ setSelected((prev) => [...prev, option]);
+ }}
+ value={String(option.label)}
+ className={"cursor-pointer"}
+ >
+ {option.label}
+ </CommandItem>
+ );
+ })}
+ </CommandGroup>
+ </CommandList>
</div>
) : null}
</div>
diff --git a/packages/utils/index.ts b/packages/utils/index.ts
index 2858d5475..e4cde27c2 100644
--- a/packages/utils/index.ts
+++ b/packages/utils/index.ts
@@ -125,21 +125,22 @@ import type { MonitorFlyRegion } from "@openstatus/db/src/schema";
// },
// } as const;
-export const flyRegionsDict: Record<
- MonitorFlyRegion,
- {
- code: MonitorFlyRegion;
- location: string;
- flag: string;
- continent:
- | "Europe"
- | "North America"
- | "South America"
- | "Asia"
- | "Africa"
- | "Oceania";
- }
-> = {
+export type Continent =
+ | "Europe"
+ | "North America"
+ | "South America"
+ | "Asia"
+ | "Africa"
+ | "Oceania";
+
+export type RegionInfo = {
+ code: MonitorFlyRegion;
+ location: string;
+ flag: string;
+ continent: Continent;
+};
+
+export const flyRegionsDict: Record<MonitorFlyRegion, RegionInfo> = {
ams: {
code: "ams",
location: "Amsterdam, Netherlands",
@@ -391,7 +392,7 @@ export const groupByContinent = Object.entries(flyRegionsDict).reduce<
Oceania: [],
Asia: [],
Africa: [],
- }
+ },
);
export const vercelRegions = [
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 11d26d571..f867ef475 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -372,8 +372,8 @@ importers:
specifier: 2.0.0
version: 2.0.0
cmdk:
- specifier: 0.2.0
+ specifier: 1.0.0
cobe:
specifier: 0.6.3
version: 0.6.3
@@ -1086,8 +1086,8 @@ importers:
specifier: 2.0.0
version: 2.0.0
cmdk:
- specifier: 0.2.0
+ specifier: 1.0.0
date-fns:
specifier: 2.30.0
version: 2.30.0
@@ -2864,9 +2864,6 @@ packages:
'@radix-ui/[email protected]':
resolution: {integrity: sha512-T5gIdVO2mmPW3NNhjNgEP3cqMXjXL9UbO0BzWcXfvdBs+BohbQxvd/K5hSVKmn9/lbTdsQVKbUcP5WLCwvUbBg==}
- '@radix-ui/[email protected]':
- resolution: {integrity: sha512-3e7rn8FDMin4CgeL7Z/49smCA3rFYY3Ha2rUQ7HRWFadS5iCRw08ZgVT1LaNTCNqgvrUiyczLflrVrF0SRQtNA==}
-
'@radix-ui/[email protected]':
resolution: {integrity: sha512-yQ8oGX2GVsEYMWGxcovu1uGWPCxV5BFfeeYxqPmuAzUyLT9qmaMXSAhXpb0WrspIeqYzdJpkh2vHModJPgRIaw==}
@@ -2988,11 +2985,6 @@ packages:
'@types/react-dom':
optional: true
- '@radix-ui/[email protected]':
- resolution: {integrity: sha512-1pVM9RfOQ+n/N5PJK33kRSKsr1glNxomxONs5c49MliinBY6Yw2Q995qfBUUo0/Mbg05B/sGA0gkgPI7kmSHBg==}
- peerDependencies:
- react: ^16.8 || ^17.0 || ^18.0
-
'@radix-ui/[email protected]':
resolution: {integrity: sha512-ebbrdFoYTcuZ0v4wG5tedGnp9tzcV8awzsxYph7gXUyvnNLuTIcCk1q17JEbnVhXAKG9oX3KtchwiMIAYp9NLg==}
peerDependencies:
@@ -3002,12 +2994,6 @@ packages:
'@types/react':
optional: true
- '@radix-ui/[email protected]':
- resolution: {integrity: sha512-Yn9YU+QlHYLWwV1XfKiqnGVpWYWk6MeBVM6x/bcoyPvxgjQGoeT35482viLPctTMWoMw0PoHgqfSox7Ig+957Q==}
- peerDependencies:
- react: ^16.8 || ^17.0 || ^18.0
- react-dom: ^16.8 || ^17.0 || ^18.0
-
'@radix-ui/[email protected]':
resolution: {integrity: sha512-hJtRy/jPULGQZceSAP2Re6/4NpKo8im6V8P2hUqZsdFiSL8l35kYsw3qbRI6Ay5mQd2+wlLqje770eq+RJ3yZg==}
peerDependencies:
@@ -3043,12 +3029,6 @@ packages:
'@types/react':
optional: true
- '@radix-ui/[email protected]':
- resolution: {integrity: sha512-n7kDRfx+LB1zLueRDvZ1Pd0bxdJWDUZNQ/GWoxDn2prnuJKRdxsjulejX/ePkOsLi2tTm6P24mDqlMSgQpsT6g==}
- peerDependencies:
- react: ^16.8 || ^17.0 || ^18.0
- react-dom: ^16.8 || ^17.0 || ^18.0
-
'@radix-ui/[email protected]':
resolution: {integrity: sha512-7UpBa/RKMoHJYjie1gkF1DlK8l1fdU/VKDpoS3rCCo8YBJR294GwcEHyxHw72yvphJ7ld0AXEcSLAzY2F/WyCg==}
peerDependencies:
@@ -3088,11 +3068,6 @@ packages:
'@types/react-dom':
optional: true
- '@radix-ui/[email protected]':
- resolution: {integrity: sha512-UagjDk4ijOAnGu4WMUPj9ahi7/zJJqNZ9ZAiGPp7waUWJO0O1aWXi/udPphI0IUjvrhBsZJGSN66dR2dsueLWQ==}
- peerDependencies:
- react: ^16.8 || ^17.0 || ^18.0
-
'@radix-ui/[email protected]':
resolution: {integrity: sha512-Rect2dWbQ8waGzhMavsIbmSVCgYxkXLxxR3ZvCX79JOglzdEy4JXMb98lq4hPxUbLr77nP0UOGf4rcMU+s1pUA==}
peerDependencies:
@@ -3102,12 +3077,6 @@ packages:
'@types/react':
optional: true
- '@radix-ui/[email protected]':
- resolution: {integrity: sha512-C4SWtsULLGf/2L4oGeIHlvWQx7Rf+7cX/vKOAD2dXW0A1b5QXwi3wWeaEgW+wn+SEVrraMUk05vLU9fZZz5HbQ==}
- peerDependencies:
- react: ^16.8 || ^17.0 || ^18.0
- react-dom: ^16.8 || ^17.0 || ^18.0
-
'@radix-ui/[email protected]':
resolution: {integrity: sha512-upXdPfqI4islj2CslyfUBNlaJCPybbqRHAi1KER7Isel9Q2AtSJ0zRBZv8mWQiFXD2nyAJ4BhC3yXgZ6kMBSrQ==}
peerDependencies:
@@ -3147,11 +3116,6 @@ packages:
'@types/react-dom':
optional: true
- '@radix-ui/[email protected]':
- resolution: {integrity: sha512-Q6iAB/U7Tq3NTolBBQbHTgclPmGWE3OlktGGqrClPozSw4vkQ1DfQAOtzgRPecKsMdJINE05iaoDUG8tRzCBjw==}
- peerDependencies:
- react: ^16.8 || ^17.0 || ^18.0
-
'@radix-ui/[email protected]':
resolution: {integrity: sha512-tI7sT/kqYp8p96yGWY1OAnLHrqDgzHefRBKQ2YAkBS5ja7QLcZ9Z/uY7bEjPUatf8RomoXM8/1sMj1IJaE5UzQ==}
peerDependencies:
@@ -3213,12 +3177,6 @@ packages:
'@types/react-dom':
optional: true
- '@radix-ui/[email protected]':
- resolution: {integrity: sha512-a8qyFO/Xb99d8wQdu4o7qnigNjTPG123uADNecz0eX4usnQEj7o+cG4ZX4zkqq98NYekT7UoEQIjxBNWIFuqTA==}
- peerDependencies:
- react: ^16.8 || ^17.0 || ^18.0
- react-dom: ^16.8 || ^17.0 || ^18.0
-
'@radix-ui/[email protected]':
resolution: {integrity: sha512-xLYZeHrWoPmA5mEKEfZZevoVRK/Q43GfzRXkWV6qawIWWK8t6ifIiLQdd7rmQ4Vk1bmI21XhqF9BN3jWf+phpA==}
peerDependencies:
@@ -3245,12 +3203,6 @@ packages:
'@types/react-dom':
optional: true
- '@radix-ui/[email protected]':
- resolution: {integrity: sha512-A+6XEvN01NfVWiKu38ybawfHsBjWum42MRPnEuqPsBZ4eV7e/7K321B5VgYMPv3Xx5An6o1/l9ZuDBgmcmWK3w==}
- peerDependencies:
- react: ^16.8 || ^17.0 || ^18.0
- react-dom: ^16.8 || ^17.0 || ^18.0
-
'@radix-ui/[email protected]':
resolution: {integrity: sha512-UXLW4UAbIY5ZjcvzjfRFo5gxva8QirC9hF7wRE4U5gz+TP0DbRk+//qyuAQ1McDxBt1xNMBTaciFGvEmJvAZCg==}
peerDependencies:
@@ -3264,12 +3216,6 @@ packages:
'@types/react-dom':
optional: true
- '@radix-ui/[email protected]':
- resolution: {integrity: sha512-EyXe6mnRlHZ8b6f4ilTDrXmkLShICIuOTTj0GX4w1rp+wSxf3+TD05u1UOITC8VsJ2a9nwHvdXtOXEOl0Cw/zQ==}
- peerDependencies:
- react: ^16.8 || ^17.0 || ^18.0
- react-dom: ^16.8 || ^17.0 || ^18.0
-
'@radix-ui/[email protected]':
resolution: {integrity: sha512-yi58uVyoAcK/Nq1inRY56ZSjKypBNKTa/1mcL8qdl6oJeEaDbOldlzrGn7P6Q3Id5d+SYNGc5AJgc4vGhjs5+g==}
peerDependencies:
@@ -3414,11 +3360,6 @@ packages:
'@types/react-dom':
optional: true
- '@radix-ui/[email protected]':
- resolution: {integrity: sha512-GZtyzoHz95Rhs6S63D2t/eqvdFCm7I+yHMLVQheKM7nBD8mbZIt+ct1jz4536MDnaOGKIxynJ8eHTkVGVVkoTg==}
- peerDependencies:
- react: ^16.8 || ^17.0 || ^18.0
-
'@radix-ui/[email protected]':
resolution: {integrity: sha512-D94LjX4Sp0xJFVaoQOd3OO9k7tpBYNOXdVhkltUbGv2Qb9OXdrg/CpsjlZv7ia14Sylv398LswWBVVu5nqKzAQ==}
peerDependencies:
@@ -3428,11 +3369,6 @@ packages:
'@types/react':
optional: true
- '@radix-ui/[email protected]':
- resolution: {integrity: sha512-FohDoZvk3mEXh9AWAVyRTYR4Sq7/gavuofglmiXB2g1aKyboUD4YtgWxKj8O5n+Uak52gXQ4wKz5IFST4vtJHg==}
- peerDependencies:
- react: ^16.8 || ^17.0 || ^18.0
-
'@radix-ui/[email protected]':
resolution: {integrity: sha512-Svl5GY5FQeN758fWKrjM6Qb7asvXeiZltlT4U2gVfl8Gx5UAv2sMR0LWo8yhsIZh2oQ0eFdZ59aoOOMV7b47VA==}
peerDependencies:
@@ -3442,11 +3378,6 @@ packages:
'@types/react':
optional: true
- '@radix-ui/[email protected]':
- resolution: {integrity: sha512-JwfBCUIfhXRxKExgIqGa4CQsiMemo1Xt0W/B4ei3fpzpvPENKpMKQ8mZSB6Acj3ebrAEgi2xiQvcI1PAAodvyg==}
- peerDependencies:
- react: ^16.8 || ^17.0 || ^18.0
-
'@radix-ui/[email protected]':
resolution: {integrity: sha512-vyL82j40hcFicA+M4Ex7hVkB9vHgSse1ZWomAqV2Je3RleKGO5iM8KMOEtfoSB0PnIelMd2lATjTGMYqN5ylTg==}
peerDependencies:
@@ -3456,11 +3387,6 @@ packages:
'@types/react':
optional: true
- '@radix-ui/[email protected]':
- resolution: {integrity: sha512-6Tpkq+R6LOlmQb1R5NNETLG0B4YP0wc+klfXafpUCj6JGyaUc8il7/kUZ7m59rGbXGczE9Bs+iz2qloqsZBduQ==}
- peerDependencies:
- react: ^16.8 || ^17.0 || ^18.0
-
'@radix-ui/[email protected]':
resolution: {integrity: sha512-v/5RegiJWYdoCvMnITBkNNx6bCj20fiaJnWtRkU18yITptraXjffz5Qbn05uOiQnOvi+dbkznkoaMltz1GnszQ==}
peerDependencies:
@@ -4637,8 +4563,8 @@ packages:
resolution: {integrity: sha512-rQ1+kcj+ttHG0MKVGBUXwayCCF1oh39BF5COIpRzuCEv8Mwjv0XucrI2ExNTOn9IlLifGClWQcU9BrZORvtw6Q==}
engines: {node: '>=6'}
- resolution: {integrity: sha512-JQpKvEOb86SnvMZbYaFKYhvzFntWBeSZdyii0rZPhKJj9uwJBxu4DaVYDrRN7r3mPop56oPhRw+JYWTKs66TYw==}
+ resolution: {integrity: sha512-gDzVf0a09TvoJ5jnuPvygTB77+XdOSwEmJ88L6XPFPlv7T3RxbP9jgenfylrAMD0+Le1aO0nVjQUzl2g+vjz5Q==}
peerDependencies:
react: ^18.0.0
react-dom: ^18.0.0
@@ -4666,9 +4592,6 @@ packages:
resolution: {integrity: sha512-Fu4hJdvzeylCfQPp9SGWidpzrMs7tTrlu6Vb8XGaRGck8QSNZJJp538Wrb60Lax4fPwR64ViY468OIUTbRlGZg==}
- resolution: {integrity: sha512-VtDvQpIJBvBatnONUsPzXYFVKQQAhuf3XTNOAsdBxCNO/QCtUUd8LSgjn0GVarBkCad6aJCZfXgrjYbl/KRr7w==}
-
resolution: {integrity: sha512-y4Mg2tXshplEbSGzx7amzPwKKOCGuoSRP/CjEdwwk0FOGlUbq6lKuoyDZTNZkmxHdJtp54hdfY/JUrdL7Xfdug==}
engines: {node: '>=14'}
@@ -7067,16 +6990,6 @@ packages:
'@types/react':
optional: true
- resolution: {integrity: sha512-xGVKJJr0SJGQVirVFAUZ2k1QLyO6m+2fy0l8Qawbp5Jgrv3DeLalrfMNBFSlmz5kriGGzsVBtGVnf4pTKIhhWA==}
- engines: {node: '>=10'}
- peerDependencies:
- '@types/react': ^16.8.0 || ^17.0.0 || ^18.0.0
- react: ^16.8.0 || ^17.0.0 || ^18.0.0
- peerDependenciesMeta:
- '@types/react':
- optional: true
-
resolution: {integrity: sha512-ImKhrzJJsyXJfBZ4bzu8Bwpka14c/fQt0k+cyFp/PBhTfyDnU5hjOtM4AG/0AMyy8oKzOTR0lDgJIM7pYXI0kw==}
engines: {node: '>=10'}
@@ -10026,10 +9939,6 @@ snapshots:
dependencies:
'@babel/runtime': 7.23.2
- '@radix-ui/[email protected]':
- dependencies:
- '@babel/runtime': 7.23.2
-
'@radix-ui/[email protected]':
dependencies:
'@babel/runtime': 7.23.2
@@ -10142,11 +10051,6 @@ snapshots:
'@babel/runtime': 7.23.2
react: 18.2.0
- dependencies:
- '@babel/runtime': 7.23.2
- react: 18.3.1
-
dependencies:
'@babel/runtime': 7.23.2
@@ -10169,11 +10073,6 @@ snapshots:
'@types/react': 18.3.3
'@types/react-dom': 18.3.0
- dependencies:
- '@babel/runtime': 7.23.2
- react: 18.3.1
-
dependencies:
'@babel/runtime': 7.23.2
@@ -10181,28 +10080,6 @@ snapshots:
optionalDependencies:
'@types/react': 18.3.3
- dependencies:
- '@babel/runtime': 7.23.2
- '@radix-ui/primitive': 1.0.0
- '@radix-ui/react-compose-refs': 1.0.0([email protected])
- '@radix-ui/react-context': 1.0.0([email protected])
- '@radix-ui/react-dismissable-layer': 1.0.0([email protected]([email protected]))([email protected])
- '@radix-ui/react-focus-guards': 1.0.0([email protected])
- '@radix-ui/react-focus-scope': 1.0.0([email protected]([email protected]))([email protected])
- '@radix-ui/react-id': 1.0.0([email protected])
- '@radix-ui/react-portal': 1.0.0([email protected]([email protected]))([email protected])
- '@radix-ui/react-presence': 1.0.0([email protected]([email protected]))([email protected])
- '@radix-ui/react-primitive': 1.0.0([email protected]([email protected]))([email protected])
- '@radix-ui/react-slot': 1.0.0([email protected])
- '@radix-ui/react-use-controllable-state': 1.0.0([email protected])
- aria-hidden: 1.2.3
- react: 18.3.1
- react-dom: 18.3.1([email protected])
- react-remove-scroll: 2.5.4(@types/[email protected])([email protected])
- transitivePeerDependencies:
- - '@types/react'
-
dependencies:
'@babel/runtime': 7.23.2
@@ -10256,17 +10133,6 @@ snapshots:
optionalDependencies:
'@types/react': 18.3.3
- dependencies:
- '@babel/runtime': 7.23.2
- '@radix-ui/primitive': 1.0.0
- '@radix-ui/react-compose-refs': 1.0.0([email protected])
- '@radix-ui/react-primitive': 1.0.0([email protected]([email protected]))([email protected])
- '@radix-ui/react-use-callback-ref': 1.0.0([email protected])
- '@radix-ui/react-use-escape-keydown': 1.0.0([email protected])
- react: 18.3.1
- react-dom: 18.3.1([email protected])
-
dependencies:
'@babel/runtime': 7.23.2
@@ -10311,11 +10177,6 @@ snapshots:
'@types/react': 18.3.3
'@types/react-dom': 18.3.0
- dependencies:
- '@babel/runtime': 7.23.2
- react: 18.3.1
-
dependencies:
'@babel/runtime': 7.23.2
@@ -10323,15 +10184,6 @@ snapshots:
optionalDependencies:
'@types/react': 18.3.3
- dependencies:
- '@babel/runtime': 7.23.2
- '@radix-ui/react-compose-refs': 1.0.0([email protected])
- '@radix-ui/react-primitive': 1.0.0([email protected]([email protected]))([email protected])
- '@radix-ui/react-use-callback-ref': 1.0.0([email protected])
- react: 18.3.1
- react-dom: 18.3.1([email protected])
-
dependencies:
'@babel/runtime': 7.23.2
@@ -10374,12 +10226,6 @@ snapshots:
'@types/react': 18.3.3
'@types/react-dom': 18.3.0
- dependencies:
- '@babel/runtime': 7.23.2
- '@radix-ui/react-use-layout-effect': 1.0.0([email protected])
- react: 18.3.1
-
dependencies:
'@babel/runtime': 7.23.2
@@ -10468,13 +10314,6 @@ snapshots:
'@types/react': 18.3.3
'@types/react-dom': 18.3.0
- dependencies:
- '@babel/runtime': 7.23.2
- '@radix-ui/react-primitive': 1.0.0([email protected]([email protected]))([email protected])
- react: 18.3.1
- react-dom: 18.3.1([email protected])
-
dependencies:
'@babel/runtime': 7.23.2
@@ -10495,14 +10334,6 @@ snapshots:
'@types/react': 18.3.3
'@types/react-dom': 18.3.0
- dependencies:
- '@babel/runtime': 7.23.2
- '@radix-ui/react-compose-refs': 1.0.0([email protected])
- '@radix-ui/react-use-layout-effect': 1.0.0([email protected])
- react: 18.3.1
- react-dom: 18.3.1([email protected])
-
dependencies:
'@babel/runtime': 7.23.2
@@ -10514,13 +10345,6 @@ snapshots:
'@types/react': 18.3.3
'@types/react-dom': 18.3.0
- dependencies:
- '@babel/runtime': 7.23.2
- '@radix-ui/react-slot': 1.0.0([email protected])
- react: 18.3.1
- react-dom: 18.3.1([email protected])
-
dependencies:
'@babel/runtime': 7.23.2
@@ -10625,12 +10449,6 @@ snapshots:
'@radix-ui/react-compose-refs': 1.0.0([email protected])
react: 18.2.0
- dependencies:
- '@babel/runtime': 7.23.2
- '@radix-ui/react-compose-refs': 1.0.0([email protected])
- react: 18.3.1
-
dependencies:
'@babel/runtime': 7.23.2
@@ -10705,11 +10523,6 @@ snapshots:
'@types/react': 18.3.3
'@types/react-dom': 18.3.0
- dependencies:
- '@babel/runtime': 7.23.2
- react: 18.3.1
-
dependencies:
'@babel/runtime': 7.23.2
@@ -10717,12 +10530,6 @@ snapshots:
optionalDependencies:
'@types/react': 18.3.3
- dependencies:
- '@babel/runtime': 7.23.2
- '@radix-ui/react-use-callback-ref': 1.0.0([email protected])
- react: 18.3.1
-
dependencies:
'@babel/runtime': 7.23.2
@@ -10731,12 +10538,6 @@ snapshots:
optionalDependencies:
'@types/react': 18.3.3
- dependencies:
- '@babel/runtime': 7.23.2
- '@radix-ui/react-use-callback-ref': 1.0.0([email protected])
- react: 18.3.1
-
dependencies:
'@babel/runtime': 7.23.2
@@ -10745,11 +10546,6 @@ snapshots:
optionalDependencies:
'@types/react': 18.3.3
- dependencies:
- '@babel/runtime': 7.23.2
- react: 18.3.1
-
dependencies:
'@babel/runtime': 7.23.2
@@ -12195,14 +11991,15 @@ snapshots:
dependencies:
- '@radix-ui/react-dialog': 1.0.0(@types/[email protected])([email protected]([email protected]))([email protected])
- command-score: 0.1.2
+ '@radix-ui/react-primitive': 1.0.3(@types/[email protected])(@types/[email protected])([email protected]([email protected]))([email protected])
react: 18.3.1
react-dom: 18.3.1([email protected])
transitivePeerDependencies:
- '@types/react'
+ - '@types/react-dom'
dependencies:
@@ -12226,8 +12023,6 @@ snapshots:
-
@@ -15151,17 +14946,6 @@ snapshots:
optionalDependencies:
'@types/react': 18.3.3
- dependencies:
- react: 18.3.1
- react-remove-scroll-bar: 2.3.4(@types/[email protected])([email protected])
- react-style-singleton: 2.2.1(@types/[email protected])([email protected])
- tslib: 2.6.2
- use-callback-ref: 1.3.0(@types/[email protected])([email protected])
- use-sidecar: 1.1.2(@types/[email protected])([email protected])
- optionalDependencies:
- '@types/react': 18.3.3
-
dependencies:
react: 18.3.1