feat(ui): use one quiet panel style across the app #227
No files matched your search
@@ -73,17 +73,18 @@ export function Slider(props: {
|
||||
);
|
||||
}
|
||||
|
||||
function Section({ title, children, open: initial = true, onReset }: { title: string; children: React.ReactNode; open?: boolean; onReset?: () => void }) {
|
||||
function Section({ title, children, open: initial = true, onReset, extra }: { title: string; children: React.ReactNode; open?: boolean; onReset?: () => void; extra?: React.ReactNode }) {
|
||||
const [open, setOpen] = useState(initial);
|
||||
return (
|
||||
<section className="border-b border-line">
|
||||
<div className="panel-head">
|
||||
<button type="button" className="flex flex-1 items-center gap-2 text-left" aria-expanded={open} onClick={() => setOpen(!open)}>
|
||||
<span aria-hidden="true" className="text-[9px]">
|
||||
<button type="button" className="flex min-w-0 flex-1 items-center gap-2 text-left" aria-expanded={open} onClick={() => setOpen(!open)}>
|
||||
<span aria-hidden="true" className="text-[9px] text-faint">
|
||||
{open ? "▼" : "▶"}
|
||||
</span>
|
||||
{title}
|
||||
<span className="truncate">{title}</span>
|
||||
</button>
|
||||
{extra}
|
||||
{onReset && (
|
||||
<button type="button" className="normal-case tracking-normal text-faint hover:text-ink" onClick={onReset}>
|
||||
{t.dev.reset}
|
||||
@@ -115,41 +116,44 @@ export function DevelopPanels(props: {
|
||||
const extra = props.modules.filter((m) => m !== "crop" && m !== "basic");
|
||||
return (
|
||||
<>
|
||||
{props.modules.includes("basic") && (
|
||||
<Section title={t.modules.basic} onReset={() => resetIds(BASIC_GROUPS.flatMap((g) => g.ids))}>
|
||||
{BASIC_GROUPS.map((g) => (
|
||||
<div key={g.key} className="mb-2">
|
||||
<div className="mb-1 mt-1 flex items-center gap-2">
|
||||
<p className="flex-1 text-[10px] uppercase tracking-[0.08em] text-faint">{t.dev.groups[g.key]}</p>
|
||||
{props.onAuto && g.key === "wb" && (
|
||||
<button
|
||||
type="button"
|
||||
disabled={props.disabled}
|
||||
aria-pressed={!!props.picking}
|
||||
title={t.dev.pickWbHelp}
|
||||
onClick={() => props.onAuto?.("pick")}
|
||||
className={`h-5 border border-black px-1.5 text-[11px] disabled:opacity-40 ${props.picking ? "bg-accent text-white" : "bg-cell text-muted hover:text-ink"}`}
|
||||
>
|
||||
{t.dev.pickWb}
|
||||
</button>
|
||||
)}
|
||||
{props.onAuto && (g.key === "wb" || g.key === "tone") && (
|
||||
{props.modules.includes("basic") &&
|
||||
BASIC_GROUPS.map((g) => (
|
||||
<Section
|
||||
key={g.key}
|
||||
title={t.dev.groups[g.key]}
|
||||
open={g.key === "wb" || g.key === "tone"}
|
||||
onReset={() => resetIds(g.ids)}
|
||||
extra={
|
||||
props.onAuto && (g.key === "wb" || g.key === "tone") ? (
|
||||
<span className="flex items-center gap-2">
|
||||
{g.key === "wb" && (
|
||||
<button
|
||||
type="button"
|
||||
disabled={props.disabled}
|
||||
aria-pressed={!!props.picking}
|
||||
title={t.dev.pickWbHelp}
|
||||
onClick={() => props.onAuto?.("pick")}
|
||||
className={`text-[12px] disabled:opacity-40 ${props.picking ? "text-accent" : "text-faint hover:text-ink"}`}
|
||||
>
|
||||
{t.dev.pickWb}
|
||||
</button>
|
||||
)}
|
||||
<button
|
||||
type="button"
|
||||
disabled={props.disabled}
|
||||
title={g.key === "wb" ? t.dev.autoWbHelp : t.dev.autoToneHelp}
|
||||
onClick={() => props.onAuto?.(g.key === "wb" ? "wb" : "tone")}
|
||||
className="h-5 border border-black bg-cell px-1.5 text-[11px] text-muted hover:text-ink disabled:opacity-40"
|
||||
className="text-[12px] text-faint hover:text-ink disabled:opacity-40"
|
||||
>
|
||||
{t.dev.auto}
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
{g.ids.map(slider)}
|
||||
</div>
|
||||
))}
|
||||
</Section>
|
||||
)}
|
||||
</span>
|
||||
) : undefined
|
||||
}
|
||||
>
|
||||
{g.ids.map(slider)}
|
||||
</Section>
|
||||
))}
|
||||
{extra.map((m) => {
|
||||
const ids = CONTROLS.filter((c) => c.module === m).map((c) => c.id);
|
||||
if (!ids.length) return null;
|
||||
|
||||
@@ -69,7 +69,7 @@ export function FilterBar(props: { filter: LibraryFilter; onChange: (f: LibraryF
|
||||
{t.colorNone}
|
||||
</button>
|
||||
{f.uncolored && <span className="text-ink">{t.colorUncolored}</span>}
|
||||
{f.color && !f.uncolored && (
|
||||
{f.color && f.color !== "NONE" && !f.uncolored && (
|
||||
<span className="text-ink">{f.withoutColor ? t.colorWithout(t.colors[f.color]) : t.colorOnly(t.colors[f.color])}</span>
|
||||
)}
|
||||
</span>
|
||||
|
||||
@@ -57,7 +57,7 @@ export function LibraryMenus(props: {
|
||||
<Item label={t.menuSelectNone} onSelect={() => run(props.onSelectNone)} />
|
||||
<Item label={t.menuSelectUncolored} onSelect={() => run(props.onSelectUncolored)} />
|
||||
{COLORS.filter((c) => c !== "NONE").map((c) => (
|
||||
<Item key={c} label={t.menuSelectColor(t.colors[c])} swatch={LABEL_COLOR[c] ?? undefined} onSelect={() => run(() => props.onSelectColor(c))} />
|
||||
<Item key={c} label={t.menuSelectColor(t.colors[c])} swatch={LABEL_COLOR[c] ?? ""} onSelect={() => run(() => props.onSelectColor(c))} />
|
||||
))}
|
||||
</MenuPanel>
|
||||
)}
|
||||
@@ -71,7 +71,7 @@ export function LibraryMenus(props: {
|
||||
key={c}
|
||||
label={c === "NONE" ? t.colorNone : t.colors[c]}
|
||||
disabled={!props.canEdit || !props.hasSelection}
|
||||
swatch={c === "NONE" ? "none" : (LABEL_COLOR[c] ?? undefined)}
|
||||
swatch={c === "NONE" ? "none" : (LABEL_COLOR[c] ?? "")}
|
||||
onSelect={() => run(() => props.onColor(c))}
|
||||
/>
|
||||
))}
|
||||
|
||||
@@ -161,7 +161,7 @@ export function SquadsButton({ api, event, canEdit, onSaved, facesTick = 0, sele
|
||||
}
|
||||
|
||||
/** The enrolled face, the squad photo, or an empty slot when this athlete has neither. */
|
||||
function FaceThumb(props: { name: string; url?: string | null; hasFace: boolean; absolute: (path: string) => string }) {
|
||||
function FaceThumb(props: { name: string; url?: string | null | undefined; hasFace: boolean; absolute: (path: string) => string }) {
|
||||
const [failed, setFailed] = useState(false);
|
||||
if (!props.url || failed) {
|
||||
return <span title={`${props.name}: ${t.sports.faceNone}`} className="inline-block h-8 w-8 shrink-0 border border-dashed border-[#555] bg-raised" />;
|
||||
|
||||
@@ -75,7 +75,8 @@ describe("library store", () => {
|
||||
expect(matchesFilter(photo("a", "", { flag: "PICK", rating: 1 }), toSend)).toBe(false);
|
||||
expect(matchesFilter(photo("a", "", { flag: "NONE", rating: 5 }), toSend)).toBe(false);
|
||||
expect(matchesFilter(photo("a", "", { colorLabel: "RED" }), { ...ALL_PHOTOS, color: "GREEN" })).toBe(false);
|
||||
const hideRed = { ...ALL_PHOTOS, ...cycleColor(cycleColor(ALL_PHOTOS, "RED"), "RED") };
|
||||
const once = { ...ALL_PHOTOS, ...cycleColor(ALL_PHOTOS, "RED") };
|
||||
const hideRed = { ...ALL_PHOTOS, ...cycleColor(once, "RED") };
|
||||
expect(hideRed).toEqual({ ...ALL_PHOTOS, color: "RED", withoutColor: true });
|
||||
expect(matchesFilter(photo("a", "", { colorLabel: "RED" }), hideRed)).toBe(false);
|
||||
expect(matchesFilter(photo("a", "", { colorLabel: "NONE" }), hideRed)).toBe(true);
|
||||
|
||||
@@ -798,22 +798,52 @@ export function DevelopPage() {
|
||||
{picking && <p className="border-b border-line bg-accent/20 px-3 py-2 text-[12px] text-ink">{t.dev.pickWbNow}</p>}
|
||||
{spotting && <p className="border-b border-line bg-accent/20 px-3 py-2 text-[12px] text-ink">{t.dev.spotNow}</p>}
|
||||
{!canEdit && current && <p className="border-b border-line px-3 py-2 text-[12px] text-faint">{t.dev.noAccess}</p>}
|
||||
<Section title={t.dev.spot}>
|
||||
<div className="mb-2 flex flex-wrap items-center gap-2">
|
||||
<div className="pr-tools" role="tablist" aria-label={t.dev.spot}>
|
||||
<button
|
||||
type="button"
|
||||
role="tab"
|
||||
disabled={!canEdit}
|
||||
aria-pressed={spotting}
|
||||
onClick={() => {
|
||||
setCropping(false);
|
||||
setPicking(false);
|
||||
setSpotting((s) => !s);
|
||||
}}
|
||||
>
|
||||
{t.dev.spot}
|
||||
</button>
|
||||
{modules.includes("crop") && (
|
||||
<button
|
||||
type="button"
|
||||
role="tab"
|
||||
disabled={!canEdit}
|
||||
aria-pressed={cropping}
|
||||
onClick={() => {
|
||||
setCropping(false);
|
||||
setSpotting(false);
|
||||
setPicking(false);
|
||||
setSpotting((s) => !s);
|
||||
setCropping((c) => !c);
|
||||
}}
|
||||
aria-pressed={spotting}
|
||||
className={`h-7 border border-black px-3 text-[12px] disabled:opacity-40 ${spotting ? "bg-accent text-white" : "bg-cell"}`}
|
||||
>
|
||||
{spotting ? t.dev.spotDone : t.dev.spot}
|
||||
{t.dev.crop}
|
||||
</button>
|
||||
<span className="text-[11px] text-faint">{t.dev.spotHelp}</span>
|
||||
</div>
|
||||
)}
|
||||
<button
|
||||
type="button"
|
||||
role="tab"
|
||||
disabled={!canEdit}
|
||||
aria-pressed={picking}
|
||||
title={t.dev.pickWbHelp}
|
||||
onClick={() => {
|
||||
setSpotting(false);
|
||||
setCropping(false);
|
||||
setPicking((p) => !p);
|
||||
}}
|
||||
>
|
||||
{t.dev.pickWb}
|
||||
</button>
|
||||
</div>
|
||||
{spotting && (
|
||||
<Section title={t.dev.spot}>
|
||||
<div className="mb-2 flex flex-wrap gap-1">
|
||||
{SPOT_MODES.map((m) => (
|
||||
<button
|
||||
@@ -827,8 +857,9 @@ export function DevelopPage() {
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
<label className="mb-2 block text-[11px] text-faint">
|
||||
<label className="mb-2 grid grid-cols-[1fr_auto] items-center gap-x-2 text-[12px] text-muted">
|
||||
{t.dev.spotSize}
|
||||
<output className="font-mono text-[11px] text-ink">{Math.round(spotSize * 1000)}</output>
|
||||
<input
|
||||
type="range"
|
||||
min={0.005}
|
||||
@@ -837,11 +868,12 @@ export function DevelopPage() {
|
||||
value={spotSize}
|
||||
disabled={!canEdit}
|
||||
onChange={(e) => setSpotSize(Number(e.target.value))}
|
||||
className="mt-1 w-full"
|
||||
className="col-span-2 mt-1 w-full"
|
||||
/>
|
||||
</label>
|
||||
<label className="mb-2 block text-[11px] text-faint">
|
||||
<label className="mb-2 grid grid-cols-[1fr_auto] items-center gap-x-2 text-[12px] text-muted">
|
||||
{t.dev.spotFeather}
|
||||
<output className="font-mono text-[11px] text-ink">{spotFeather}</output>
|
||||
<input
|
||||
type="range"
|
||||
min={0}
|
||||
@@ -850,11 +882,12 @@ export function DevelopPage() {
|
||||
value={spotFeather}
|
||||
disabled={!canEdit}
|
||||
onChange={(e) => setSpotFeather(Number(e.target.value))}
|
||||
className="mt-1 w-full"
|
||||
className="col-span-2 mt-1 w-full"
|
||||
/>
|
||||
</label>
|
||||
<label className="mb-2 block text-[11px] text-faint">
|
||||
<label className="mb-2 grid grid-cols-[1fr_auto] items-center gap-x-2 text-[12px] text-muted">
|
||||
{t.dev.spotOpacity}
|
||||
<output className="font-mono text-[11px] text-ink">{spotOpacity}</output>
|
||||
<input
|
||||
type="range"
|
||||
min={0}
|
||||
@@ -863,7 +896,7 @@ export function DevelopPage() {
|
||||
value={spotOpacity}
|
||||
disabled={!canEdit}
|
||||
onChange={(e) => setSpotOpacity(Number(e.target.value))}
|
||||
className="mt-1 w-full"
|
||||
className="col-span-2 mt-1 w-full"
|
||||
/>
|
||||
</label>
|
||||
{spots.length > 0 && (
|
||||
@@ -884,20 +917,10 @@ export function DevelopPage() {
|
||||
</ul>
|
||||
)}
|
||||
</Section>
|
||||
{modules.includes("crop") && (
|
||||
)}
|
||||
{modules.includes("crop") && cropping && (
|
||||
<Section title={t.modules.crop}>
|
||||
<div className="mb-2 flex items-center gap-2">
|
||||
<button
|
||||
disabled={!canEdit}
|
||||
onClick={() => {
|
||||
setSpotting(false);
|
||||
setCropping(!cropping);
|
||||
}}
|
||||
aria-pressed={cropping}
|
||||
className={`h-7 border border-black px-3 text-[12px] disabled:opacity-40 ${cropping ? "bg-accent text-white" : "bg-cell"}`}
|
||||
>
|
||||
{cropping ? t.dev.cropDone : t.dev.crop}
|
||||
</button>
|
||||
<button
|
||||
disabled={!canEdit || !session?.loaded || !sourceSize}
|
||||
onClick={() => void autoCrop()}
|
||||
|
||||
+26
-6
@@ -54,18 +54,38 @@ body {
|
||||
outline-offset: 2px;
|
||||
}
|
||||
|
||||
/* Lightroom-style panel section header. */
|
||||
/* Shared panel title: the same quiet header in every module. */
|
||||
.panel-head {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: 8px 12px;
|
||||
gap: 8px;
|
||||
padding: 10px 12px;
|
||||
border-bottom: 1px solid var(--color-line);
|
||||
font-size: 11px;
|
||||
font-size: 13px;
|
||||
font-weight: 600;
|
||||
letter-spacing: 0.08em;
|
||||
text-transform: uppercase;
|
||||
color: #d0d0d0;
|
||||
letter-spacing: 0;
|
||||
text-transform: none;
|
||||
color: var(--color-ink);
|
||||
}
|
||||
|
||||
/* One row of tools. The active one is marked, and only that tool's controls show. */
|
||||
.pr-tools {
|
||||
display: flex;
|
||||
border-bottom: 1px solid var(--color-line);
|
||||
}
|
||||
.pr-tools button {
|
||||
flex: 1;
|
||||
height: 36px;
|
||||
border: none;
|
||||
border-bottom: 2px solid transparent;
|
||||
background: transparent;
|
||||
color: var(--color-faint);
|
||||
font-size: 13px;
|
||||
}
|
||||
.pr-tools button[aria-pressed="true"] {
|
||||
color: var(--color-ink);
|
||||
border-bottom-color: var(--color-accent);
|
||||
}
|
||||
|
||||
/* Develop sliders: thin track drawn by the panel, small round thumb (Lightroom-like). */
|
||||
|
||||
Reference in new issue
Block a user