Usenet streaming with a WebDAV server and a SABnzbd-compatible API
C#
Added MultiCheckboxInput component.
nzbdav-dev799c5af6022c
diff --git a/frontend/app/components/multi-checkbox-input/multi-checkbox-input.module.css b/frontend/app/components/multi-checkbox-input/multi-checkbox-input.module.cssnew file mode 100644index 00000000..d6aa7cb6--- /dev/null+++ b/frontend/app/components/multi-checkbox-input/multi-checkbox-input.module.css@@ -0,0 +1,19 @@+.container {+ display: flex;+ flex-wrap: wrap;+ gap: 8px 16px;+ padding: 10px;+ background-color: var(--bs-body-bg);+ border-radius: var(--bs-border-radius);+ margin-top: 10px;+ border: 1px solid var(--bs-border-color);+}++.container :global(.form-check-input:not(:checked)) {+ background-color: var(--bs-secondary-bg);+}++.container :global(.form-check label) {+ color: var(--bs-body-color);+ font-size: 0.875rem;+}\ No newline at end of filediff --git a/frontend/app/components/multi-checkbox-input/multi-checkbox-input.module.css.d.ts b/frontend/app/components/multi-checkbox-input/multi-checkbox-input.module.css.d.tsnew file mode 100644index 00000000..c00d77c6--- /dev/null+++ b/frontend/app/components/multi-checkbox-input/multi-checkbox-input.module.css.d.ts@@ -0,0 +1,4 @@+declare const styles: {+ readonly "container": string;+};+export = styles;diff --git a/frontend/app/components/multi-checkbox-input/multi-checkbox-input.tsx b/frontend/app/components/multi-checkbox-input/multi-checkbox-input.tsxnew file mode 100644index 00000000..84cc0963--- /dev/null+++ b/frontend/app/components/multi-checkbox-input/multi-checkbox-input.tsx@@ -0,0 +1,45 @@+import { useCallback, useMemo } from "react";+import { Form } from "react-bootstrap";+import styles from "./multi-checkbox-input.module.css";++type MultiCheckboxInputProps = {+ options: string[];+ value: string;+ onChange: (value: string) => void;+};++export function MultiCheckboxInput({ options, value, onChange }: MultiCheckboxInputProps) {+ const selectedOptions = useMemo(() => {+ if (!value || value.trim() === "") return [];+ return value.split(",").map(c => c.trim()).filter(c => c.length > 0);+ }, [value]);++ const onOptionCheckboxChange = useCallback((option: string, checked: boolean) => {+ let newSelected: string[];+ if (checked) {+ newSelected = [...selectedOptions, option];+ } else {+ newSelected = selectedOptions.filter(o => o !== option);+ }+ onChange(newSelected.join(", "));+ }, [onChange, selectedOptions]);++ if (options.length === 0) {+ return null;+ }++ return (+ <div className={styles.container}>+ {options.map(option => (+ <Form.Check+ key={option}+ type="checkbox"+ id={`multi-checkbox-${option}`}+ label={option}+ checked={selectedOptions.includes(option)}+ onChange={e => onOptionCheckboxChange(option, e.target.checked)}+ />+ ))}+ </div>+ );+}