@lemonriver/core 0.6.0 → 0.7.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-RlcGG-Ve.js → build-CKwrex8y.js} +1 -1
- package/dist/cli/bin.js +3 -3
- package/dist/{config-BJT87wE9.js → config-B1_gk0sy.js} +1641 -60
- package/dist/{dev-DR-j_xda.js → dev-DZ2Yzl2p.js} +1 -1
- package/dist/{preview-BTAhTb5B.js → preview-hMDcuHfP.js} +1 -1
- package/dist/vite/index.js +1 -1
- package/package.json +1 -1
- package/src/app/lemonriver/chrome/app-chrome.tsx +12 -1
- package/src/app/lemonriver/features.test.ts +5 -0
- package/src/app/lemonriver/features.ts +2 -1
- package/src/app/lemonriver/feedback/pending-toast.ts +7 -2
- package/src/app/lemonriver/home/deck-card.tsx +10 -1
- package/src/app/lemonriver/home/home-page.tsx +52 -1
- package/src/app/lemonriver/share/capture.ts +76 -0
- package/src/app/lemonriver/share/client.ts +162 -0
- package/src/app/lemonriver/share/codes.test.ts +49 -0
- package/src/app/lemonriver/share/codes.ts +30 -0
- package/src/app/lemonriver/share/compare.test.ts +199 -0
- package/src/app/lemonriver/share/compare.ts +367 -0
- package/src/app/lemonriver/share/drop.ts +84 -0
- package/src/app/lemonriver/share/folder.test.ts +42 -0
- package/src/app/lemonriver/share/folder.ts +29 -0
- package/src/app/lemonriver/share/freeze.ts +51 -0
- package/src/app/lemonriver/share/guide.test.ts +78 -0
- package/src/app/lemonriver/share/guide.ts +222 -0
- package/src/app/lemonriver/share/import-dialog.tsx +391 -0
- package/src/app/lemonriver/share/import-entry.tsx +106 -0
- package/src/app/lemonriver/share/model.ts +150 -0
- package/src/app/lemonriver/share/naming.test.ts +59 -0
- package/src/app/lemonriver/share/naming.ts +71 -0
- package/src/app/lemonriver/share/paths.test.ts +75 -0
- package/src/app/lemonriver/share/paths.ts +181 -0
- package/src/app/lemonriver/share/pdf.test.ts +79 -0
- package/src/app/lemonriver/share/pdf.ts +169 -0
- package/src/app/lemonriver/share/share-dialog.tsx +286 -0
- package/src/app/lemonriver/share/summary.ts +47 -0
- package/src/app/lemonriver/slide-extensions.tsx +69 -23
- package/src/app/lemonriver/templates/library-page.tsx +5 -2
- package/src/app/lemonriver/text/en.ts +67 -0
- package/src/app/lemonriver/text/es.ts +67 -0
- package/src/app/lemonriver/text/ja.ts +67 -0
- package/src/app/lemonriver/text/types.ts +78 -0
- package/src/app/lemonriver/text/zh-cn.ts +62 -0
- package/src/app/lemonriver/text/zh-tw.ts +62 -0
|
@@ -0,0 +1,286 @@
|
|
|
1
|
+
import { Share2 } from 'lucide-react';
|
|
2
|
+
import { useEffect, useRef, useState } from 'react';
|
|
3
|
+
import { Button } from '@/components/ui/button';
|
|
4
|
+
import {
|
|
5
|
+
Dialog,
|
|
6
|
+
DialogContent,
|
|
7
|
+
DialogDescription,
|
|
8
|
+
DialogFooter,
|
|
9
|
+
DialogHeader,
|
|
10
|
+
DialogTitle,
|
|
11
|
+
} from '@/components/ui/dialog';
|
|
12
|
+
import { Progress } from '@/components/ui/progress';
|
|
13
|
+
import { format, useLocale } from '@/lib/use-locale';
|
|
14
|
+
import { CANVAS_HEIGHT, CANVAS_WIDTH, type SlideModule } from '../../lib/sdk';
|
|
15
|
+
import { loadSlide } from '../../lib/slides';
|
|
16
|
+
import { useLrText } from '../text';
|
|
17
|
+
import { CaptureCancelled, captureDeck, toBase64 } from './capture';
|
|
18
|
+
import { appVersion, packShare, revealShared } from './client';
|
|
19
|
+
import { buildGuideHtml, guideFileName, guideLocaleFor } from './guide';
|
|
20
|
+
import { safeFileName } from './naming';
|
|
21
|
+
import { buildImagePdf } from './pdf';
|
|
22
|
+
|
|
23
|
+
type Phase = 'idle' | 'working' | 'done' | 'failed';
|
|
24
|
+
|
|
25
|
+
type Result = { name: string; path: string; size: number; warnings: string[] };
|
|
26
|
+
|
|
27
|
+
const MAX_LISTED_FILES = 10;
|
|
28
|
+
|
|
29
|
+
function estimateSeconds(pages: number): number {
|
|
30
|
+
return Math.max(2, Math.round(pages * 1.2));
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export function ShareDialog({
|
|
34
|
+
open,
|
|
35
|
+
slideId,
|
|
36
|
+
title,
|
|
37
|
+
onOpenChange,
|
|
38
|
+
}: {
|
|
39
|
+
open: boolean;
|
|
40
|
+
slideId: string;
|
|
41
|
+
title: string;
|
|
42
|
+
onOpenChange: (open: boolean) => void;
|
|
43
|
+
}) {
|
|
44
|
+
const t = useLocale();
|
|
45
|
+
const lr = useLrText();
|
|
46
|
+
const locale = useLocale();
|
|
47
|
+
const [attachPdf, setAttachPdf] = useState(true);
|
|
48
|
+
const [phase, setPhase] = useState<Phase>('idle');
|
|
49
|
+
const [pages, setPages] = useState<number | null>(null);
|
|
50
|
+
const [progress, setProgress] = useState({ current: 0, total: 0 });
|
|
51
|
+
const [packing, setPacking] = useState(false);
|
|
52
|
+
const [version, setVersion] = useState('');
|
|
53
|
+
const [result, setResult] = useState<Result | null>(null);
|
|
54
|
+
const [failure, setFailure] = useState<{ message: string; paths: string[] } | null>(null);
|
|
55
|
+
const abortRef = useRef<AbortController | null>(null);
|
|
56
|
+
|
|
57
|
+
useEffect(() => {
|
|
58
|
+
if (!open) return;
|
|
59
|
+
setAttachPdf(true);
|
|
60
|
+
setPhase('idle');
|
|
61
|
+
setProgress({ current: 0, total: 0 });
|
|
62
|
+
setPacking(false);
|
|
63
|
+
setResult(null);
|
|
64
|
+
setFailure(null);
|
|
65
|
+
void appVersion().then(setVersion);
|
|
66
|
+
let cancelled = false;
|
|
67
|
+
loadSlide(slideId)
|
|
68
|
+
.then((slide) => {
|
|
69
|
+
if (!cancelled) setPages(slide.default?.length ?? 0);
|
|
70
|
+
})
|
|
71
|
+
.catch(() => {});
|
|
72
|
+
return () => {
|
|
73
|
+
cancelled = true;
|
|
74
|
+
};
|
|
75
|
+
}, [open, slideId]);
|
|
76
|
+
|
|
77
|
+
const cancel = () => {
|
|
78
|
+
abortRef.current?.abort();
|
|
79
|
+
abortRef.current = null;
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
const close = (next: boolean) => {
|
|
83
|
+
if (!next) cancel();
|
|
84
|
+
onOpenChange(next);
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
const start = async () => {
|
|
88
|
+
const controller = new AbortController();
|
|
89
|
+
abortRef.current = controller;
|
|
90
|
+
setPhase('working');
|
|
91
|
+
setPacking(false);
|
|
92
|
+
setFailure(null);
|
|
93
|
+
setProgress({ current: 0, total: pages ?? 0 });
|
|
94
|
+
try {
|
|
95
|
+
const slide: SlideModule = await loadSlide(slideId);
|
|
96
|
+
const captured = await captureDeck(slide, {
|
|
97
|
+
signal: controller.signal,
|
|
98
|
+
onPage: (current, total) => setProgress({ current, total }),
|
|
99
|
+
});
|
|
100
|
+
setPacking(true);
|
|
101
|
+
const base = safeFileName(title, slideId);
|
|
102
|
+
const guideLocale = guideLocaleFor(locale.id);
|
|
103
|
+
const extras = [];
|
|
104
|
+
if (attachPdf) {
|
|
105
|
+
const pdf = buildImagePdf(
|
|
106
|
+
captured.map((page) => ({
|
|
107
|
+
jpeg: page.jpeg,
|
|
108
|
+
width: CANVAS_WIDTH,
|
|
109
|
+
height: CANVAS_HEIGHT,
|
|
110
|
+
})),
|
|
111
|
+
{ title: base },
|
|
112
|
+
);
|
|
113
|
+
extras.push({ name: `${base}.pdf`, base64: toBase64(pdf) });
|
|
114
|
+
}
|
|
115
|
+
const guide = buildGuideHtml({
|
|
116
|
+
title: base,
|
|
117
|
+
pages: captured.length,
|
|
118
|
+
appVersion: version,
|
|
119
|
+
createdAt: Date.now(),
|
|
120
|
+
locale: guideLocale,
|
|
121
|
+
hasPdf: attachPdf,
|
|
122
|
+
});
|
|
123
|
+
extras.push({
|
|
124
|
+
name: guideFileName(guideLocale),
|
|
125
|
+
base64: toBase64(new TextEncoder().encode(guide)),
|
|
126
|
+
});
|
|
127
|
+
const packed = await packShare({
|
|
128
|
+
slideIds: [slideId],
|
|
129
|
+
pages: { [slideId]: captured.length },
|
|
130
|
+
thumbs: { [slideId]: captured.map((page) => toBase64(page.thumb)) },
|
|
131
|
+
extras,
|
|
132
|
+
});
|
|
133
|
+
if (!packed.ok) {
|
|
134
|
+
setFailure({ message: packed.error, paths: packed.paths ?? [] });
|
|
135
|
+
setPhase('failed');
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
138
|
+
setResult({
|
|
139
|
+
name: packed.name,
|
|
140
|
+
path: packed.path,
|
|
141
|
+
size: packed.size,
|
|
142
|
+
warnings: packed.warnings,
|
|
143
|
+
});
|
|
144
|
+
setPhase('done');
|
|
145
|
+
} catch (err) {
|
|
146
|
+
if (err instanceof CaptureCancelled || controller.signal.aborted) {
|
|
147
|
+
setPhase('idle');
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
setFailure({ message: err instanceof Error ? err.message : String(err), paths: [] });
|
|
151
|
+
setPhase('failed');
|
|
152
|
+
} finally {
|
|
153
|
+
abortRef.current = null;
|
|
154
|
+
setPacking(false);
|
|
155
|
+
}
|
|
156
|
+
};
|
|
157
|
+
|
|
158
|
+
const total = progress.total || pages || 0;
|
|
159
|
+
const percent =
|
|
160
|
+
phase === 'done' ? 100 : packing ? 95 : total > 0 ? (progress.current / total) * 90 : 0;
|
|
161
|
+
|
|
162
|
+
return (
|
|
163
|
+
<Dialog open={open} onOpenChange={close}>
|
|
164
|
+
<DialogContent className="sm:max-w-[520px]">
|
|
165
|
+
<DialogHeader>
|
|
166
|
+
<DialogTitle>{format(lr.share.dialogTitle, { title })}</DialogTitle>
|
|
167
|
+
<DialogDescription>{lr.share.dialogDescription}</DialogDescription>
|
|
168
|
+
</DialogHeader>
|
|
169
|
+
|
|
170
|
+
{phase === 'idle' && (
|
|
171
|
+
<div className="flex flex-col gap-2">
|
|
172
|
+
<label className="flex items-start gap-2.5 text-[14px]">
|
|
173
|
+
<input
|
|
174
|
+
type="checkbox"
|
|
175
|
+
checked={attachPdf}
|
|
176
|
+
onChange={(e) => setAttachPdf(e.target.checked)}
|
|
177
|
+
className="mt-0.5 size-4 shrink-0 accent-[var(--lr-accent)]"
|
|
178
|
+
/>
|
|
179
|
+
<span>{lr.share.attachPdf}</span>
|
|
180
|
+
</label>
|
|
181
|
+
{pages !== null && pages > 0 && (
|
|
182
|
+
<p className="text-[13px] text-muted-foreground">
|
|
183
|
+
{format(lr.share.estimate, { n: pages, s: estimateSeconds(pages) })}
|
|
184
|
+
</p>
|
|
185
|
+
)}
|
|
186
|
+
</div>
|
|
187
|
+
)}
|
|
188
|
+
|
|
189
|
+
{(phase === 'working' || phase === 'done') && (
|
|
190
|
+
<div className="flex flex-col gap-2" data-lr-share-progress>
|
|
191
|
+
<Progress value={percent} className="h-1.5" />
|
|
192
|
+
<p className="text-[13px] text-muted-foreground">
|
|
193
|
+
{phase === 'done'
|
|
194
|
+
? format(lr.share.done, {
|
|
195
|
+
name: result?.name ?? '',
|
|
196
|
+
size: (Math.max(0, result?.size ?? 0) / (1024 * 1024)).toFixed(1),
|
|
197
|
+
})
|
|
198
|
+
: packing
|
|
199
|
+
? lr.share.preparing
|
|
200
|
+
: format(lr.share.capturing, {
|
|
201
|
+
k: Math.max(1, progress.current),
|
|
202
|
+
n: total || 1,
|
|
203
|
+
})}
|
|
204
|
+
</p>
|
|
205
|
+
</div>
|
|
206
|
+
)}
|
|
207
|
+
|
|
208
|
+
{phase === 'done' && result && result.warnings.length > 0 && (
|
|
209
|
+
<div className="rounded-[8px] border border-border bg-muted/40 px-3 py-2 text-[13px]">
|
|
210
|
+
<p className="font-semibold">{lr.share.warnings}</p>
|
|
211
|
+
<ul className="mt-1 list-disc pl-4 text-muted-foreground">
|
|
212
|
+
{result.warnings.map((warning) => (
|
|
213
|
+
<li key={warning}>{warning}</li>
|
|
214
|
+
))}
|
|
215
|
+
</ul>
|
|
216
|
+
</div>
|
|
217
|
+
)}
|
|
218
|
+
|
|
219
|
+
{phase === 'failed' && failure && (
|
|
220
|
+
<div data-lr-share-failed className="text-[13px] text-destructive">
|
|
221
|
+
<p className="font-semibold">{lr.share.failed}</p>
|
|
222
|
+
<p className="mt-1 break-words">{failure.message}</p>
|
|
223
|
+
{failure.paths.length > 0 && (
|
|
224
|
+
<ul className="mt-2 list-disc pl-4 font-mono text-[12px] text-muted-foreground">
|
|
225
|
+
{failure.paths.slice(0, MAX_LISTED_FILES).map((path) => (
|
|
226
|
+
<li key={path} className="break-all">
|
|
227
|
+
{path}
|
|
228
|
+
</li>
|
|
229
|
+
))}
|
|
230
|
+
{failure.paths.length > MAX_LISTED_FILES && (
|
|
231
|
+
<li>
|
|
232
|
+
{format(lr.share.moreFiles, { n: failure.paths.length - MAX_LISTED_FILES })}
|
|
233
|
+
</li>
|
|
234
|
+
)}
|
|
235
|
+
</ul>
|
|
236
|
+
)}
|
|
237
|
+
</div>
|
|
238
|
+
)}
|
|
239
|
+
|
|
240
|
+
<DialogFooter>
|
|
241
|
+
{phase === 'idle' && (
|
|
242
|
+
<>
|
|
243
|
+
<Button type="button" variant="outline" size="sm" onClick={() => close(false)}>
|
|
244
|
+
{t.common.cancel}
|
|
245
|
+
</Button>
|
|
246
|
+
<Button type="button" size="sm" onClick={() => void start()}>
|
|
247
|
+
<Share2 className="size-3.5" aria-hidden />
|
|
248
|
+
{lr.share.generate}
|
|
249
|
+
</Button>
|
|
250
|
+
</>
|
|
251
|
+
)}
|
|
252
|
+
{phase === 'working' && (
|
|
253
|
+
<Button type="button" variant="outline" size="sm" onClick={cancel}>
|
|
254
|
+
{t.common.cancel}
|
|
255
|
+
</Button>
|
|
256
|
+
)}
|
|
257
|
+
{phase === 'done' && (
|
|
258
|
+
<>
|
|
259
|
+
<Button
|
|
260
|
+
type="button"
|
|
261
|
+
variant="outline"
|
|
262
|
+
size="sm"
|
|
263
|
+
onClick={() => result && void revealShared(result.path)}
|
|
264
|
+
>
|
|
265
|
+
{lr.share.reveal}
|
|
266
|
+
</Button>
|
|
267
|
+
<Button type="button" size="sm" onClick={() => close(false)}>
|
|
268
|
+
{lr.share.finish}
|
|
269
|
+
</Button>
|
|
270
|
+
</>
|
|
271
|
+
)}
|
|
272
|
+
{phase === 'failed' && (
|
|
273
|
+
<>
|
|
274
|
+
<Button type="button" variant="outline" size="sm" onClick={() => close(false)}>
|
|
275
|
+
{t.common.cancel}
|
|
276
|
+
</Button>
|
|
277
|
+
<Button type="button" size="sm" onClick={() => void start()}>
|
|
278
|
+
{lr.share.generate}
|
|
279
|
+
</Button>
|
|
280
|
+
</>
|
|
281
|
+
)}
|
|
282
|
+
</DialogFooter>
|
|
283
|
+
</DialogContent>
|
|
284
|
+
</Dialog>
|
|
285
|
+
);
|
|
286
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { format } from '../../../locale/format';
|
|
2
|
+
import type { LrText } from '../text/types';
|
|
3
|
+
import type { DeckChanges } from './compare';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* The one-line answer to "what changed", joined the way the language joins
|
|
7
|
+
* clauses: Chinese commas, English middots.
|
|
8
|
+
*/
|
|
9
|
+
export function changeSummary(
|
|
10
|
+
changes: DeckChanges,
|
|
11
|
+
text: LrText['share'],
|
|
12
|
+
listSeparator: string,
|
|
13
|
+
clauseSeparator: string,
|
|
14
|
+
): string {
|
|
15
|
+
if (!changes.readable) return text.compareUnreadable;
|
|
16
|
+
const clauses: string[] = [];
|
|
17
|
+
const changedPages = changes.pages
|
|
18
|
+
.filter((page) => page.status === 'changed' && !page.notesOnly)
|
|
19
|
+
.map((page) => page.n);
|
|
20
|
+
const notesOnlyPages = changes.pages.filter((page) => page.notesOnly).map((page) => page.n);
|
|
21
|
+
const added = changes.pages.filter((page) => page.status === 'added').length;
|
|
22
|
+
const removed = changes.pages.filter((page) => page.status === 'removed').length;
|
|
23
|
+
const moved = changes.pages.some((page) => page.status === 'moved');
|
|
24
|
+
|
|
25
|
+
if (changedPages.length > 0) {
|
|
26
|
+
clauses.push(format(text.compareChanged, { pages: changedPages.join(listSeparator) }));
|
|
27
|
+
}
|
|
28
|
+
if (added > 0) clauses.push(format(text.compareAdded, { n: added }));
|
|
29
|
+
if (removed > 0) clauses.push(format(text.compareRemoved, { n: removed }));
|
|
30
|
+
if (moved) clauses.push(text.compareMoved);
|
|
31
|
+
if (notesOnlyPages.length > 0) {
|
|
32
|
+
clauses.push(format(text.compareNotesOnly, { pages: notesOnlyPages.join(listSeparator) }));
|
|
33
|
+
}
|
|
34
|
+
if (changes.shared) clauses.push(text.compareShared);
|
|
35
|
+
const { added: assetsAdded, changed: assetsChanged, removed: assetsRemoved } = changes.assets;
|
|
36
|
+
if (assetsAdded.length + assetsChanged.length + assetsRemoved.length > 0) {
|
|
37
|
+
clauses.push(
|
|
38
|
+
format(text.compareAssets, {
|
|
39
|
+
added: assetsAdded.length,
|
|
40
|
+
changed: assetsChanged.length,
|
|
41
|
+
removed: assetsRemoved.length,
|
|
42
|
+
}),
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
return clauses.length > 0 ? clauses.join(clauseSeparator) : text.compareSame;
|
|
47
|
+
}
|
|
@@ -1,14 +1,16 @@
|
|
|
1
|
-
import { Workflow } from 'lucide-react';
|
|
2
|
-
import { useEffect } from 'react';
|
|
1
|
+
import { Share2, Workflow } from 'lucide-react';
|
|
2
|
+
import { useEffect, useState } from 'react';
|
|
3
3
|
import { createPortal } from 'react-dom';
|
|
4
4
|
import { useNavigate } from 'react-router-dom';
|
|
5
5
|
import { Tooltip, TooltipContent, TooltipTrigger } from '@/components/ui/tooltip';
|
|
6
6
|
import { hasModifier, isTypingTarget } from '@/lib/keys';
|
|
7
7
|
import { cn } from '@/lib/utils';
|
|
8
|
+
import { loadSlide } from '../lib/slides';
|
|
8
9
|
import { useSlot } from './chrome/use-slot';
|
|
9
10
|
import { isFeatureEnabled } from './features';
|
|
10
11
|
import { useNewDeckBrief } from './home/brief';
|
|
11
12
|
import { PendingPages } from './outline/pending-pages';
|
|
13
|
+
import { ShareDialog } from './share/share-dialog';
|
|
12
14
|
import { useLrText } from './text';
|
|
13
15
|
|
|
14
16
|
type Props = {
|
|
@@ -30,10 +32,25 @@ function isInsideOverlay(target: EventTarget | null): boolean {
|
|
|
30
32
|
|
|
31
33
|
export function SlideExtensions({ slideId, overviewOpen }: Props) {
|
|
32
34
|
const enabled = isFeatureEnabled('board');
|
|
35
|
+
const shareOn = isFeatureEnabled('share');
|
|
33
36
|
const navigate = useNavigate();
|
|
34
37
|
const slot = useSlot('data-lr-rail-actions', enabled);
|
|
35
38
|
useNewDeckBrief(slideId);
|
|
36
39
|
const lr = useLrText();
|
|
40
|
+
const [sharing, setSharing] = useState(false);
|
|
41
|
+
const [title, setTitle] = useState(slideId);
|
|
42
|
+
|
|
43
|
+
useEffect(() => {
|
|
44
|
+
let cancelled = false;
|
|
45
|
+
loadSlide(slideId)
|
|
46
|
+
.then((slide) => {
|
|
47
|
+
if (!cancelled && slide.meta?.title) setTitle(slide.meta.title);
|
|
48
|
+
})
|
|
49
|
+
.catch(() => {});
|
|
50
|
+
return () => {
|
|
51
|
+
cancelled = true;
|
|
52
|
+
};
|
|
53
|
+
}, [slideId]);
|
|
37
54
|
|
|
38
55
|
useEffect(() => {
|
|
39
56
|
if (!enabled) return;
|
|
@@ -63,29 +80,58 @@ export function SlideExtensions({ slideId, overviewOpen }: Props) {
|
|
|
63
80
|
<>
|
|
64
81
|
{slot &&
|
|
65
82
|
createPortal(
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
<
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
83
|
+
<>
|
|
84
|
+
{shareOn && (
|
|
85
|
+
<Tooltip>
|
|
86
|
+
<TooltipTrigger
|
|
87
|
+
render={
|
|
88
|
+
<button
|
|
89
|
+
type="button"
|
|
90
|
+
onClick={() => setSharing(true)}
|
|
91
|
+
aria-label={lr.share.open}
|
|
92
|
+
data-lr-share-open
|
|
93
|
+
className={cn(
|
|
94
|
+
'flex size-5 items-center justify-center rounded-[3px] text-muted-foreground/70 outline-none',
|
|
95
|
+
'motion-safe:transition-colors hover:bg-muted hover:text-foreground',
|
|
96
|
+
'focus-visible:ring-1 focus-visible:ring-brand',
|
|
97
|
+
)}
|
|
98
|
+
>
|
|
99
|
+
<Share2 className="size-3.5" strokeWidth={1.75} />
|
|
100
|
+
</button>
|
|
101
|
+
}
|
|
102
|
+
/>
|
|
103
|
+
<TooltipContent side="bottom" sideOffset={6}>
|
|
104
|
+
{lr.share.open}
|
|
105
|
+
</TooltipContent>
|
|
106
|
+
</Tooltip>
|
|
107
|
+
)}
|
|
108
|
+
<Tooltip>
|
|
109
|
+
<TooltipTrigger
|
|
110
|
+
render={
|
|
111
|
+
<button
|
|
112
|
+
type="button"
|
|
113
|
+
onClick={() => navigate(`/s/${encodeURIComponent(slideId)}/board`)}
|
|
114
|
+
aria-label={lr.board.openBoard}
|
|
115
|
+
className={cn(
|
|
116
|
+
'flex size-5 items-center justify-center rounded-[3px] text-muted-foreground/70 outline-none',
|
|
117
|
+
'motion-safe:transition-colors hover:bg-muted hover:text-foreground',
|
|
118
|
+
'focus-visible:ring-1 focus-visible:ring-brand',
|
|
119
|
+
)}
|
|
120
|
+
>
|
|
121
|
+
<Workflow className="size-3.5" strokeWidth={1.75} />
|
|
122
|
+
</button>
|
|
123
|
+
}
|
|
124
|
+
/>
|
|
125
|
+
<TooltipContent side="bottom" sideOffset={6}>
|
|
126
|
+
{lr.board.openBoard}
|
|
127
|
+
</TooltipContent>
|
|
128
|
+
</Tooltip>
|
|
129
|
+
</>,
|
|
87
130
|
slot,
|
|
88
131
|
)}
|
|
132
|
+
{shareOn && (
|
|
133
|
+
<ShareDialog open={sharing} slideId={slideId} title={title} onOpenChange={setSharing} />
|
|
134
|
+
)}
|
|
89
135
|
<PendingPages slideId={slideId} />
|
|
90
136
|
</>
|
|
91
137
|
);
|
|
@@ -210,7 +210,10 @@ function TemplateDialog({
|
|
|
210
210
|
|
|
211
211
|
return (
|
|
212
212
|
<Dialog open onOpenChange={(next) => !next && onClose()}>
|
|
213
|
-
<DialogContent
|
|
213
|
+
<DialogContent
|
|
214
|
+
className="sm:max-w-[960px]"
|
|
215
|
+
style={{ maxHeight: '92dvh', gridTemplateRows: 'auto minmax(0, 1fr) auto' }}
|
|
216
|
+
>
|
|
214
217
|
<DialogHeader>
|
|
215
218
|
<DialogTitle>{template.name}</DialogTitle>
|
|
216
219
|
<DialogDescription>
|
|
@@ -218,7 +221,7 @@ function TemplateDialog({
|
|
|
218
221
|
</DialogDescription>
|
|
219
222
|
</DialogHeader>
|
|
220
223
|
|
|
221
|
-
<div className="grid gap-5 md:grid-cols-[minmax(0,3fr)_minmax(0,2fr)]">
|
|
224
|
+
<div className="grid min-h-0 gap-5 overflow-y-auto md:grid-cols-[minmax(0,3fr)_minmax(0,2fr)]">
|
|
222
225
|
<div className="min-w-0">
|
|
223
226
|
<div
|
|
224
227
|
data-lr-preview-main={indexes[active] + 1}
|
|
@@ -480,4 +480,71 @@ export const en: LrText = {
|
|
|
480
480
|
followClient: 'client settings',
|
|
481
481
|
followClientHint: 'Uses the model and effort set in {provider}.',
|
|
482
482
|
},
|
|
483
|
+
share: {
|
|
484
|
+
open: 'Share',
|
|
485
|
+
menuItem: 'Share',
|
|
486
|
+
dialogTitle: 'Share “{title}”',
|
|
487
|
+
dialogDescription:
|
|
488
|
+
'Pack it into one zip and send it over WeChat, email or a cloud drive. They can still read the PDF without LemonRiver.',
|
|
489
|
+
attachPdf: 'Attach a PDF so anyone can read it',
|
|
490
|
+
estimate: 'About {n} pages, takes {s} seconds',
|
|
491
|
+
generate: 'Create package',
|
|
492
|
+
capturing: 'Drawing page {k} of {n}',
|
|
493
|
+
preparing: 'Packing…',
|
|
494
|
+
done: 'Package ready: {name} ({size} MB)',
|
|
495
|
+
reveal: 'Show in Finder',
|
|
496
|
+
finish: 'Done',
|
|
497
|
+
warnings: 'Notes',
|
|
498
|
+
failed: 'Could not create the package',
|
|
499
|
+
moreFiles: 'and {n} more',
|
|
500
|
+
importTitle: 'Import package',
|
|
501
|
+
importAction: 'Import',
|
|
502
|
+
dropHint: 'Drop to import',
|
|
503
|
+
notAPackage: 'This is not a LemonRiver package',
|
|
504
|
+
madeWith: 'Made with LemonRiver {version}',
|
|
505
|
+
keepBoth: 'Keep both',
|
|
506
|
+
replaceExisting: 'Replace “{title}” on my computer (the old one goes to the trash)',
|
|
507
|
+
securityNotice:
|
|
508
|
+
'A deck is program code that runs on your computer once imported. Only import packages from people you trust.',
|
|
509
|
+
importedToast: 'Imported “{title}”',
|
|
510
|
+
openAction: 'Open',
|
|
511
|
+
pageCount: '{n} pages',
|
|
512
|
+
pageOf: 'Page {n}',
|
|
513
|
+
earlier: 'Previous',
|
|
514
|
+
later: 'Next',
|
|
515
|
+
compareTitle: 'Compared with your copy',
|
|
516
|
+
compareSame: 'Same as your copy — nothing to import.',
|
|
517
|
+
compareUnreadable:
|
|
518
|
+
'This deck cannot be compared page by page; only the overall change is visible.',
|
|
519
|
+
compareChanged: 'Pages changed: {pages}',
|
|
520
|
+
compareAdded: 'Pages added: {n}',
|
|
521
|
+
compareRemoved: 'Pages removed: {n}',
|
|
522
|
+
compareMoved: 'Page order changed',
|
|
523
|
+
compareNotesOnly: 'Speaker notes only: page {pages}',
|
|
524
|
+
compareShared: 'Shared parts (styles, template pieces) changed too, so every page may differ',
|
|
525
|
+
compareAssets: 'Assets: {added} added, {changed} changed, {removed} removed',
|
|
526
|
+
compareExpand: 'Show pages',
|
|
527
|
+
compareCollapse: 'Hide pages',
|
|
528
|
+
statusSame: 'same',
|
|
529
|
+
statusChanged: 'changed',
|
|
530
|
+
statusAdded: 'added',
|
|
531
|
+
statusRemoved: 'removed',
|
|
532
|
+
statusMoved: 'moved',
|
|
533
|
+
unknownVersion: 'unknown version',
|
|
534
|
+
errors: {
|
|
535
|
+
notAPackage: 'This is not a LemonRiver package, or the package is damaged.',
|
|
536
|
+
badManifest: 'This is not a LemonRiver package, or the package is damaged.',
|
|
537
|
+
newerVersion:
|
|
538
|
+
'This package was made by a newer LemonRiver ({version}). Update first, then import.',
|
|
539
|
+
badPath: 'The package contains files it should not, so nothing was imported.',
|
|
540
|
+
blockedFile: 'The package contains files it should not, so nothing was imported.',
|
|
541
|
+
checksum:
|
|
542
|
+
'Files in the package were changed or are missing. Ask the sender to share it again.',
|
|
543
|
+
missingFile:
|
|
544
|
+
'Files in the package were changed or are missing. Ask the sender to share it again.',
|
|
545
|
+
extraFile: 'The package contains files it should not, so nothing was imported.',
|
|
546
|
+
tooLarge: 'The package is too large and was not imported.',
|
|
547
|
+
tooManyFiles: 'The package is too large and was not imported.',
|
|
548
|
+
},
|
|
549
|
+
},
|
|
483
550
|
};
|
|
@@ -473,4 +473,71 @@ export const es: LrText = {
|
|
|
473
473
|
followClient: 'ajustes del cliente',
|
|
474
474
|
followClientHint: 'Usa el modelo y el esfuerzo configurados en {provider}.',
|
|
475
475
|
},
|
|
476
|
+
share: {
|
|
477
|
+
open: 'Share',
|
|
478
|
+
menuItem: 'Share',
|
|
479
|
+
dialogTitle: 'Share “{title}”',
|
|
480
|
+
dialogDescription:
|
|
481
|
+
'Pack it into one zip and send it over WeChat, email or a cloud drive. They can still read the PDF without LemonRiver.',
|
|
482
|
+
attachPdf: 'Attach a PDF so anyone can read it',
|
|
483
|
+
estimate: 'About {n} pages, takes {s} seconds',
|
|
484
|
+
generate: 'Create package',
|
|
485
|
+
capturing: 'Drawing page {k} of {n}',
|
|
486
|
+
preparing: 'Packing…',
|
|
487
|
+
done: 'Package ready: {name} ({size} MB)',
|
|
488
|
+
reveal: 'Show in Finder',
|
|
489
|
+
finish: 'Done',
|
|
490
|
+
warnings: 'Notes',
|
|
491
|
+
failed: 'Could not create the package',
|
|
492
|
+
moreFiles: 'and {n} more',
|
|
493
|
+
importTitle: 'Import package',
|
|
494
|
+
importAction: 'Import',
|
|
495
|
+
dropHint: 'Drop to import',
|
|
496
|
+
notAPackage: 'This is not a LemonRiver package',
|
|
497
|
+
madeWith: 'Made with LemonRiver {version}',
|
|
498
|
+
keepBoth: 'Keep both',
|
|
499
|
+
replaceExisting: 'Replace “{title}” on my computer (the old one goes to the trash)',
|
|
500
|
+
securityNotice:
|
|
501
|
+
'A deck is program code that runs on your computer once imported. Only import packages from people you trust.',
|
|
502
|
+
importedToast: 'Imported “{title}”',
|
|
503
|
+
openAction: 'Open',
|
|
504
|
+
pageCount: '{n} pages',
|
|
505
|
+
pageOf: 'Page {n}',
|
|
506
|
+
earlier: 'Previous',
|
|
507
|
+
later: 'Next',
|
|
508
|
+
compareTitle: 'Compared with your copy',
|
|
509
|
+
compareSame: 'Same as your copy — nothing to import.',
|
|
510
|
+
compareUnreadable:
|
|
511
|
+
'This deck cannot be compared page by page; only the overall change is visible.',
|
|
512
|
+
compareChanged: 'Pages changed: {pages}',
|
|
513
|
+
compareAdded: 'Pages added: {n}',
|
|
514
|
+
compareRemoved: 'Pages removed: {n}',
|
|
515
|
+
compareMoved: 'Page order changed',
|
|
516
|
+
compareNotesOnly: 'Speaker notes only: page {pages}',
|
|
517
|
+
compareShared: 'Shared parts (styles, template pieces) changed too, so every page may differ',
|
|
518
|
+
compareAssets: 'Assets: {added} added, {changed} changed, {removed} removed',
|
|
519
|
+
compareExpand: 'Show pages',
|
|
520
|
+
compareCollapse: 'Hide pages',
|
|
521
|
+
statusSame: 'same',
|
|
522
|
+
statusChanged: 'changed',
|
|
523
|
+
statusAdded: 'added',
|
|
524
|
+
statusRemoved: 'removed',
|
|
525
|
+
statusMoved: 'moved',
|
|
526
|
+
unknownVersion: 'unknown version',
|
|
527
|
+
errors: {
|
|
528
|
+
notAPackage: 'This is not a LemonRiver package, or the package is damaged.',
|
|
529
|
+
badManifest: 'This is not a LemonRiver package, or the package is damaged.',
|
|
530
|
+
newerVersion:
|
|
531
|
+
'This package was made by a newer LemonRiver ({version}). Update first, then import.',
|
|
532
|
+
badPath: 'The package contains files it should not, so nothing was imported.',
|
|
533
|
+
blockedFile: 'The package contains files it should not, so nothing was imported.',
|
|
534
|
+
checksum:
|
|
535
|
+
'Files in the package were changed or are missing. Ask the sender to share it again.',
|
|
536
|
+
missingFile:
|
|
537
|
+
'Files in the package were changed or are missing. Ask the sender to share it again.',
|
|
538
|
+
extraFile: 'The package contains files it should not, so nothing was imported.',
|
|
539
|
+
tooLarge: 'The package is too large and was not imported.',
|
|
540
|
+
tooManyFiles: 'The package is too large and was not imported.',
|
|
541
|
+
},
|
|
542
|
+
},
|
|
476
543
|
};
|