@lemonriver/core 0.2.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{build-Df_xwIpg.js → build-Nl7EeJ6x.js} +1 -1
- package/dist/cli/bin.js +4 -4
- package/dist/{config-rMGCkz6i.d.ts → config-CYNOR93W.d.ts} +1 -1
- package/dist/{config-BjWCLoMQ.js → config-CpC0nM3r.js} +3152 -1837
- package/dist/{dev-Ctsx9IeO.js → dev-BB3THd5I.js} +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/locale/index.d.ts +1 -1
- package/dist/locale/index.js +1 -1
- package/dist/{preview-CJgcqsPk.js → preview-BGjgTg7H.js} +1 -1
- package/dist/{types-8VUyA2bu.d.ts → types-tdaXSyah.d.ts} +1 -35
- package/dist/{update-BKOA3Z6o.js → update-DsxZBtwv.js} +2 -70
- package/dist/vite/index.d.ts +1 -1
- package/dist/vite/index.js +1 -1
- package/dist/{zh-tw-CeLrYwRE.js → zh-tw-DcrDeKxr.js} +11 -172
- package/package.json +1 -1
- package/src/agent/prompt.ts +2 -0
- package/src/app/app.tsx +5 -18
- package/src/app/components/agent/agent-panel.tsx +5 -0
- package/src/app/components/agent/agent-presence.tsx +2 -2
- package/src/app/components/agent/history-view.tsx +3 -2
- package/src/app/components/agent/transcript.tsx +15 -4
- package/src/app/components/asset-view.tsx +6 -6
- package/src/app/components/command/command-menu.tsx +2 -1
- package/src/app/components/inspector/asset-picker-dialog.tsx +7 -5
- package/src/app/components/inspector/comment-layer.tsx +2 -1
- package/src/app/components/inspector/inspector-panel.tsx +2 -2
- package/src/app/components/player.tsx +105 -23
- package/src/app/components/present/curtain.tsx +52 -0
- package/src/app/components/present/last-slide-hint.tsx +36 -0
- package/src/app/components/sidebar/sidebar-footer.tsx +7 -2
- package/src/app/components/sidebar/sidebar.tsx +3 -2
- package/src/app/components/themes/theme-detail.tsx +4 -2
- package/src/app/components/thumbnail-rail.tsx +2 -28
- package/src/app/index.html +2 -2
- package/src/app/lemonriver/agent/lemon.tsx +79 -0
- package/src/app/lemonriver/agent-prefs/prefs.test.ts +173 -0
- package/src/app/lemonriver/agent-prefs/prefs.ts +137 -0
- package/src/app/lemonriver/agent-prefs/use-prefs.ts +36 -0
- package/src/app/{components → lemonriver}/board/board-canvas.tsx +17 -17
- package/src/app/{routes/board.tsx → lemonriver/board/board-page.tsx} +16 -15
- package/src/app/{components → lemonriver}/board/layout.ts +1 -1
- package/src/app/lemonriver/board/model/cards.test.ts +239 -0
- package/src/app/lemonriver/board/model/cards.ts +234 -0
- package/src/app/lemonriver/board/model/structure.test.ts +101 -0
- package/src/app/lemonriver/board/model/structure.ts +82 -0
- package/src/app/{components → lemonriver}/board/page-node.tsx +34 -31
- package/src/app/{components → lemonriver}/board/use-board-cards.ts +6 -6
- package/src/app/{components → lemonriver}/board/use-board-columns.ts +7 -7
- package/src/app/{components → lemonriver}/board/use-page-order.ts +10 -6
- package/src/app/lemonriver/brand/app-icon.svg +44 -0
- package/src/app/lemonriver/brand/apple-touch-icon.png +0 -0
- package/src/app/lemonriver/brand/favicon-32.png +0 -0
- package/src/app/lemonriver/brand/mascot.tsx +145 -0
- package/src/app/lemonriver/brand/mascots/design-done.png +0 -0
- package/src/app/lemonriver/brand/mascots/design-idle.png +0 -0
- package/src/app/lemonriver/brand/mascots/design-needs-you.png +0 -0
- package/src/app/lemonriver/brand/mascots/design-working.png +0 -0
- package/src/app/lemonriver/brand/mascots/lemon-done.png +0 -0
- package/src/app/lemonriver/brand/mascots/lemon-idle.png +0 -0
- package/src/app/lemonriver/brand/mascots/lemon-needs-you.png +0 -0
- package/src/app/lemonriver/brand/mascots/lemon-thinking.png +0 -0
- package/src/app/lemonriver/brand/mascots/lemon-working.png +0 -0
- package/src/app/lemonriver/brand/mascots/outline-done.png +0 -0
- package/src/app/lemonriver/brand/mascots/outline-idle.png +0 -0
- package/src/app/lemonriver/brand/mascots/outline-needs-you.png +0 -0
- package/src/app/lemonriver/brand/mascots/outline-working.png +0 -0
- package/src/app/lemonriver/brand/mascots/research-done.png +0 -0
- package/src/app/lemonriver/brand/mascots/research-idle.png +0 -0
- package/src/app/lemonriver/brand/mascots/research-needs-you.png +0 -0
- package/src/app/lemonriver/brand/mascots/research-working.png +0 -0
- package/src/app/lemonriver/brand/mascots/review-done.png +0 -0
- package/src/app/lemonriver/brand/mascots/review-idle.png +0 -0
- package/src/app/lemonriver/brand/mascots/review-needs-you.png +0 -0
- package/src/app/lemonriver/brand/mascots/review-working.png +0 -0
- package/src/app/lemonriver/chrome/app-chrome.tsx +101 -0
- package/src/app/lemonriver/chrome/nav-row.tsx +34 -0
- package/src/app/lemonriver/chrome/not-found.tsx +34 -0
- package/src/app/lemonriver/chrome/sidebar-extras.tsx +57 -0
- package/src/app/lemonriver/chrome/use-slot.ts +23 -0
- package/src/app/lemonriver/features.test.ts +34 -0
- package/src/app/lemonriver/features.ts +27 -0
- package/src/app/lemonriver/feedback/export.ts +7 -0
- package/src/app/lemonriver/feedback/lemon-empty.tsx +54 -0
- package/src/app/lemonriver/feedback/offline-banner.tsx +41 -0
- package/src/app/lemonriver/feedback/pending-toast.test.ts +44 -0
- package/src/app/lemonriver/feedback/pending-toast.ts +39 -0
- package/src/app/lemonriver/feedback/toaster.tsx +34 -0
- package/src/app/lemonriver/feedback/upload.test.ts +26 -0
- package/src/app/lemonriver/feedback/upload.ts +19 -0
- package/src/app/lemonriver/home/brief-card.tsx +70 -0
- package/src/app/lemonriver/home/brief.test.ts +38 -0
- package/src/app/lemonriver/home/brief.ts +34 -0
- package/src/app/lemonriver/home/controls.tsx +93 -0
- package/src/app/lemonriver/home/deck-card.tsx +183 -0
- package/src/app/lemonriver/home/dialogs.tsx +292 -0
- package/src/app/lemonriver/home/home-page.tsx +339 -0
- package/src/app/lemonriver/home/sorting.test.ts +24 -0
- package/src/app/lemonriver/home/sorting.ts +59 -0
- package/src/app/lemonriver/home/time.test.ts +33 -0
- package/src/app/lemonriver/home/time.ts +33 -0
- package/src/app/lemonriver/home/use-deck-times.ts +27 -0
- package/src/app/lemonriver/home/use-delayed.ts +15 -0
- package/src/app/lemonriver/onboarding/onboarding.tsx +182 -0
- package/src/app/lemonriver/outline/build-team.tsx +278 -0
- package/src/app/lemonriver/outline/describe-page.tsx +380 -0
- package/src/app/lemonriver/outline/files.test.ts +90 -0
- package/src/app/lemonriver/outline/files.ts +69 -0
- package/src/app/lemonriver/outline/model.test.ts +633 -0
- package/src/app/lemonriver/outline/model.ts +443 -0
- package/src/app/lemonriver/outline/outline-page.tsx +504 -0
- package/src/app/lemonriver/outline/pending-pages.tsx +39 -0
- package/src/app/lemonriver/outline/rule.ts +3 -0
- package/src/app/lemonriver/outline/steps.tsx +43 -0
- package/src/app/lemonriver/outline/use-build-driver.ts +258 -0
- package/src/app/lemonriver/routes.test.tsx +37 -0
- package/src/app/lemonriver/routes.tsx +66 -0
- package/src/app/lemonriver/settings/settings-page.tsx +314 -0
- package/src/app/lemonriver/slide-extensions.tsx +80 -0
- package/src/app/lemonriver/text/all.ts +19 -0
- package/src/app/lemonriver/text/en.ts +255 -0
- package/src/app/lemonriver/text/es.ts +256 -0
- package/src/app/lemonriver/text/index.ts +9 -0
- package/src/app/lemonriver/text/ja.ts +256 -0
- package/src/app/lemonriver/text/text.test.ts +90 -0
- package/src/app/lemonriver/text/types.ts +280 -0
- package/src/app/lemonriver/text/zh-cn.ts +247 -0
- package/src/app/lemonriver/text/zh-tw.ts +247 -0
- package/src/app/lemonriver/theme/app.css +299 -0
- package/src/app/lemonriver/theme/controls.css +463 -0
- package/src/app/lemonriver/theme/index.css +3 -0
- package/src/app/lemonriver/theme/motion.ts +52 -0
- package/src/app/lemonriver/theme/pages.test.ts +70 -0
- package/src/app/lemonriver/theme/pages.ts +65 -0
- package/src/app/lemonriver/theme/theme-menu.tsx +64 -0
- package/src/app/lemonriver/theme/themes.test.ts +18 -0
- package/src/app/lemonriver/theme/themes.ts +16 -0
- package/src/app/lemonriver/theme/tokens.css +226 -0
- package/src/app/lemonriver/theme/use-theme.tsx +49 -0
- package/src/app/lemonriver/trash/api.test.ts +19 -0
- package/src/app/lemonriver/trash/api.ts +77 -0
- package/src/app/lemonriver/trash/trash-page.tsx +131 -0
- package/src/app/lemonriver/update/beta-badge.tsx +26 -0
- package/src/app/lemonriver/update/prompt.test.ts +84 -0
- package/src/app/lemonriver/update/prompt.ts +48 -0
- package/src/app/lemonriver/update/update-prompt.tsx +113 -0
- package/src/app/lib/pptx/raster.ts +1 -1
- package/src/app/main.tsx +8 -1
- package/src/app/routes/home-shell.tsx +4 -2
- package/src/app/routes/home.tsx +13 -5
- package/src/app/routes/slide.tsx +81 -28
- package/src/app/styles.css +1 -0
- package/src/locale/en.ts +1 -35
- package/src/locale/es.ts +1 -34
- package/src/locale/ja.ts +1 -34
- package/src/locale/types.ts +1 -36
- package/src/locale/zh-cn.ts +4 -37
- package/src/locale/zh-tw.ts +4 -37
- /package/src/app/{components → lemonriver}/board/board.css +0 -0
- /package/src/app/{components → lemonriver}/board/layout.test.ts +0 -0
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The board's own structure, stored outside the deck: a deck file never learns
|
|
3
|
+
* that a board exists. Columns hold a count rather than page ids, so reordering
|
|
4
|
+
* a deck can never strand the structure — only the page count has to agree.
|
|
5
|
+
*/
|
|
6
|
+
export type BoardColumn = { title: string; size: number };
|
|
7
|
+
export type BoardStructure = { columns: BoardColumn[] };
|
|
8
|
+
|
|
9
|
+
export function sanitizeStructure(parsed: unknown): BoardStructure | null {
|
|
10
|
+
if (!parsed || typeof parsed !== 'object') return null;
|
|
11
|
+
const columns = (parsed as { columns?: unknown }).columns;
|
|
12
|
+
if (!Array.isArray(columns)) return null;
|
|
13
|
+
const cleaned = columns.flatMap((column) => {
|
|
14
|
+
if (!column || typeof column !== 'object') return [];
|
|
15
|
+
const { title, size } = column as { title?: unknown; size?: unknown };
|
|
16
|
+
if (typeof size !== 'number' || !Number.isInteger(size) || size < 0) return [];
|
|
17
|
+
return [{ title: typeof title === 'string' ? title : '', size }];
|
|
18
|
+
});
|
|
19
|
+
return cleaned.length > 0 ? { columns: cleaned } : null;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Keeps a stored structure usable after the deck changed behind the board's
|
|
24
|
+
* back: pages added outside the board join the last column, and pages deleted
|
|
25
|
+
* outside it come off the end.
|
|
26
|
+
*/
|
|
27
|
+
export function reconcileColumns(columns: BoardColumn[], pageCount: number): BoardColumn[] {
|
|
28
|
+
if (pageCount <= 0) return [];
|
|
29
|
+
const kept = columns.map((column) => ({ ...column }));
|
|
30
|
+
if (kept.length === 0) return [{ title: '', size: pageCount }];
|
|
31
|
+
|
|
32
|
+
let total = kept.reduce((sum, column) => sum + column.size, 0);
|
|
33
|
+
if (total === pageCount) return kept;
|
|
34
|
+
|
|
35
|
+
if (total < pageCount) {
|
|
36
|
+
kept[kept.length - 1].size += pageCount - total;
|
|
37
|
+
return kept;
|
|
38
|
+
}
|
|
39
|
+
for (let i = kept.length - 1; i >= 0 && total > pageCount; i--) {
|
|
40
|
+
const drop = Math.min(kept[i].size, total - pageCount);
|
|
41
|
+
kept[i].size -= drop;
|
|
42
|
+
total -= drop;
|
|
43
|
+
}
|
|
44
|
+
// A column emptied by deletions keeps its title; only trailing empties go, so
|
|
45
|
+
// the board does not accumulate labels for chapters that no longer exist.
|
|
46
|
+
while (kept.length > 1 && kept[kept.length - 1].size === 0) kept.pop();
|
|
47
|
+
return kept;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/** Column index that owns a position, and where each column starts. */
|
|
51
|
+
export function columnStarts(columns: BoardColumn[]): number[] {
|
|
52
|
+
const starts: number[] = [];
|
|
53
|
+
let at = 0;
|
|
54
|
+
for (const column of columns) {
|
|
55
|
+
starts.push(at);
|
|
56
|
+
at += column.size;
|
|
57
|
+
}
|
|
58
|
+
return starts;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export function columnOfPosition(columns: BoardColumn[], position: number): number {
|
|
62
|
+
const starts = columnStarts(columns);
|
|
63
|
+
for (let i = starts.length - 1; i >= 0; i--) {
|
|
64
|
+
if (position >= starts[i]) return i;
|
|
65
|
+
}
|
|
66
|
+
return 0;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Moving a card across a column boundary hands one page from one column to the
|
|
71
|
+
* other. Nothing else about the structure moves — a chapter divider is an
|
|
72
|
+
* ordinary card, so the pages it used to head keep their own column.
|
|
73
|
+
*/
|
|
74
|
+
export function columnsAfterMove(columns: BoardColumn[], from: number, to: number): BoardColumn[] {
|
|
75
|
+
const source = columnOfPosition(columns, from);
|
|
76
|
+
const target = columnOfPosition(columns, to);
|
|
77
|
+
if (source === target) return columns;
|
|
78
|
+
const next = columns.map((column) => ({ ...column }));
|
|
79
|
+
next[source].size -= 1;
|
|
80
|
+
next[target].size += 1;
|
|
81
|
+
return next;
|
|
82
|
+
}
|
|
@@ -15,19 +15,20 @@ import {
|
|
|
15
15
|
} from '@/components/ui/context-menu';
|
|
16
16
|
import { format, useLocale } from '@/lib/use-locale';
|
|
17
17
|
import { cn, pad2 } from '@/lib/utils';
|
|
18
|
+
import { SlideCanvas } from '../../components/slide-canvas';
|
|
19
|
+
import type { DesignSystem } from '../../lib/design';
|
|
20
|
+
import { useNotes } from '../../lib/inspector/use-notes';
|
|
21
|
+
import { SlidePageProvider } from '../../lib/page-context';
|
|
22
|
+
import { CANVAS_WIDTH, type Page } from '../../lib/sdk';
|
|
23
|
+
import { useLrText } from '../text';
|
|
24
|
+
import { CARD_H, CARD_W, MEMO_H, NOTE_H } from './layout';
|
|
18
25
|
import {
|
|
19
26
|
type BoardCard,
|
|
20
27
|
CARD_STATUSES,
|
|
21
28
|
type CardPatch,
|
|
22
29
|
type CardStatus,
|
|
23
30
|
isCardStatus,
|
|
24
|
-
} from '
|
|
25
|
-
import type { DesignSystem } from '../../lib/design';
|
|
26
|
-
import { useNotes } from '../../lib/inspector/use-notes';
|
|
27
|
-
import { SlidePageProvider } from '../../lib/page-context';
|
|
28
|
-
import { CANVAS_WIDTH, type Page } from '../../lib/sdk';
|
|
29
|
-
import { SlideCanvas } from '../slide-canvas';
|
|
30
|
-
import { CARD_H, CARD_W, MEMO_H, NOTE_H } from './layout';
|
|
31
|
+
} from './model/cards';
|
|
31
32
|
|
|
32
33
|
export type PageNodeData = {
|
|
33
34
|
slideId: string;
|
|
@@ -52,18 +53,18 @@ const hiddenHandle = { opacity: 0, width: 1, height: 1, minWidth: 1, minHeight:
|
|
|
52
53
|
|
|
53
54
|
const STATUS_STYLE: Record<CardStatus, { dot: string; ring: string }> = {
|
|
54
55
|
todo: { dot: 'bg-muted-foreground/50', ring: 'ring-muted-foreground/35' },
|
|
55
|
-
doing: { dot: 'bg-
|
|
56
|
-
review: { dot: 'bg-
|
|
57
|
-
done: { dot: 'bg-
|
|
56
|
+
doing: { dot: 'bg-[var(--lr-accent)]', ring: 'ring-[var(--lr-accent)]' },
|
|
57
|
+
review: { dot: 'bg-[var(--lr-warning)]', ring: 'ring-[var(--lr-warning)]/75' },
|
|
58
|
+
done: { dot: 'bg-[var(--lr-success)]', ring: 'ring-[var(--lr-success)]/70' },
|
|
58
59
|
};
|
|
59
60
|
|
|
60
61
|
export function useStatusLabels(): Record<CardStatus, string> {
|
|
61
|
-
const
|
|
62
|
+
const lr = useLrText();
|
|
62
63
|
return {
|
|
63
|
-
todo:
|
|
64
|
-
doing:
|
|
65
|
-
review:
|
|
66
|
-
done:
|
|
64
|
+
todo: lr.board.statusTodo,
|
|
65
|
+
doing: lr.board.statusDoing,
|
|
66
|
+
review: lr.board.statusReview,
|
|
67
|
+
done: lr.board.statusDone,
|
|
67
68
|
};
|
|
68
69
|
}
|
|
69
70
|
|
|
@@ -82,6 +83,7 @@ export function PageNode({ data, selected, dragging }: NodeProps) {
|
|
|
82
83
|
...actions
|
|
83
84
|
} = data as unknown as PageNodeData;
|
|
84
85
|
const t = useLocale();
|
|
86
|
+
const lr = useLrText();
|
|
85
87
|
const labels = useStatusLabels();
|
|
86
88
|
const status = card?.status;
|
|
87
89
|
const [renaming, setRenaming] = useState(false);
|
|
@@ -166,10 +168,10 @@ export function PageNode({ data, selected, dragging }: NodeProps) {
|
|
|
166
168
|
setRenaming(true);
|
|
167
169
|
}}
|
|
168
170
|
>
|
|
169
|
-
{
|
|
171
|
+
{lr.board.renameCard}
|
|
170
172
|
</ContextMenuItem>
|
|
171
173
|
<ContextMenuSub>
|
|
172
|
-
<ContextMenuSubTrigger disabled={!cardsReady}>{
|
|
174
|
+
<ContextMenuSubTrigger disabled={!cardsReady}>{lr.board.status}</ContextMenuSubTrigger>
|
|
173
175
|
<ContextMenuSubContent className="min-w-[150px]">
|
|
174
176
|
<ContextMenuRadioGroup
|
|
175
177
|
value={status ?? ''}
|
|
@@ -178,7 +180,7 @@ export function PageNode({ data, selected, dragging }: NodeProps) {
|
|
|
178
180
|
}
|
|
179
181
|
>
|
|
180
182
|
<ContextMenuRadioItem value="" closeOnClick>
|
|
181
|
-
{
|
|
183
|
+
{lr.board.statusNone}
|
|
182
184
|
</ContextMenuRadioItem>
|
|
183
185
|
{CARD_STATUSES.map((value) => (
|
|
184
186
|
<ContextMenuRadioItem key={value} value={value} closeOnClick>
|
|
@@ -199,7 +201,7 @@ export function PageNode({ data, selected, dragging }: NodeProps) {
|
|
|
199
201
|
onClick={() => actions.onMoveToEnd(index)}
|
|
200
202
|
>
|
|
201
203
|
<MoveRight />
|
|
202
|
-
{
|
|
204
|
+
{lr.board.moveToEnd}
|
|
203
205
|
</ContextMenuItem>
|
|
204
206
|
<ContextMenuSeparator />
|
|
205
207
|
<ContextMenuItem
|
|
@@ -226,7 +228,7 @@ export function PageNode({ data, selected, dragging }: NodeProps) {
|
|
|
226
228
|
type="source"
|
|
227
229
|
id="link"
|
|
228
230
|
position={Position.Right}
|
|
229
|
-
title={
|
|
231
|
+
title={lr.board.linkHandle}
|
|
230
232
|
className={cn('osd-board-link-handle', !canLink && 'hidden')}
|
|
231
233
|
isConnectableStart={canLink}
|
|
232
234
|
isConnectableEnd={false}
|
|
@@ -273,7 +275,7 @@ function CardTitle({
|
|
|
273
275
|
onEditingChange: (editing: boolean) => void;
|
|
274
276
|
onCommit: (title: string) => void;
|
|
275
277
|
}) {
|
|
276
|
-
const
|
|
278
|
+
const lr = useLrText();
|
|
277
279
|
const ref = useRef<HTMLInputElement | null>(null);
|
|
278
280
|
|
|
279
281
|
// Opened from the context menu, the field mounts while the menu is still
|
|
@@ -289,8 +291,8 @@ function CardTitle({
|
|
|
289
291
|
<input
|
|
290
292
|
ref={ref}
|
|
291
293
|
defaultValue={title ?? ''}
|
|
292
|
-
aria-label={
|
|
293
|
-
placeholder={
|
|
294
|
+
aria-label={lr.board.renameCard}
|
|
295
|
+
placeholder={lr.board.cardTitlePlaceholder}
|
|
294
296
|
onKeyDown={(e) => {
|
|
295
297
|
e.stopPropagation();
|
|
296
298
|
if (e.key === 'Enter') e.currentTarget.blur();
|
|
@@ -314,7 +316,7 @@ function CardTitle({
|
|
|
314
316
|
type="button"
|
|
315
317
|
disabled={disabled}
|
|
316
318
|
onClick={() => onEditingChange(true)}
|
|
317
|
-
aria-label={
|
|
319
|
+
aria-label={lr.board.renameCard}
|
|
318
320
|
className={cn(
|
|
319
321
|
'nodrag nopan min-w-0 truncate rounded-[4px] px-1.5 py-0.5 text-left text-[12.5px]',
|
|
320
322
|
'motion-safe:transition-[background-color,opacity] hover:bg-muted/60 disabled:pointer-events-none',
|
|
@@ -323,7 +325,7 @@ function CardTitle({
|
|
|
323
325
|
: 'text-muted-foreground/45 opacity-0 group-hover/card:opacity-100',
|
|
324
326
|
)}
|
|
325
327
|
>
|
|
326
|
-
{title ||
|
|
328
|
+
{title || lr.board.cardTitlePlaceholder}
|
|
327
329
|
</button>
|
|
328
330
|
);
|
|
329
331
|
}
|
|
@@ -343,6 +345,7 @@ function NoteStrip({
|
|
|
343
345
|
initial?: string;
|
|
344
346
|
}) {
|
|
345
347
|
const t = useLocale();
|
|
348
|
+
const lr = useLrText();
|
|
346
349
|
const [editing, setEditing] = useState(false);
|
|
347
350
|
const ref = useRef<HTMLTextAreaElement | null>(null);
|
|
348
351
|
const { value, setValue, status, flush } = useNotes(slideId, index, initial);
|
|
@@ -370,7 +373,7 @@ function NoteStrip({
|
|
|
370
373
|
e.currentTarget.blur();
|
|
371
374
|
}
|
|
372
375
|
}}
|
|
373
|
-
placeholder={
|
|
376
|
+
placeholder={lr.board.notesPlaceholder}
|
|
374
377
|
className={cn(
|
|
375
378
|
shared,
|
|
376
379
|
'nowheel h-full resize-none bg-muted/50 text-foreground outline-none',
|
|
@@ -392,7 +395,7 @@ function NoteStrip({
|
|
|
392
395
|
)}
|
|
393
396
|
>
|
|
394
397
|
<span className="line-clamp-3 whitespace-pre-wrap">
|
|
395
|
-
{value ||
|
|
398
|
+
{value || lr.board.notesPlaceholder}
|
|
396
399
|
</span>
|
|
397
400
|
</button>
|
|
398
401
|
)}
|
|
@@ -419,7 +422,7 @@ function MemoStrip({
|
|
|
419
422
|
disabled: boolean;
|
|
420
423
|
onCommit: (memo: string) => void;
|
|
421
424
|
}) {
|
|
422
|
-
const
|
|
425
|
+
const lr = useLrText();
|
|
423
426
|
const [draft, setDraft] = useState<string | null>(null);
|
|
424
427
|
const ref = useRef<HTMLTextAreaElement | null>(null);
|
|
425
428
|
const editing = draft !== null;
|
|
@@ -436,7 +439,7 @@ function MemoStrip({
|
|
|
436
439
|
<textarea
|
|
437
440
|
ref={ref}
|
|
438
441
|
value={draft}
|
|
439
|
-
aria-label={
|
|
442
|
+
aria-label={lr.board.memoPlaceholder}
|
|
440
443
|
onChange={(e) => setDraft(e.target.value)}
|
|
441
444
|
onBlur={() => {
|
|
442
445
|
const next = draft.trim();
|
|
@@ -447,7 +450,7 @@ function MemoStrip({
|
|
|
447
450
|
e.stopPropagation();
|
|
448
451
|
if (e.key === 'Escape') e.currentTarget.blur();
|
|
449
452
|
}}
|
|
450
|
-
placeholder={
|
|
453
|
+
placeholder={lr.board.memoPlaceholder}
|
|
451
454
|
className={cn(
|
|
452
455
|
shared,
|
|
453
456
|
'nowheel h-full resize-none bg-amber-500/10 text-foreground outline-none',
|
|
@@ -469,7 +472,7 @@ function MemoStrip({
|
|
|
469
472
|
)}
|
|
470
473
|
>
|
|
471
474
|
<span className="line-clamp-2 whitespace-pre-wrap">
|
|
472
|
-
{memo ||
|
|
475
|
+
{memo || lr.board.memoPlaceholder}
|
|
473
476
|
</span>
|
|
474
477
|
</button>
|
|
475
478
|
)}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
2
2
|
import { toast } from 'sonner';
|
|
3
|
-
import {
|
|
3
|
+
import type { Page } from '../../lib/sdk';
|
|
4
|
+
import { useLrText } from '../text';
|
|
4
5
|
import {
|
|
5
6
|
adoptEntries,
|
|
6
7
|
type BoardCard,
|
|
@@ -19,8 +20,7 @@ import {
|
|
|
19
20
|
sanitizeCards,
|
|
20
21
|
sanitizeLinks,
|
|
21
22
|
unlinkCards,
|
|
22
|
-
} from '
|
|
23
|
-
import type { Page } from '../../lib/sdk';
|
|
23
|
+
} from './model/cards';
|
|
24
24
|
|
|
25
25
|
type BoardState = {
|
|
26
26
|
cards: BoardCards;
|
|
@@ -41,7 +41,7 @@ const countAfter = (op: PageOp, count: number) =>
|
|
|
41
41
|
* data stays on its page however and wherever the deck is reordered.
|
|
42
42
|
*/
|
|
43
43
|
export function useBoardCards(slideId: string, modulePages: Page[], count: number) {
|
|
44
|
-
const
|
|
44
|
+
const lr = useLrText();
|
|
45
45
|
const [board, setBoard] = useState<BoardState>(INITIAL);
|
|
46
46
|
const boardRef = useRef(board);
|
|
47
47
|
const countRef = useRef(count);
|
|
@@ -63,11 +63,11 @@ export function useBoardCards(slideId: string, modulePages: Page[], count: numbe
|
|
|
63
63
|
});
|
|
64
64
|
if (!res.ok) throw new Error(`HTTP ${res.status}`);
|
|
65
65
|
} catch (err) {
|
|
66
|
-
toast.error(`${
|
|
66
|
+
toast.error(`${lr.board.saveFailed}: ${String((err as Error).message ?? err)}`);
|
|
67
67
|
}
|
|
68
68
|
});
|
|
69
69
|
},
|
|
70
|
-
[slideId,
|
|
70
|
+
[slideId, lr.board],
|
|
71
71
|
);
|
|
72
72
|
|
|
73
73
|
const commit = useCallback(
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { useCallback, useEffect, useRef, useState } from 'react';
|
|
2
2
|
import { toast } from 'sonner';
|
|
3
|
-
import {
|
|
3
|
+
import type { Page } from '../../lib/sdk';
|
|
4
|
+
import { useLrText } from '../text';
|
|
5
|
+
import { seedColumns } from './layout';
|
|
4
6
|
import {
|
|
5
7
|
type BoardColumn,
|
|
6
8
|
columnOfPosition,
|
|
7
9
|
columnsAfterMove,
|
|
8
10
|
reconcileColumns,
|
|
9
|
-
} from '
|
|
10
|
-
import type { Page } from '../../lib/sdk';
|
|
11
|
-
import { seedColumns } from './layout';
|
|
11
|
+
} from './model/structure';
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* The board's columns live beside the project, never in the deck file. The deck
|
|
@@ -21,7 +21,7 @@ export function useBoardColumns(
|
|
|
21
21
|
columnTitle: (index: number) => string,
|
|
22
22
|
) {
|
|
23
23
|
const [columns, setColumns] = useState<BoardColumn[] | null>(null);
|
|
24
|
-
const
|
|
24
|
+
const lr = useLrText();
|
|
25
25
|
const seedRef = useRef<{ pages: Page[]; title: (index: number) => string }>({
|
|
26
26
|
pages,
|
|
27
27
|
title: columnTitle,
|
|
@@ -38,10 +38,10 @@ export function useBoardColumns(
|
|
|
38
38
|
});
|
|
39
39
|
if (!res.ok) throw new Error(`HTTP ${res.status}`);
|
|
40
40
|
} catch (err) {
|
|
41
|
-
toast.error(`${
|
|
41
|
+
toast.error(`${lr.board.saveFailed}: ${String((err as Error).message ?? err)}`);
|
|
42
42
|
}
|
|
43
43
|
},
|
|
44
|
-
[slideId,
|
|
44
|
+
[slideId, lr.board],
|
|
45
45
|
);
|
|
46
46
|
|
|
47
47
|
// Load once the deck has pages. A deck with no stored structure gets one seeded
|
|
@@ -2,6 +2,7 @@ import { useCallback, useEffect, useState } from 'react';
|
|
|
2
2
|
import { toast } from 'sonner';
|
|
3
3
|
import { format, useLocale } from '@/lib/use-locale';
|
|
4
4
|
import type { Page } from '../../lib/sdk';
|
|
5
|
+
import { useLrText } from '../text';
|
|
5
6
|
|
|
6
7
|
/**
|
|
7
8
|
* Page edits on the board go through the same dev-server routes the thumbnail
|
|
@@ -11,6 +12,7 @@ import type { Page } from '../../lib/sdk';
|
|
|
11
12
|
export function usePageOrder(slideId: string, modulePages: Page[]) {
|
|
12
13
|
const [pages, setPages] = useState<Page[]>(modulePages);
|
|
13
14
|
const t = useLocale();
|
|
15
|
+
const lr = useLrText();
|
|
14
16
|
|
|
15
17
|
useEffect(() => {
|
|
16
18
|
setPages(modulePages);
|
|
@@ -48,11 +50,11 @@ export function usePageOrder(slideId: string, modulePages: Page[]) {
|
|
|
48
50
|
return true;
|
|
49
51
|
} catch (err) {
|
|
50
52
|
setPages(before);
|
|
51
|
-
toast.error(`${
|
|
53
|
+
toast.error(`${lr.board.reorderFailed}: ${String((err as Error).message ?? err)}`);
|
|
52
54
|
return false;
|
|
53
55
|
}
|
|
54
56
|
},
|
|
55
|
-
[pages, slideId, send,
|
|
57
|
+
[pages, slideId, send, lr.board],
|
|
56
58
|
);
|
|
57
59
|
|
|
58
60
|
const duplicate = useCallback(
|
|
@@ -89,18 +91,20 @@ export function usePageOrder(slideId: string, modulePages: Page[]) {
|
|
|
89
91
|
next.splice(i, 0, before[Math.max(0, i - 1)]);
|
|
90
92
|
setPages(next);
|
|
91
93
|
try {
|
|
92
|
-
await send(
|
|
94
|
+
await send('/__board/pages/insert', {
|
|
93
95
|
method: 'POST',
|
|
96
|
+
headers: { 'content-type': 'application/json' },
|
|
97
|
+
body: JSON.stringify({ slideId, index: i }),
|
|
94
98
|
});
|
|
95
|
-
toast.success(format(
|
|
99
|
+
toast.success(format(lr.board.toastInserted, { n: i + 1 }));
|
|
96
100
|
return true;
|
|
97
101
|
} catch (err) {
|
|
98
102
|
setPages(before);
|
|
99
|
-
toast.error(`${
|
|
103
|
+
toast.error(`${lr.board.insertFailed}: ${String((err as Error).message ?? err)}`);
|
|
100
104
|
return false;
|
|
101
105
|
}
|
|
102
106
|
},
|
|
103
|
-
[pages, slideId, send,
|
|
107
|
+
[pages, slideId, send, lr.board],
|
|
104
108
|
);
|
|
105
109
|
|
|
106
110
|
const remove = useCallback(
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="109.5 109.5 805.0 805.0" width="805" height="805"><defs><radialGradient id="ba" gradientUnits="userSpaceOnUse" cx="330" cy="430" r="1090" fx="250" fy="300"><stop offset="0" stop-color="#FFFA8C" /><stop offset="0.09" stop-color="#FDEF5C" /><stop offset="0.26" stop-color="#FCE331" /><stop offset="0.46" stop-color="#FCD91B" /><stop offset="0.64" stop-color="#FCD408" /><stop offset="0.82" stop-color="#FCC002" /><stop offset="1" stop-color="#F5A000" /></radialGradient>
|
|
2
|
+
<radialGradient id="sa" gradientUnits="userSpaceOnUse" cx="830" cy="980" r="640">
|
|
3
|
+
<stop offset="0" stop-color="#DE8600" stop-opacity="0.42" />
|
|
4
|
+
<stop offset="0.5" stop-color="#DE8600" stop-opacity="0.076" />
|
|
5
|
+
<stop offset="1" stop-color="#DE8600" stop-opacity="0" /></radialGradient>
|
|
6
|
+
<radialGradient id="ha" cx="0.45" cy="0.42" r="0.55">
|
|
7
|
+
<stop offset="0" stop-color="#FFFFFF" stop-opacity="0.98" />
|
|
8
|
+
<stop offset="0.42" stop-color="#FFFFFF" stop-opacity="0.49" />
|
|
9
|
+
<stop offset="1" stop-color="#FFFFFF" stop-opacity="0" /></radialGradient>
|
|
10
|
+
<linearGradient id="ra" gradientUnits="userSpaceOnUse" x1="40" y1="700" x2="330" y2="300">
|
|
11
|
+
<stop offset="0" stop-color="#FFF7BC" stop-opacity="0" />
|
|
12
|
+
<stop offset="0.5" stop-color="#FFF7BC" stop-opacity="0.9" />
|
|
13
|
+
<stop offset="1" stop-color="#FFF7BC" stop-opacity="0" /></linearGradient>
|
|
14
|
+
<linearGradient id="ea" gradientUnits="userSpaceOnUse" x1="530" y1="450" x2="700" y2="650"><stop offset="0" stop-color="#0B4212" /><stop offset="0.5" stop-color="#02380B" /><stop offset="1" stop-color="#012906" /></linearGradient>
|
|
15
|
+
<linearGradient id="la" gradientUnits="userSpaceOnUse" x1="600" y1="370" x2="250" y2="30"><stop offset="0" stop-color="#C8E45E" /><stop offset="0.3" stop-color="#A8D63C" /><stop offset="0.66" stop-color="#7BC227" /><stop offset="1" stop-color="#5AA81B" /></linearGradient>
|
|
16
|
+
<linearGradient id="lsa" gradientUnits="userSpaceOnUse" x1="250" y1="60" x2="560" y2="330">
|
|
17
|
+
<stop offset="0" stop-color="#3B7F0E" stop-opacity="0" />
|
|
18
|
+
<stop offset="0.6" stop-color="#3B7F0E" stop-opacity="0.16" />
|
|
19
|
+
<stop offset="1" stop-color="#3B7F0E" stop-opacity="0.42" /></linearGradient>
|
|
20
|
+
<clipPath id="ca"><path d="M389 1099C377 1096 357 1094 342 1090C326 1087 312 1083 298 1078C283 1073 270 1067 257 1061C244 1054 231 1047 219 1040C207 1032 196 1023 185 1014C174 1005 164 995 155 985C146 975 138 964 130 953C123 942 116 930 110 917C104 905 98 891 94 878C89 865 85 852 82 838C79 825 77 812 76 798C75 784 74 770 75 756C75 743 76 728 78 714C80 700 83 686 87 671C91 657 96 643 101 628C107 614 113 599 121 584C128 570 137 554 145 540C154 526 163 512 173 499C183 486 194 474 205 462C215 450 227 439 239 428C251 418 264 407 277 398C290 389 303 380 317 371C331 363 345 356 360 349C375 342 390 335 405 330C421 324 437 319 453 314C469 310 484 306 500 304C515 301 530 299 545 298C560 296 575 296 589 296C604 297 619 298 632 300C646 302 659 304 672 307C685 310 697 313 708 317C720 321 731 325 741 330C752 335 762 341 771 347C780 352 789 359 798 365C806 372 814 379 821 386C828 394 835 401 841 410C848 418 853 426 859 435C864 444 869 454 874 464C879 474 884 485 888 496C892 508 896 520 899 532C903 544 906 558 909 571C912 584 914 596 916 609C917 621 918 634 919 646C920 658 920 670 919 682C919 694 918 706 916 717C915 729 913 740 911 751C908 762 906 773 903 784C899 795 896 806 892 816C888 827 883 837 878 847C873 858 868 868 862 878C856 888 849 897 842 907C836 917 828 926 820 936C813 945 804 955 796 963C787 972 778 981 769 989C759 997 750 1004 740 1012C730 1019 720 1026 709 1032C699 1039 688 1045 677 1051C666 1056 654 1062 642 1066C630 1071 618 1076 605 1080C592 1084 579 1087 565 1090C552 1093 536 1096 523 1099C511 1101 501 1103 492 1105C483 1106 476 1108 471 1109C466 1110 462 1111 461 1111C459 1111 463 1111 461 1111C459 1111 455 1110 449 1109C443 1108 431 1106 425 1105C419 1104 415 1103 413 1103C411 1102 417 1103 413 1103C409 1102 401 1101 389 1099Z" /></clipPath>
|
|
21
|
+
<radialGradient id="bg5" cx="0.44" cy="0.28" r="0.94">
|
|
22
|
+
<stop offset="0" stop-color="#E4FA88" /><stop offset="0.48" stop-color="#D0F05E" />
|
|
23
|
+
<stop offset="1" stop-color="#B5E53E" /></radialGradient>
|
|
24
|
+
<linearGradient id="sq5" x1="0.04" y1="0" x2="0.92" y2="1">
|
|
25
|
+
<stop offset="0" stop-color="#47991F" /><stop offset="0.3" stop-color="#276E11" />
|
|
26
|
+
<stop offset="0.7" stop-color="#195409" /><stop offset="1" stop-color="#124208" /></linearGradient>
|
|
27
|
+
<linearGradient id="sq5g" x1="0.04" y1="0" x2="0.28" y2="1">
|
|
28
|
+
<stop offset="0" stop-color="#FFFFFF" stop-opacity="0.16" />
|
|
29
|
+
<stop offset="0.45" stop-color="#FFFFFF" stop-opacity="0.02" />
|
|
30
|
+
<stop offset="1" stop-color="#FFFFFF" stop-opacity="0" /></linearGradient>
|
|
31
|
+
<filter id="sh5" x="-30%" y="-30%" width="160%" height="160%"><feGaussianBlur stdDeviation="16" /></filter>
|
|
32
|
+
<clipPath id="cpa"><rect x="109.5" y="109.5" width="805.0" height="805.0" rx="167.44" /></clipPath>
|
|
33
|
+
</defs>
|
|
34
|
+
<rect x="109.5" y="109.5" width="805.0" height="805.0" rx="167.44" fill="url(#sq5)" />
|
|
35
|
+
<rect x="109.5" y="109.5" width="805.0" height="805.0" rx="167.44" fill="url(#sq5g)" />
|
|
36
|
+
<g clip-path="url(#cpa)"><g transform="translate(140.2,7.5) scale(0.7570) rotate(-3 496.5 1111.0)">
|
|
37
|
+
<path d="M389 1099C377 1096 357 1094 342 1090C326 1087 312 1083 298 1078C283 1073 270 1067 257 1061C244 1054 231 1047 219 1040C207 1032 196 1023 185 1014C174 1005 164 995 155 985C146 975 138 964 130 953C123 942 116 930 110 917C104 905 98 891 94 878C89 865 85 852 82 838C79 825 77 812 76 798C75 784 74 770 75 756C75 743 76 728 78 714C80 700 83 686 87 671C91 657 96 643 101 628C107 614 113 599 121 584C128 570 137 554 145 540C154 526 163 512 173 499C183 486 194 474 205 462C215 450 227 439 239 428C251 418 264 407 277 398C290 389 303 380 317 371C331 363 345 356 360 349C375 342 390 335 405 330C421 324 437 319 453 314C469 310 484 306 500 304C515 301 530 299 545 298C560 296 575 296 589 296C604 297 619 298 632 300C646 302 659 304 672 307C685 310 697 313 708 317C720 321 731 325 741 330C752 335 762 341 771 347C780 352 789 359 798 365C806 372 814 379 821 386C828 394 835 401 841 410C848 418 853 426 859 435C864 444 869 454 874 464C879 474 884 485 888 496C892 508 896 520 899 532C903 544 906 558 909 571C912 584 914 596 916 609C917 621 918 634 919 646C920 658 920 670 919 682C919 694 918 706 916 717C915 729 913 740 911 751C908 762 906 773 903 784C899 795 896 806 892 816C888 827 883 837 878 847C873 858 868 868 862 878C856 888 849 897 842 907C836 917 828 926 820 936C813 945 804 955 796 963C787 972 778 981 769 989C759 997 750 1004 740 1012C730 1019 720 1026 709 1032C699 1039 688 1045 677 1051C666 1056 654 1062 642 1066C630 1071 618 1076 605 1080C592 1084 579 1087 565 1090C552 1093 536 1096 523 1099C511 1101 501 1103 492 1105C483 1106 476 1108 471 1109C466 1110 462 1111 461 1111C459 1111 463 1111 461 1111C459 1111 455 1110 449 1109C443 1108 431 1106 425 1105C419 1104 415 1103 413 1103C411 1102 417 1103 413 1103C409 1102 401 1101 389 1099Z" fill="url(#ba)" />
|
|
38
|
+
<g clip-path="url(#ca)"><path d="M389 1099C377 1096 357 1094 342 1090C326 1087 312 1083 298 1078C283 1073 270 1067 257 1061C244 1054 231 1047 219 1040C207 1032 196 1023 185 1014C174 1005 164 995 155 985C146 975 138 964 130 953C123 942 116 930 110 917C104 905 98 891 94 878C89 865 85 852 82 838C79 825 77 812 76 798C75 784 74 770 75 756C75 743 76 728 78 714C80 700 83 686 87 671C91 657 96 643 101 628C107 614 113 599 121 584C128 570 137 554 145 540C154 526 163 512 173 499C183 486 194 474 205 462C215 450 227 439 239 428C251 418 264 407 277 398C290 389 303 380 317 371C331 363 345 356 360 349C375 342 390 335 405 330C421 324 437 319 453 314C469 310 484 306 500 304C515 301 530 299 545 298C560 296 575 296 589 296C604 297 619 298 632 300C646 302 659 304 672 307C685 310 697 313 708 317C720 321 731 325 741 330C752 335 762 341 771 347C780 352 789 359 798 365C806 372 814 379 821 386C828 394 835 401 841 410C848 418 853 426 859 435C864 444 869 454 874 464C879 474 884 485 888 496C892 508 896 520 899 532C903 544 906 558 909 571C912 584 914 596 916 609C917 621 918 634 919 646C920 658 920 670 919 682C919 694 918 706 916 717C915 729 913 740 911 751C908 762 906 773 903 784C899 795 896 806 892 816C888 827 883 837 878 847C873 858 868 868 862 878C856 888 849 897 842 907C836 917 828 926 820 936C813 945 804 955 796 963C787 972 778 981 769 989C759 997 750 1004 740 1012C730 1019 720 1026 709 1032C699 1039 688 1045 677 1051C666 1056 654 1062 642 1066C630 1071 618 1076 605 1080C592 1084 579 1087 565 1090C552 1093 536 1096 523 1099C511 1101 501 1103 492 1105C483 1106 476 1108 471 1109C466 1110 462 1111 461 1111C459 1111 463 1111 461 1111C459 1111 455 1110 449 1109C443 1108 431 1106 425 1105C419 1104 415 1103 413 1103C411 1102 417 1103 413 1103C409 1102 401 1101 389 1099Z" fill="url(#sa)" />
|
|
39
|
+
<ellipse cx="300.0" cy="418.0" rx="112.0" ry="92.0" transform="rotate(-38.0 300.0 418.0)" fill="url(#ha)" /></g>
|
|
40
|
+
<path d="M389 1099C377 1096 357 1094 342 1090C326 1087 312 1083 298 1078C283 1073 270 1067 257 1061C244 1054 231 1047 219 1040C207 1032 196 1023 185 1014C174 1005 164 995 155 985C146 975 138 964 130 953C123 942 116 930 110 917C104 905 98 891 94 878C89 865 85 852 82 838C79 825 77 812 76 798C75 784 74 770 75 756C75 743 76 728 78 714C80 700 83 686 87 671C91 657 96 643 101 628C107 614 113 599 121 584C128 570 137 554 145 540C154 526 163 512 173 499C183 486 194 474 205 462C215 450 227 439 239 428C251 418 264 407 277 398C290 389 303 380 317 371C331 363 345 356 360 349C375 342 390 335 405 330C421 324 437 319 453 314C469 310 484 306 500 304C515 301 530 299 545 298C560 296 575 296 589 296C604 297 619 298 632 300C646 302 659 304 672 307C685 310 697 313 708 317C720 321 731 325 741 330C752 335 762 341 771 347C780 352 789 359 798 365C806 372 814 379 821 386C828 394 835 401 841 410C848 418 853 426 859 435C864 444 869 454 874 464C879 474 884 485 888 496C892 508 896 520 899 532C903 544 906 558 909 571C912 584 914 596 916 609C917 621 918 634 919 646C920 658 920 670 919 682C919 694 918 706 916 717C915 729 913 740 911 751C908 762 906 773 903 784C899 795 896 806 892 816C888 827 883 837 878 847C873 858 868 868 862 878C856 888 849 897 842 907C836 917 828 926 820 936C813 945 804 955 796 963C787 972 778 981 769 989C759 997 750 1004 740 1012C730 1019 720 1026 709 1032C699 1039 688 1045 677 1051C666 1056 654 1062 642 1066C630 1071 618 1076 605 1080C592 1084 579 1087 565 1090C552 1093 536 1096 523 1099C511 1101 501 1103 492 1105C483 1106 476 1108 471 1109C466 1110 462 1111 461 1111C459 1111 463 1111 461 1111C459 1111 455 1110 449 1109C443 1108 431 1106 425 1105C419 1104 415 1103 413 1103C411 1102 417 1103 413 1103C409 1102 401 1101 389 1099Z" fill="none" stroke="url(#ra)" stroke-width="7" opacity="0.55" />
|
|
41
|
+
<path d="M251 360C252 351 253 336 255 325C257 314 259 302 263 291C267 280 271 269 277 258C282 247 289 236 296 226C303 215 311 204 320 194C329 184 338 175 347 166C357 158 367 150 378 142C388 135 399 129 411 122C423 116 435 111 447 106C460 102 472 98 485 94C497 91 510 89 522 87C535 85 548 84 561 83C574 83 589 82 600 84C611 85 620 87 628 90C635 94 640 98 644 103C647 109 649 115 649 122C648 130 645 139 642 148C639 156 635 165 631 173C627 182 623 191 617 199C612 208 606 216 600 225C593 233 586 243 578 251C570 259 562 266 552 273C542 279 532 285 521 291C509 296 497 301 484 305C471 309 456 311 443 315C429 319 416 323 403 327C390 332 378 337 366 343C354 348 342 354 330 360C319 367 306 375 296 381C287 387 278 392 271 396C264 400 259 404 254 406C250 409 247 410 246 411C245 412 246 413 246 411C246 410 246 407 247 403C247 398 248 390 249 385C249 381 249 378 249 377C250 375 249 380 249 377C250 374 250 368 251 360Z" fill="url(#la)" /><path d="M251 360C252 351 253 336 255 325C257 314 259 302 263 291C267 280 271 269 277 258C282 247 289 236 296 226C303 215 311 204 320 194C329 184 338 175 347 166C357 158 367 150 378 142C388 135 399 129 411 122C423 116 435 111 447 106C460 102 472 98 485 94C497 91 510 89 522 87C535 85 548 84 561 83C574 83 589 82 600 84C611 85 620 87 628 90C635 94 640 98 644 103C647 109 649 115 649 122C648 130 645 139 642 148C639 156 635 165 631 173C627 182 623 191 617 199C612 208 606 216 600 225C593 233 586 243 578 251C570 259 562 266 552 273C542 279 532 285 521 291C509 296 497 301 484 305C471 309 456 311 443 315C429 319 416 323 403 327C390 332 378 337 366 343C354 348 342 354 330 360C319 367 306 375 296 381C287 387 278 392 271 396C264 400 259 404 254 406C250 409 247 410 246 411C245 412 246 413 246 411C246 410 246 407 247 403C247 398 248 390 249 385C249 381 249 378 249 377C250 375 249 380 249 377C250 374 250 368 251 360Z" fill="url(#lsa)" />
|
|
42
|
+
<path d="M262 388 Q441 268 640 96" fill="none" stroke="#3B7F0E" stroke-width="5" opacity="0.22" stroke-linecap="round" />
|
|
43
|
+
<path d="M600 679C598 678 594 676 591 674C587 671 583 668 580 664C576 659 572 654 567 648C563 642 559 635 554 628C549 620 543 609 539 601C535 593 531 586 528 580C525 573 523 567 521 562C520 557 519 553 518 549C518 545 518 543 519 540C519 537 520 534 521 532C522 529 523 527 525 524C526 522 528 520 529 518C531 516 534 513 536 512C538 510 540 508 542 507C544 506 546 505 549 504C551 503 553 503 555 502C558 502 560 502 562 502C564 502 567 502 569 503C571 503 573 504 575 505C577 505 580 506 582 508C584 509 585 509 588 512C590 514 593 517 596 521C599 525 603 530 606 536C610 542 614 549 619 557C623 565 629 575 633 583C637 591 641 598 644 604C647 610 650 616 652 620C654 625 655 628 656 631C657 634 657 635 657 637C657 639 658 640 658 642C658 644 657 646 657 648C657 649 657 651 656 653C656 654 655 656 654 658C653 659 652 661 651 663C649 664 647 666 645 668C643 670 641 671 638 673C635 675 632 677 629 678C626 680 624 681 622 682C620 683 619 684 617 685C616 685 616 686 615 686C615 686 616 686 615 686C615 686 614 685 613 685C611 684 609 683 608 682C607 682 606 681 605 681C605 681 606 682 605 681C605 681 603 680 600 679Z" fill="url(#ea)" /><path d="M758 606C756 605 752 604 749 602C745 600 742 597 738 592C734 588 730 583 725 577C721 570 716 563 712 555C707 546 701 535 696 527C692 518 688 511 685 504C682 497 679 491 677 486C676 481 675 477 674 473C674 470 674 468 675 465C675 463 676 460 677 458C678 456 679 454 680 452C681 450 683 448 684 447C686 445 688 444 690 442C692 441 693 440 695 439C697 438 699 437 701 437C703 436 704 436 706 436C708 435 710 435 712 436C713 436 715 436 717 436C719 437 720 437 722 438C724 439 726 440 727 441C729 442 730 442 733 444C735 446 737 449 740 454C743 458 747 463 751 470C754 476 759 483 763 492C768 500 774 511 779 520C783 528 787 536 790 543C793 550 796 556 797 561C799 567 800 571 800 575C801 578 800 580 799 583C799 585 798 588 797 590C796 592 795 594 793 596C792 598 790 600 788 601C786 603 784 604 782 605C780 607 779 608 777 609C776 609 775 610 774 611C773 611 773 611 773 612C772 612 773 612 773 612C772 611 771 611 770 611C769 610 767 609 765 609C764 608 763 608 763 608C763 608 764 608 763 608C762 608 761 607 758 606Z" fill="url(#ea)" />
|
|
44
|
+
</g></g></svg>
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import { useEffect, useRef, useState } from 'react';
|
|
2
|
+
import { cn } from '@/lib/utils';
|
|
3
|
+
import designDone from './mascots/design-done.png';
|
|
4
|
+
import designIdle from './mascots/design-idle.png';
|
|
5
|
+
import designNeedsYou from './mascots/design-needs-you.png';
|
|
6
|
+
import designWorking from './mascots/design-working.png';
|
|
7
|
+
import done from './mascots/lemon-done.png';
|
|
8
|
+
import idle from './mascots/lemon-idle.png';
|
|
9
|
+
import needsYou from './mascots/lemon-needs-you.png';
|
|
10
|
+
import thinking from './mascots/lemon-thinking.png';
|
|
11
|
+
import working from './mascots/lemon-working.png';
|
|
12
|
+
import outlineDone from './mascots/outline-done.png';
|
|
13
|
+
import outlineIdle from './mascots/outline-idle.png';
|
|
14
|
+
import outlineNeedsYou from './mascots/outline-needs-you.png';
|
|
15
|
+
import outlineWorking from './mascots/outline-working.png';
|
|
16
|
+
import researchDone from './mascots/research-done.png';
|
|
17
|
+
import researchIdle from './mascots/research-idle.png';
|
|
18
|
+
import researchNeedsYou from './mascots/research-needs-you.png';
|
|
19
|
+
import researchWorking from './mascots/research-working.png';
|
|
20
|
+
import reviewDone from './mascots/review-done.png';
|
|
21
|
+
import reviewIdle from './mascots/review-idle.png';
|
|
22
|
+
import reviewNeedsYou from './mascots/review-needs-you.png';
|
|
23
|
+
import reviewWorking from './mascots/review-working.png';
|
|
24
|
+
|
|
25
|
+
export type MascotState = 'idle' | 'thinking' | 'working' | 'needs-you' | 'done';
|
|
26
|
+
|
|
27
|
+
export const MASCOT_SRC: Record<MascotState, string> = {
|
|
28
|
+
idle,
|
|
29
|
+
thinking,
|
|
30
|
+
working,
|
|
31
|
+
'needs-you': needsYou,
|
|
32
|
+
done,
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
/** Lemon. Floats while idle and bounces once when its state changes; both stop under reduced motion. */
|
|
36
|
+
export function Mascot({
|
|
37
|
+
state,
|
|
38
|
+
size,
|
|
39
|
+
float = false,
|
|
40
|
+
className,
|
|
41
|
+
}: {
|
|
42
|
+
state: MascotState;
|
|
43
|
+
size: number;
|
|
44
|
+
float?: boolean;
|
|
45
|
+
className?: string;
|
|
46
|
+
}) {
|
|
47
|
+
const first = useRef(true);
|
|
48
|
+
const [bounce, setBounce] = useState(0);
|
|
49
|
+
|
|
50
|
+
// biome-ignore lint/correctness/useExhaustiveDependencies: state is the trigger
|
|
51
|
+
useEffect(() => {
|
|
52
|
+
if (first.current) {
|
|
53
|
+
first.current = false;
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
setBounce((n) => n + 1);
|
|
57
|
+
}, [state]);
|
|
58
|
+
|
|
59
|
+
return (
|
|
60
|
+
<img
|
|
61
|
+
key={bounce}
|
|
62
|
+
src={MASCOT_SRC[state]}
|
|
63
|
+
alt=""
|
|
64
|
+
aria-hidden
|
|
65
|
+
draggable={false}
|
|
66
|
+
width={size}
|
|
67
|
+
height={size}
|
|
68
|
+
data-lr-mascot={state}
|
|
69
|
+
data-float={float && bounce === 0 ? '' : undefined}
|
|
70
|
+
data-bounce={bounce > 0 ? '' : undefined}
|
|
71
|
+
className={cn('lr-mascot shrink-0', className)}
|
|
72
|
+
style={{ width: size, height: size }}
|
|
73
|
+
/>
|
|
74
|
+
);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export type HelperRole = 'research' | 'outline' | 'design' | 'review';
|
|
78
|
+
export type HelperState = 'idle' | 'working' | 'done' | 'needs-you';
|
|
79
|
+
|
|
80
|
+
const HELPER_SRC: Record<HelperRole, Record<HelperState, string>> = {
|
|
81
|
+
research: {
|
|
82
|
+
idle: researchIdle,
|
|
83
|
+
working: researchWorking,
|
|
84
|
+
done: researchDone,
|
|
85
|
+
'needs-you': researchNeedsYou,
|
|
86
|
+
},
|
|
87
|
+
outline: {
|
|
88
|
+
idle: outlineIdle,
|
|
89
|
+
working: outlineWorking,
|
|
90
|
+
done: outlineDone,
|
|
91
|
+
'needs-you': outlineNeedsYou,
|
|
92
|
+
},
|
|
93
|
+
design: {
|
|
94
|
+
idle: designIdle,
|
|
95
|
+
working: designWorking,
|
|
96
|
+
done: designDone,
|
|
97
|
+
'needs-you': designNeedsYou,
|
|
98
|
+
},
|
|
99
|
+
review: {
|
|
100
|
+
idle: reviewIdle,
|
|
101
|
+
working: reviewWorking,
|
|
102
|
+
done: reviewDone,
|
|
103
|
+
'needs-you': reviewNeedsYou,
|
|
104
|
+
},
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
/** One of the four helpers on the build team; floats and bounces like Lemon. */
|
|
108
|
+
export function HelperMascot({
|
|
109
|
+
role,
|
|
110
|
+
state,
|
|
111
|
+
size,
|
|
112
|
+
}: {
|
|
113
|
+
role: HelperRole;
|
|
114
|
+
state: HelperState;
|
|
115
|
+
size: number;
|
|
116
|
+
}) {
|
|
117
|
+
const first = useRef(true);
|
|
118
|
+
const [bounce, setBounce] = useState(0);
|
|
119
|
+
|
|
120
|
+
// biome-ignore lint/correctness/useExhaustiveDependencies: state is the trigger
|
|
121
|
+
useEffect(() => {
|
|
122
|
+
if (first.current) {
|
|
123
|
+
first.current = false;
|
|
124
|
+
return;
|
|
125
|
+
}
|
|
126
|
+
setBounce((n) => n + 1);
|
|
127
|
+
}, [state]);
|
|
128
|
+
|
|
129
|
+
return (
|
|
130
|
+
<img
|
|
131
|
+
key={bounce}
|
|
132
|
+
src={HELPER_SRC[role][state]}
|
|
133
|
+
alt=""
|
|
134
|
+
aria-hidden
|
|
135
|
+
draggable={false}
|
|
136
|
+
width={size}
|
|
137
|
+
height={size}
|
|
138
|
+
data-lr-helper={role}
|
|
139
|
+
data-lr-helper-state={state}
|
|
140
|
+
data-bounce={bounce > 0 ? '' : undefined}
|
|
141
|
+
className={cn('lr-mascot shrink-0', state === 'idle' && 'opacity-45')}
|
|
142
|
+
style={{ width: size, height: size }}
|
|
143
|
+
/>
|
|
144
|
+
);
|
|
145
|
+
}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|