@lemonriver/core 0.3.0 → 0.5.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/README.md +14 -4
- package/dist/{build-Bqo69DWP.js → build-CS1goZxt.js} +1 -1
- package/dist/cli/bin.js +4 -4
- package/dist/{config-DJ5rkMMg.js → config-BpbcCbUv.js} +3835 -1532
- package/dist/{config-teo3kWz7.d.ts → config-CYNOR93W.d.ts} +1 -1
- package/dist/{dev-B2FJD5bJ.js → dev-BpYnfgLL.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-C93BOZL1.js → preview-HSzPPkSs.js} +1 -1
- package/dist/{types-DFK02XVv.d.ts → types-tdaXSyah.d.ts} +1 -0
- package/dist/{update-DsxZBtwv.js → update-CMRxtTc9.js} +18 -8
- package/dist/vite/index.d.ts +1 -1
- package/dist/vite/index.js +1 -1
- package/dist/{zh-tw-DwTAZKa6.js → zh-tw-DcrDeKxr.js} +5 -0
- package/package.json +2 -2
- package/src/agent/prompt.ts +2 -0
- package/src/agent/types.ts +14 -2
- package/src/app/components/agent/agent-panel.tsx +19 -5
- package/src/app/components/agent/connect-view.tsx +1 -1
- package/src/app/components/agent/provider-logo.tsx +10 -1
- 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 +6 -1
- package/src/app/components/thumbnail-rail.tsx +1 -0
- package/src/app/lemonriver/agent/lemon.tsx +16 -1
- package/src/app/lemonriver/agent/provider-marks.tsx +53 -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/lemonriver/agent-providers/section.tsx +75 -0
- package/src/app/lemonriver/agent-providers/use-providers.ts +61 -0
- package/src/app/lemonriver/board/blocks/block-panel.tsx +666 -0
- package/src/app/lemonriver/board/blocks/cache.ts +28 -0
- package/src/app/lemonriver/board/blocks/change-list.tsx +189 -0
- package/src/app/lemonriver/board/blocks/classify.test.ts +204 -0
- package/src/app/lemonriver/board/blocks/classify.ts +125 -0
- package/src/app/lemonriver/board/blocks/snapshot.ts +86 -0
- package/src/app/lemonriver/board/board-canvas.tsx +627 -104
- package/src/app/lemonriver/board/board-page.tsx +1687 -91
- package/src/app/lemonriver/board/board.css +58 -7
- package/src/app/lemonriver/board/layout.test.ts +84 -0
- package/src/app/lemonriver/board/layout.ts +112 -11
- package/src/app/lemonriver/board/model/agent-tasks.test.ts +200 -0
- package/src/app/lemonriver/board/model/agent-tasks.ts +191 -0
- package/src/app/lemonriver/board/model/apply-prompt.test.ts +121 -0
- package/src/app/lemonriver/board/model/apply-prompt.ts +115 -0
- package/src/app/lemonriver/board/model/apply.ts +71 -0
- package/src/app/lemonriver/board/model/cards.test.ts +95 -2
- package/src/app/lemonriver/board/model/cards.ts +88 -20
- package/src/app/lemonriver/board/model/changes.test.ts +244 -0
- package/src/app/lemonriver/board/model/changes.ts +268 -0
- package/src/app/lemonriver/board/model/filter.test.ts +50 -0
- package/src/app/lemonriver/board/model/filter.ts +42 -0
- package/src/app/lemonriver/board/model/history.test.ts +71 -0
- package/src/app/lemonriver/board/model/history.ts +51 -0
- package/src/app/lemonriver/board/model/restructure.test.ts +205 -0
- package/src/app/lemonriver/board/model/restructure.ts +169 -0
- package/src/app/lemonriver/board/model/structure.test.ts +249 -0
- package/src/app/lemonriver/board/model/structure.ts +209 -0
- package/src/app/lemonriver/board/model/timing.test.ts +113 -0
- package/src/app/lemonriver/board/model/timing.ts +117 -0
- package/src/app/lemonriver/board/page-node.tsx +236 -55
- package/src/app/lemonriver/board/status-style.ts +25 -0
- package/src/app/lemonriver/board/use-board-apply.ts +206 -0
- package/src/app/lemonriver/board/use-board-cards.ts +108 -5
- package/src/app/lemonriver/board/use-board-changes.ts +108 -0
- package/src/app/lemonriver/board/use-board-columns.ts +37 -56
- package/src/app/lemonriver/board/use-board-comments.ts +36 -0
- package/src/app/lemonriver/board/use-board-restructures.ts +107 -0
- package/src/app/lemonriver/board/use-history.ts +86 -0
- package/src/app/lemonriver/board/use-page-order.ts +65 -38
- package/src/app/lemonriver/board/use-target-minutes.ts +47 -0
- package/src/app/lemonriver/board/views/block-readings.tsx +46 -0
- package/src/app/lemonriver/board/views/list-view.tsx +356 -0
- package/src/app/lemonriver/board/views/progress.tsx +32 -0
- package/src/app/lemonriver/board/views/timeline-view.tsx +341 -0
- package/src/app/lemonriver/brand/mascot.tsx +86 -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/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 +2 -0
- package/src/app/lemonriver/features.test.ts +5 -0
- package/src/app/lemonriver/features.ts +2 -1
- package/src/app/lemonriver/home/brief-card.tsx +8 -1
- package/src/app/lemonriver/home/home-page.tsx +11 -7
- 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 +672 -0
- package/src/app/lemonriver/outline/model.ts +455 -0
- package/src/app/lemonriver/outline/outline-page.tsx +537 -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 +6 -6
- package/src/app/lemonriver/routes.tsx +28 -0
- package/src/app/lemonriver/settings/settings-page.tsx +214 -0
- package/src/app/lemonriver/slide-extensions.tsx +45 -26
- package/src/app/lemonriver/text/en.ts +320 -0
- package/src/app/lemonriver/text/es.ts +311 -0
- package/src/app/lemonriver/text/ja.ts +313 -0
- package/src/app/lemonriver/text/text.test.ts +33 -0
- package/src/app/lemonriver/text/types.ts +339 -0
- package/src/app/lemonriver/text/zh-cn.ts +307 -0
- package/src/app/lemonriver/text/zh-tw.ts +307 -0
- package/src/app/lemonriver/theme/app.css +12 -1
- package/src/app/lemonriver/theme/lemon-icon.tsx +6 -0
- package/src/app/lemonriver/theme/pages.test.ts +4 -0
- package/src/app/lemonriver/theme/pages.ts +11 -2
- package/src/app/lemonriver/theme/theme-menu.tsx +3 -2
- package/src/app/lemonriver/theme/use-theme.tsx +2 -2
- 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/agent/use-agent.ts +4 -3
- package/src/app/routes/home.tsx +13 -5
- package/src/app/routes/slide.tsx +71 -14
- package/src/locale/en.ts +1 -0
- package/src/locale/es.ts +1 -0
- package/src/locale/ja.ts +1 -0
- package/src/locale/types.ts +1 -0
- package/src/locale/zh-cn.ts +1 -0
- package/src/locale/zh-tw.ts +1 -0
- package/src/app/assets/open-slide.svg +0 -39
- package/src/app/favicon.ico +0 -0
- package/src/app/favicon.svg +0 -39
|
@@ -0,0 +1,341 @@
|
|
|
1
|
+
import {
|
|
2
|
+
closestCenter,
|
|
3
|
+
DndContext,
|
|
4
|
+
type DragEndEvent,
|
|
5
|
+
KeyboardSensor,
|
|
6
|
+
PointerSensor,
|
|
7
|
+
useSensor,
|
|
8
|
+
useSensors,
|
|
9
|
+
} from '@dnd-kit/core';
|
|
10
|
+
import {
|
|
11
|
+
horizontalListSortingStrategy,
|
|
12
|
+
SortableContext,
|
|
13
|
+
sortableKeyboardCoordinates,
|
|
14
|
+
useSortable,
|
|
15
|
+
} from '@dnd-kit/sortable';
|
|
16
|
+
import { CSS } from '@dnd-kit/utilities';
|
|
17
|
+
import { useEffect, useState } from 'react';
|
|
18
|
+
import { format, useLocale } from '@/lib/use-locale';
|
|
19
|
+
import { cn, pad2 } from '@/lib/utils';
|
|
20
|
+
import type { Page } from '../../../lib/sdk';
|
|
21
|
+
import { useLrText } from '../../text';
|
|
22
|
+
import type { Block } from '../blocks/classify';
|
|
23
|
+
import { pageName } from '../layout';
|
|
24
|
+
import type { BoardCard } from '../model/cards';
|
|
25
|
+
import { type BoardColumn, chapterProgress, columnStarts } from '../model/structure';
|
|
26
|
+
import {
|
|
27
|
+
estimateSeconds,
|
|
28
|
+
formatDuration,
|
|
29
|
+
type Timing,
|
|
30
|
+
timelineSegments,
|
|
31
|
+
xForSeconds,
|
|
32
|
+
} from '../model/timing';
|
|
33
|
+
import { useStatusLabels } from '../page-node';
|
|
34
|
+
import { STATUS_STYLE } from '../status-style';
|
|
35
|
+
import { Progress } from './progress';
|
|
36
|
+
|
|
37
|
+
type Props = {
|
|
38
|
+
pages: Page[];
|
|
39
|
+
keys: string[];
|
|
40
|
+
cards: (BoardCard | undefined)[];
|
|
41
|
+
columns: BoardColumn[];
|
|
42
|
+
notes?: (string | undefined)[];
|
|
43
|
+
dimmed: boolean[];
|
|
44
|
+
selected: number[];
|
|
45
|
+
target: number | null;
|
|
46
|
+
targetFor: (minutes: number | null) => void;
|
|
47
|
+
onSelect: (indices: number[]) => void;
|
|
48
|
+
onOpenPage: (index: number) => void;
|
|
49
|
+
onMovePages: (moving: number[], to: number) => void;
|
|
50
|
+
blocksOfPage: (key: string) => Block[] | null;
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
const pageIndexOf = (id: string) => Number(id.replace('page-', ''));
|
|
54
|
+
|
|
55
|
+
const BASIS: Record<Timing['basis'], 'basisNotes' | 'basisPage' | 'basisNone'> = {
|
|
56
|
+
notes: 'basisNotes',
|
|
57
|
+
page: 'basisPage',
|
|
58
|
+
none: 'basisNone',
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* The deck laid out as the talk it will be: every page a stretch of the track as
|
|
63
|
+
* wide as it takes to say, chapter after chapter, with the target marked on it.
|
|
64
|
+
*/
|
|
65
|
+
export function TimelineView({
|
|
66
|
+
pages,
|
|
67
|
+
keys,
|
|
68
|
+
cards,
|
|
69
|
+
columns,
|
|
70
|
+
notes,
|
|
71
|
+
dimmed,
|
|
72
|
+
selected,
|
|
73
|
+
target,
|
|
74
|
+
targetFor,
|
|
75
|
+
onSelect,
|
|
76
|
+
onOpenPage,
|
|
77
|
+
onMovePages,
|
|
78
|
+
blocksOfPage,
|
|
79
|
+
}: Props) {
|
|
80
|
+
const lr = useLrText();
|
|
81
|
+
const locale = useLocale();
|
|
82
|
+
const [draft, setDraft] = useState(target === null ? '' : String(target));
|
|
83
|
+
|
|
84
|
+
useEffect(() => setDraft(target === null ? '' : String(target)), [target]);
|
|
85
|
+
|
|
86
|
+
const sensors = useSensors(
|
|
87
|
+
useSensor(PointerSensor, { activationConstraint: { distance: 5 } }),
|
|
88
|
+
useSensor(KeyboardSensor, { coordinateGetter: sortableKeyboardCoordinates }),
|
|
89
|
+
);
|
|
90
|
+
|
|
91
|
+
const timings = pages.map((_, index) => {
|
|
92
|
+
const key = keys[index];
|
|
93
|
+
return estimateSeconds({ notes: notes?.[index], blocks: key ? blocksOfPage(key) : null });
|
|
94
|
+
});
|
|
95
|
+
const seconds = timings.map((timing) => timing.seconds);
|
|
96
|
+
const segments = timelineSegments(seconds);
|
|
97
|
+
const total = seconds.reduce((sum, value) => sum + value, 0);
|
|
98
|
+
const trackWidth = segments.reduce((sum, segment) => sum + segment.width, 0);
|
|
99
|
+
|
|
100
|
+
const targetSeconds = target === null ? null : target * 60;
|
|
101
|
+
const over = targetSeconds !== null && total > targetSeconds;
|
|
102
|
+
const targetX = targetSeconds === null ? null : xForSeconds(seconds, targetSeconds);
|
|
103
|
+
|
|
104
|
+
const starts = columnStarts(columns);
|
|
105
|
+
const chapterOf = (index: number) => {
|
|
106
|
+
for (let i = starts.length - 1; i >= 0; i--) if (index >= starts[i]) return i;
|
|
107
|
+
return 0;
|
|
108
|
+
};
|
|
109
|
+
const byKey = cards.reduce<Record<string, BoardCard>>((all, card, index) => {
|
|
110
|
+
const key = keys[index];
|
|
111
|
+
if (card && key) all[key] = card;
|
|
112
|
+
return all;
|
|
113
|
+
}, {});
|
|
114
|
+
|
|
115
|
+
const onDragEnd = (event: DragEndEvent) => {
|
|
116
|
+
const { active, over: on } = event;
|
|
117
|
+
if (!on || active.id === on.id) return;
|
|
118
|
+
const from = pageIndexOf(String(active.id));
|
|
119
|
+
const to = pageIndexOf(String(on.id));
|
|
120
|
+
if (!Number.isInteger(from) || !Number.isInteger(to)) return;
|
|
121
|
+
onMovePages([from], to);
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
const commitTarget = (value: string) => {
|
|
125
|
+
setDraft(value);
|
|
126
|
+
if (!value.trim()) {
|
|
127
|
+
targetFor(null);
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
const minutes = Math.trunc(Number(value));
|
|
131
|
+
if (Number.isInteger(minutes) && minutes >= 1 && minutes <= 180) targetFor(minutes);
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
return (
|
|
135
|
+
<div className="flex h-full min-h-0 min-w-0 flex-col" data-lr-timeline-view>
|
|
136
|
+
<div className="flex shrink-0 items-center gap-3 border-b border-hairline px-6 py-2.5">
|
|
137
|
+
<span
|
|
138
|
+
className={cn('text-[13px] tabular-nums', over ? 'text-destructive' : 'text-foreground')}
|
|
139
|
+
data-lr-total
|
|
140
|
+
data-over={over ? 'true' : 'false'}
|
|
141
|
+
>
|
|
142
|
+
{format(lr.board.totalDuration, { d: formatDuration(total, locale.id) })}
|
|
143
|
+
</span>
|
|
144
|
+
{target !== null && targetSeconds !== null && (
|
|
145
|
+
<span
|
|
146
|
+
className={cn(
|
|
147
|
+
'text-[12px] tabular-nums',
|
|
148
|
+
over ? 'text-destructive' : 'text-muted-foreground',
|
|
149
|
+
)}
|
|
150
|
+
data-lr-target-diff
|
|
151
|
+
>
|
|
152
|
+
{over
|
|
153
|
+
? format(lr.board.overTarget, {
|
|
154
|
+
d: formatDuration(total - targetSeconds, locale.id),
|
|
155
|
+
})
|
|
156
|
+
: format(lr.board.underTarget, {
|
|
157
|
+
d: formatDuration(targetSeconds - total, locale.id),
|
|
158
|
+
})}
|
|
159
|
+
</span>
|
|
160
|
+
)}
|
|
161
|
+
<label className="ml-auto flex items-center gap-1.5 text-[12px] text-muted-foreground">
|
|
162
|
+
{lr.board.target}
|
|
163
|
+
<input
|
|
164
|
+
type="number"
|
|
165
|
+
min={1}
|
|
166
|
+
max={180}
|
|
167
|
+
value={draft}
|
|
168
|
+
aria-label={lr.board.target}
|
|
169
|
+
data-lr-target
|
|
170
|
+
onChange={(event) => commitTarget(event.currentTarget.value)}
|
|
171
|
+
className="w-16 rounded-[4px] border border-hairline bg-background px-2 py-1 text-[12.5px] tabular-nums text-foreground outline-none focus:ring-1 focus:ring-brand/50"
|
|
172
|
+
/>
|
|
173
|
+
</label>
|
|
174
|
+
</div>
|
|
175
|
+
|
|
176
|
+
<div className="min-h-0 w-full flex-1 overflow-auto px-6 py-5">
|
|
177
|
+
{pages.length === 0 ? null : (
|
|
178
|
+
<DndContext sensors={sensors} collisionDetection={closestCenter} onDragEnd={onDragEnd}>
|
|
179
|
+
<div className="relative" style={{ width: trackWidth }}>
|
|
180
|
+
<div className="mb-2 flex">
|
|
181
|
+
{columns.map((column, columnIndex) => {
|
|
182
|
+
const from = starts[columnIndex] ?? 0;
|
|
183
|
+
const width = segments
|
|
184
|
+
.slice(from, from + column.size)
|
|
185
|
+
.reduce((sum, segment) => sum + segment.width, 0);
|
|
186
|
+
const chapterSeconds = seconds
|
|
187
|
+
.slice(from, from + column.size)
|
|
188
|
+
.reduce((sum, value) => sum + value, 0);
|
|
189
|
+
const progress = chapterProgress(byKey, keys.slice(from, from + column.size));
|
|
190
|
+
return (
|
|
191
|
+
<div
|
|
192
|
+
// biome-ignore lint/suspicious/noArrayIndexKey: a chapter is its position in the deck
|
|
193
|
+
key={`chapter-${columnIndex}`}
|
|
194
|
+
data-lr-timeline-chapter
|
|
195
|
+
className={cn(
|
|
196
|
+
'flex min-w-0 items-baseline gap-1.5 overflow-hidden pr-2',
|
|
197
|
+
columnIndex > 0 && 'border-l border-hairline pl-2',
|
|
198
|
+
)}
|
|
199
|
+
style={{ width }}
|
|
200
|
+
>
|
|
201
|
+
<span className="eyebrow truncate text-foreground">
|
|
202
|
+
{column.title || format(lr.board.columnFallback, { n: columnIndex + 1 })}
|
|
203
|
+
</span>
|
|
204
|
+
{/* A short chapter cannot show its numbers; the name is what it
|
|
205
|
+
has to keep. */}
|
|
206
|
+
{width >= 120 && (
|
|
207
|
+
<span className="shrink-0 text-[11px] text-muted-foreground tabular-nums">
|
|
208
|
+
{formatDuration(chapterSeconds, locale.id)}
|
|
209
|
+
</span>
|
|
210
|
+
)}
|
|
211
|
+
{width >= 140 && <Progress progress={progress} compact={width < 260} />}
|
|
212
|
+
</div>
|
|
213
|
+
);
|
|
214
|
+
})}
|
|
215
|
+
</div>
|
|
216
|
+
|
|
217
|
+
<div className="relative flex h-20" data-lr-timeline-track>
|
|
218
|
+
<SortableContext
|
|
219
|
+
items={segments.map((_, index) => `page-${index}`)}
|
|
220
|
+
strategy={horizontalListSortingStrategy}
|
|
221
|
+
>
|
|
222
|
+
{segments.map((segment, index) => {
|
|
223
|
+
const chapter = chapterOf(index);
|
|
224
|
+
const chapterHead = index === starts[chapter];
|
|
225
|
+
return (
|
|
226
|
+
<Segment
|
|
227
|
+
// biome-ignore lint/suspicious/noArrayIndexKey: a page is its position in the deck
|
|
228
|
+
key={`page-${index}`}
|
|
229
|
+
id={`page-${index}`}
|
|
230
|
+
index={index}
|
|
231
|
+
width={segment.width}
|
|
232
|
+
chapterHead={chapterHead}
|
|
233
|
+
pages={pages}
|
|
234
|
+
card={cards[index]}
|
|
235
|
+
timing={timings[index]}
|
|
236
|
+
dimmed={dimmed[index] === true}
|
|
237
|
+
beyond={
|
|
238
|
+
targetX !== null && segment.start >= targetX && targetSeconds !== null
|
|
239
|
+
}
|
|
240
|
+
selected={selected.includes(index)}
|
|
241
|
+
onSelect={() => onSelect([index])}
|
|
242
|
+
onOpen={() => onOpenPage(index)}
|
|
243
|
+
/>
|
|
244
|
+
);
|
|
245
|
+
})}
|
|
246
|
+
</SortableContext>
|
|
247
|
+
|
|
248
|
+
{targetX !== null && (
|
|
249
|
+
<span
|
|
250
|
+
aria-hidden
|
|
251
|
+
data-lr-target-line
|
|
252
|
+
className="pointer-events-none absolute top-0 bottom-0 w-px bg-destructive/70"
|
|
253
|
+
style={{ left: Math.min(targetX, trackWidth) }}
|
|
254
|
+
/>
|
|
255
|
+
)}
|
|
256
|
+
</div>
|
|
257
|
+
</div>
|
|
258
|
+
</DndContext>
|
|
259
|
+
)}
|
|
260
|
+
</div>
|
|
261
|
+
</div>
|
|
262
|
+
);
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
function Segment({
|
|
266
|
+
id,
|
|
267
|
+
index,
|
|
268
|
+
width,
|
|
269
|
+
chapterHead,
|
|
270
|
+
pages,
|
|
271
|
+
card,
|
|
272
|
+
timing,
|
|
273
|
+
dimmed,
|
|
274
|
+
beyond,
|
|
275
|
+
selected,
|
|
276
|
+
onSelect,
|
|
277
|
+
onOpen,
|
|
278
|
+
}: {
|
|
279
|
+
id: string;
|
|
280
|
+
index: number;
|
|
281
|
+
width: number;
|
|
282
|
+
chapterHead: boolean;
|
|
283
|
+
pages: Page[];
|
|
284
|
+
card?: BoardCard;
|
|
285
|
+
timing: Timing;
|
|
286
|
+
dimmed: boolean;
|
|
287
|
+
beyond: boolean;
|
|
288
|
+
selected: boolean;
|
|
289
|
+
onSelect: () => void;
|
|
290
|
+
onOpen: () => void;
|
|
291
|
+
}) {
|
|
292
|
+
const lr = useLrText();
|
|
293
|
+
const locale = useLocale();
|
|
294
|
+
const labels = useStatusLabels();
|
|
295
|
+
const { attributes, listeners, setNodeRef, transform, transition, isDragging } = useSortable({
|
|
296
|
+
id,
|
|
297
|
+
});
|
|
298
|
+
const status = card?.status;
|
|
299
|
+
const title = card?.title || pageName(pages[index]) || '';
|
|
300
|
+
const duration = formatDuration(timing.seconds, locale.id);
|
|
301
|
+
const hint = [
|
|
302
|
+
`${pad2(index + 1)}${title ? ` ${title}` : ''}`,
|
|
303
|
+
duration,
|
|
304
|
+
lr.board[BASIS[timing.basis]],
|
|
305
|
+
status ? labels[status] : null,
|
|
306
|
+
]
|
|
307
|
+
.filter(Boolean)
|
|
308
|
+
.join(' · ');
|
|
309
|
+
|
|
310
|
+
return (
|
|
311
|
+
<button
|
|
312
|
+
ref={setNodeRef}
|
|
313
|
+
type="button"
|
|
314
|
+
title={hint}
|
|
315
|
+
data-lr-timeline-segment
|
|
316
|
+
data-page={index + 1}
|
|
317
|
+
data-selected={selected ? 'true' : 'false'}
|
|
318
|
+
onClick={onSelect}
|
|
319
|
+
onDoubleClick={onOpen}
|
|
320
|
+
style={{ width, transform: CSS.Transform.toString(transform), transition }}
|
|
321
|
+
className={cn(
|
|
322
|
+
'relative flex h-full flex-col items-start justify-start overflow-hidden rounded-[4px] border-r border-background px-1.5 py-1 text-left',
|
|
323
|
+
status ? STATUS_STYLE[status].bar : 'bg-muted',
|
|
324
|
+
'hover:brightness-[0.97]',
|
|
325
|
+
chapterHead && 'border-l-2 border-l-foreground/25',
|
|
326
|
+
selected && 'ring-2 ring-brand ring-inset',
|
|
327
|
+
dimmed && 'opacity-35',
|
|
328
|
+
beyond && 'opacity-40',
|
|
329
|
+
isDragging && 'z-10 opacity-70 shadow-[var(--lr-shadow-1)]',
|
|
330
|
+
)}
|
|
331
|
+
{...attributes}
|
|
332
|
+
{...listeners}
|
|
333
|
+
>
|
|
334
|
+
<span className="text-[11px] tabular-nums text-muted-foreground">{pad2(index + 1)}</span>
|
|
335
|
+
{width >= 120 && title && (
|
|
336
|
+
<span className="line-clamp-2 text-[11.5px] text-foreground/80">{title}</span>
|
|
337
|
+
)}
|
|
338
|
+
<span className="mt-auto text-[10.5px] tabular-nums text-muted-foreground">{duration}</span>
|
|
339
|
+
</button>
|
|
340
|
+
);
|
|
341
|
+
}
|
|
@@ -1,10 +1,26 @@
|
|
|
1
1
|
import { useEffect, useRef, useState } from 'react';
|
|
2
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';
|
|
3
7
|
import done from './mascots/lemon-done.png';
|
|
4
8
|
import idle from './mascots/lemon-idle.png';
|
|
5
9
|
import needsYou from './mascots/lemon-needs-you.png';
|
|
6
10
|
import thinking from './mascots/lemon-thinking.png';
|
|
7
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';
|
|
8
24
|
|
|
9
25
|
export type MascotState = 'idle' | 'thinking' | 'working' | 'needs-you' | 'done';
|
|
10
26
|
|
|
@@ -57,3 +73,73 @@ export function Mascot({
|
|
|
57
73
|
/>
|
|
58
74
|
);
|
|
59
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
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -15,6 +15,7 @@ import {
|
|
|
15
15
|
listTrash,
|
|
16
16
|
restoreFromTrash,
|
|
17
17
|
} from '../trash/api';
|
|
18
|
+
import { UpdatePrompt } from '../update/update-prompt';
|
|
18
19
|
import { SidebarExtras } from './sidebar-extras';
|
|
19
20
|
|
|
20
21
|
const UNDO_MS = 5000;
|
|
@@ -94,6 +95,7 @@ export function AppChrome() {
|
|
|
94
95
|
<Toaster />
|
|
95
96
|
{import.meta.env.DEV && <OfflineBanner />}
|
|
96
97
|
<SidebarExtras />
|
|
98
|
+
<UpdatePrompt />
|
|
97
99
|
</>
|
|
98
100
|
);
|
|
99
101
|
}
|
|
@@ -26,4 +26,9 @@ describe('isFeatureEnabled', () => {
|
|
|
26
26
|
it('offers settings in a built site too', () => {
|
|
27
27
|
expect(isFeatureEnabled('settings', { dev: false })).toBe(true);
|
|
28
28
|
});
|
|
29
|
+
|
|
30
|
+
it('keeps the guided outline to dev, where the agent it drives runs', () => {
|
|
31
|
+
expect(isFeatureEnabled('outline', { dev: true })).toBe(true);
|
|
32
|
+
expect(isFeatureEnabled('outline', { dev: false })).toBe(false);
|
|
33
|
+
});
|
|
29
34
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export type Tier = 'free' | 'pro';
|
|
2
|
-
export type FeatureId = 'board' | 'trash' | 'settings';
|
|
2
|
+
export type FeatureId = 'board' | 'trash' | 'settings' | 'outline';
|
|
3
3
|
|
|
4
4
|
export type Feature = { id: FeatureId; tier: Tier; devOnly: boolean };
|
|
5
5
|
|
|
@@ -7,6 +7,7 @@ export const FEATURES: readonly Feature[] = [
|
|
|
7
7
|
{ id: 'board', tier: 'free', devOnly: true },
|
|
8
8
|
{ id: 'trash', tier: 'free', devOnly: true },
|
|
9
9
|
{ id: 'settings', tier: 'free', devOnly: false },
|
|
10
|
+
{ id: 'outline', tier: 'free', devOnly: true },
|
|
10
11
|
];
|
|
11
12
|
|
|
12
13
|
/** The single place a paid tier will hook into later; today every tier is unlocked. */
|
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
import { ArrowRight } from 'lucide-react';
|
|
2
2
|
import { useState } from 'react';
|
|
3
|
+
import { useNavigate } from 'react-router-dom';
|
|
3
4
|
import { Button } from '@/components/ui/button';
|
|
4
5
|
import { useAgentStatus, useCreateDeck } from '@/lib/agent/use-agent';
|
|
5
6
|
import { Mascot } from '../brand/mascot';
|
|
7
|
+
import { isFeatureEnabled } from '../features';
|
|
6
8
|
import { useLrText } from '../text';
|
|
7
9
|
import { saveBrief } from './brief';
|
|
8
10
|
|
|
9
|
-
/** "Say it in one sentence":
|
|
11
|
+
/** "Say it in one sentence": opens the guided flow, or creates a deck and tells the agent. */
|
|
10
12
|
export function BriefCard() {
|
|
11
13
|
const lr = useLrText();
|
|
14
|
+
const navigate = useNavigate();
|
|
12
15
|
const createDeck = useCreateDeck();
|
|
13
16
|
const { connected, loading } = useAgentStatus();
|
|
14
17
|
const [text, setText] = useState('');
|
|
@@ -19,6 +22,10 @@ export function BriefCard() {
|
|
|
19
22
|
const submit = async () => {
|
|
20
23
|
const brief = text.trim();
|
|
21
24
|
if (!brief || busy) return;
|
|
25
|
+
if (isFeatureEnabled('outline')) {
|
|
26
|
+
navigate('/new', { state: { brief } });
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
22
29
|
setBusy(true);
|
|
23
30
|
saveBrief(brief);
|
|
24
31
|
await createDeck();
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ChevronDown, Plus } from 'lucide-react';
|
|
2
2
|
import { type ReactNode, useEffect, useMemo, useState } from 'react';
|
|
3
|
-
import { useOutletContext } from 'react-router-dom';
|
|
3
|
+
import { useNavigate, useOutletContext } from 'react-router-dom';
|
|
4
4
|
import { toast } from 'sonner';
|
|
5
5
|
import { Button } from '@/components/ui/button';
|
|
6
6
|
import {
|
|
@@ -226,12 +226,14 @@ export function LemonRiverHome() {
|
|
|
226
226
|
|
|
227
227
|
function NewDeckCard() {
|
|
228
228
|
const lr = useLrText();
|
|
229
|
+
const navigate = useNavigate();
|
|
229
230
|
const createDeck = useCreateDeck();
|
|
231
|
+
const guided = isFeatureEnabled('outline');
|
|
230
232
|
return (
|
|
231
233
|
<li>
|
|
232
234
|
<button
|
|
233
235
|
type="button"
|
|
234
|
-
onClick={() => void createDeck()}
|
|
236
|
+
onClick={() => (guided ? navigate('/new') : void createDeck())}
|
|
235
237
|
className={cn(
|
|
236
238
|
'flex h-full min-h-[190px] w-full flex-col items-center justify-center gap-2 rounded-[16px]',
|
|
237
239
|
'border-[1.5px] border-dashed border-border text-[14px] font-semibold text-muted-foreground outline-none',
|
|
@@ -239,7 +241,7 @@ function NewDeckCard() {
|
|
|
239
241
|
)}
|
|
240
242
|
>
|
|
241
243
|
<Plus className="size-7" />
|
|
242
|
-
{lr.shell.newDeckCard}
|
|
244
|
+
{guided ? lr.shell.newDeckGuided : lr.shell.newDeckCard}
|
|
243
245
|
</button>
|
|
244
246
|
</li>
|
|
245
247
|
);
|
|
@@ -261,7 +263,7 @@ function GridSkeleton() {
|
|
|
261
263
|
|
|
262
264
|
function EmptyHome({ isDraft, folderName }: { isDraft: boolean; folderName?: string }) {
|
|
263
265
|
const t = useLocale();
|
|
264
|
-
const { provider } = useAgentStatus();
|
|
266
|
+
const { enabled, provider } = useAgentStatus();
|
|
265
267
|
const createDeck = useCreateDeck();
|
|
266
268
|
if (!isDraft) {
|
|
267
269
|
return (
|
|
@@ -275,14 +277,16 @@ function EmptyHome({ isDraft, folderName }: { isDraft: boolean; folderName?: str
|
|
|
275
277
|
title={t.home.noSlidesYet}
|
|
276
278
|
actions={
|
|
277
279
|
import.meta.env.DEV &&
|
|
278
|
-
|
|
280
|
+
enabled && (
|
|
279
281
|
<Button onClick={() => void createDeck()}>
|
|
280
|
-
{
|
|
282
|
+
{provider
|
|
283
|
+
? format(t.agent.createDeckWith, { provider: provider.name })
|
|
284
|
+
: t.agent.createDeck}
|
|
281
285
|
</Button>
|
|
282
286
|
)
|
|
283
287
|
}
|
|
284
288
|
>
|
|
285
|
-
{!
|
|
289
|
+
{!enabled && (
|
|
286
290
|
<>
|
|
287
291
|
{t.home.createSlideHintPrefix}
|
|
288
292
|
<code className="rounded-[4px] bg-muted px-1.5 py-0.5 font-mono text-[12.5px] text-foreground">
|