@hanzo/app 0.2.56 → 0.2.57
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/Board.js +121 -37
- package/dist/Boxes.js +16 -12
- package/dist/CalScheduler.js +81 -40
- package/dist/Chat.js +1 -2
- package/dist/Contents.d.ts +1 -1
- package/dist/Contents.js +1 -2
- package/dist/Drive.js +121 -100
- package/dist/Inbox.js +7 -7
- package/dist/Market.js +15 -10
- package/dist/Meet.js +78 -48
- package/dist/Orgs.js +9 -10
- package/dist/Palette.d.ts +1 -1
- package/dist/Palette.js +1 -2
- package/dist/Schedule.js +15 -11
- package/dist/Settings.d.ts +1 -1
- package/dist/SettingsPane.js +2 -2
- package/dist/Shared.js +16 -11
- package/dist/Talk.js +4 -4
- package/dist/Terminals.js +3 -1
- package/dist/Usage.js +3 -3
- package/dist/WindowControls.js +5 -3
- package/dist/Work.js +51 -28
- package/dist/bots/Bots.js +129 -73
- package/dist/bots/runtime.js +103 -41
- package/dist/cast.d.ts +1 -1
- package/dist/cast.js +1 -1
- package/dist/failure.d.ts +1 -1
- package/dist/failure.js +1 -1
- package/dist/lib/limits.d.ts +1 -1
- package/dist/lib/limits.js +1 -1
- package/dist/lib/org.d.ts +3 -3
- package/dist/lib/org.js +4 -5
- package/dist/lib/orgname.d.ts +1 -1
- package/dist/lib/orgname.js +1 -1
- package/dist/lib/pay.d.ts +6 -2
- package/dist/lib/pay.js +15 -2
- package/dist/lib/plans.d.ts +1 -1
- package/dist/lib/plans.js +1 -1
- package/dist/lib/tier.d.ts +2 -2
- package/dist/lib/tier.js +6 -6
- package/dist/look.js +10 -8
- package/dist/recent.d.ts +1 -1
- package/dist/recent.js +1 -2
- package/dist/thread.js +1 -1
- package/package.json +3 -3
- package/dist/say.d.ts +0 -4
- package/dist/say.js +0 -7
package/dist/Drive.js
CHANGED
|
@@ -4,6 +4,7 @@ import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react'
|
|
|
4
4
|
import { ArrowRight, ChevronDown, ChevronRight, Clock, Cloud, Download, File as FileIcon, FileArchive, FileAudio, FileCode, FileImage, FilePlus, FileText, FileVideo, Folder, FolderGit2, FolderInput, FolderPlus, HardDrive, Laptop, ListTree, MessageSquare, LayoutGrid, List, MoreHorizontal, PanelLeft, Plus, Search, Trash2, Upload, } from 'lucide-react';
|
|
5
5
|
import { Box, Button, Text, View, XStack, YStack } from '@hanzo/ui';
|
|
6
6
|
import { useIam, useOrganizations } from '@hanzo/iam/react';
|
|
7
|
+
import { useI18n } from '@hanzo/i18n/react';
|
|
7
8
|
import { useAi } from './lib/ai.js';
|
|
8
9
|
import { empty, useOpen } from './open.js';
|
|
9
10
|
import { attach, channel } from './pane.js';
|
|
@@ -16,14 +17,14 @@ import { weigh as size } from './lib/attach.js';
|
|
|
16
17
|
import { dropped, filesIn, forget, pool, register, search, settled, slug, upload, } from './lib/files.js';
|
|
17
18
|
import { checkoutUrl } from './lib/pay.js';
|
|
18
19
|
import { BAD, mix } from './lib/mix.js';
|
|
19
|
-
const blame = (e) => {
|
|
20
|
+
const blame = (e, t) => {
|
|
20
21
|
const text = e instanceof Error ? e.message : String(e ?? '');
|
|
21
|
-
return text || 'The store did not say what went wrong.';
|
|
22
|
+
return text || t('The store did not say what went wrong.');
|
|
22
23
|
};
|
|
23
24
|
/** A size as a row shows it; nothing is a dash. */
|
|
24
25
|
const weigh = (bytes) => (bytes ? size(bytes) : '—');
|
|
25
26
|
/** Format timestamp */
|
|
26
|
-
const when = (stamp) => {
|
|
27
|
+
const when = (stamp, locale) => {
|
|
27
28
|
if (!stamp)
|
|
28
29
|
return '';
|
|
29
30
|
const ms = stamp < 1e12 ? stamp * 1000 : stamp;
|
|
@@ -31,34 +32,34 @@ const when = (stamp) => {
|
|
|
31
32
|
const now = new Date();
|
|
32
33
|
const sameDay = d.toDateString() === now.toDateString();
|
|
33
34
|
if (sameDay)
|
|
34
|
-
return d.toLocaleTimeString(
|
|
35
|
+
return d.toLocaleTimeString(locale, { hour: 'numeric', minute: '2-digit' });
|
|
35
36
|
const sameYear = d.getFullYear() === now.getFullYear();
|
|
36
|
-
return d.toLocaleDateString(
|
|
37
|
+
return d.toLocaleDateString(locale, sameYear ? { month: 'short', day: 'numeric' } : { year: 'numeric', month: 'short', day: 'numeric' });
|
|
37
38
|
};
|
|
38
39
|
/** The store publishes a bucket's own display name; the slug is the fallback. */
|
|
39
|
-
const getBucketDisplayName = (b) => (typeof b === 'string' ? b : b?.displayName || b?.name) || 'Drive';
|
|
40
|
+
const getBucketDisplayName = (b, t) => (typeof b === 'string' ? b : b?.displayName || b?.name) || t('Drive');
|
|
40
41
|
const wire = (key) => key.split('/').map(encodeURIComponent).join('/');
|
|
41
42
|
const objects = (bucket) => `/v1/s3/buckets/${encodeURIComponent(bucket)}/objects`;
|
|
42
|
-
async function putBytes(client, bucket, key, body, type) {
|
|
43
|
+
async function putBytes(client, bucket, key, body, t, type) {
|
|
43
44
|
const grant = await client.http.json({
|
|
44
45
|
method: 'POST',
|
|
45
46
|
path: objects(bucket),
|
|
46
47
|
body: { bucket, key },
|
|
47
48
|
});
|
|
48
49
|
if (!grant?.url)
|
|
49
|
-
throw new Error('The store issued no upload address.');
|
|
50
|
+
throw new Error(t('The store issued no upload address.'));
|
|
50
51
|
const sent = await fetch(grant.url, {
|
|
51
52
|
method: grant.method || 'PUT',
|
|
52
53
|
body,
|
|
53
54
|
headers: type ? { 'Content-Type': type } : undefined,
|
|
54
55
|
});
|
|
55
56
|
if (!sent.ok)
|
|
56
|
-
throw new Error(
|
|
57
|
+
throw new Error(t('{name} did not upload ({status}).', { name: key.split('/').pop() || '', status: sent.status }));
|
|
57
58
|
}
|
|
58
|
-
async function urlFor(client, bucket, key) {
|
|
59
|
+
async function urlFor(client, bucket, key, t) {
|
|
59
60
|
const grant = await client.http.json({ path: `${objects(bucket)}/${wire(key)}` });
|
|
60
61
|
if (!grant?.url)
|
|
61
|
-
throw new Error('The store issued no download address.');
|
|
62
|
+
throw new Error(t('The store issued no download address.'));
|
|
62
63
|
return grant.url;
|
|
63
64
|
}
|
|
64
65
|
async function remove(client, bucket, key) {
|
|
@@ -95,7 +96,8 @@ const CHIP = { fontSize: '$1', color: '$soft', bg: '$hover', px: 8, py: 2, round
|
|
|
95
96
|
const CELL = { fontSize: '$2', color: '$soft' };
|
|
96
97
|
/** A row's "more" control. */
|
|
97
98
|
function More({ onPress }) {
|
|
98
|
-
|
|
99
|
+
const { t, locale } = useI18n();
|
|
100
|
+
return (_jsx(Button, { variant: "ghost", size: "icon-sm", onClick: onPress, "aria-label": t('More'), title: t('More'), children: _jsx(MoreHorizontal, { size: 15 }) }));
|
|
99
101
|
}
|
|
100
102
|
/** One line of a row's menu: a glyph and a word, the whole width. */
|
|
101
103
|
function Pick({ icon: Icon, label, tone, onPress, }) {
|
|
@@ -114,6 +116,7 @@ const NOTE = { display: 'block', px: 16, py: 24, fontSize: '$2', color: '$faint'
|
|
|
114
116
|
/** The drop target's veil: the page's own ground, nearly opaque. */
|
|
115
117
|
const VEIL = mix('var(--background)', 90, 'srgb');
|
|
116
118
|
export function Drive() {
|
|
119
|
+
const { t, locale } = useI18n();
|
|
117
120
|
const { client } = useAi();
|
|
118
121
|
const { user, isAuthenticated } = useIam();
|
|
119
122
|
const ready = Boolean(client && isAuthenticated);
|
|
@@ -164,8 +167,8 @@ export function Drive() {
|
|
|
164
167
|
: activeWs.path;
|
|
165
168
|
listLocalEntries(targetDir)
|
|
166
169
|
.then((items) => setLocalEntries(items))
|
|
167
|
-
.catch((e) => setFailed(blame(e)));
|
|
168
|
-
}, [activeWs, localPrefix]);
|
|
170
|
+
.catch((e) => setFailed(blame(e, t)));
|
|
171
|
+
}, [activeWs, localPrefix, t]);
|
|
169
172
|
useEffect(() => {
|
|
170
173
|
if (navSection === 'local') {
|
|
171
174
|
loadLocalEntries();
|
|
@@ -209,11 +212,11 @@ export function Drive() {
|
|
|
209
212
|
client.http
|
|
210
213
|
.json({ path: '/v1/s3/buckets' })
|
|
211
214
|
.then((out) => live && setBuckets(out?.buckets ?? []))
|
|
212
|
-
.catch((e) => live && setFailed(blame(e)));
|
|
215
|
+
.catch((e) => live && setFailed(blame(e, t)));
|
|
213
216
|
return () => {
|
|
214
217
|
live = false;
|
|
215
218
|
};
|
|
216
|
-
}, [ready, client, reload]);
|
|
219
|
+
}, [ready, client, reload, t]);
|
|
217
220
|
// THE DRIVE IS A BUCKET THE ORG OWNS. It used to fall back to the literal
|
|
218
221
|
// "my-drive", which is a nav label rather than a name the store answers to —
|
|
219
222
|
// so every read 404'd and every write went nowhere.
|
|
@@ -281,8 +284,8 @@ export function Drive() {
|
|
|
281
284
|
void client.http
|
|
282
285
|
.json({ path: `/v1/knowledge/files/${encodeURIComponent(id)}` })
|
|
283
286
|
.then((f) => setContents({ file: f, at }))
|
|
284
|
-
.catch((e) => setFailed(blame(e)));
|
|
285
|
-
}, [index, client]);
|
|
287
|
+
.catch((e) => setFailed(blame(e, t)));
|
|
288
|
+
}, [index, client, t]);
|
|
286
289
|
/** ASK IN CHAT: a new conversation with the file put into it, by reference. */
|
|
287
290
|
const askInChat = useCallback((f) => {
|
|
288
291
|
if (!client)
|
|
@@ -303,11 +306,11 @@ export function Drive() {
|
|
|
303
306
|
client.http
|
|
304
307
|
.collection('objects', { path: objects(activeBucket), query: { prefix } })
|
|
305
308
|
.then((found) => live && setEntries(found))
|
|
306
|
-
.catch((e) => live && setFailed(blame(e)));
|
|
309
|
+
.catch((e) => live && setFailed(blame(e, t)));
|
|
307
310
|
return () => {
|
|
308
311
|
live = false;
|
|
309
312
|
};
|
|
310
|
-
}, [ready, client, activeBucket, prefix]);
|
|
313
|
+
}, [ready, client, activeBucket, prefix, t]);
|
|
311
314
|
useEffect(() => {
|
|
312
315
|
loadEntries();
|
|
313
316
|
}, [loadEntries, reload]);
|
|
@@ -348,12 +351,12 @@ export function Drive() {
|
|
|
348
351
|
setReload((n) => n + 1);
|
|
349
352
|
}
|
|
350
353
|
catch (e) {
|
|
351
|
-
setFailed(blame(e));
|
|
354
|
+
setFailed(blame(e, t));
|
|
352
355
|
}
|
|
353
356
|
finally {
|
|
354
357
|
setBusy(null);
|
|
355
358
|
}
|
|
356
|
-
}, [client, activeBucket, busy]);
|
|
359
|
+
}, [client, activeBucket, busy, t]);
|
|
357
360
|
// UPLOAD skips the platform: the bytes go straight to the store through
|
|
358
361
|
// presigned PUTs — one for a small file, one per 16 MB part for a large one,
|
|
359
362
|
// resumed from the parts the store holds when a connection drops — several
|
|
@@ -365,10 +368,18 @@ export function Drive() {
|
|
|
365
368
|
const list = Array.from(files);
|
|
366
369
|
if (!list.length || !client || !activeBucket)
|
|
367
370
|
return;
|
|
368
|
-
|
|
371
|
+
const count = list.length.toLocaleString(locale);
|
|
372
|
+
const uploading = (percent) => list.length === 1
|
|
373
|
+
? percent === undefined
|
|
374
|
+
? t('Uploading {name}', { name: list[0].name })
|
|
375
|
+
: t('Uploading {name} — {percent}%', { name: list[0].name, percent })
|
|
376
|
+
: percent === undefined
|
|
377
|
+
? t('Uploading {count} files', { count })
|
|
378
|
+
: t('Uploading {count} files — {percent}%', { count, percent });
|
|
379
|
+
void run(uploading(), async (say) => {
|
|
369
380
|
const sent = new Map();
|
|
370
381
|
const total = list.reduce((n, f) => n + f.size, 0) || 1;
|
|
371
|
-
const tell = () => say(
|
|
382
|
+
const tell = () => say(uploading(Math.floor(([...sent.values()].reduce((a, b) => a + b, 0) / total) * 100).toLocaleString(locale)));
|
|
372
383
|
await pool(list, 3, async (file) => {
|
|
373
384
|
const f = file;
|
|
374
385
|
const key = `${prefix}${f.relative || f.webkitRelativePath || file.name}`;
|
|
@@ -379,7 +390,7 @@ export function Drive() {
|
|
|
379
390
|
await register(client, activeBucket, key);
|
|
380
391
|
});
|
|
381
392
|
});
|
|
382
|
-
}, [client, activeBucket, prefix, run]);
|
|
393
|
+
}, [client, activeBucket, prefix, run, t, locale]);
|
|
383
394
|
const handleCreateFolder = useCallback((folderName) => {
|
|
384
395
|
const clean = folderName.trim().replace(/^\/+|\/+$/g, '');
|
|
385
396
|
if (!clean)
|
|
@@ -395,14 +406,14 @@ export function Drive() {
|
|
|
395
406
|
setNaming(null);
|
|
396
407
|
loadLocalEntries();
|
|
397
408
|
})
|
|
398
|
-
.catch((e) => setFailed(blame(e)));
|
|
409
|
+
.catch((e) => setFailed(blame(e, t)));
|
|
399
410
|
return;
|
|
400
411
|
}
|
|
401
412
|
if (!client || !activeBucket)
|
|
402
413
|
return;
|
|
403
|
-
void run(
|
|
414
|
+
void run(t('Creating {name}', { name: clean }), () => putBytes(client, activeBucket, `${prefix}${clean}/`, new Blob([]), t));
|
|
404
415
|
setNaming(null);
|
|
405
|
-
}, [client, activeBucket, prefix, run, navSection, activeWs, localPrefix, loadLocalEntries]);
|
|
416
|
+
}, [client, activeBucket, prefix, run, navSection, activeWs, localPrefix, loadLocalEntries, t]);
|
|
406
417
|
const handleCreateFile = useCallback((fileName) => {
|
|
407
418
|
const clean = fileName.trim().replace(/^\/+|\/+$/g, '');
|
|
408
419
|
if (!clean)
|
|
@@ -419,39 +430,39 @@ export function Drive() {
|
|
|
419
430
|
loadLocalEntries();
|
|
420
431
|
setEditingFile({ path: filePath, name: clean });
|
|
421
432
|
})
|
|
422
|
-
.catch((e) => setFailed(blame(e)));
|
|
433
|
+
.catch((e) => setFailed(blame(e, t)));
|
|
423
434
|
return;
|
|
424
435
|
}
|
|
425
436
|
if (!client || !activeBucket)
|
|
426
437
|
return;
|
|
427
|
-
void run(
|
|
438
|
+
void run(t('Creating {name}', { name: clean }), () => putBytes(client, activeBucket, `${prefix}${clean}`, new Blob(['']), t));
|
|
428
439
|
setNaming(null);
|
|
429
|
-
}, [client, activeBucket, prefix, run, navSection, activeWs, localPrefix, loadLocalEntries]);
|
|
440
|
+
}, [client, activeBucket, prefix, run, navSection, activeWs, localPrefix, loadLocalEntries, t]);
|
|
430
441
|
const handleCloneRepo = useCallback((repoUrl) => {
|
|
431
442
|
const clean = repoUrl.trim();
|
|
432
443
|
if (!clean)
|
|
433
444
|
return;
|
|
434
445
|
setNaming(null);
|
|
435
|
-
void run(
|
|
446
|
+
void run(t('Cloning {name}', { name: clean }), async () => {
|
|
436
447
|
const ws = await cloneRemoteRepo(clean);
|
|
437
448
|
setNavSection('local');
|
|
438
449
|
setActiveWorkspace(ws);
|
|
439
450
|
setLocalPrefix('');
|
|
440
451
|
loadLocalEntries();
|
|
441
452
|
});
|
|
442
|
-
}, [run, loadLocalEntries]);
|
|
453
|
+
}, [run, loadLocalEntries, t]);
|
|
443
454
|
const handleOpenLocalFile = useCallback(async () => {
|
|
444
455
|
try {
|
|
445
456
|
const selected = await pickLocalFile();
|
|
446
457
|
if (selected) {
|
|
447
|
-
const fileName = selected.split(/[/\\]/).pop() || 'file';
|
|
458
|
+
const fileName = selected.split(/[/\\]/).pop() || t('file');
|
|
448
459
|
setEditingFile({ path: selected, name: fileName });
|
|
449
460
|
}
|
|
450
461
|
}
|
|
451
462
|
catch (e) {
|
|
452
|
-
setFailed(blame(e));
|
|
463
|
+
setFailed(blame(e, t));
|
|
453
464
|
}
|
|
454
|
-
}, []);
|
|
465
|
+
}, [t]);
|
|
455
466
|
const handleImportLocalFile = useCallback(async () => {
|
|
456
467
|
if (!activeWs)
|
|
457
468
|
return;
|
|
@@ -466,25 +477,25 @@ export function Drive() {
|
|
|
466
477
|
}
|
|
467
478
|
}
|
|
468
479
|
catch (e) {
|
|
469
|
-
setFailed(blame(e));
|
|
480
|
+
setFailed(blame(e, t));
|
|
470
481
|
}
|
|
471
|
-
}, [activeWs, localPrefix, loadLocalEntries]);
|
|
482
|
+
}, [activeWs, localPrefix, loadLocalEntries, t]);
|
|
472
483
|
const handleRename = useCallback((entry, to) => {
|
|
473
484
|
const clean = to.trim().replace(/^\/+|\/+$/g, '');
|
|
474
485
|
if (!clean || !client || !activeBucket || entry.isDir)
|
|
475
486
|
return;
|
|
476
487
|
const from = `${prefix}${entry.key}`;
|
|
477
488
|
// The store has no copy, so a rename is the three verbs it does have.
|
|
478
|
-
void run(
|
|
479
|
-
const src = await fetch(await urlFor(client, activeBucket, from));
|
|
489
|
+
void run(t('Renaming {name}', { name: entry.key }), async () => {
|
|
490
|
+
const src = await fetch(await urlFor(client, activeBucket, from, t));
|
|
480
491
|
if (!src.ok)
|
|
481
|
-
throw new Error(
|
|
492
|
+
throw new Error(t('{name} could not be read ({status}).', { name: entry.key, status: src.status }));
|
|
482
493
|
const body = await src.blob();
|
|
483
|
-
await putBytes(client, activeBucket, `${prefix}${clean}`, body, body.type || undefined);
|
|
494
|
+
await putBytes(client, activeBucket, `${prefix}${clean}`, body, t, body.type || undefined);
|
|
484
495
|
await remove(client, activeBucket, from);
|
|
485
496
|
});
|
|
486
497
|
setNaming(null);
|
|
487
|
-
}, [client, activeBucket, prefix, run]);
|
|
498
|
+
}, [client, activeBucket, prefix, run, t]);
|
|
488
499
|
const handleDelete = useCallback((entry) => {
|
|
489
500
|
if (!client || !activeBucket)
|
|
490
501
|
return;
|
|
@@ -495,7 +506,7 @@ export function Drive() {
|
|
|
495
506
|
if (f)
|
|
496
507
|
await forget(client, f.id).catch(() => { });
|
|
497
508
|
};
|
|
498
|
-
void run(
|
|
509
|
+
void run(t('Deleting {name}', { name: entry.key }), async (say) => {
|
|
499
510
|
if (!entry.isDir) {
|
|
500
511
|
await remove(client, activeBucket, key);
|
|
501
512
|
return unindex(key);
|
|
@@ -503,21 +514,21 @@ export function Drive() {
|
|
|
503
514
|
const root = key.endsWith('/') ? key : `${key}/`;
|
|
504
515
|
const out = await client.http.json({ path: objects(activeBucket), query: { prefix: root, recursive: 'true' } });
|
|
505
516
|
for (const e of (out?.objects ?? []).filter((x) => !x.isDir)) {
|
|
506
|
-
say(
|
|
517
|
+
say(t('Deleting {name}', { name: e.key }));
|
|
507
518
|
await remove(client, activeBucket, root + e.key);
|
|
508
519
|
await unindex(root + e.key);
|
|
509
520
|
}
|
|
510
521
|
await remove(client, activeBucket, root).catch(() => { });
|
|
511
522
|
});
|
|
512
|
-
}, [client, activeBucket, prefix, run, index]);
|
|
523
|
+
}, [client, activeBucket, prefix, run, index, t]);
|
|
513
524
|
// DOWNLOAD follows a presigned GET. The object's platform address answers a
|
|
514
525
|
// signed URL, not the bytes, and it needs the caller's token — which an
|
|
515
526
|
// anchor href does not carry.
|
|
516
527
|
const handleDownload = useCallback((entry) => {
|
|
517
528
|
if (!client || !activeBucket || entry.isDir)
|
|
518
529
|
return;
|
|
519
|
-
void run(
|
|
520
|
-
const url = await urlFor(client, activeBucket, `${prefix}${entry.key}
|
|
530
|
+
void run(t('Fetching {name}', { name: entry.key }), async () => {
|
|
531
|
+
const url = await urlFor(client, activeBucket, `${prefix}${entry.key}`, t);
|
|
521
532
|
const a = document.createElement('a');
|
|
522
533
|
a.href = url;
|
|
523
534
|
a.download = entry.key.split('/').pop() || 'download';
|
|
@@ -527,14 +538,14 @@ export function Drive() {
|
|
|
527
538
|
a.click();
|
|
528
539
|
document.body.removeChild(a);
|
|
529
540
|
});
|
|
530
|
-
}, [client, activeBucket, prefix, run]);
|
|
541
|
+
}, [client, activeBucket, prefix, run, t]);
|
|
531
542
|
const allProjects = useMemo(() => (projects ?? []).map((p) => ({
|
|
532
543
|
id: p.id || p.slug || p.name,
|
|
533
544
|
name: p.name || p.slug || p.id,
|
|
534
|
-
type: p.framework || 'Project',
|
|
535
|
-
updated: when(p.updatedAt || p.createdAt || 0),
|
|
545
|
+
type: p.framework || t('Project'),
|
|
546
|
+
updated: when(p.updatedAt || p.createdAt || 0, locale),
|
|
536
547
|
size: '—',
|
|
537
|
-
})), [projects]);
|
|
548
|
+
})), [projects, t, locale]);
|
|
538
549
|
const filteredProjects = useMemo(() => {
|
|
539
550
|
if (!searchQuery.trim())
|
|
540
551
|
return allProjects;
|
|
@@ -592,7 +603,7 @@ export function Drive() {
|
|
|
592
603
|
webkitdirectory: "true", directory: "true", multiple: true, hidden: true, onChange: (e) => {
|
|
593
604
|
handleUpload(e.target.files);
|
|
594
605
|
e.currentTarget.value = '';
|
|
595
|
-
} }), _jsxs(XStack, { height: 56, items: "center", justify: "space-between", px: "$5", borderBottomWidth: 1, borderColor: "$borderColor", shrink: 0, children: [_jsx(XStack, { width: 220, shrink: 1, children: _jsx(View, { display: "none", "$max-md": { display: 'flex' }, children: _jsx(Button, { variant: "ghost", size: "icon-sm", onClick: () => setMenu((v) => !v), "aria-label":
|
|
606
|
+
} }), _jsxs(XStack, { height: 56, items: "center", justify: "space-between", px: "$5", borderBottomWidth: 1, borderColor: "$borderColor", shrink: 0, children: [_jsx(XStack, { width: 220, shrink: 1, children: _jsx(View, { display: "none", "$max-md": { display: 'flex' }, children: _jsx(Button, { variant: "ghost", size: "icon-sm", onClick: () => setMenu((v) => !v), "aria-label": t('Drive menu'), "aria-expanded": menu, "aria-controls": "drive-menu", title: t('Drive menu'), children: _jsx(PanelLeft, { size: 16 }) }) }) }), _jsxs(XStack, { items: "center", gap: "$2", width: 460, maxW: "45%", height: 38, px: "$3", rounded: 8, bg: "$panel", borderWidth: 1, borderColor: "var(--border-control)", children: [_jsx(Search, { size: 15, color: "var(--muted-foreground)", "aria-hidden": true }), _jsx(Text, { render: _jsx("input", { value: searchQuery, onChange: (e) => setSearchQuery(e.target.value), placeholder: t('Search Drive'), "aria-label": t('Search Drive') }), ...BARE })] }), _jsxs(XStack, { items: "center", gap: "$3", children: [_jsx(Button, { size: "icon-sm", onClick: () => fileInputRef.current?.click(), "aria-label": t('Upload'), title: t('Upload'), children: _jsx(Upload, { size: 15 }) }), _jsx(Button, { size: "icon-sm", onClick: () => setNaming({ kind: 'folder', value: '' }), "aria-label": t('Add Folder'), title: t('Add Folder'), children: _jsx(Plus, { size: 16 }) }), _jsx(Text, { ...tip(userEmail), width: 32, height: 32, rounded: 9999, bg: "$raised", borderWidth: 1, borderColor: "$borderColor", display: "flex", items: "center", justify: "center", fontSize: "$2", fontWeight: "600", color: "$ink", children: userInitials })] })] }), _jsxs(XStack, { flex: 1, minH: 0, overflow: "hidden", position: "relative", children: [_jsx(View, { display: "none", "$max-md": { display: menu ? 'flex' : 'none' }, position: "absolute", t: 0, r: 0, b: 0, l: 0, z: "var(--z-scrim)", bg: "var(--surface-scrim)", onPress: () => setMenu(false), "aria-hidden": true }), _jsxs(YStack, { id: "drive-menu", width: 240, minW: 240, bg: "$background", borderRightWidth: 1, borderColor: "$borderColor", px: "$3", py: "$4", justify: "space-between", "$max-md": {
|
|
596
607
|
display: menu ? 'flex' : 'none',
|
|
597
608
|
position: 'absolute',
|
|
598
609
|
t: 0,
|
|
@@ -601,15 +612,15 @@ export function Drive() {
|
|
|
601
612
|
z: 'var(--z-drawer)',
|
|
602
613
|
overflowY: 'auto',
|
|
603
614
|
boxShadow: 'var(--shadow-lg)',
|
|
604
|
-
}, children: [_jsxs(YStack, { gap: "$4", children: [_jsxs(View, { position: "relative", children: [_jsxs(Button, { size: "lg", width: "100%", justify: "space-between", onClick: () => setNewMenuOpen((v) => !v), "aria-expanded": newMenuOpen, children: [_jsxs(XStack, { items: "center", gap: "$2", children: [_jsx(Plus, { size: 16 }), _jsx(Text, { fontSize: "$3", fontWeight: "500", color: "$ink", children:
|
|
615
|
+
}, children: [_jsxs(YStack, { gap: "$4", children: [_jsxs(View, { position: "relative", children: [_jsxs(Button, { size: "lg", width: "100%", justify: "space-between", onClick: () => setNewMenuOpen((v) => !v), "aria-expanded": newMenuOpen, children: [_jsxs(XStack, { items: "center", gap: "$2", children: [_jsx(Plus, { size: 16 }), _jsx(Text, { fontSize: "$3", fontWeight: "500", color: "$ink", children: t('New') })] }), _jsx(ChevronDown, { size: 14, opacity: 0.65 })] }), newMenuOpen ? (_jsx(YStack, { position: "absolute", t: "100%", mt: 6, l: 0, width: "100%", bg: "var(--popover)", borderWidth: 1, borderColor: "$borderColor", rounded: 10, boxShadow: "var(--shadow-lg)", z: "var(--z-dropdown)", p: 6, gap: 2, children: navSection === 'local' ? (_jsxs(_Fragment, { children: [_jsxs(Button, { ...ITEM, onClick: () => {
|
|
605
616
|
setNewMenuOpen(false);
|
|
606
617
|
setMenu(false);
|
|
607
618
|
setNaming({ kind: 'file', value: '' });
|
|
608
|
-
}, children: [_jsx(FilePlus, { size: 14 }),
|
|
619
|
+
}, children: [_jsx(FilePlus, { size: 14 }), t('New file')] }), _jsxs(Button, { ...ITEM, onClick: () => {
|
|
609
620
|
setNewMenuOpen(false);
|
|
610
621
|
setMenu(false);
|
|
611
622
|
setNaming({ kind: 'folder', value: '' });
|
|
612
|
-
}, children: [_jsx(FolderPlus, { size: 14 }),
|
|
623
|
+
}, children: [_jsx(FolderPlus, { size: 14 }), t('New folder')] }), _jsx(View, { height: 1, bg: "$borderColor", my: 4 }), _jsxs(Button, { ...ITEM, onClick: () => {
|
|
613
624
|
setNewMenuOpen(false);
|
|
614
625
|
setMenu(false);
|
|
615
626
|
void pickLocalFolder().then((ws) => {
|
|
@@ -618,42 +629,42 @@ export function Drive() {
|
|
|
618
629
|
setLocalPrefix('');
|
|
619
630
|
}
|
|
620
631
|
});
|
|
621
|
-
}, children: [_jsx(FolderInput, { size: 14 }),
|
|
632
|
+
}, children: [_jsx(FolderInput, { size: 14 }), t('Open local folder…')] }), _jsxs(Button, { ...ITEM, onClick: () => {
|
|
622
633
|
setNewMenuOpen(false);
|
|
623
634
|
setMenu(false);
|
|
624
635
|
void handleOpenLocalFile();
|
|
625
|
-
}, children: [_jsx(FileText, { size: 14 }),
|
|
636
|
+
}, children: [_jsx(FileText, { size: 14 }), t('Open local file…')] }), _jsxs(Button, { ...ITEM, onClick: () => {
|
|
626
637
|
setNewMenuOpen(false);
|
|
627
638
|
setMenu(false);
|
|
628
639
|
void handleImportLocalFile();
|
|
629
|
-
}, children: [_jsx(Upload, { size: 14 }),
|
|
640
|
+
}, children: [_jsx(Upload, { size: 14 }), t('Import local file…')] }), _jsxs(Button, { ...ITEM, onClick: () => {
|
|
630
641
|
setNewMenuOpen(false);
|
|
631
642
|
setMenu(false);
|
|
632
643
|
setNaming({ kind: 'clone', value: '' });
|
|
633
|
-
}, children: [_jsx(FolderGit2, { size: 14 }),
|
|
644
|
+
}, children: [_jsx(FolderGit2, { size: 14 }), t('Clone remote repo…')] })] })) : (_jsxs(_Fragment, { children: [_jsxs(Button, { ...ITEM, onClick: () => {
|
|
634
645
|
setNewMenuOpen(false);
|
|
635
646
|
setMenu(false);
|
|
636
647
|
setNaming({ kind: 'file', value: '' });
|
|
637
|
-
}, children: [_jsx(FilePlus, { size: 14 }),
|
|
648
|
+
}, children: [_jsx(FilePlus, { size: 14 }), t('New file')] }), _jsxs(Button, { ...ITEM, onClick: () => {
|
|
638
649
|
setNewMenuOpen(false);
|
|
639
650
|
setMenu(false);
|
|
640
651
|
setNaming({ kind: 'folder', value: '' });
|
|
641
|
-
}, children: [_jsx(FolderPlus, { size: 14 }),
|
|
652
|
+
}, children: [_jsx(FolderPlus, { size: 14 }), t('New folder')] }), _jsx(View, { height: 1, bg: "$borderColor", my: 4 }), _jsxs(Button, { ...ITEM, onClick: () => {
|
|
642
653
|
setNewMenuOpen(false);
|
|
643
654
|
setMenu(false);
|
|
644
655
|
fileInputRef.current?.click();
|
|
645
|
-
}, children: [_jsx(Upload, { size: 14 }),
|
|
656
|
+
}, children: [_jsx(Upload, { size: 14 }), t('File upload')] }), _jsxs(Button, { ...ITEM, onClick: () => {
|
|
646
657
|
setNewMenuOpen(false);
|
|
647
658
|
setMenu(false);
|
|
648
659
|
folderInputRef.current?.click();
|
|
649
|
-
}, children: [_jsx(FolderInput, { size: 14 }),
|
|
660
|
+
}, children: [_jsx(FolderInput, { size: 14 }), t('Folder upload')] }), _jsx(View, { height: 1, bg: "$borderColor", my: 4 }), _jsxs(Button, { ...ITEM, onClick: () => {
|
|
650
661
|
setNewMenuOpen(false);
|
|
651
662
|
setMenu(false);
|
|
652
663
|
setNaming({ kind: 'clone', value: '' });
|
|
653
|
-
}, children: [_jsx(FolderGit2, { size: 14 }),
|
|
654
|
-
{ id: 'my-drive', label: 'My Drive', icon: HardDrive },
|
|
655
|
-
{ id: 'local', label: 'Local Folders', icon: Laptop },
|
|
656
|
-
{ id: 'recent', label: 'Recent', icon: Clock },
|
|
664
|
+
}, children: [_jsx(FolderGit2, { size: 14 }), t('Clone remote repo…')] })] })) })) : null] }), _jsx(YStack, { gap: "$1", children: [
|
|
665
|
+
{ id: 'my-drive', label: t('My Drive'), icon: HardDrive },
|
|
666
|
+
{ id: 'local', label: t('Local Folders'), icon: Laptop },
|
|
667
|
+
{ id: 'recent', label: t('Recent'), icon: Clock },
|
|
657
668
|
].map((item) => {
|
|
658
669
|
const isActive = navSection === item.id && !bucket && !prefix;
|
|
659
670
|
const Icon = item.icon;
|
|
@@ -663,7 +674,7 @@ export function Drive() {
|
|
|
663
674
|
setPrefix('');
|
|
664
675
|
setMenu(false);
|
|
665
676
|
}, children: [_jsx(Icon, { size: 16 }), item.label] }, item.id));
|
|
666
|
-
}) }), navSection === 'local' || localWorkspaces.length > 0 ? (_jsxs(YStack, { gap: "$1", pl: "$2", borderLeftWidth: 1, borderColor: "$borderColor", ml: "$3", children: [_jsx(Text, { fontSize: 11, fontWeight: "600", color: "$faint", letterSpacing: 0.5, mb: 2, children:
|
|
677
|
+
}) }), navSection === 'local' || localWorkspaces.length > 0 ? (_jsxs(YStack, { gap: "$1", pl: "$2", borderLeftWidth: 1, borderColor: "$borderColor", ml: "$3", children: [_jsx(Text, { fontSize: 11, fontWeight: "600", color: "$faint", letterSpacing: 0.5, mb: 2, children: t('Workspaces') }), localWorkspaces.map((ws) => {
|
|
667
678
|
const isCur = navSection === 'local' && activeWs?.id === ws.id;
|
|
668
679
|
return (_jsxs(XStack, { items: "center", justify: "space-between", px: "$2", py: "$1", rounded: 6, bg: isCur ? '$hover' : 'transparent', hoverStyle: { bg: '$hover' }, cursor: "pointer", onPress: () => {
|
|
669
680
|
setActiveWorkspace(ws);
|
|
@@ -672,7 +683,7 @@ export function Drive() {
|
|
|
672
683
|
}, children: [_jsxs(XStack, { items: "center", gap: "$2", minW: 0, flex: 1, children: [_jsx(Folder, { size: 13, color: isCur ? 'var(--primary)' : 'var(--muted-foreground)' }), _jsx(Text, { fontSize: "$2", fontWeight: isCur ? '600' : '400', color: isCur ? '$ink' : '$soft', numberOfLines: 1, children: ws.name })] }), _jsx(Button, { variant: "ghost", size: "icon-sm", onClick: (e) => {
|
|
673
684
|
e.stopPropagation();
|
|
674
685
|
removeLocalWorkspace(ws.id);
|
|
675
|
-
}, title:
|
|
686
|
+
}, title: t('Remove'), children: _jsx(Trash2, { size: 11, color: "var(--muted-foreground)" }) })] }, ws.id));
|
|
676
687
|
}), _jsxs(Button, { variant: "ghost", size: "sm", justify: "flex-start", gap: 6, px: 8, py: 4, color: "$soft", onClick: () => {
|
|
677
688
|
void pickLocalFolder().then((ws) => {
|
|
678
689
|
if (ws) {
|
|
@@ -680,21 +691,31 @@ export function Drive() {
|
|
|
680
691
|
setLocalPrefix('');
|
|
681
692
|
}
|
|
682
693
|
});
|
|
683
|
-
}, children: [_jsx(Plus, { size: 13 }), _jsx(Text, { fontSize: "$1", color: "$soft", children:
|
|
694
|
+
}, children: [_jsx(Plus, { size: 13 }), _jsx(Text, { fontSize: "$1", color: "$soft", children: t('Open folder…') })] })] })) : null, _jsxs(YStack, { gap: "$2", mt: "$2", px: "$2", children: [_jsx(Text, { fontSize: 11, fontWeight: "600", color: "$faint", letterSpacing: 0.6, children: t('Storage') }), _jsx(Text, { fontSize: 12, color: "$quiet", children: usage
|
|
695
|
+
? usage.capped
|
|
696
|
+
? t(usage.files === 1 ? 'over {size} in {count} file' : 'over {size} in {count} files', {
|
|
697
|
+
size: weigh(usage.bytes),
|
|
698
|
+
count: usage.files.toLocaleString(locale),
|
|
699
|
+
})
|
|
700
|
+
: t(usage.files === 1 ? '{size} in {count} file' : '{size} in {count} files', {
|
|
701
|
+
size: weigh(usage.bytes),
|
|
702
|
+
count: usage.files.toLocaleString(locale),
|
|
703
|
+
})
|
|
704
|
+
: t('Measuring…') }), _jsx(Button, { asChild: true, size: "sm", mt: 8, children: _jsx("a", { href: checkoutUrl(), target: "_blank", rel: "noreferrer", children: t('Manage storage') }) })] })] }), _jsxs(YStack, { px: 14, py: 12, rounded: 10, borderWidth: 1, borderColor: "$borderColor", bg: "$panel", gap: 6, children: [_jsxs(XStack, { items: "center", gap: "$2", children: [_jsx(Cloud, { size: 16, color: "var(--foreground)" }), _jsx(Text, { fontSize: "$2", fontWeight: "600", color: "$ink", children: t('Hanzo Drive') })] }), _jsx(Text, { fontSize: "$1", color: "$soft", children: [userEmail, activeBucket].filter(Boolean).join(' · ') }), _jsx(Button, { asChild: true, variant: "link", size: "sm", px: 0, mt: 4, justify: "flex-start", children: _jsxs("a", { href: "https://docs.hanzo.ai/docs/openapi/s3/", target: "_blank", rel: "noreferrer", children: [t('Documentation'), _jsx(ArrowRight, { size: 12 })] }) })] })] }), _jsxs(YStack, { flex: 1, minH: 0, px: "$6", py: "$5", overflowY: "auto", overflowX: "hidden", gap: "$5", children: [navSection === 'local' && activeWs ? (_jsxs(XStack, { items: "center", gap: "$2", pb: "$2", borderBottomWidth: 1, borderColor: "$borderColor", children: [_jsx(Button, { ...CRUMB, color: "$soft", onClick: () => {
|
|
684
705
|
setLocalPrefix('');
|
|
685
|
-
}, children:
|
|
706
|
+
}, children: t('Local Folders') }), _jsx(ChevronRight, { size: 13, color: "var(--muted-foreground)" }), _jsx(Button, { ...CRUMB, color: !localPrefix ? '$ink' : '$soft', onClick: () => setLocalPrefix(''), children: activeWs.name }), localPrefix
|
|
686
707
|
? localPrefix.split('/').map((c, i, arr) => (_jsxs(React.Fragment, { children: [_jsx(ChevronRight, { size: 13, color: "var(--muted-foreground)" }), _jsx(Button, { ...CRUMB, color: i === arr.length - 1 ? '$ink' : '$soft', onClick: () => setLocalPrefix(arr.slice(0, i + 1).join('/')), children: c })] }, `${i}-${c}`)))
|
|
687
708
|
: null] })) : bucket || prefix ? (_jsxs(XStack, { items: "center", gap: "$2", pb: "$2", borderBottomWidth: 1, borderColor: "$borderColor", children: [_jsx(Button, { ...CRUMB, color: "$soft", onClick: () => {
|
|
688
709
|
openBucket(null);
|
|
689
710
|
setPrefix('');
|
|
690
|
-
}, children:
|
|
711
|
+
}, children: t('Drive') }), _jsx(ChevronRight, { size: 13, color: "var(--muted-foreground)" }), _jsx(Button, { ...CRUMB, color: crumbs.length === 0 ? '$ink' : '$soft', onClick: () => setPrefix(''), children: bucket || 'hanzo' }), crumbs.map((c, i) => (_jsxs(React.Fragment, { children: [_jsx(ChevronRight, { size: 13, color: "var(--muted-foreground)" }), _jsx(Button, { ...CRUMB, color: i === crumbs.length - 1 ? '$ink' : '$soft', onClick: () => setPrefix(crumbs.slice(0, i + 1).map((x) => `${x}/`).join('')), children: c })] }, `${i}-${c}`)))] })) : null, _jsxs(XStack, { items: "center", justify: "space-between", children: [_jsxs(YStack, { gap: "$1", children: [_jsx(Text, { render: "h1", fontSize: 26, fontWeight: "700", color: "$ink", children: navSection === 'local' ? (activeWs ? activeWs.name : t('Local Folders')) : t('Drive') }), _jsx(Text, { fontSize: 13, color: "$soft", children: navSection === 'local'
|
|
691
712
|
? activeWs
|
|
692
713
|
? activeWs.path
|
|
693
|
-
: 'Edit local files, add files & folders, and code locally.'
|
|
694
|
-
: 'Secure. Private. Built for builders.' })] }), _jsx(XStack, { items: "center", bg: "$panel", rounded: 8, borderWidth: 1, borderColor: "$borderColor", p: 2, gap: 2, children: [
|
|
695
|
-
['list', 'List View', List],
|
|
696
|
-
['grid', 'Grid View', LayoutGrid],
|
|
697
|
-
['details', 'Details View', MoreHorizontal],
|
|
714
|
+
: t('Edit local files, add files & folders, and code locally.')
|
|
715
|
+
: t('Secure. Private. Built for builders.') })] }), _jsx(XStack, { items: "center", bg: "$panel", rounded: 8, borderWidth: 1, borderColor: "$borderColor", p: 2, gap: 2, children: [
|
|
716
|
+
['list', t('List View'), List],
|
|
717
|
+
['grid', t('Grid View'), LayoutGrid],
|
|
718
|
+
['details', t('Details View'), MoreHorizontal],
|
|
698
719
|
].map(([mode, label, Icon]) => (_jsx(Button, { variant: viewMode === mode ? 'secondary' : 'ghost', size: "icon-sm", color: viewMode === mode ? '$ink' : '$soft', onClick: () => setViewMode(mode), "aria-label": label, "aria-pressed": viewMode === mode, title: label, children: _jsx(Icon, { size: 14 }) }, mode))) })] }), naming ? (_jsxs(XStack, { items: "center", gap: "$3", py: 10, px: 14, rounded: 8, borderWidth: 1, borderColor: "var(--border-control)", bg: "$panel", children: [naming.kind === 'file' ? (_jsx(FileCode, { size: 16, color: "var(--primary)" })) : naming.kind === 'clone' ? (_jsx(FolderGit2, { size: 16, color: "var(--primary)" })) : (_jsx(Folder, { size: 16, color: "var(--foreground)" })), _jsx(Text, { render: _jsx("input", { autoFocus: true, value: naming.value, onChange: (e) => setNaming({ ...naming, value: e.target.value }), onKeyDown: (e) => {
|
|
699
720
|
if (e.key === 'Escape')
|
|
700
721
|
setNaming(null);
|
|
@@ -707,34 +728,34 @@ export function Drive() {
|
|
|
707
728
|
handleCreateFolder(naming.value);
|
|
708
729
|
}
|
|
709
730
|
}, placeholder: naming.kind === 'file'
|
|
710
|
-
? 'File name (e.g. index.ts)
|
|
731
|
+
? t('File name (e.g. {example})', { example: 'index.ts' })
|
|
711
732
|
: naming.kind === 'clone'
|
|
712
|
-
? 'owner/repo or Git URL (e.g. hanzoai/desktop)
|
|
713
|
-
: 'Folder name', "aria-label": naming.kind === 'file'
|
|
714
|
-
? 'File name'
|
|
733
|
+
? t('owner/repo or Git URL (e.g. {example})', { example: 'hanzoai/desktop' })
|
|
734
|
+
: t('Folder name'), "aria-label": naming.kind === 'file'
|
|
735
|
+
? t('File name')
|
|
715
736
|
: naming.kind === 'clone'
|
|
716
|
-
? 'Clone remote repository'
|
|
717
|
-
: 'Folder name' }), ...BARE }), _jsx(Button, { variant: "primary", size: "sm", onClick: () => {
|
|
737
|
+
? t('Clone remote repository')
|
|
738
|
+
: t('Folder name') }), ...BARE }), _jsx(Button, { variant: "primary", size: "sm", onClick: () => {
|
|
718
739
|
if (naming.kind === 'file')
|
|
719
740
|
handleCreateFile(naming.value);
|
|
720
741
|
else if (naming.kind === 'clone')
|
|
721
742
|
handleCloneRepo(naming.value);
|
|
722
743
|
else
|
|
723
744
|
handleCreateFolder(naming.value);
|
|
724
|
-
}, children: naming.kind === 'clone' ? 'Clone' : 'Create' }), _jsx(Button, { variant: "ghost", size: "sm", color: "$soft", onClick: () => setNaming(null), children:
|
|
745
|
+
}, children: t(naming.kind === 'clone' ? 'Clone' : 'Create') }), _jsx(Button, { variant: "ghost", size: "sm", color: "$soft", onClick: () => setNaming(null), children: t('Cancel') })] })) : null, editingFile ? (_jsx(Editor, { filePath: editingFile.path, fileName: editingFile.name, onClose: () => {
|
|
725
746
|
setEditingFile(null);
|
|
726
747
|
loadLocalEntries();
|
|
727
748
|
}, onAskInChat: () => {
|
|
728
749
|
setEditingFile(null);
|
|
729
750
|
router.push('/chat');
|
|
730
|
-
} })) : null, busy ? (
|
|
751
|
+
} })) : null, busy ? (_jsx(Text, { fontSize: "$2", color: "$soft", "data-slot": "drive-busy", children: t('{status}…', { status: busy }) })) : null, hits && hits.length ? _jsx(Hits, { hits: hits, onOpen: (p) => showContents(p.file.id, p.section.id) }) : null, navSection === 'local' ? (!activeWs ? (_jsxs(YStack, { py: 60, px: 24, items: "center", justify: "center", gap: "$4", borderWidth: 1, borderStyle: "dashed", borderColor: "$borderColor", rounded: 12, bg: "$panel", children: [_jsx(Laptop, { size: 40, color: "var(--primary)" }), _jsxs(YStack, { items: "center", gap: "$1", maxW: 460, children: [_jsx(Text, { fontSize: 18, fontWeight: "600", color: "$ink", text: "center", children: t('No local folder opened') }), _jsx(Text, { fontSize: 13, color: "$soft", text: "center", children: t('Open a local folder on your computer to browse, create, edit, and save files directly in Hanzo Desktop.') })] }), _jsxs(XStack, { items: "center", gap: "$2", children: [_jsxs(Button, { onClick: () => {
|
|
731
752
|
void pickLocalFolder().then((ws) => {
|
|
732
753
|
if (ws) {
|
|
733
754
|
setNavSection('local');
|
|
734
755
|
setLocalPrefix('');
|
|
735
756
|
}
|
|
736
757
|
});
|
|
737
|
-
}, children: [_jsx(FolderPlus, { size: 16 }),
|
|
758
|
+
}, children: [_jsx(FolderPlus, { size: 16 }), t('Open Local Folder…')] }), _jsxs(Button, { variant: "outline", onClick: () => setNaming({ kind: 'clone', value: '' }), children: [_jsx(FolderGit2, { size: 16 }), t('Clone Remote Repo…')] })] })] })) : (_jsxs(YStack, { gap: "$2", children: [_jsxs(XStack, { items: "center", justify: "space-between", pb: "$1", children: [_jsx(Text, { fontSize: 12, fontWeight: "600", color: "$soft", children: localPrefix ? t('Folder: {path}', { path: localPrefix }) : t('Root Files & Directories') }), _jsxs(XStack, { items: "center", gap: "$2", children: [_jsxs(Button, { variant: "outline", size: "sm", onClick: () => setNaming({ kind: 'file', value: '' }), children: [_jsx(FilePlus, { size: 13 }), t('New file')] }), _jsxs(Button, { variant: "outline", size: "sm", onClick: () => setNaming({ kind: 'folder', value: '' }), children: [_jsx(FolderPlus, { size: 13 }), t('New folder')] }), _jsxs(Button, { variant: "outline", size: "sm", onClick: () => void handleImportLocalFile(), children: [_jsx(Upload, { size: 13 }), t('Import file')] }), _jsxs(Button, { variant: "outline", size: "sm", onClick: () => setNaming({ kind: 'clone', value: '' }), children: [_jsx(FolderGit2, { size: 13 }), t('Clone repo')] })] })] }), _jsxs(YStack, { borderWidth: 1, borderColor: "$borderColor", rounded: 8, overflowX: "auto", overflowY: "hidden", children: [_jsxs(View, { display: "grid", gridTemplateColumns: FILES, minW: "min-content", px: 16, py: 10, borderBottomWidth: 1, borderColor: "$borderColor", children: [_jsx(Text, { ...HEAD, children: t('Name') }), _jsx(Text, { ...HEAD, children: t('Type') }), _jsx(Text, { ...HEAD, children: t('Updated') }), _jsx(Text, { ...HEAD, children: t('Size') }), _jsx(View, {})] }), !localEntries || localEntries.length === 0 ? (_jsx(Text, { py: 36, px: 16, text: "center", fontSize: "$2", color: "$faint", children: t('Empty folder') })) : (localEntries.map((e) => {
|
|
738
759
|
const ext = e.name.split('.').pop() || '';
|
|
739
760
|
return (_jsxs(View, { display: "grid", gridTemplateColumns: FILES, minW: "min-content", px: 16, py: 11, items: "center", cursor: "pointer", borderBottomWidth: 1, borderColor: "$borderColor", transition: "100ms", hoverStyle: { bg: '$hover' }, onClick: () => {
|
|
740
761
|
if (e.isDir) {
|
|
@@ -743,19 +764,19 @@ export function Drive() {
|
|
|
743
764
|
else {
|
|
744
765
|
setEditingFile({ path: e.path, name: e.name });
|
|
745
766
|
}
|
|
746
|
-
}, children: [_jsxs(XStack, { items: "center", gap: "$3", minW: 0, pr: "$2", children: [e.isDir ? (_jsx(Folder, { size: 16, color: "var(--foreground)" })) : (_jsx(FileCode, { size: 16, color: "var(--muted-foreground)" })), _jsx(Text, { ...NAME, children: e.name })] }), _jsx(Text, { fontSize: "$2", color: "$soft", numberOfLines: 1, children: e.isDir ? 'Folder' : ext.toUpperCase() || 'File' }), _jsx(Text, { ...CELL, children: e.lastModified ? when(e.lastModified) : '—' }), _jsx(Text, { ...CELL, children: e.isDir ? '—' : weigh(e.size) }), _jsxs(View, { position: "relative", onClick: (evt) => evt.stopPropagation(), children: [_jsx(More, { onPress: (evt) => {
|
|
767
|
+
}, children: [_jsxs(XStack, { items: "center", gap: "$3", minW: 0, pr: "$2", children: [e.isDir ? (_jsx(Folder, { size: 16, color: "var(--foreground)" })) : (_jsx(FileCode, { size: 16, color: "var(--muted-foreground)" })), _jsx(Text, { ...NAME, children: e.name })] }), _jsx(Text, { fontSize: "$2", color: "$soft", numberOfLines: 1, children: e.isDir ? t('Folder') : ext.toUpperCase() || t('File') }), _jsx(Text, { ...CELL, children: e.lastModified ? when(e.lastModified, locale) : '—' }), _jsx(Text, { ...CELL, children: e.isDir ? '—' : weigh(e.size) }), _jsxs(View, { position: "relative", onClick: (evt) => evt.stopPropagation(), children: [_jsx(More, { onPress: (evt) => {
|
|
747
768
|
evt.stopPropagation();
|
|
748
769
|
setItemMenuKey(itemMenuKey === e.path ? null : e.path);
|
|
749
|
-
} }), itemMenuKey === e.path ? (_jsxs(YStack, { position: "absolute", r: 0, t: "100%", z: "var(--z-dropdown)", width: 160, bg: "var(--popover)", borderWidth: 1, borderColor: "$borderColor", rounded: 8, boxShadow: "var(--shadow-lg)", p: 4, gap: 2, children: [!e.isDir ? (_jsx(Pick, { icon: FileCode, label:
|
|
770
|
+
} }), itemMenuKey === e.path ? (_jsxs(YStack, { position: "absolute", r: 0, t: "100%", z: "var(--z-dropdown)", width: 160, bg: "var(--popover)", borderWidth: 1, borderColor: "$borderColor", rounded: 8, boxShadow: "var(--shadow-lg)", p: 4, gap: 2, children: [!e.isDir ? (_jsx(Pick, { icon: FileCode, label: t('Edit file'), onPress: () => {
|
|
750
771
|
setItemMenuKey(null);
|
|
751
772
|
setEditingFile({ path: e.path, name: e.name });
|
|
752
|
-
} })) : null, _jsx(Pick, { icon: Trash2, label:
|
|
773
|
+
} })) : null, _jsx(Pick, { icon: Trash2, label: t('Delete'), tone: BAD, onPress: () => {
|
|
753
774
|
setItemMenuKey(null);
|
|
754
775
|
deleteLocalPath(e.path)
|
|
755
776
|
.then(() => loadLocalEntries())
|
|
756
|
-
.catch((err) => setFailed(blame(err)));
|
|
777
|
+
.catch((err) => setFailed(blame(err, t)));
|
|
757
778
|
} })] })) : null] })] }, e.path));
|
|
758
|
-
}))] })] }))) : bucket || prefix ? (_jsx(YStack, { gap: "$2", children: _jsxs(YStack, { borderWidth: 1, borderColor: "$borderColor", rounded: 8, overflowX: "auto", overflowY: "hidden", children: [_jsxs(View, { display: "grid", gridTemplateColumns: FILES, minW: "min-content", px: 16, py: 10, borderBottomWidth: 1, borderColor: "$borderColor", children: [_jsx(Text, { ...HEAD, children:
|
|
779
|
+
}))] })] }))) : bucket || prefix ? (_jsx(YStack, { gap: "$2", children: _jsxs(YStack, { borderWidth: 1, borderColor: "$borderColor", rounded: 8, overflowX: "auto", overflowY: "hidden", children: [_jsxs(View, { display: "grid", gridTemplateColumns: FILES, minW: "min-content", px: 16, py: 10, borderBottomWidth: 1, borderColor: "$borderColor", children: [_jsx(Text, { ...HEAD, children: t('NAME') }), _jsx(Text, { ...HEAD, children: t('TYPE') }), _jsx(Text, { ...HEAD, children: t('UPDATED ↓') }), _jsx(Text, { ...HEAD, children: t('SIZE') }), _jsx(View, {})] }), !filteredEntries || filteredEntries.length === 0 ? (_jsx(Text, { py: 36, px: 16, text: "center", fontSize: "$2", color: "$faint", children: t('None') })) : (filteredEntries.map((e) => {
|
|
759
780
|
const isFolder = e.isDir || e.key.endsWith('/');
|
|
760
781
|
const cleanName = e.key.replace(/\/+$/, '');
|
|
761
782
|
return (_jsxs(View, { display: "grid", gridTemplateColumns: FILES, minW: "min-content", px: 16, py: 11, items: "center", cursor: "pointer", borderBottomWidth: 1, borderColor: "$borderColor", transition: "100ms", hoverStyle: { bg: '$hover' }, onClick: () => {
|
|
@@ -765,28 +786,28 @@ export function Drive() {
|
|
|
765
786
|
else {
|
|
766
787
|
handleDownload(e);
|
|
767
788
|
}
|
|
768
|
-
}, children: [_jsxs(XStack, { items: "center", gap: "$2.5", minW: 0, children: [_jsx(Glyph, { entry: e, size: 16 }), _jsxs(YStack, { minW: 0, children: [_jsx(Text, { ...NAME, children: cleanName }), !isFolder && index.get(prefix + e.key) ? _jsx(Badge, { f: index.get(prefix + e.key) }) : null] })] }), _jsx(View, { items: "flex-start", children: _jsx(Text, { ...CHIP, children: isFolder ? 'Folder' : cleanName.split('.').pop()?.toUpperCase() || 'File' }) }), _jsx(Text, { ...CELL, children: when(e.lastModified) }), _jsx(Text, { ...CELL, children: weigh(e.size) }), _jsxs(View, { position: "relative", items: "flex-start", children: [_jsx(More, { onPress: (ev) => {
|
|
789
|
+
}, children: [_jsxs(XStack, { items: "center", gap: "$2.5", minW: 0, children: [_jsx(Glyph, { entry: e, size: 16 }), _jsxs(YStack, { minW: 0, children: [_jsx(Text, { ...NAME, children: cleanName }), !isFolder && index.get(prefix + e.key) ? _jsx(Badge, { f: index.get(prefix + e.key) }) : null] })] }), _jsx(View, { items: "flex-start", children: _jsx(Text, { ...CHIP, children: isFolder ? t('Folder') : cleanName.split('.').pop()?.toUpperCase() || t('File') }) }), _jsx(Text, { ...CELL, children: when(e.lastModified, locale) }), _jsx(Text, { ...CELL, children: weigh(e.size) }), _jsxs(View, { position: "relative", items: "flex-start", children: [_jsx(More, { onPress: (ev) => {
|
|
769
790
|
ev.stopPropagation();
|
|
770
791
|
setItemMenuKey(itemMenuKey === e.key ? null : e.key);
|
|
771
|
-
} }), itemMenuKey === e.key ? (_jsxs(YStack, { position: "absolute", r: 0, t: "100%", bg: "var(--popover)", borderWidth: 1, borderColor: "$borderColor", rounded: 8, boxShadow: "var(--shadow-lg)", z: "var(--z-dropdown)", p: 4, minW: 140, onClick: (ev) => ev.stopPropagation(), children: [!isFolder && index.get(prefix + e.key) ? (_jsxs(_Fragment, { children: [_jsx(Pick, { icon: ListTree, label:
|
|
792
|
+
} }), itemMenuKey === e.key ? (_jsxs(YStack, { position: "absolute", r: 0, t: "100%", bg: "var(--popover)", borderWidth: 1, borderColor: "$borderColor", rounded: 8, boxShadow: "var(--shadow-lg)", z: "var(--z-dropdown)", p: 4, minW: 140, onClick: (ev) => ev.stopPropagation(), children: [!isFolder && index.get(prefix + e.key) ? (_jsxs(_Fragment, { children: [_jsx(Pick, { icon: ListTree, label: t('Contents'), onPress: () => {
|
|
772
793
|
setItemMenuKey(null);
|
|
773
794
|
setContents({ file: index.get(prefix + e.key) });
|
|
774
|
-
} }), _jsx(Pick, { icon: MessageSquare, label:
|
|
795
|
+
} }), _jsx(Pick, { icon: MessageSquare, label: t('Ask in chat'), onPress: () => {
|
|
775
796
|
setItemMenuKey(null);
|
|
776
797
|
askInChat(index.get(prefix + e.key));
|
|
777
|
-
} })] })) : null, !isFolder ? (_jsx(Pick, { icon: Download, label:
|
|
798
|
+
} })] })) : null, !isFolder ? (_jsx(Pick, { icon: Download, label: t('Download'), onPress: () => {
|
|
778
799
|
setItemMenuKey(null);
|
|
779
800
|
handleDownload(e);
|
|
780
|
-
} })) : null, _jsx(Pick, { icon: Trash2, label:
|
|
801
|
+
} })) : null, _jsx(Pick, { icon: Trash2, label: t('Delete'), tone: BAD, onPress: () => {
|
|
781
802
|
setItemMenuKey(null);
|
|
782
803
|
handleDelete(e);
|
|
783
804
|
} })] })) : null] })] }, e.key));
|
|
784
|
-
}))] }) })) : (_jsxs(_Fragment, { children: [_jsxs(YStack, { gap: "$2.5", children: [_jsx(Text, { fontSize: 12, fontWeight: "600", color: "$soft", children:
|
|
805
|
+
}))] }) })) : (_jsxs(_Fragment, { children: [_jsxs(YStack, { gap: "$2.5", children: [_jsx(Text, { fontSize: 12, fontWeight: "600", color: "$soft", children: t('Storage Buckets') }), _jsx(YStack, { borderWidth: 1, borderColor: "$borderColor", rounded: 8, overflowX: "auto", overflowY: "hidden", children: failed ? (_jsxs(Text, { ...NOTE, children: [failed, _jsx(Button, { size: "sm", mx: "auto", mt: 10, onClick: () => {
|
|
785
806
|
setFailed(null);
|
|
786
807
|
setReload((n) => n + 1);
|
|
787
|
-
}, children:
|
|
808
|
+
}, children: t('Try again') })] })) : !buckets ? (_jsx(Text, { ...NOTE, children: t('Reading your storage…') })) : buckets.length === 0 ? (_jsx(Text, { ...NOTE, children: t('No buckets yet.') })) : (buckets.map((b) => (_jsxs(XStack, { onClick: () => openBucket(b.name), items: "center", justify: "space-between", px: 16, py: 12, cursor: "pointer", bg: "transparent", transition: "100ms", hoverStyle: { bg: '$hover' }, children: [_jsxs(XStack, { items: "center", gap: "$2.5", children: [_jsx(Folder, { size: 17, color: "var(--foreground)" }), _jsx(Text, { fontSize: "$2", fontWeight: "500", color: "$ink", children: getBucketDisplayName(b, t) })] }), _jsxs(XStack, { items: "center", gap: "$4", children: [_jsx(Text, { fontSize: "$2", color: "$faint", children: when(b.createdAt, locale) }), _jsx(More, { onPress: (e) => e.stopPropagation() })] })] }, b.name)))) })] }), _jsxs(YStack, { gap: "$2.5", children: [_jsx(Text, { fontSize: 12, fontWeight: "600", color: "$soft", children: t('Projects (Unified VFS)') }), _jsxs(YStack, { borderWidth: 1, borderColor: "$borderColor", rounded: 8, overflowX: "auto", overflowY: "hidden", children: [_jsxs(View, { display: "grid", gridTemplateColumns: PROJECTS, minW: "min-content", px: 16, py: 10, borderBottomWidth: 1, borderColor: "$borderColor", children: [_jsx(Text, { ...HEAD, children: t('NAME') }), _jsx(Text, { ...HEAD, children: t('TYPE') }), _jsx(Text, { ...HEAD, children: t('UPDATED ↓') }), _jsx(Text, { ...HEAD, children: t('SIZE') }), _jsx(View, {})] }), filteredProjects.length === 0 ? (_jsx(Text, { py: 36, px: 16, text: "center", fontSize: "$2", color: "$faint", children: t('None') })) : (filteredProjects.map((p) => (_jsxs(View, { onClick: () => {
|
|
788
809
|
const targetBucket = buckets[0]?.name || 'hanzo';
|
|
789
810
|
openBucket(targetBucket);
|
|
790
811
|
setPrefix(`projects/${p.name || p.id}/`);
|
|
791
|
-
}, display: "grid", gridTemplateColumns: PROJECTS, minW: "min-content", px: 16, py: 11, items: "center", cursor: "pointer", borderBottomWidth: 1, borderColor: "$borderColor", transition: "100ms", hoverStyle: { bg: '$hover' }, children: [_jsxs(XStack, { items: "center", gap: "$2.5", minW: 0, children: [_jsx(Folder, { size: 16, color: "var(--foreground)" }), _jsx(Text, { ...NAME, children: p.name })] }), _jsx(View, { items: "flex-start", children: _jsx(Text, { ...CHIP, children: p.type }) }), _jsx(Text, { ...CELL, children: p.updated }), _jsx(Text, { ...CELL, children: p.size }), _jsx(View, { items: "flex-start", children: _jsx(More, { onPress: (e) => e.stopPropagation() }) })] }, p.id))))] })] })] }))] })] }), contents && client ? (_jsx(Contents, { api: client, file: contents.file, at: contents.at, onClose: () => setContents(null), onAsk: askInChat, onFollow: (id, at) => showContents(id, at) })) : null, over ? (_jsx(Box, { position: "absolute", t: 0, l: 0, r: 0, b: 0, z: 1000, bg: VEIL, borderWidth: 2, borderStyle: "dashed", borderColor: "var(--ring)", rounded: "$3", display: "flex", items: "center", justify: "center", pointerEvents: "none", children: _jsxs(YStack, { items: "center", gap: "$2", children: [_jsx(Upload, { size: 36, color: "currentColor" }),
|
|
812
|
+
}, display: "grid", gridTemplateColumns: PROJECTS, minW: "min-content", px: 16, py: 11, items: "center", cursor: "pointer", borderBottomWidth: 1, borderColor: "$borderColor", transition: "100ms", hoverStyle: { bg: '$hover' }, children: [_jsxs(XStack, { items: "center", gap: "$2.5", minW: 0, children: [_jsx(Folder, { size: 16, color: "var(--foreground)" }), _jsx(Text, { ...NAME, children: p.name })] }), _jsx(View, { items: "flex-start", children: _jsx(Text, { ...CHIP, children: p.type }) }), _jsx(Text, { ...CELL, children: p.updated }), _jsx(Text, { ...CELL, children: p.size }), _jsx(View, { items: "flex-start", children: _jsx(More, { onPress: (e) => e.stopPropagation() }) })] }, p.id))))] })] })] }))] })] }), contents && client ? (_jsx(Contents, { api: client, file: contents.file, at: contents.at, onClose: () => setContents(null), onAsk: askInChat, onFollow: (id, at) => showContents(id, at) })) : null, over ? (_jsx(Box, { position: "absolute", t: 0, l: 0, r: 0, b: 0, z: 1000, bg: VEIL, borderWidth: 2, borderStyle: "dashed", borderColor: "var(--ring)", rounded: "$3", display: "flex", items: "center", justify: "center", pointerEvents: "none", children: _jsxs(YStack, { items: "center", gap: "$2", children: [_jsx(Upload, { size: 36, color: "currentColor" }), _jsx(Text, { fontSize: "$4", fontWeight: "600", color: "$ink", children: t('Drop files to upload to {name}', { name: bucket || workspace }) })] }) })) : null] }));
|
|
792
813
|
}
|