Watch
0
0
Fork
You've already forked hyperhive
0

swarm-ui: add CheckboxField and use it for the issue report toggle and the account delete option

This commit is contained in:
iris 2026-10-21 23:49:57 +02:00 • committed by mara
commit acf82beba3
7 changed files with 105 additions and 30 deletions

View file

@ -27,6 +27,7 @@ import {
SelectField,
type SelectOption,
} from "../ui/select-field/SelectField.js";
import { CheckboxField } from "../ui/checkbox-field/CheckboxField.js";
import { Button, type ButtonVariant } from "../ui/button/Button.js";
import { Dialog } from "../ui/dialog/Dialog.js";
import { ConfirmDialog } from "../ui/confirm-dialog/ConfirmDialog.js";
@ -156,6 +157,18 @@ function SelectFieldSample() {
);
}
function CheckboxFieldSample() {
const [checked, setChecked] = useState(true);
return (
<CheckboxField
id="sample-checkbox-field"
label="hide blocked (open dependency)"
checked={checked}
onChange={setChecked}
/>
);
}
function RefreshIntervalPickerSample() {
const [value, setValue] = useState<RefreshIntervalMs>(30_000);
return (
@ -517,6 +530,21 @@ export function ComponentsPage() {
</Sample>
</Section>
<Section title="CheckboxField">
<Sample label="editable">
<CheckboxFieldSample />
</Sample>
<Sample label="disabled">
<CheckboxField
id="sample-checkbox-field-disabled"
label="also log the token out"
checked={false}
onChange={() => {}}
disabled
/>
</Sample>
</Section>
<Section title="Button">
<div class="components-chip-row">
{BUTTON_VARIANTS.map((variant) => (

View file

@ -15,12 +15,6 @@
gap: 1.25em;
margin-bottom: 1em;
}
.issue-report-toggle {
display: flex;
align-items: center;
gap: 0.4em;
cursor: pointer;
}
.issue-report-sort-btn {
background: none;
border: none;

View file

@ -33,6 +33,7 @@ import { readApiError, type ProblemDetails } from "@hive/shared/api-error.js";
import { Badge } from "@hive/shared/badge.js";
import { useLocalSetting } from "@hive/shared/settings-storage.js";
import { Panel } from "../ui/panel/Panel.js";
import { CheckboxField } from "../ui/checkbox-field/CheckboxField.js";
import { SelectField } from "../ui/select-field/SelectField.js";
import { Table, type TableColumn } from "../ui/table/Table.js";
import { ALL_REPOS, reportUrl, repoOptions } from "./issue-report-repo.js";
@ -378,16 +379,12 @@ export function IssueReportPage() {
onChange={setRepoFilter}
options={repoOptions(repos, repoFilter)}
/>
<label class="issue-report-toggle">
<input
type="checkbox"
checked={hideBlocked}
onChange={(e) =>
setHideBlocked((e.target as HTMLInputElement).checked)
}
/>
hide blocked (open dependency)
</label>
<CheckboxField
id="issue-report-hide-blocked"
label="hide blocked (open dependency)"
checked={hideBlocked}
onChange={setHideBlocked}
/>
</div>
{reposError ? (
<ApiErrorPanel