Files
margin-mail/src/screens/WindowChoice.tsx
T
pj eb59cb5f8d build the app, and ship it on Linux and Windows as well as macOS
The client itself: the sync engine and mirror, the Gmail and IMAP providers,
the screener, the three boxes and two piles, compose and send, the sanitiser
and tracker stripping, contacts, clips, backup, notifications and the guide.

The pipeline that ships it. Three runners now build in parallel and the
publish gate wants all four platform keys in latest.json before a release
leaves draft. Linux gets two more packages Tauri does not build: a flatpak
repackaged from the deb against GNOME 48, and a Nix package that relinks the
deb against nixpkgs so it runs as a native Wayland client rather than through
Xwayland. CI runs the Rust suite on all three desktops rather than on Linux
alone, and rebuilds the flatpak manifest on every push to main.

Two things that were only ever exercised on macOS and were wrong everywhere
else. The menu bar was built by adjusting the submenus macOS is given, so on
a platform whose default menu has no File or View the new File menu landed
after Edit, Check for Updates landed nowhere, and the three places and the
reading pane had no menu at all. The deb declared libwebkit2gtk-4.1-0 and
libgtk-3-0 twice, because tauri.conf.json named the dependencies Tauri
already emits.

The updater key exists now, so releases can sign their artifacts.
2026-09-06 12:15:30 +05:30

69 lines
2.2 KiB
TypeScript

import { useState } from "react";
import { Button } from "../ui";
import "./windowchoice.css";
/** The same five spans the Storage window row in Settings offers, in the same order. */
export const WINDOWS = [
{ days: 30, label: "30 days" },
{ days: 90, label: "90 days" },
{ days: 180, label: "180 days" },
{ days: 365, label: "A year" },
{ days: 0, label: "Everything" },
];
/** A window as a sentence names it: "the last month", "the last year", "everything". */
export function spanOf(days: number): string {
if (days === 0) return "everything";
if (days === 30) return "the last month";
if (days === 365) return "the last year";
return `the last ${days} days`;
}
/**
* The one question between an account being written and its mail arriving: how far back this
* device holds. Asked here rather than assumed, because a month is a guess and a year of a busy
* mailbox is a long wait nobody was told about. The welcome screen and the arriving panel both
* host it, each with its own heading; this is the row of spans and the button that starts the
* sync, and nothing else.
*/
export function WindowChoice({
initial,
busy,
onStart,
}: {
initial: number;
busy: boolean;
onStart: (days: number) => void;
}) {
const [days, setDays] = useState(initial);
return (
<div className="window-choice">
<div className="window-choice-options" role="radiogroup" aria-label="How far back">
{WINDOWS.map((option) => (
<button
key={option.days}
type="button"
role="radio"
className="window-choice-option"
aria-checked={option.days === days}
data-on={option.days === days ? "" : undefined}
disabled={busy}
onClick={() => setDays(option.days)}
>
{option.label}
</button>
))}
</div>
<p className="window-choice-note">
Older mail stays on the server and is fetched when you search for it. This can be changed
later in Settings.
</p>
<div className="window-choice-actions">
<Button variant="primary" disabled={busy} onClick={() => onStart(days)}>
{busy ? "Starting" : "Start"}
</Button>
</div>
</div>
);
}