@lemonriver/core 1.3.0 → 1.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-CSkdswfd.js → build-Cv0nNc4G.js} +1 -1
- package/dist/cli/bin.js +5 -5
- package/dist/{config-C5-myPY6.js → config-Di9kipre.js} +2773 -714
- package/dist/{config-CYNOR93W.d.ts → config-f1SqAhtR.d.ts} +1 -1
- package/dist/{dev-DHtYH8sw.js → dev-Az1UzCQp.js} +11 -11
- package/dist/index.d.ts +2 -2
- package/dist/index.js +21 -2
- package/dist/locale/index.d.ts +1 -1
- package/dist/locale/index.js +1 -1
- package/dist/{mcp-B2UeO1un.js → mcp-CW7H6oUg.js} +1 -1
- package/dist/{preview-C1B6-umF.js → preview-DtSq5uN1.js} +1 -1
- package/dist/{types-tdaXSyah.d.ts → types-C4VfD89E.d.ts} +12 -0
- package/dist/{update-DzL8fpcI.js → update-DVe2kQA7.js} +86 -13
- package/dist/vite/index.d.ts +1 -1
- package/dist/vite/index.js +1 -1
- package/dist/{zh-tw-BhYyMx0-.js → zh-tw-BX3oQAc2.js} +110 -0
- package/package.json +5 -6
- package/release-notes.json +20 -0
- package/src/agent/types.ts +9 -2
- package/src/app/app.tsx +2 -0
- package/src/app/components/agent/agent-panel.tsx +12 -3
- package/src/app/components/agent/agent-presence.tsx +1 -1
- package/src/app/components/command/home-command-menu.tsx +4 -1
- package/src/app/components/command/slide-command-menu.tsx +4 -1
- package/src/app/components/export-progress-toast.tsx +3 -1
- package/src/app/components/inspector/asset-picker-dialog.tsx +1 -1
- package/src/app/components/inspector/comment-layer.tsx +3 -3
- package/src/app/components/inspector/inline-text-editor.tsx +1 -12
- package/src/app/components/inspector/inspect-overlay.tsx +9 -1
- package/src/app/components/inspector/inspector-panel.tsx +7 -23
- package/src/app/components/inspector/inspector-provider.tsx +177 -36
- package/src/app/components/inspector/page-panel.tsx +270 -0
- package/src/app/components/language-toggle.tsx +13 -11
- package/src/app/components/overview-grid.tsx +3 -3
- package/src/app/components/panel/editor-sidebar.tsx +43 -8
- package/src/app/components/panel/panel-shell.tsx +9 -5
- package/src/app/components/panel/save-card.tsx +1 -1
- package/src/app/components/sidebar/folder-item.tsx +4 -1
- package/src/app/components/sidebar/sidebar.tsx +11 -8
- package/src/app/components/slide-canvas.tsx +1 -1
- package/src/app/components/style-panel/design-provider.tsx +48 -11
- package/src/app/components/style-panel/use-design.ts +6 -1
- package/src/app/components/theme-toggle.tsx +16 -22
- package/src/app/components/thumbnail-rail.tsx +69 -50
- package/src/app/components/ui/context-menu.tsx +9 -10
- package/src/app/components/ui/dialog.tsx +2 -4
- package/src/app/components/ui/dropdown-menu.tsx +9 -10
- package/src/app/components/ui/popover.tsx +1 -1
- package/src/app/components/ui/select.tsx +2 -2
- package/src/app/components/ui/sonner.tsx +2 -2
- package/src/app/index.html +7 -0
- package/src/app/lemonriver/agent-cli/model.ts +22 -0
- package/src/app/lemonriver/agent-install/model.ts +46 -0
- package/src/app/lemonriver/agent-install/section.tsx +178 -0
- package/src/app/lemonriver/agent-install/use-install.ts +51 -0
- package/src/app/lemonriver/agent-providers/section.tsx +385 -44
- package/src/app/lemonriver/agent-providers/use-providers.ts +50 -3
- package/src/app/lemonriver/backup/places.ts +22 -12
- package/src/app/lemonriver/chrome/sidebar-extras.tsx +1 -1
- package/src/app/lemonriver/feedback/dialog.tsx +1 -2
- package/src/app/lemonriver/feedback/model.ts +0 -5
- package/src/app/lemonriver/guide/clipboard.ts +19 -0
- package/src/app/lemonriver/guide/create-board.tsx +150 -0
- package/src/app/lemonriver/guide/install-board.tsx +208 -0
- package/src/app/lemonriver/guide/more-agents-page.tsx +89 -0
- package/src/app/lemonriver/guide/more-agents.ts +137 -0
- package/src/app/lemonriver/guide/quick-board.tsx +57 -0
- package/src/app/lemonriver/guide/start-board.tsx +38 -0
- package/src/app/lemonriver/guide/start-card.tsx +105 -0
- package/src/app/lemonriver/guide/start.ts +174 -0
- package/src/app/lemonriver/guide/state.ts +5 -21
- package/src/app/lemonriver/help/help-page.tsx +24 -6
- package/src/app/lemonriver/help/model.ts +1 -0
- package/src/app/lemonriver/home/home-page.tsx +12 -6
- package/src/app/lemonriver/home/sorting.ts +45 -0
- package/src/app/lemonriver/home/use-deck-times.ts +1 -2
- package/src/app/lemonriver/i18n/system-locale.ts +39 -0
- package/src/app/lemonriver/routes.tsx +2 -0
- package/src/app/lemonriver/settings/backup-section.tsx +3 -2
- package/src/app/lemonriver/settings/settings-page.tsx +5 -6
- package/src/app/lemonriver/settings/workspace-card.tsx +2 -1
- package/src/app/lemonriver/share/share-dialog.tsx +2 -1
- package/src/app/lemonriver/text/en.ts +592 -453
- package/src/app/lemonriver/text/es.ts +402 -271
- package/src/app/lemonriver/text/ja.ts +403 -274
- package/src/app/lemonriver/text/platform.ts +7 -0
- package/src/app/lemonriver/text/types.ts +118 -1
- package/src/app/lemonriver/text/zh-cn.ts +643 -508
- package/src/app/lemonriver/text/zh-tw.ts +679 -545
- package/src/app/lemonriver/theme/app.css +9 -0
- package/src/app/lemonriver/theme/controls.css +5 -2
- package/src/app/lemonriver/theme/index.css +9 -0
- package/src/app/lemonriver/theme/pages.ts +2 -0
- package/src/app/lemonriver/theme/theme-menu.tsx +10 -11
- package/src/app/lemonriver/update/restart-wait.ts +45 -0
- package/src/app/lemonriver/update/update-prompt.tsx +9 -0
- package/src/app/lib/agent/use-agent.ts +117 -30
- package/src/app/lib/desktop-host.ts +31 -0
- package/src/app/lib/desktop-routes.ts +22 -0
- package/src/app/lib/desktop.ts +106 -0
- package/src/app/lib/export-pdf.ts +15 -7
- package/src/app/lib/inspector/color.ts +51 -0
- package/src/app/lib/inspector/fiber.ts +6 -0
- package/src/app/lib/inspector/use-editor.ts +2 -1
- package/src/app/lib/inspector/use-notes.ts +331 -57
- package/src/app/lib/inspector/use-visual-editor.ts +9 -1
- package/src/app/lib/locale-store.ts +6 -1
- package/src/app/lib/transition.ts +43 -0
- package/src/app/lib/unsaved.ts +155 -0
- package/src/app/routes/home.tsx +1 -1
- package/src/app/routes/slide.tsx +116 -73
- package/src/app/styles.css +39 -1
- package/src/locale/en.ts +19 -0
- package/src/locale/es.ts +19 -0
- package/src/locale/ja.ts +19 -0
- package/src/locale/types.ts +12 -0
- package/src/locale/zh-cn.ts +19 -0
- package/src/locale/zh-tw.ts +19 -0
- package/src/app/lemonriver/guide/guide-prompt.tsx +0 -89
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { X } from 'lucide-react';
|
|
2
|
+
import { useCallback, useEffect, useRef, useState } from 'react';
|
|
3
|
+
import { Link } from 'react-router-dom';
|
|
4
|
+
import { Dialog, DialogClose, DialogContent } from '@/components/ui/dialog';
|
|
5
|
+
import { slideIds } from '../../lib/slides';
|
|
6
|
+
import { useAgentInstall } from '../agent-install/use-install';
|
|
7
|
+
import { useLrText } from '../text';
|
|
8
|
+
import { CreateBoard } from './create-board';
|
|
9
|
+
import { InstallBoard } from './install-board';
|
|
10
|
+
import { QuickBoard } from './quick-board';
|
|
11
|
+
import { readStart, type StartState, saveStart, startProgress, startVisible } from './start';
|
|
12
|
+
|
|
13
|
+
export function StartCard({ times }: { times: Record<string, { modifiedAt: number }> }) {
|
|
14
|
+
const lr = useLrText();
|
|
15
|
+
const t = lr.start;
|
|
16
|
+
const { catalog, working, act } = useAgentInstall();
|
|
17
|
+
const [start, setStart] = useState<StartState>(() => readStart(localStorage));
|
|
18
|
+
const [finishedNow, setFinishedNow] = useState(false);
|
|
19
|
+
const shownAtMount = useRef<boolean | null>(null);
|
|
20
|
+
if (shownAtMount.current === null) shownAtMount.current = startVisible(start, slideIds);
|
|
21
|
+
|
|
22
|
+
const apps = catalog?.apps ?? [];
|
|
23
|
+
const progress = startProgress(start, times);
|
|
24
|
+
|
|
25
|
+
const update = useCallback((patch: Partial<StartState>) => {
|
|
26
|
+
setStart((current) => {
|
|
27
|
+
const next = { ...current, ...patch };
|
|
28
|
+
saveStart(localStorage, next);
|
|
29
|
+
return next;
|
|
30
|
+
});
|
|
31
|
+
}, []);
|
|
32
|
+
|
|
33
|
+
useEffect(() => {
|
|
34
|
+
if (shownAtMount.current && start.since === null) update({ since: Date.now() });
|
|
35
|
+
}, [start.since, update]);
|
|
36
|
+
|
|
37
|
+
useEffect(() => {
|
|
38
|
+
if (shownAtMount.current && progress.made && !start.made) {
|
|
39
|
+
update({ made: true, madeDeck: progress.madeDeck });
|
|
40
|
+
}
|
|
41
|
+
}, [progress.made, progress.madeDeck, start.made, update]);
|
|
42
|
+
|
|
43
|
+
useEffect(() => {
|
|
44
|
+
if (shownAtMount.current && progress.done && !start.done) {
|
|
45
|
+
update({ done: true });
|
|
46
|
+
setFinishedNow(true);
|
|
47
|
+
}
|
|
48
|
+
}, [progress.done, start.done, update]);
|
|
49
|
+
|
|
50
|
+
if (!shownAtMount.current) return null;
|
|
51
|
+
const open = !start.collapsed && (!start.done || finishedNow);
|
|
52
|
+
|
|
53
|
+
return (
|
|
54
|
+
<Dialog
|
|
55
|
+
open={open}
|
|
56
|
+
onOpenChange={(next) => {
|
|
57
|
+
// Closing (the X, Escape or the mask) keeps the card away for good;
|
|
58
|
+
// the help page can bring it back.
|
|
59
|
+
if (!next) update({ collapsed: true });
|
|
60
|
+
}}
|
|
61
|
+
>
|
|
62
|
+
<DialogContent
|
|
63
|
+
showCloseButton={false}
|
|
64
|
+
data-lr-start-card
|
|
65
|
+
data-lr-start-done={progress.done ? '' : undefined}
|
|
66
|
+
className="max-h-[calc(100dvh-2rem)] w-[calc(100vw-2rem)] gap-4 overflow-y-auto p-5 sm:max-w-[940px] sm:p-6"
|
|
67
|
+
>
|
|
68
|
+
<div className="flex items-start gap-4">
|
|
69
|
+
<div className="min-w-0 flex-1">
|
|
70
|
+
<h2 className="font-heading text-[19px] font-semibold leading-6">
|
|
71
|
+
{progress.done ? t.done : t.title}
|
|
72
|
+
</h2>
|
|
73
|
+
{!progress.done && (
|
|
74
|
+
<p className="mt-1 text-[13px] text-muted-foreground">{t.subtitle}</p>
|
|
75
|
+
)}
|
|
76
|
+
</div>
|
|
77
|
+
<DialogClose
|
|
78
|
+
data-lr-start-close
|
|
79
|
+
aria-label={t.close}
|
|
80
|
+
title={t.close}
|
|
81
|
+
className="flex size-8 shrink-0 items-center justify-center rounded-[8px] text-muted-foreground outline-none hover:bg-muted hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring/40"
|
|
82
|
+
>
|
|
83
|
+
<X className="size-4" />
|
|
84
|
+
</DialogClose>
|
|
85
|
+
</div>
|
|
86
|
+
|
|
87
|
+
<div data-lr-start-boards className="grid gap-3 md:grid-cols-3">
|
|
88
|
+
<QuickBoard copied={start.copied} onCopied={() => update({ copied: true })} />
|
|
89
|
+
<InstallBoard apps={apps} working={working} act={act} />
|
|
90
|
+
<CreateBoard />
|
|
91
|
+
</div>
|
|
92
|
+
|
|
93
|
+
<div className="text-right">
|
|
94
|
+
<Link
|
|
95
|
+
to="/help#guide"
|
|
96
|
+
data-lr-start-help
|
|
97
|
+
className="text-[12px] text-muted-foreground underline-offset-2 outline-none hover:text-foreground hover:underline focus-visible:ring-2 focus-visible:ring-ring/40"
|
|
98
|
+
>
|
|
99
|
+
{lr.guide.sidebar}
|
|
100
|
+
</Link>
|
|
101
|
+
</div>
|
|
102
|
+
</DialogContent>
|
|
103
|
+
</Dialog>
|
|
104
|
+
);
|
|
105
|
+
}
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
import { format } from '../../../locale/format';
|
|
2
|
+
|
|
3
|
+
// Decks every new workspace ships with. A workspace holding only these is
|
|
4
|
+
// still new: upgrading an existing install must not pop the start card.
|
|
5
|
+
export const BUILT_IN_SLIDES: ReadonlySet<string> = new Set([
|
|
6
|
+
'getting-started',
|
|
7
|
+
'getting-started-zh',
|
|
8
|
+
'try-lemonriver',
|
|
9
|
+
'lemonriver-intro',
|
|
10
|
+
'lemonriver-intro-en',
|
|
11
|
+
]);
|
|
12
|
+
|
|
13
|
+
/** Sample decks generated from the template library all start this way. */
|
|
14
|
+
export const SAMPLE_PREFIX = 'sample-';
|
|
15
|
+
|
|
16
|
+
export function isBuiltInSlide(
|
|
17
|
+
id: string,
|
|
18
|
+
builtIns: ReadonlySet<string> = BUILT_IN_SLIDES,
|
|
19
|
+
): boolean {
|
|
20
|
+
return id.startsWith(SAMPLE_PREFIX) || builtIns.has(id);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export type StartState = {
|
|
24
|
+
copied: boolean;
|
|
25
|
+
made: boolean;
|
|
26
|
+
madeDeck: string | null;
|
|
27
|
+
done: boolean;
|
|
28
|
+
collapsed: boolean;
|
|
29
|
+
reopened: boolean;
|
|
30
|
+
/** Epoch ms of the first time the card was shown, for "a deck changed after this". */
|
|
31
|
+
since: number | null;
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export const START_KEY = 'lemonriver:start';
|
|
35
|
+
|
|
36
|
+
export const DEFAULT_START: StartState = {
|
|
37
|
+
copied: false,
|
|
38
|
+
made: false,
|
|
39
|
+
madeDeck: null,
|
|
40
|
+
done: false,
|
|
41
|
+
collapsed: false,
|
|
42
|
+
reopened: false,
|
|
43
|
+
since: null,
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
function flag(value: unknown, fallback: boolean): boolean {
|
|
47
|
+
return typeof value === 'boolean' ? value : fallback;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export function sanitizeStart(raw: unknown): StartState {
|
|
51
|
+
if (!raw || typeof raw !== 'object' || Array.isArray(raw)) return { ...DEFAULT_START };
|
|
52
|
+
const r = raw as Record<string, unknown>;
|
|
53
|
+
const madeDeck = typeof r.madeDeck === 'string' ? r.madeDeck : null;
|
|
54
|
+
// Earlier versions recorded a change to a shipped deck as the user's first
|
|
55
|
+
// deck; treat that stored result as unfinished so the card comes back.
|
|
56
|
+
const bogus = madeDeck !== null && isBuiltInSlide(madeDeck);
|
|
57
|
+
return {
|
|
58
|
+
copied: flag(r.copied, false),
|
|
59
|
+
made: bogus ? false : flag(r.made, false),
|
|
60
|
+
madeDeck: bogus ? null : madeDeck,
|
|
61
|
+
done: bogus ? false : flag(r.done, false),
|
|
62
|
+
collapsed: flag(r.collapsed, false),
|
|
63
|
+
reopened: flag(r.reopened, false),
|
|
64
|
+
since: typeof r.since === 'number' && Number.isFinite(r.since) ? r.since : null,
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export function readStart(storage: Storage): StartState {
|
|
69
|
+
try {
|
|
70
|
+
const raw = storage.getItem(START_KEY);
|
|
71
|
+
return raw ? sanitizeStart(JSON.parse(raw)) : { ...DEFAULT_START };
|
|
72
|
+
} catch {
|
|
73
|
+
return { ...DEFAULT_START };
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export function saveStart(storage: Storage, state: StartState): void {
|
|
78
|
+
try {
|
|
79
|
+
storage.setItem(START_KEY, JSON.stringify(state));
|
|
80
|
+
} catch {}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export function clearStart(storage: Storage): void {
|
|
84
|
+
try {
|
|
85
|
+
storage.removeItem(START_KEY);
|
|
86
|
+
} catch {}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/** True when every deck is one the product shipped; an old user has their own. */
|
|
90
|
+
export function isNewWorkspace(
|
|
91
|
+
slideIds: readonly string[],
|
|
92
|
+
builtIns: ReadonlySet<string> = BUILT_IN_SLIDES,
|
|
93
|
+
): boolean {
|
|
94
|
+
return slideIds.every((id) => isBuiltInSlide(id, builtIns));
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
type Times = Record<string, { modifiedAt: number } | undefined>;
|
|
98
|
+
|
|
99
|
+
/** The deck the user changed since the card first appeared, newest first. */
|
|
100
|
+
export function changedDeck(
|
|
101
|
+
times: Times,
|
|
102
|
+
since: number | null,
|
|
103
|
+
builtIns: ReadonlySet<string> = BUILT_IN_SLIDES,
|
|
104
|
+
): string | null {
|
|
105
|
+
if (since === null) return null;
|
|
106
|
+
let best: { id: string; at: number } | null = null;
|
|
107
|
+
for (const [id, time] of Object.entries(times)) {
|
|
108
|
+
if (isBuiltInSlide(id, builtIns)) continue;
|
|
109
|
+
if (!time || !Number.isFinite(time.modifiedAt)) continue;
|
|
110
|
+
if (time.modifiedAt <= since) continue;
|
|
111
|
+
if (!best || time.modifiedAt > best.at) best = { id, at: time.modifiedAt };
|
|
112
|
+
}
|
|
113
|
+
return best?.id ?? null;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
export type StartProgress = {
|
|
117
|
+
made: boolean;
|
|
118
|
+
madeDeck: string | null;
|
|
119
|
+
done: boolean;
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* Any of the three boards finishes the card once a new deck is here — copied
|
|
124
|
+
* prompts and installed plugins only line up the deck that follows.
|
|
125
|
+
*/
|
|
126
|
+
export function startProgress(state: StartState, times: Times): StartProgress {
|
|
127
|
+
const changed = changedDeck(times, state.since);
|
|
128
|
+
const madeDeck = state.madeDeck ?? changed;
|
|
129
|
+
const made = state.made || changed !== null;
|
|
130
|
+
return { made, madeDeck, done: made };
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/** The quick-start prompt, with the live workspace path and address filled in. */
|
|
134
|
+
export function startPrompt(
|
|
135
|
+
template: string,
|
|
136
|
+
workspace: string | null,
|
|
137
|
+
url: string,
|
|
138
|
+
): string | null {
|
|
139
|
+
if (!workspace) return null;
|
|
140
|
+
return format(template, { path: workspace, url });
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
/** Apps whose desktop program is on this machine first; the rest keep their order. */
|
|
144
|
+
export function orderInstallApps<T extends { state: string }>(apps: readonly T[]): T[] {
|
|
145
|
+
return [
|
|
146
|
+
...apps.filter((app) => app.state !== 'no-app'),
|
|
147
|
+
...apps.filter((a) => a.state === 'no-app'),
|
|
148
|
+
];
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
type CliLike = { state: string } | null;
|
|
152
|
+
|
|
153
|
+
/** Command lines found on this machine (signed in or not) first. */
|
|
154
|
+
export function orderCliAgents<T extends { cli: CliLike }>(rows: readonly T[]): T[] {
|
|
155
|
+
return [
|
|
156
|
+
...rows.filter((row) => row.cli && row.cli.state !== 'missing'),
|
|
157
|
+
...rows.filter((row) => !row.cli || row.cli.state === 'missing'),
|
|
158
|
+
];
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
// Starting a deck needs a command line the panel can actually drive, signed in;
|
|
162
|
+
// a detected agent the panel has no provider for does not count.
|
|
163
|
+
export function hasReadyCli(rows: readonly { cli: CliLike; connectable?: boolean }[]): boolean {
|
|
164
|
+
return rows.some((row) => row.connectable === true && row.cli?.state === 'found');
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
/** Whether the card belongs on the home page at all. */
|
|
168
|
+
export function startVisible(state: StartState, slideIds: readonly string[]): boolean {
|
|
169
|
+
if (state.done) return false;
|
|
170
|
+
// Once the card has been shown, keep it until it is finished: the deck the
|
|
171
|
+
// user just made must not turn them into an "old user" and hide the card.
|
|
172
|
+
if (state.reopened || state.since !== null) return true;
|
|
173
|
+
return isNewWorkspace(slideIds);
|
|
174
|
+
}
|
|
@@ -1,29 +1,13 @@
|
|
|
1
|
-
export type GuideFlags = {
|
|
1
|
+
export type GuideFlags = { guided: boolean };
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
export function guideSeen(): boolean {
|
|
6
|
-
try {
|
|
7
|
-
return localStorage.getItem(GUIDE_SEEN_KEY) === '1';
|
|
8
|
-
} catch {
|
|
9
|
-
return true;
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export function markGuideSeen(): void {
|
|
14
|
-
try {
|
|
15
|
-
localStorage.setItem(GUIDE_SEEN_KEY, '1');
|
|
16
|
-
} catch {}
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
/** The server decides both: the chooser on first open, and the in-app agent entry points. */
|
|
3
|
+
/** The server decides whether the in-app agent entry points stay on. */
|
|
20
4
|
export async function guideFlags(): Promise<GuideFlags> {
|
|
21
5
|
try {
|
|
22
6
|
const res = await fetch('/__lr/guide');
|
|
23
7
|
if (!res.ok) throw new Error(String(res.status));
|
|
24
|
-
const data = (await res.json()) as {
|
|
25
|
-
return {
|
|
8
|
+
const data = (await res.json()) as { guided?: unknown };
|
|
9
|
+
return { guided: data.guided === true };
|
|
26
10
|
} catch {
|
|
27
|
-
return {
|
|
11
|
+
return { guided: false };
|
|
28
12
|
}
|
|
29
13
|
}
|
|
@@ -3,9 +3,10 @@ import { useEffect, useMemo, useState } from 'react';
|
|
|
3
3
|
import { Link, useLocation } from 'react-router-dom';
|
|
4
4
|
import { format } from '@/lib/use-locale';
|
|
5
5
|
import { cn } from '@/lib/utils';
|
|
6
|
-
import {
|
|
6
|
+
import { DEFAULT_START, saveStart } from '../guide/start';
|
|
7
7
|
import { SUPPORT_URL } from '../links';
|
|
8
8
|
import { useLrText } from '../text';
|
|
9
|
+
import { revealLabel } from '../text/platform';
|
|
9
10
|
import { useReduceMotionSetting } from '../theme/motion';
|
|
10
11
|
import {
|
|
11
12
|
filterHelpSections,
|
|
@@ -220,10 +221,6 @@ export function HelpPage() {
|
|
|
220
221
|
|
|
221
222
|
const anchor = location.hash.replace(/^#/, '');
|
|
222
223
|
|
|
223
|
-
useEffect(() => {
|
|
224
|
-
if (anchor.startsWith('guide')) markGuideSeen();
|
|
225
|
-
}, [anchor]);
|
|
226
|
-
|
|
227
224
|
useEffect(() => {
|
|
228
225
|
if (anchor === '') return;
|
|
229
226
|
const target = document.getElementById(`help-${anchor}`);
|
|
@@ -248,6 +245,20 @@ export function HelpPage() {
|
|
|
248
245
|
{help.title}
|
|
249
246
|
</h1>
|
|
250
247
|
<p className="mt-0.5 text-[14px] text-muted-foreground">{help.intro}</p>
|
|
248
|
+
<Link
|
|
249
|
+
to="/"
|
|
250
|
+
data-lr-start-reopen
|
|
251
|
+
onClick={() => {
|
|
252
|
+
saveStart(localStorage, {
|
|
253
|
+
...DEFAULT_START,
|
|
254
|
+
reopened: true,
|
|
255
|
+
since: Date.now(),
|
|
256
|
+
});
|
|
257
|
+
}}
|
|
258
|
+
className="mt-2 inline-block text-[13px] text-foreground underline underline-offset-2 outline-none hover:no-underline focus-visible:ring-2 focus-visible:ring-ring/40"
|
|
259
|
+
>
|
|
260
|
+
{lr.start.reopen}
|
|
261
|
+
</Link>
|
|
251
262
|
</header>
|
|
252
263
|
|
|
253
264
|
<input
|
|
@@ -270,7 +281,14 @@ export function HelpPage() {
|
|
|
270
281
|
<Section
|
|
271
282
|
key={section.id}
|
|
272
283
|
section={section}
|
|
273
|
-
values={
|
|
284
|
+
values={{
|
|
285
|
+
...help.buttons,
|
|
286
|
+
reveal: revealLabel(
|
|
287
|
+
navigator.userAgent,
|
|
288
|
+
help.buttons.reveal,
|
|
289
|
+
help.buttons.revealExplorer,
|
|
290
|
+
),
|
|
291
|
+
}}
|
|
274
292
|
highlighted={highlight === section.id}
|
|
275
293
|
/>
|
|
276
294
|
))}
|
|
@@ -19,7 +19,7 @@ import type { HomeOutletContext } from '../../routes/home-shell';
|
|
|
19
19
|
import { FilterPill } from '../chrome/filter-pill';
|
|
20
20
|
import { isFeatureEnabled } from '../features';
|
|
21
21
|
import { LemonEmpty } from '../feedback/lemon-empty';
|
|
22
|
-
import {
|
|
22
|
+
import { StartCard } from '../guide/start-card';
|
|
23
23
|
import { useGuideFlags } from '../guide/use-guide';
|
|
24
24
|
import { type InspectOk, inspectPackage } from '../share/client';
|
|
25
25
|
import { shareErrorText } from '../share/codes';
|
|
@@ -35,7 +35,7 @@ import { SearchInput, SortControl } from './controls';
|
|
|
35
35
|
import { DeckCard } from './deck-card';
|
|
36
36
|
import { MoveDialog, RenameDialog, TypedConfirmDialog } from './dialogs';
|
|
37
37
|
import { OrganizeDraftsDialog } from './organize-drafts';
|
|
38
|
-
import { filterDecks,
|
|
38
|
+
import { filterDecks, homeOrder, useSortPref } from './sorting';
|
|
39
39
|
import { greetingFor } from './time';
|
|
40
40
|
import { useDeckTimes } from './use-deck-times';
|
|
41
41
|
import { useDelayed } from './use-delayed';
|
|
@@ -95,11 +95,17 @@ export function LemonRiverHome() {
|
|
|
95
95
|
() => (occasion ? filtered.filter((id) => times[id]?.occasion === occasion) : filtered),
|
|
96
96
|
[filtered, occasion, times],
|
|
97
97
|
);
|
|
98
|
+
const searching = query.trim().length > 0;
|
|
98
99
|
const sorted = useMemo(
|
|
99
|
-
() =>
|
|
100
|
-
|
|
100
|
+
() =>
|
|
101
|
+
homeOrder(
|
|
102
|
+
shown,
|
|
103
|
+
{ sort: sortKey, all: isAll, searching, locale: t.id },
|
|
104
|
+
(id) => titleMap[id] ?? id,
|
|
105
|
+
slideCreatedAt,
|
|
106
|
+
),
|
|
107
|
+
[shown, sortKey, isAll, searching, t.id, titleMap],
|
|
101
108
|
);
|
|
102
|
-
const searching = query.trim().length > 0;
|
|
103
109
|
const narrowing = searching || occasion !== null;
|
|
104
110
|
const showLoading = useDelayed(loading);
|
|
105
111
|
const titleOf = (id: string) => titleMap[id] ?? id;
|
|
@@ -199,7 +205,7 @@ export function LemonRiverHome() {
|
|
|
199
205
|
return (
|
|
200
206
|
<div data-lr-home {...(shareOn ? dropHandlers : {})}>
|
|
201
207
|
{shareOn && dropHint}
|
|
202
|
-
{
|
|
208
|
+
<StartCard times={times} />
|
|
203
209
|
{import.meta.env.DEV && isAll && (
|
|
204
210
|
<>
|
|
205
211
|
<header className="mb-6">
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { useState } from 'react';
|
|
2
|
+
import { BUILT_IN_SLIDES } from '../guide/start';
|
|
2
3
|
|
|
3
4
|
export type SortKey = 'created-desc' | 'created-asc' | 'title-asc' | 'title-desc';
|
|
4
5
|
|
|
@@ -57,3 +58,47 @@ export function filterDecks(
|
|
|
57
58
|
if (!q) return ids;
|
|
58
59
|
return ids.filter((id) => id.toLowerCase().includes(q) || titles[id]?.toLowerCase().includes(q));
|
|
59
60
|
}
|
|
61
|
+
|
|
62
|
+
/** The decks every workspace ships with, in the order the home page puts them first. */
|
|
63
|
+
export function builtInOrder(locale: string): readonly string[] {
|
|
64
|
+
const chinese = locale === 'zh-CN' || locale === 'zh-TW';
|
|
65
|
+
return chinese
|
|
66
|
+
? [
|
|
67
|
+
'lemonriver-intro',
|
|
68
|
+
'getting-started-zh',
|
|
69
|
+
'try-lemonriver',
|
|
70
|
+
'lemonriver-intro-en',
|
|
71
|
+
'getting-started',
|
|
72
|
+
]
|
|
73
|
+
: [
|
|
74
|
+
'lemonriver-intro-en',
|
|
75
|
+
'getting-started',
|
|
76
|
+
'try-lemonriver',
|
|
77
|
+
'lemonriver-intro',
|
|
78
|
+
'getting-started-zh',
|
|
79
|
+
];
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* The decks' order on the home page. The built-ins lead the all-slides view
|
|
84
|
+
* under the default "newest first" sort, so a new workspace opens on the
|
|
85
|
+
* introduction instead of on whatever was written last; any other sort, the
|
|
86
|
+
* folder views and search results keep the plain key order.
|
|
87
|
+
*/
|
|
88
|
+
export function homeOrder(
|
|
89
|
+
ids: readonly string[],
|
|
90
|
+
opts: { sort: SortKey; all: boolean; searching: boolean; locale: string },
|
|
91
|
+
titleOf: (id: string) => string,
|
|
92
|
+
createdAt: Record<string, number>,
|
|
93
|
+
): string[] {
|
|
94
|
+
const sorted = sortDecks([...ids], opts.sort, titleOf, createdAt);
|
|
95
|
+
if (!opts.all || opts.searching || opts.sort !== 'created-desc') return sorted;
|
|
96
|
+
const rest = new Set(sorted);
|
|
97
|
+
const pinned: string[] = [];
|
|
98
|
+
for (const id of builtInOrder(opts.locale)) {
|
|
99
|
+
if (!BUILT_IN_SLIDES.has(id) || !rest.has(id)) continue;
|
|
100
|
+
pinned.push(id);
|
|
101
|
+
rest.delete(id);
|
|
102
|
+
}
|
|
103
|
+
return [...pinned, ...sorted.filter((id) => rest.has(id))];
|
|
104
|
+
}
|
|
@@ -5,11 +5,10 @@ export type DeckTimes = Record<
|
|
|
5
5
|
{ modifiedAt: number; occasion: string | null; template?: string | null }
|
|
6
6
|
>;
|
|
7
7
|
|
|
8
|
-
/** When each deck was last saved
|
|
8
|
+
/** When each deck was last saved, so the home page can sort and the start card can tick. */
|
|
9
9
|
export function useDeckTimes(): DeckTimes {
|
|
10
10
|
const [times, setTimes] = useState<DeckTimes>({});
|
|
11
11
|
useEffect(() => {
|
|
12
|
-
if (!import.meta.env.DEV) return;
|
|
13
12
|
let cancelled = false;
|
|
14
13
|
const load = () =>
|
|
15
14
|
fetch('/__lr/decks')
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { Locale } from '../../../locale/types';
|
|
2
|
+
|
|
3
|
+
function matchTag(tag: string): Locale['id'] | null {
|
|
4
|
+
const t = tag.trim().toLowerCase().replace(/_/g, '-');
|
|
5
|
+
if (
|
|
6
|
+
t === 'zh' ||
|
|
7
|
+
t.startsWith('zh-hans') ||
|
|
8
|
+
t === 'zh-cn' ||
|
|
9
|
+
t.startsWith('zh-cn-') ||
|
|
10
|
+
t === 'zh-sg' ||
|
|
11
|
+
t.startsWith('zh-sg-')
|
|
12
|
+
) {
|
|
13
|
+
return 'zh-CN';
|
|
14
|
+
}
|
|
15
|
+
if (
|
|
16
|
+
t.startsWith('zh-hant') ||
|
|
17
|
+
t === 'zh-tw' ||
|
|
18
|
+
t.startsWith('zh-tw-') ||
|
|
19
|
+
t === 'zh-hk' ||
|
|
20
|
+
t.startsWith('zh-hk-') ||
|
|
21
|
+
t === 'zh-mo' ||
|
|
22
|
+
t.startsWith('zh-mo-')
|
|
23
|
+
) {
|
|
24
|
+
return 'zh-TW';
|
|
25
|
+
}
|
|
26
|
+
const base = t.split('-')[0];
|
|
27
|
+
if (base === 'ja') return 'ja';
|
|
28
|
+
if (base === 'es') return 'es';
|
|
29
|
+
return null;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/** The UI language for a browser language list, English when none matches. */
|
|
33
|
+
export function systemLocaleId(languages: readonly string[] | undefined): Locale['id'] {
|
|
34
|
+
for (const tag of languages ?? []) {
|
|
35
|
+
const id = matchTag(tag);
|
|
36
|
+
if (id) return id;
|
|
37
|
+
}
|
|
38
|
+
return 'en';
|
|
39
|
+
}
|
|
@@ -2,6 +2,7 @@ import { lazy } from 'react';
|
|
|
2
2
|
import { Route } from 'react-router-dom';
|
|
3
3
|
import { NotFound } from './chrome/not-found';
|
|
4
4
|
import { isFeatureEnabled } from './features';
|
|
5
|
+
import { MoreAgentsPage } from './guide/more-agents-page';
|
|
5
6
|
import { HelpPage } from './help/help-page';
|
|
6
7
|
import { LemonRiverHome } from './home/home-page';
|
|
7
8
|
import { SettingsPage } from './settings/settings-page';
|
|
@@ -81,6 +82,7 @@ export function lemonRiverShellRoutes() {
|
|
|
81
82
|
<Route key="settings" path="/settings" element={<SettingsPage />} />
|
|
82
83
|
),
|
|
83
84
|
isFeatureEnabled('help') && <Route key="help" path="/help" element={<HelpPage />} />,
|
|
85
|
+
<Route key="agents-more" path="/agents/more" element={<MoreAgentsPage />} />,
|
|
84
86
|
isFeatureEnabled('templates') && (
|
|
85
87
|
<Route
|
|
86
88
|
key="templates"
|
|
@@ -35,6 +35,7 @@ import { placeLabel } from '../backup/places';
|
|
|
35
35
|
import { openFeedback } from '../feedback/dialog';
|
|
36
36
|
import { helpAnchorForPlace } from '../help/model';
|
|
37
37
|
import { useLrText } from '../text';
|
|
38
|
+
import { revealLabel } from '../text/platform';
|
|
38
39
|
import { useReduceMotionSetting } from '../theme/motion';
|
|
39
40
|
import { useTheme } from '../theme/use-theme';
|
|
40
41
|
import { BackupRestoreDialog } from './backup-restore-dialog';
|
|
@@ -260,7 +261,7 @@ export function BackupSection() {
|
|
|
260
261
|
return;
|
|
261
262
|
}
|
|
262
263
|
if ('cancelled' in answer) return;
|
|
263
|
-
const name = answer.path.split(
|
|
264
|
+
const name = answer.path.split(/[\\/]/).pop() ?? answer.path;
|
|
264
265
|
setExportNotice(format(b.exportDone, { name, size: formatSize(answer.size) }));
|
|
265
266
|
} catch {
|
|
266
267
|
setExportNotice(b.exportFailed);
|
|
@@ -415,7 +416,7 @@ export function BackupSection() {
|
|
|
415
416
|
onClick={() => void revealBackup(last.path)}
|
|
416
417
|
className="rounded text-[12.5px] text-muted-foreground underline-offset-2 outline-none hover:text-foreground hover:underline focus-visible:ring-2 focus-visible:ring-ring/40"
|
|
417
418
|
>
|
|
418
|
-
{b.reveal}
|
|
419
|
+
{revealLabel(navigator.userAgent, b.reveal, b.revealExplorer)}
|
|
419
420
|
</button>
|
|
420
421
|
)}
|
|
421
422
|
|
|
@@ -3,12 +3,12 @@ import { useEffect, useState } from 'react';
|
|
|
3
3
|
import { useNavigate } from 'react-router-dom';
|
|
4
4
|
import { useLocale } from '@/lib/use-locale';
|
|
5
5
|
import { cn } from '@/lib/utils';
|
|
6
|
+
import { AgentInstallSection } from '../agent-install/section';
|
|
6
7
|
import type { AgentPrefs } from '../agent-prefs/prefs';
|
|
7
8
|
import { updateAgentPrefs, useAgentPrefs } from '../agent-prefs/use-prefs';
|
|
8
9
|
import { AgentProvidersSection } from '../agent-providers/section';
|
|
9
10
|
import { HelperMascot, type HelperRole } from '../brand/mascot';
|
|
10
11
|
import { isFeatureEnabled } from '../features';
|
|
11
|
-
import { GUIDE_SEEN_KEY } from '../guide/state';
|
|
12
12
|
import { SUPPORT_URL } from '../links';
|
|
13
13
|
import { useLrText } from '../text';
|
|
14
14
|
import { setReduceMotionSetting, useReduceMotionSetting } from '../theme/motion';
|
|
@@ -45,10 +45,7 @@ export function SettingsPage() {
|
|
|
45
45
|
};
|
|
46
46
|
|
|
47
47
|
function replayOnboarding() {
|
|
48
|
-
|
|
49
|
-
localStorage.removeItem(GUIDE_SEEN_KEY);
|
|
50
|
-
} catch {}
|
|
51
|
-
navigate('/');
|
|
48
|
+
navigate('/help#guide');
|
|
52
49
|
}
|
|
53
50
|
|
|
54
51
|
const helpers: {
|
|
@@ -171,7 +168,9 @@ export function SettingsPage() {
|
|
|
171
168
|
</div>
|
|
172
169
|
</section>
|
|
173
170
|
|
|
174
|
-
|
|
171
|
+
<AgentInstallSection />
|
|
172
|
+
|
|
173
|
+
<AgentProvidersSection />
|
|
175
174
|
|
|
176
175
|
{isFeatureEnabled('backup') && <BackupSection />}
|
|
177
176
|
|
|
@@ -2,6 +2,7 @@ import { Check, Copy, Folder } from 'lucide-react';
|
|
|
2
2
|
import { useEffect, useState } from 'react';
|
|
3
3
|
import { Button } from '@/components/ui/button';
|
|
4
4
|
import { useLrText } from '../text';
|
|
5
|
+
import { revealLabel } from '../text/platform';
|
|
5
6
|
import { copyWorkspacePath, revealWorkspace, workspacePath } from './workspace';
|
|
6
7
|
|
|
7
8
|
export function WorkspaceCard() {
|
|
@@ -44,7 +45,7 @@ export function WorkspaceCard() {
|
|
|
44
45
|
</Button>
|
|
45
46
|
<Button variant="outline" size="sm" onClick={revealWorkspace}>
|
|
46
47
|
<Folder />
|
|
47
|
-
{t.workspaceReveal}
|
|
48
|
+
{revealLabel(navigator.userAgent, t.workspaceReveal, t.workspaceRevealExplorer)}
|
|
48
49
|
</Button>
|
|
49
50
|
</div>
|
|
50
51
|
<p className="mt-3 text-[12.5px] text-muted-foreground">{t.workspaceHint}</p>
|
|
@@ -17,6 +17,7 @@ import { loadSlide } from '../../lib/slides';
|
|
|
17
17
|
import { isFeatureEnabled } from '../features';
|
|
18
18
|
import { noteSuccess } from '../feedback/first-success';
|
|
19
19
|
import { useLrText } from '../text';
|
|
20
|
+
import { revealLabel } from '../text/platform';
|
|
20
21
|
import { CaptureCancelled, captureDeck, toBase64 } from './capture';
|
|
21
22
|
import { appVersion, packShare, revealShared } from './client';
|
|
22
23
|
import { buildGuideHtml, guideFileName, guideLocaleFor } from './guide';
|
|
@@ -317,7 +318,7 @@ export function ShareDialog({
|
|
|
317
318
|
size="sm"
|
|
318
319
|
onClick={() => result && void revealShared(result.path)}
|
|
319
320
|
>
|
|
320
|
-
{lr.share.reveal}
|
|
321
|
+
{revealLabel(navigator.userAgent, lr.share.reveal, lr.share.revealExplorer)}
|
|
321
322
|
</Button>
|
|
322
323
|
<Button type="button" size="sm" onClick={() => close(false)}>
|
|
323
324
|
{lr.share.finish}
|