Skip to content

Open-source status page, incident response and uptime monitoring

fix: checkbox label id (#830)

Maximilian Kaske7adf2b85b02a
diff --git a/apps/web/src/components/forms/monitor/section-notifications.tsx b/apps/web/src/components/forms/monitor/section-notifications.tsx
index 0f318587a..f262bd216 100644
--- a/apps/web/src/components/forms/monitor/section-notifications.tsx
+++ b/apps/web/src/components/forms/monitor/section-notifications.tsx
@@ -76,6 +76,7 @@ export function SectionNotifications({ form, plan, notifications }: Props) {
<FormControl className="h-full">
<CheckboxLabel
id={String(item.id)}
+ name={"notification"}
checked={field.value?.includes(item.id)}
onCheckedChange={(checked) => {
return checked
@@ -85,8 +86,8 @@ export function SectionNotifications({ form, plan, notifications }: Props) {
])
: field.onChange(
field.value?.filter(
- (value) => value !== item.id,
- ),
+ (value) => value !== item.id
+ )
);
}}
>
diff --git a/apps/web/src/components/forms/monitor/section-scheduling.tsx b/apps/web/src/components/forms/monitor/section-scheduling.tsx
index 04eb4f462..564eb43fd 100644
--- a/apps/web/src/components/forms/monitor/section-scheduling.tsx
+++ b/apps/web/src/components/forms/monitor/section-scheduling.tsx
@@ -110,6 +110,7 @@ export function SectionScheduling({ form, plan }: Props) {
<FormControl className="h-full">
<CheckboxLabel
id={item}
+ name="region"
checked={field.value?.includes(item)}
onCheckedChange={(checked) => {
return checked
@@ -119,8 +120,8 @@ export function SectionScheduling({ form, plan }: Props) {
])
: field.onChange(
field.value?.filter(
- (value) => value !== item,
- ),
+ (value) => value !== item
+ )
);
}}
>
diff --git a/apps/web/src/components/forms/monitor/section-status-page.tsx b/apps/web/src/components/forms/monitor/section-status-page.tsx
index 75c554308..26c4d4941 100644
--- a/apps/web/src/components/forms/monitor/section-status-page.tsx
+++ b/apps/web/src/components/forms/monitor/section-status-page.tsx
@@ -79,6 +79,7 @@ export function SectionStatusPage({ form, pages }: Props) {
<FormControl className="h-full">
<CheckboxLabel
id={String(item.id)}
+ name="page"
checked={field.value?.includes(item.id)}
onCheckedChange={(checked) => {
return checked
@@ -88,8 +89,8 @@ export function SectionStatusPage({ form, pages }: Props) {
])
: field.onChange(
field.value?.filter(
- (value) => value !== item.id,
- ),
+ (value) => value !== item.id
+ )
);
}}
>
diff --git a/apps/web/src/components/forms/shared/checkbox-label.tsx b/apps/web/src/components/forms/shared/checkbox-label.tsx
index 90f0513a4..f582e37dd 100644
--- a/apps/web/src/components/forms/shared/checkbox-label.tsx
+++ b/apps/web/src/components/forms/shared/checkbox-label.tsx
@@ -10,6 +10,7 @@ interface Props {
checked?: boolean;
onCheckedChange(checked: boolean): void;
className?: string;
+ name: string;
}
export function CheckboxLabel({
@@ -18,20 +19,22 @@ export function CheckboxLabel({
checked,
onCheckedChange,
className,
+ name,
}: Props) {
return (
<div className="relative h-full">
<Checkbox
- id={id}
+ id={`${name}-${id}`}
+ name={name}
className="peer sr-only"
checked={checked}
onCheckedChange={onCheckedChange}
/>
<Label
- htmlFor={id}
+ htmlFor={`${name}-${id}`}
className={cn(
"flex h-full items-center gap-1 rounded-md border border-border bg-popover p-4 pr-10 [&:has([data-state=checked])]:border-primary peer-data-[state=checked]:border-primary hover:bg-accent hover:text-accent-foreground",
- className,
+ className
)}
>
{children}
diff --git a/apps/web/src/components/forms/status-report/section-connect.tsx b/apps/web/src/components/forms/status-report/section-connect.tsx
index ab2578d7b..7a747ae8e 100644
--- a/apps/web/src/components/forms/status-report/section-connect.tsx
+++ b/apps/web/src/components/forms/status-report/section-connect.tsx
@@ -52,8 +52,10 @@ export function SectionConnect({ form, pages, monitors }: Props) {
<FormControl className="w-full">
<CheckboxLabel
id={String(item.id)}
+ name="page"
checked={field.value?.includes(item.id)}
onCheckedChange={(checked) => {
+ console.log(field, item.id, checked);
return checked
? field.onChange([
...(field.value || []),
@@ -61,8 +63,8 @@ export function SectionConnect({ form, pages, monitors }: Props) {
])
: field.onChange(
field.value?.filter(
- (value) => value !== item.id,
- ),
+ (value) => value !== item.id
+ )
);
}}
>
@@ -107,8 +109,10 @@ export function SectionConnect({ form, pages, monitors }: Props) {
<FormControl className="w-full">
<CheckboxLabel
id={String(item.id)}
+ name="monitor"
checked={field.value?.includes(item.id)}
onCheckedChange={(checked) => {
+ console.log(field, item.id, checked);
return checked
? field.onChange([
...(field.value || []),
@@ -116,8 +120,8 @@ export function SectionConnect({ form, pages, monitors }: Props) {
])
: field.onChange(
field.value?.filter(
- (value) => value !== item.id,
- ),
+ (value) => value !== item.id
+ )
);
}}
>