diff --git a/app/components/SearchOptions.tsx b/app/components/SearchOptions.tsx index 8ae25da..671fed4 100644 --- a/app/components/SearchOptions.tsx +++ b/app/components/SearchOptions.tsx @@ -1,8 +1,9 @@ // Copyright 2026 Cloudhal and the Podbay contributors // Licensed under the Apache 2.0 license found in the LICENSE file. -import { Input, LayerDialog } from "@cloudflare/kumo"; +import { Checkbox, Input, LayerDialog, Select } from "@cloudflare/kumo"; import { type FormEvent, useEffect, useState } from "react"; +import DateTimeField from "~/components/controls/DateTimeField"; import { t } from "~/i18n"; import { placeName } from "~/lib/places"; import { @@ -15,9 +16,6 @@ import { useFolders } from "~/queries/folders"; import { useLabels } from "~/queries/labels"; import type { Folder } from "~/types"; -const NATIVE_FIELD = - "h-9 w-full rounded-lg border border-kumo-line bg-kumo-control px-3 text-sm text-kumo-default"; - /** * A search by its parts: who, what, where and when. It writes the same query a person could type * in the search box, so the box always shows what is being searched. @@ -61,126 +59,74 @@ export default function SearchOptions({
set({ from: event.target.value })} /> set({ to: event.target.value })} /> set({ subject: event.target.value })} /> set({ words: event.target.value })} /> -
- - -
+ set({ folder: event.target.value })} - > - - {folders.map((folder) => ( - - ))} - - -
- - set({ after: event.target.value })} - /> -
-
- - set({ before: event.target.value })} - /> -
+ set({ hasAttachment: event.target.checked })} - /> - {t("Has an attachment")} - - + set({ hasAttachment: checked === true })} + /> + set({ unreadOnly: checked === true })} + />
diff --git a/app/components/SendLater.tsx b/app/components/SendLater.tsx index 6209dbf..0fdea70 100644 --- a/app/components/SendLater.tsx +++ b/app/components/SendLater.tsx @@ -5,12 +5,10 @@ import { Button, DropdownMenu, LayerDialog } from "@cloudflare/kumo"; import { CalendarBlankIcon, ClockIcon } from "@phosphor-icons/react"; import { type FormEvent, useState } from "react"; import { SENDING } from "shared/sending"; +import DateTimeField from "~/components/controls/DateTimeField"; import { t } from "~/i18n"; import { fieldValue, laterChoices, timeRefusal, timeWords } from "~/lib/sending-words"; -const NATIVE_FIELD = - "h-9 w-full rounded-lg border border-kumo-line bg-kumo-control px-3 text-sm text-kumo-default"; - /** * "Send later" (ADR-0016, decision 12): a few times of the app's own and a date and time, in * this device's time zone. Every choice is shown back with its date and time before it is @@ -108,24 +106,14 @@ export default function SendLater({ onInput={(event) => event.stopPropagation()} >
-
- - setPicked(event.target.value)} - required - /> -
+ {refusal === null && picked !== "" ? (

{t("The message will be sent {time}.", { time: timeWords(time) })} diff --git a/app/components/controls/DateTimeField.tsx b/app/components/controls/DateTimeField.tsx new file mode 100644 index 0000000..4dc50bc --- /dev/null +++ b/app/components/controls/DateTimeField.tsx @@ -0,0 +1,54 @@ +// Copyright 2026 Cloudhal and the Podbay contributors +// Licensed under the Apache 2.0 license found in the LICENSE file. + +import { Label } from "@cloudflare/kumo"; +import { useId } from "react"; + +/** + * A date, or a date with a time of day, as a person types or picks it: the one place the app + * uses the browser's own date field (issue #82). Kumo 2.18.1 has no field for a date and a time: + * its DatePicker is a calendar with no time of day and no field to type in. + * + * The field is drawn once, here, at the height, corner and type of Kumo's default size (36 px, + * 14 px), with Kumo's label above it, so it stands beside Kumo's fields as one of them. The label + * stands where a Kumo select draws its own: a line of its own type above the field, 8 px apart, so + * a row of selects and date fields shares its labels' top as well as its fields'. Its + * limit stays: the browser shows the date in the device's own form and language, not the app's. + */ +export default function DateTimeField({ + label, + kind = "datetime-local", + labelClassName, + ...field +}: { + /** What the field is called; it is its label above it. */ + label: string; + /** A date alone, or a date with a time of day. */ + kind?: "date" | "datetime-local"; + /** The label's own look where a screen sets labels apart, as a small subtle line. */ + labelClassName?: string; + value: string; + onChange: (value: string) => void; + min?: string; + max?: string; + required?: boolean; +}) { + const id = useId(); + const { onChange, ...rest } = field; + return ( +

+
+ +
+ onChange(event.target.value)} + /> +
+ ); +} diff --git a/app/components/rules/FilterDialog.tsx b/app/components/rules/FilterDialog.tsx index 1712720..997c410 100644 --- a/app/components/rules/FilterDialog.tsx +++ b/app/components/rules/FilterDialog.tsx @@ -1,8 +1,8 @@ // Copyright 2026 Cloudhal and the Podbay contributors // Licensed under the Apache 2.0 license found in the LICENSE file. -import { Input, LayerDialog } from "@cloudflare/kumo"; -import { type FormEvent, useEffect, useState } from "react"; +import { Checkbox, Input, Label, LayerDialog, Select } from "@cloudflare/kumo"; +import { type FormEvent, useEffect, useId, useState } from "react"; import { RULE_LIMITS, type Rule, @@ -16,9 +16,6 @@ import { labelDot } from "~/lib/labels"; import { useLabels } from "~/queries/labels"; import { type RuleDraft, useSaveRules } from "~/queries/rules"; -const NATIVE_FIELD = - "h-9 rounded-lg border border-kumo-line bg-kumo-control px-2 text-sm text-kumo-default"; - interface Form { fromMatch: RuleMatch; from: string; @@ -75,15 +72,13 @@ function Match({ onChange: (value: RuleMatch) => void; }) { return ( - + onValueChange={(chosen) => onChange(chosen === "is" ? "is" : "contains")} + items={{ contains: t("contains"), is: t("is exactly") }} + /> ); } @@ -112,6 +107,8 @@ export default function FilterDialog({ }) { const { data: labels = [] } = useLabels(mailboxId); const saveRules = useSaveRules(); + const senderField = useId(); + const recipientField = useId(); const [form, setForm] = useState(formOf()); const [error, setError] = useState(null); const set = (change: Partial) => setForm((held) => ({ ...held, ...change })); @@ -162,104 +159,91 @@ export default function FilterDialog({ {t("When a message arrives and all of this is true")} -
- set({ fromMatch })} - /> -
- set({ from: event.target.value })} + {/* The row's label stands at its left edge, above the comparison and the field both. */} +
+ +
+ set({ fromMatch })} /> +
+ set({ from: event.target.value })} + /> +
-
- set({ toMatch })} - /> -
- set({ to: event.target.value })} + {/* The row's label stands at its left edge, above the comparison and the field both. */} +
+ +
+ set({ toMatch })} /> +
+ set({ to: event.target.value })} + /> +
set({ subject: event.target.value })} /> set({ words: event.target.value })} /> - + set({ hasAttachment: checked === true })} + />
{t("Do this")} -
- - -
- - + = RULE_LIMITS.labels} - onChange={(event) => toggleLabel(label.id, event.target.checked)} - /> -
diff --git a/app/components/settings/AutoReplySettings.tsx b/app/components/settings/AutoReplySettings.tsx index aeff170..cfc2b40 100644 --- a/app/components/settings/AutoReplySettings.tsx +++ b/app/components/settings/AutoReplySettings.tsx @@ -1,9 +1,10 @@ // Copyright 2026 Cloudhal and the Podbay contributors // Licensed under the Apache 2.0 license found in the LICENSE file. -import { Button, Input, useKumoToastManager } from "@cloudflare/kumo"; +import { Button, Checkbox, Input, InputArea, useKumoToastManager } from "@cloudflare/kumo"; import { type FormEvent, useEffect, useState } from "react"; import { AUTO_REPLY } from "shared/rules"; +import DateTimeField from "~/components/controls/DateTimeField"; import { useFreshProof } from "~/components/FreshProof"; import { t } from "~/i18n"; import { replyToSave, shownText } from "~/lib/auto-reply"; @@ -11,9 +12,6 @@ import { fieldValue } from "~/lib/sending-words"; import { useAutoReply, useSaveAutoReply } from "~/queries/rules"; import Row from "./Row"; -const NATIVE_FIELD = - "h-9 w-full rounded-lg border border-kumo-line bg-kumo-control px-3 text-sm text-kumo-default"; - /** An instant as the date and time field of this device shows it; empty for none. */ const shown = (instant: string | null): string => instant === null || Number.isNaN(Date.parse(instant)) ? "" : fieldValue(new Date(instant)); @@ -105,45 +103,29 @@ export default function AutoReplySettings({ )}
- + setEnabled(checked === true)} + />
-
- - setFrom(event.target.value)} - /> -
-
- - setUntil(event.target.value)} - /> -
+ +
{backwards && (

@@ -152,16 +134,14 @@ export default function AutoReplySettings({ )} -

-
- setSubject(event.target.value)} - /> -
+
+ setSubject(event.target.value)} + />
@@ -172,13 +152,16 @@ export default function AutoReplySettings({ )}

)} -