8000 Move the other screens to colour names, type scale and focus rings by kiran-brahma · Pull Request #78 · kiran-brahma/writing-tool · GitHub
[go: up one dir, main page]

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/help/HowThisWorksView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,25 +20,25 @@ export function HowThisWorksView({ initialSectionId = null }: { initialSectionId
<div className="min-h-0 flex-1 overflow-y-auto">
<article className="mx-auto max-w-2xl px-6 py-8">
<h2 className="text-lg font-semibold tracking-tight">How this works</h2>
<p className="mt-1 text-sm text-stone-500">
<p className="mt-1 text-sm text-faint-ink">
The method inside the tool: the two rules, the loop, the words, and the keys.
</p>

{HELP_SECTIONS.map((section) => (
<section key={section.id} id={section.id} className="mt-8 scroll-mt-8">
<h3 className="text-base font-semibold text-stone-900">{section.heading}</h3>
<h3 className="text-lg font-semibold text-ink">{section.heading}</h3>
{section.paragraphs.map((paragraph) => (
<p key={paragraph} className="mt-3 text-sm leading-relaxed text-stone-700">
<p key={paragraph} className="mt-3 text-sm leading-relaxed text-quiet-ink">
{paragraph}
</p>
))}
{section.items !== undefined && (
<ol className="mt-4 space-y-4">
{section.items.map((entry) => (
<li key={entry.title}>
<h4 className="text-sm font-semibold text-stone-900">{entry.title}</h4>
<h4 className="text-sm font-semibold text-ink">{entry.title}</h4>
{entry.body.map((paragraph) => (
<p key={paragraph} className="mt-1 text-sm leading-relaxed text-stone-700">
<p key={paragraph} className="mt-1 text-sm leading-relaxed text-quiet-ink">
{paragraph}
</p>
))}
Expand Down
35 changes: 18 additions & 17 deletions src/library/BackupPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,31 +62,32 @@ export function BackupPanel({
};

return (
<section className="mt-6 rounded border border-stone-200 bg-white p-4">
<section className="mt-6 rounded border border-rule-soft bg-paper p-4">
<div className="flex flex-wrap items-center justify-between gap-3">
<div>
<h3 className="text-sm font-semibold">Backup</h3>
<p className="mt-0.5 text-xs text-stone-500">
<p className="mt-0.5 text-xs text-faint-ink">
{PANEL_GLOSSES.backup.text}{" "}
{onOpenHelp !== undefined && (
<button
type="button"
=> onOpenHelp(PANEL_GLOSSES.backup.sectionId)}
className="text-stone-500 underline hover:text-stone-800"
className="text-faint-ink underline hover:text-soft-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus"
>
How this works
</button>
)}
</p>
<p className={reminder.stale ? "mt-1 text-sm text-amber-800" : "mt-1 text-sm text-stone-500"}>
<p className={reminder.stale ? "mt-1 text-sm text-warning-soft" : "mt-1 text-sm text-faint-ink"}>
{reminder.label}
{reminder.stale && " Back up the library before clearing this browser."}
</p>
</div>
<div className="flex flex-wrap items-center gap-3">
<label className="flex items-center gap-1.5 text-xs text-stone-600">
<label className="flex items-center gap-1.5 text-xs text-muted-ink">
<input
type="checkbox"
className="focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus"
checked={includeKeys}
=> setIncludeKeys(event.target.checked)}
/>
Expand All @@ -95,21 +96,21 @@ export function BackupPanel({
<button
type="button"
>
className="rounded bg-stone-900 px-3 py-1.5 text-sm font-medium text-stone-50 hover:bg-stone-700"
className="rounded bg-ink px-3 py-1.5 text-sm font-medium text-on-ink hover:bg-quiet-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus focus-visible:ring-offset-2"
>
Back up library
</button>
</div>
</div>

{includeKeys && (
<p className="mt-2 text-xs text-amber-800">
<p className="mt-2 text-xs text-warning-soft">
The backup will carry your API keys in plain text. Do not share the file.
</p>
)}

<div className="mt-3 flex flex-wrap items-center gap-3 border-t border-stone-100 pt-3">
<label className="cursor-pointer rounded border border-stone-300 bg-white px-2.5 py-1 text-xs font-medium text-stone-700 hover:bg-stone-100">
<div className="mt-3 flex flex-wrap items-center gap-3 border-t border-rule-faint pt-3">
<label className="cursor-pointer rounded border border-rule bg-paper px-2.5 py-1 text-xs font-medium text-quiet-ink hover:bg-sunk has-focus-visible:ring-2 has-focus-visible:ring-focus">
Restore from backup
<input
type="file"
Expand All @@ -118,7 +119,7 @@ export function BackupPanel({
=> void chooseRestore(event)}
/>
</label>
<label className="cursor-pointer rounded border border-stone-300 bg-white px-2.5 py-1 text-xs font-medium text-stone-700 hover:bg-stone-100">
<label className="cursor-pointer rounded border border-rule bg-paper px-2.5 py-1 text-xs font-medium text-quiet-ink hover:bg-sunk has-focus-visible:ring-2 has-focus-visible:ring-focus">
Import document bundle
<input
type="file"
Expand All @@ -127,15 +128,15 @@ export function BackupPanel({
=> void importBundle(event)}
/>
</label>
<span className="text-xs text-stone-500">
<span className="text-xs text-faint-ink">
A restore replaces the library. Keys already stored in this browser are kept; keys omitted
from a backup cannot be restored.
</span>
</div>

{pending !== null && (
<div className="mt-3 rounded border border-amber-300 bg-amber-50 p-3">
<p className="text-sm text-amber-900">
<div className="mt-3 rounded border border-warning-rule-strong bg-warning-surface p-3">
<p className="text-sm text-warning">
Restore <span className="font-semibold">{pending.name}</span>? This replaces every
document, revision, finding and setting in this browser. The current library cannot be
recovered afterwards unless it is itself backed up.
Expand All @@ -145,15 +146,15 @@ export function BackupPanel({
type="button"
=> void confirmRestore()}
disabled={busy}
className="rounded bg-amb 8000 er-900 px-3 py-1.5 text-sm font-medium text-amber-50 hover:bg-amber-800 disabled:opacity-50"
className="rounded bg-warning px-3 py-1.5 text-sm font-medium text-warning-surface hover:bg-warning-soft disabled:opacity-50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-warning-focus focus-visible:ring-offset-2"
>
Replace library
</button>
<button
type="button"
=> setPending(null)}
disabled={busy}
className="rounded border border-stone-300 bg-white px-3 py-1.5 text-sm font-medium text-stone-700 hover:bg-stone-100"
className="rounded border border-rule bg-paper px-3 py-1.5 text-sm font-medium text-quiet-ink hover:bg-sunk focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus"
>
Cancel
</button>
Expand All @@ -162,12 +163,12 @@ export function BackupPanel({
)}

{error !== null && (
<div className="mt-3 flex items-start justify-between gap-3 rounded border border-amber-200 bg-amber-50 p-3 text-sm text-amber-900">
<div className="mt-3 flex items-start justify-between gap-3 rounded border border-warning-rule bg-warning-surface p-3 text-sm text-warning">
<span>{error}</span>
<button
type="button"
>
className="text-amber-700 hover:text-amber-900"
className="text-warning-muted hover:text-warning focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-warning-focus"
>
Dismiss
</button>
Expand Down
38 changes: 19 additions & 19 deletions src/library/LibraryView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,14 +82,14 @@ export function LibraryView({
<div className="flex flex-wrap items-center justify-between gap-3">
<div>
<h2 className="text-lg font-semibold tracking-tight">Library</h2>
<p className="text-sm text-stone-500">
<p className="text-sm text-faint-ink">
{entries.length} {entries.length === 1 ? "document" : "documents"} in this browser.{" "}
{PANEL_GLOSSES.library.text}{" "}
{onOpenHelp !== undefined && (
<button
type="button"
=> onOpenHelp(PANEL_GLOSSES.library.sectionId)}
className="text-stone-500 underline hover:text-stone-800"
className="text-faint-ink underline hover:text-soft-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus"
>
How this works
</button>
Expand All @@ -99,7 +99,7 @@ export function LibraryView({
<button
type="button"
>
className="rounded bg-stone-900 px-3 py-1.5 text-sm font-medium text-stone-50 hover:bg-stone-700"
className="rounded bg-ink px-3 py-1.5 text-sm font-medium text-on-ink hover:bg-quiet-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus focus-visible:ring-offset-2"
>
New document
</button>
Expand All @@ -122,12 +122,12 @@ export function LibraryView({
=> setQuery(event.target.value)}
placeholder="Search titles and body text"
aria-label="Search documents"
className="w-full rounded border border-stone-300 bg-white px-3 py-2 text-sm focus:border-stone-500 focus:outline-none"
className="w-full rounded border border-rule bg-paper px-3 py-2 text-sm focus:border-rule-focus focus:outline-none focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus"
/>

{tags.length > 0 && (
<div className="flex flex-wrap items-center gap-1.5">
<span className="text-xs uppercase tracking-wide text-stone-500">Filter</span>
<span className="text-xs uppercase tracking-wide text-faint-ink">Filter</span>
<TagFilterChip label="All" active={activeTag === null} => setTag(null)} />
{tags.map((tagName) => (
<TagFilterChip
Expand All @@ -143,7 +143,7 @@ export function LibraryView({

<ol className="mt-6 space-y-3">
{visible.length === 0 && (
<li className="rounded border border-dashed border-stone-300 px-4 py-8 text-center text-sm text-stone-500">
<li className="rounded border border-dashed border-rule px-4 py-8 text-center text-sm text-faint-ink">
{entries.length === 0
? "No documents yet. Create one, or start typing in the scratchpad."
: "No documents match this search."}
Expand Down Expand Up @@ -185,21 +185,21 @@ function LibraryRow({
<li
className={
active
? "rounded border border-stone-400 bg-white p-4 shadow-sm"
: "rounded border border-stone-200 bg-white p-4"
? "rounded border border-rule-strong bg-paper p-4 shadow-sm"
: "rounded border border-rule-soft bg-paper p-4"
}
>
<div className="flex items-start justify-between gap-3">
<button
type="button"
=> onOpen(entry.id)}
className="text-left text-base font-semibold text-stone-900 hover:underline"
className="text-left text-lg font-semibold text-ink hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus"
>
{entry.title}
</button>
<div className="flex shrink-0 items-center gap-2">
{entry.scratchpad && (
<span className="rounded bg-stone-200 px-1.5 py-0.5 text-xs font-medium text-stone-700">
<span className="rounded bg-sunk-strong px-1.5 py-0.5 text-xs font-medium text-quiet-ink">
Scratchpad
</span>
)}
Expand All @@ -212,7 +212,7 @@ function LibraryRow({
=> {
if (isDocumentStatus(event.target.value)) onStatus(entry.id, event.target.value);
}}
className="rounded border border-stone-300 bg-white px-1.5 py-1 text-xs text-stone-700 focus:border-stone-500 focus:outline-none"
className="rounded border border-rule bg-paper px-1.5 py-1 text-xs text-quiet-ink focus:border-rule-focus focus:outline-none focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus"
>
{DOCUMENT_STATUSES.map((status) => (
<option key={status} value={status}>
Expand All @@ -223,14 +223,14 @@ function LibraryRow({
<button
type="button"
=> onExportBundle(entry.id)}
className="rounded border border-stone-300 bg-white px-2 py-1 text-xs font-medium text-stone-700 hover:bg-stone-100"
className="rounded border border-rule bg-paper px-2 py-1 text-xs font-medium text-quiet-ink hover:bg-sunk focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus"
>
Export bundle
</button>
</div>
</div>

<p className="mt-1 text-xs text-stone-500">
<p className="mt-1 text-xs text-faint-ink">
{entry.wordCount} word{entry.wordCount === 1 ? "" : "s"} · edited{" "}
{new Date(entry.updatedAt).toLocaleString()} ·{" "}
{entry.openFindings === 0
Expand Down Expand Up @@ -259,14 +259,14 @@ function TagEditor({ tags, onChange }: { tags: string[]; onChange: (tags: string
{tags.map((tag) => (
<span
key={tag}
className="inline-flex items-center gap-1 rounded bg-stone-100 px-2 py-0.5 text-xs text-stone-700"
className="inline-flex items-center gap-1 rounded bg-sunk px-2 py-0.5 text-xs text-quiet-ink"
>
{tag}
<button
type="button"
aria-label={`Remove tag ${tag}`}
=> onChange(tags.filter((existing) => existing !== tag))}
className="text-stone-400 hover:text-stone-700"
className="text-ghost-ink hover:text-quiet-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus"
>
×
</button>
Expand All @@ -278,11 +278,11 @@ function TagEditor({ tags, onChange }: { tags: string[]; onChange: (tags: string
=> setDraft(event.target.value)}
placeholder="Add tag"
aria-label="Add a tag"
className="w-24 rounded border border-stone-200 px-1.5 py-0.5 text-xs focus:border-stone-400 focus:outline-none"
className="w-24 rounded border border-rule-soft px-1.5 py-0.5 text-xs focus:border-rule-strong focus:outline-none focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus"
/>
<button
type="submit"
className="rounded border border-stone-200 px-1.5 py-0.5 text-xs text-stone-600 hover:bg-stone-100"
className="rounded border border-rule-soft px-1.5 py-0.5 text-xs text-muted-ink hover:bg-sunk focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus"
>
Tag
</button>
Expand All @@ -307,8 +307,8 @@ function TagFilterChip({
aria-pressed={active}
className={
active
? "rounded-full bg-stone-900 px-2.5 py-1 text-xs font-medium text-stone-50"
: "rounded-full border border-stone-300 bg-white px-2.5 py-1 text-xs text-stone-600 hover:bg-stone-100"
? "rounded-full bg-ink px-2.5 py-1 text-xs font-medium text-on-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus focus-visible:ring-offset-2"
: "rounded-full border border-rule bg-paper px-2.5 py-1 text-xs text-muted-ink hover:bg-sunk focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus"
}
>
{label}
Expand Down
12 changes: 6 additions & 6 deletions src/privacy/PrivacyView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ export function PrivacyView() {
<div className="min-h-0 flex-1 overflow-y-auto">
<article className="mx-auto max-w-2xl px-6 py-8">
<h2 className="text-lg font-semibold tracking-tight">Privacy</h2>
<p className="mt-1 text-sm text-stone-500">
<p className="mt-1 text-sm text-faint-ink">
What happens to your words, and how to check it yourself.
</p>

{PRIVACY_SECTIONS.map((section) => (
<section key={section.heading} className="mt-8">
<h3 className="text-base font-semibold text-stone-900">{section.heading}</h3>
<h3 className="text-lg font-semibold text-ink">{section.heading}</h3>
{section.paragraphs.map((paragraph) => (
<p key={paragraph} className="mt-3 text-sm leading-relaxed text-stone-700">
<p key={paragraph} className="mt-3 text-sm leading-relaxed text-quiet-ink">
{paragraph}
</p>
))}
Expand All @@ -28,9 +28,9 @@ export function PrivacyView() {
<ol className="mt-4 space-y-4">
{section.steps.map((step) => (
<li key={step.title}>
<h4 className="text-sm font-semibold text-stone-900">{step.title}</h4>
<h4 className="text-sm font-semibold text-ink">{step.title}</h4>
{step.body.map((paragraph) => (
<p key={paragraph} className="mt-1 text-sm leading-relaxed text-stone-700">
<p key={paragraph} className="mt-1 text-sm leading-relaxed text-quiet-ink">
{paragraph}
</p>
))}
Expand Down Expand Up @@ -61,7 +61,7 @@ function LinkList({ links }: { links: readonly PrivacyLink[] }) {
href={link.href}
target="_blank"
rel="noopener noreferrer"
className="text-sm text-blue-700 underline underline-offset-2 hover:text-blue-900"
className="text-sm text-link underline underline-offset-2 hover:text-link-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus"
>
{link.label}
<span aria-hidden="true"> ↗</span>
Expand Down
Loading
0