Files
luminary/src/components/Shortcuts.tsx
T
bhursey b39cad02fe
CI / verify (push) Has been cancelled
Read the app version from package.json everywhere
The version was duplicated in the server, the About panel and the release
scripts, and had already drifted once. The server health endpoint and the
About panel now take it from package.json, and the help sheet gained an
About section that shows the version alongside the guide details.
2026-12-01 06:02:16 +00:00

112 lines
4.0 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import { useEffect } from 'react';
import { APP_VERSION, GUIDE_UPDATED, GUIDE_VERSION } from '../lib/about';
const GROUPS: { title: string; rows: [string, string][] }[] = [
{
title: 'Everywhere',
rows: [
['?', 'Show or hide this list'],
['⌘ / Ctrl + K', 'Search photos, events and actions'],
['⌘ / Ctrl + I', 'Import photos'],
['⌘ / Ctrl + E', 'Export'],
['Esc', 'Close a dialog'],
],
},
{
title: 'Library',
rows: [
['G', 'Library grid'],
['E', 'Open in Develop'],
['← → ↑ ↓', 'Move the selection'],
['Shift + arrows', 'Extend the selection'],
['⌘ / Ctrl + A', 'Select all shown'],
['C', 'Compare selected photos'],
['1 – 5', 'Star rating'],
['0', 'Clear rating'],
['6 – 9', 'Red, yellow, green, blue label'],
['P / X / U', 'Pick · reject · unflag'],
['Delete', 'Remove selected photos'],
['⌘ / Ctrl + C / V', 'Copy · paste develop settings'],
['Drag on empty space', 'Rubber-band select'],
],
},
{
title: 'Develop',
rows: [
['Z', 'Fit · 100%'],
['C', 'Crop & straighten'],
['Q', 'Spot healing brush'],
['M', 'Edit the selected local mask'],
['O', 'Show or hide the mask tint'],
['Enter', 'Apply the crop'],
['\\ (hold)', 'Before / after'],
['1 – 5', 'Star rating'],
['0', 'Clear rating'],
['6 – 9', 'Red, yellow, green, blue label'],
['P / X / U', 'Pick · reject · unflag'],
['J / Shift + J', 'Highlight · shadow clipping'],
['F', 'Full-screen loupe with rating and flags'],
['← →', 'Previous · next photo'],
['Scroll · drag', 'Zoom · pan'],
['⌘ / Ctrl + Z', 'Undo'],
['⌘ / Ctrl + Shift + Z', 'Redo'],
['⌘ / Ctrl + C / V', 'Copy · paste settings'],
['Esc', 'Back to library'],
],
},
];
export default function Shortcuts({ onClose }: { onClose: () => void }) {
useEffect(() => {
const onKey = (e: KeyboardEvent) => {
if (e.key === 'Escape') {
e.preventDefault();
// Keep Escape from also closing the photo or crop behind the sheet.
e.stopImmediatePropagation();
onClose();
}
};
window.addEventListener('keydown', onKey, true);
return () => window.removeEventListener('keydown', onKey, true);
}, [onClose]);
return (
<div className="modal-backdrop" onPointerDown={(e) => e.target === e.currentTarget && onClose()}>
<div className="modal shortcuts-modal">
<header className="modal-head">
<h2>Keyboard shortcuts</h2>
<button className="icon-btn" onClick={onClose} title="Close">
✕
</button>
</header>
<div className="modal-body shortcut-grid">
{GROUPS.map((group) => (
<section key={group.title}>
<h3>{group.title}</h3>
{group.rows.map(([keys, what]) => (
<div className="shortcut-row" key={keys}>
<span className="shortcut-keys">{keys}</span>
<span className="shortcut-what">{what}</span>
</div>
))}
</section>
))}
<section className="shortcut-start">
<h3>Quick start</h3>
<p>Import a shoot, rate and pick frames in the library, then open Develop for the keepers.</p>
<p>Hover a panel seam to reveal its collapse tab. Press Tab to move focus, or ? for this list.</p>
<p>⌘K / Ctrl+K searches the whole catalog without changing your current filters.</p>
</section>
<section className="shortcut-start shortcut-about">
<h3>About Luminary</h3>
<p>
Version {APP_VERSION} · Beta · user guide {GUIDE_VERSION}, updated {GUIDE_UPDATED}.
</p>
<p>Click the Luminary name in the top bar for the full About panel and the PDF guide.</p>
</section>
</div>
</div>
</div>
);
}