@@ -74,6 +80,20 @@ export function ThemeSamplePage() {
+
+
+ Page title (h1)
+ Section (h2)
+ With an icon and a divider (h3)
+ Subsection (h4)
+ Smallest (h5)
+
+ The level picks the size, so the type scale stays a scale: call sites
+ choose a heading level for the document outline, never a font size.
+
+
+
+
@@ -130,6 +150,12 @@ export function ThemeSamplePage() {
HTTP 403 from the remote server after 3 attempts. Retry, or check the URL.
+ setDismissed(true)}>
+ {dismissed
+ ? 'Dismissed — it would be gone in the real interface.'
+ : 'A nudge the user can clear. Only offer dismiss when clearing it is harmless.'}
+
@@ -200,6 +226,14 @@ export function ThemeSamplePage() {
+
+ Copy}
+ />
+
setComments(e.currentTarget.checked)}/>
@@ -261,6 +295,34 @@ export function ThemeSamplePage() {
+
+ Loading backups…
+
+
+
+
+
+
+
+
+
+ Semantic's compound shape is kept — Modal.Header, Modal.Content,
+ Modal.Actions — so the 34 call sites written against it migrate by import.
+
Firefox will ask you to confirm the install. Accept the prompt.
After installing
@@ -84,15 +79,14 @@ function FirefoxCard({metadata, version}) {
Open the extension's Options page (right-click the toolbar icon → Manage Extension → Options) and add this WROLPi as a destination. Click Test to grant API access.
Click the extension icon in the toolbar → the permission dropdown → Always Allow on this site. Firefox requires this second click in addition to the Test grant — without it, the extension can talk to your WROLPi but can't mark its tabs as connected.
- Install the WROLPi browser extension to send pages, videos, and feeds to
- this WROLPi from any tab. The extension is open-source and not distributed
- via official browser stores — it ships with each WROLPi release.
-
+ return
+
+ Browser Extension
+
+ Install the WROLPi browser extension to send pages, videos, and feeds to
+ this WROLPi from any tab. The extension is open-source and not distributed
+ via official browser stores — it ships with each WROLPi release.
+
- The extension binaries aren't on this WROLPi yet. They ship with the
- next release; pull the latest and they'll appear here.
-
+ {metadata && !anyAvailable &&
+ The extension binaries aren't on this WROLPi yet. They ship with the
+ next release; pull the latest and they'll appear here.
}
{browser === 'firefox' && }
{browser === 'chromium' && }
{browser === 'unknown' && }
-
- Both browsers, just in case
-
- You can install for a different browser too — useful if you sync
- between machines.
-
+
+
+ Both browsers, just in case
+
+ You can install for a different browser too — useful if you sync
+ between machines.
+
+
{browser !== 'firefox' && }
{browser !== 'chromium' && }
-
- >;
+
+ ;
}
diff --git a/app/src/components/ui/Feedback.tsx b/app/src/components/ui/Feedback.tsx
index beaa88ec..2cc3b776 100644
--- a/app/src/components/ui/Feedback.tsx
+++ b/app/src/components/ui/Feedback.tsx
@@ -25,10 +25,14 @@ export interface MessageProps {
kind?: MessageKind;
title?: React.ReactNode;
children?: React.ReactNode;
+ /** Semantic icon name or a Tabler component, shown to the left of the text. */
+ icon?: string | React.ComponentType;
+ /** Renders a dismiss button. Omit for messages the user cannot clear. */
+ onDismiss?: () => void;
className?: string;
}
-export function Message({kind = 'info', title, children, className}: MessageProps) {
+export function Message({kind = 'info', title, children, icon, onDismiss, className}: MessageProps) {
return
- {title &&
{title}
}
- {children &&
{children}
}
+ {icon &&
+ {typeof icon === 'string' ? : }
+
}
+
+ {title &&
{title}
}
+ {children &&
{children}
}
+
+ {onDismiss && }
}
@@ -137,6 +154,28 @@ export function Loader({size = 'sm', label}: LoaderProps) {
return
}
+export interface LoadingProps {
+ /** What is being waited on: "Loading backups…". Also the accessible name. */
+ children?: React.ReactNode;
+ size?: LoaderProps['size'];
+ /** Vertical padding around the loader. */
+ padding?: number | string;
+}
+
+/**
+ * A centered loader with a caption, for a region that has nothing to show yet.
+ * Replaces Semantic's ``, which 19 call sites
+ * used with their own wrapper div.
+ */
+export function Loading({children, size = 'sm', padding = '2em'}: LoadingProps) {
+ return
+
+ {children &&
{children}
}
+
+}
+
/** Placeholder for content that has not arrived. Replaces Semantic's Placeholder. */
export function Placeholder({lines = 3, height = 12}: {lines?: number; height?: number}) {
return
diff --git a/app/src/components/ui/Inputs.tsx b/app/src/components/ui/Inputs.tsx
index 1958c526..22f04602 100644
--- a/app/src/components/ui/Inputs.tsx
+++ b/app/src/components/ui/Inputs.tsx
@@ -58,6 +58,27 @@ export function Toggle({style, className, ...props}: ToggleProps) {
/>
}
+export interface ActionInputProps extends React.ComponentProps {
+ /** Button (or buttons) attached to the input's trailing edge. */
+ action?: React.ReactNode;
+}
+
+/**
+ * A text input with a button joined to its right edge. Replaces Semantic's
+ * ``.
+ *
+ * The two share one outline rather than sitting side by side, so the pair reads
+ * as a single control — the input's own right border is dropped and the button
+ * supplies the edge.
+ */
+export function ActionInput({action, className, ...props}: ActionInputProps) {
+ if (!action) return
+ return
+
+ {action}
+
+}
+
export {
MTextInput as TextInput,
MTextarea as Textarea,
diff --git a/app/src/components/ui/Overlays.tsx b/app/src/components/ui/Overlays.tsx
index ade07548..f674f238 100644
--- a/app/src/components/ui/Overlays.tsx
+++ b/app/src/components/ui/Overlays.tsx
@@ -6,17 +6,76 @@ import {Button} from './Button';
* Overlays: modals, confirmations, tooltips, menus.
*/
-export type ModalProps = React.ComponentProps;
+/*
+ * Modals.
+ *
+ * Semantic's compound shape (`Modal.Header` / `Modal.Content` / `Modal.Actions`)
+ * is kept because 34 call sites are written against it. The subcomponents are
+ * markers: Modal reads them out of its children and places each in the right
+ * slot, so the children stay in source order at the call site.
+ */
+
+const ModalHeader = ({children}: {children?: React.ReactNode}) => <>{children}>;
+ModalHeader.displayName = 'Modal.Header';
+
+const ModalContent = ({children}: {children?: React.ReactNode; scrolling?: boolean}) => <>{children}>;
+ModalContent.displayName = 'Modal.Content';
+
+const ModalActions = ({children}: {children?: React.ReactNode}) => <>{children}>;
+ModalActions.displayName = 'Modal.Actions';
+
+// Semantic's size names, mapped onto Mantine's scale.
+const modalSizes: Record = {
+ mini: 'xs',
+ tiny: 'sm',
+ small: 'md',
+ large: 'lg',
+ fullscreen: '100%',
+};
+
+export interface ModalProps extends Omit, 'opened' | 'size'> {
+ /** Semantic's name for `opened`. Either works. */
+ open?: boolean;
+ opened?: boolean;
+ /** A title given directly, instead of a `Modal.Header` child. */
+ title?: React.ReactNode;
+ /** Semantic size name (mini/tiny/small/large/fullscreen) or a Mantine size. */
+ size?: string | number;
+ /** Accepted and ignored: the close button is always shown. */
+ closeIcon?: boolean;
+}
+
+function ModalBase({open, opened, size, closeIcon, title, children, ...props}: ModalProps) {
+ const slots: Record = {header: [], actions: [], body: []};
+ React.Children.forEach(children, child => {
+ const type = React.isValidElement(child) ? child.type : undefined;
+ if (type === ModalHeader) slots.header.push((child as React.ReactElement).props.children);
+ else if (type === ModalActions) slots.actions.push((child as React.ReactElement).props.children);
+ else slots.body.push(child);
+ });
-export function Modal(props: ModalProps) {
return
+ >
+ {slots.body}
+ {slots.actions.length > 0 &&
{slots.actions}
}
+
}
+export const Modal = Object.assign(ModalBase, {
+ Header: ModalHeader,
+ Content: ModalContent,
+ Actions: ModalActions,
+ // Mantine's own names, for new code.
+ Body: ModalContent,
+});
+
export interface ConfirmProps {
open: boolean;
title?: React.ReactNode;
diff --git a/app/src/components/ui/Surfaces.tsx b/app/src/components/ui/Surfaces.tsx
index 64a9dab5..d56b518c 100644
--- a/app/src/components/ui/Surfaces.tsx
+++ b/app/src/components/ui/Surfaces.tsx
@@ -1,12 +1,49 @@
import React from 'react';
import {Card as MCard, Tabs as MTabs, Accordion as MAccordion, Breadcrumbs} from '@mantine/core';
+import {Icon} from './Icon';
/*
- * Surfaces and structure: panels, cards, statistics, tabs, accordions,
+ * Surfaces and structure: headers, panels, cards, statistics, tabs, accordions,
* breadcrumbs. Elevation is expressed with borders and background steps —
* never a shadow (shadows are zeroed in the Mantine bridge).
*/
+// ------------------------------------------------------------------- Headers
+
+export type HeaderLevel = 'h1' | 'h2' | 'h3' | 'h4' | 'h5';
+
+export interface HeaderProps extends Omit, 'color'> {
+ /** Heading level. Also the visual size — pick it for the outline, not the look. */
+ as?: HeaderLevel;
+ /** Semantic icon name or a Tabler component, shown before the text. */
+ icon?: string | React.ComponentType;
+ /** Secondary line below, in muted text. */
+ subheader?: React.ReactNode;
+ /** Hairline rule underneath, separating the section from what follows. */
+ dividing?: boolean;
+}
+
+/**
+ * A section heading. Named and shaped like Semantic's Header (`as`, `icon`,
+ * `subheader`, `dividing`) so the app's 47 call sites migrate by import.
+ *
+ * Sizes come from ui.css, keyed on the level, rather than each call site
+ * choosing — that is what keeps the type scale a scale.
+ */
+export function Header({as = 'h3', icon, subheader, dividing, className, children, ...props}: HeaderProps) {
+ const Tag = as;
+ return