@muhgholy/next-drive 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/README.md +107 -59
- package/dist/client/components/dialog.d.ts +21 -0
- package/dist/client/components/dialog.d.ts.map +1 -0
- package/dist/client/components/drive/explorer.d.ts +10 -0
- package/dist/client/components/drive/explorer.d.ts.map +1 -0
- package/dist/client/components/drive/header.d.ts +3 -0
- package/dist/client/components/drive/header.d.ts.map +1 -0
- package/dist/client/components/drive/path-bar.d.ts +3 -0
- package/dist/client/components/drive/path-bar.d.ts.map +1 -0
- package/dist/client/components/drive/sidebar.d.ts +3 -0
- package/dist/client/components/drive/sidebar.d.ts.map +1 -0
- package/dist/client/components/drive/storage/indicator.d.ts +6 -0
- package/dist/client/components/drive/storage/indicator.d.ts.map +1 -0
- package/dist/client/components/drive/upload.d.ts +6 -0
- package/dist/client/components/drive/upload.d.ts.map +1 -0
- package/dist/client/components/ui/alert-dialog.d.ts +21 -0
- package/dist/client/components/ui/alert-dialog.d.ts.map +1 -0
- package/dist/client/components/ui/alert.d.ts +10 -0
- package/dist/client/components/ui/alert.d.ts.map +1 -0
- package/dist/client/components/ui/button.d.ts +11 -0
- package/dist/client/components/ui/button.d.ts.map +1 -0
- package/dist/client/components/ui/context-menu.d.ts +28 -0
- package/dist/client/components/ui/context-menu.d.ts.map +1 -0
- package/dist/client/components/ui/dialog.d.ts +16 -0
- package/dist/client/components/ui/dialog.d.ts.map +1 -0
- package/dist/client/components/ui/dropdown-menu.d.ts +28 -0
- package/dist/client/components/ui/dropdown-menu.d.ts.map +1 -0
- package/dist/client/components/ui/input.d.ts +4 -0
- package/dist/client/components/ui/input.d.ts.map +1 -0
- package/dist/client/components/ui/label.d.ts +5 -0
- package/dist/client/components/ui/label.d.ts.map +1 -0
- package/dist/client/components/ui/progress.d.ts +7 -0
- package/dist/client/components/ui/progress.d.ts.map +1 -0
- package/dist/client/components/ui/separator.d.ts +5 -0
- package/dist/client/components/ui/separator.d.ts.map +1 -0
- package/dist/client/components/ui/sheet.d.ts +26 -0
- package/dist/client/components/ui/sheet.d.ts.map +1 -0
- package/dist/client/components/ui/tooltip.d.ts +8 -0
- package/dist/client/components/ui/tooltip.d.ts.map +1 -0
- package/dist/client/context.d.ts +87 -0
- package/dist/client/context.d.ts.map +1 -0
- package/dist/client/file-chooser.d.ts +14 -0
- package/dist/client/file-chooser.d.ts.map +1 -0
- package/dist/client/hooks/useUpload.d.ts +8 -0
- package/dist/client/hooks/useUpload.d.ts.map +1 -0
- package/dist/client/index.d.ts +13 -133
- package/dist/client/index.d.ts.map +1 -0
- package/dist/client/index.js +401 -602
- package/dist/client/index.js.map +1 -1
- package/dist/client/utils.d.ts +16 -0
- package/dist/client/utils.d.ts.map +1 -0
- package/dist/schemas.d.ts +3 -5
- package/dist/schemas.d.ts.map +1 -0
- package/dist/schemas.js +5 -4
- package/dist/schemas.js.map +1 -1
- package/dist/server/config.d.ts +6 -0
- package/dist/server/config.d.ts.map +1 -0
- package/dist/server/controllers/drive.d.ts +55 -0
- package/dist/server/controllers/drive.d.ts.map +1 -0
- package/dist/server/database/mongoose/schema/drive.d.ts +19 -0
- package/dist/server/database/mongoose/schema/drive.d.ts.map +1 -0
- package/dist/server/database/mongoose/schema/storage/account.d.ts +12 -0
- package/dist/server/database/mongoose/schema/storage/account.d.ts.map +1 -0
- package/dist/server/express.d.ts +10 -0
- package/dist/server/express.d.ts.map +1 -0
- package/dist/server/express.js +1384 -0
- package/dist/server/express.js.map +1 -0
- package/dist/server/index.d.ts +10 -156
- package/dist/server/index.d.ts.map +1 -0
- package/dist/server/index.js +68 -110
- package/dist/server/index.js.map +1 -1
- package/dist/server/providers/google.d.ts +3 -0
- package/dist/server/providers/google.d.ts.map +1 -0
- package/dist/server/providers/local.d.ts +3 -0
- package/dist/server/providers/local.d.ts.map +1 -0
- package/dist/server/security/cryptoUtils.d.ts +13 -0
- package/dist/server/security/cryptoUtils.d.ts.map +1 -0
- package/dist/server/security/mimeFilter.d.ts +6 -0
- package/dist/server/security/mimeFilter.d.ts.map +1 -0
- package/dist/server/utils/ffmpeg.d.ts +14 -0
- package/dist/server/utils/ffmpeg.d.ts.map +1 -0
- package/dist/server/utils/folderValidation.d.ts +9 -0
- package/dist/server/utils/folderValidation.d.ts.map +1 -0
- package/dist/server/utils/imageConvert.d.ts +15 -0
- package/dist/server/utils/imageConvert.d.ts.map +1 -0
- package/dist/server/utils/metadata.d.ts +23 -0
- package/dist/server/utils/metadata.d.ts.map +1 -0
- package/dist/server/utils.d.ts +14 -0
- package/dist/server/utils.d.ts.map +1 -0
- package/dist/server/zod/schemas.d.ts +207 -0
- package/dist/server/zod/schemas.d.ts.map +1 -0
- package/dist/types/client/index.d.ts +32 -0
- package/dist/types/client/index.d.ts.map +1 -0
- package/dist/types/lib/database/drive.d.ts +41 -0
- package/dist/types/lib/database/drive.d.ts.map +1 -0
- package/dist/types/lib/database/index.d.ts +3 -0
- package/dist/types/lib/database/index.d.ts.map +1 -0
- package/dist/types/lib/database/storage/account.d.ts +15 -0
- package/dist/types/lib/database/storage/account.d.ts.map +1 -0
- package/dist/types/server/api.d.ts +16 -0
- package/dist/types/server/api.d.ts.map +1 -0
- package/dist/types/server/config.d.ts +41 -0
- package/dist/types/server/config.d.ts.map +1 -0
- package/dist/types/server/drive.d.ts +2 -0
- package/dist/types/server/drive.d.ts.map +1 -0
- package/dist/types/server/express.d.ts +37 -0
- package/dist/types/server/express.d.ts.map +1 -0
- package/dist/types/server/index.d.ts +4 -0
- package/dist/types/server/index.d.ts.map +1 -0
- package/dist/types/server/storage.d.ts +29 -0
- package/dist/types/server/storage.d.ts.map +1 -0
- package/package.json +102 -96
- package/dist/index-CUS76o75.d.ts +0 -90
package/dist/client/index.js
CHANGED
|
@@ -1,11 +1,23 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
1
|
+
import * as React2 from 'react';
|
|
2
|
+
import React2__default, { createContext, useState, useCallback, useMemo, useContext, useRef, useEffect } from 'react';
|
|
3
|
+
import { clsx } from 'clsx';
|
|
4
|
+
import { twMerge } from 'tailwind-merge';
|
|
5
|
+
import { ChevronRight, Check, Circle, X, Upload, Loader2, Cloud, AlertCircle, Menu, Folder, FolderPlus, RotateCcw, Trash2, Pencil, Group, ArrowUpDown, Calendar, ArrowDownAZ, ArrowUpAZ, ArrowDown01, ArrowUp01, LayoutGrid, List, Database, HardDrive, ChevronsUpDown, LogOut, Plus, FolderOpen, Image, Video, Music, FileText, FileArchive, FileCode, File, Clock, CheckCircle2 } from 'lucide-react';
|
|
6
|
+
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
7
|
+
import { startOfWeek, subWeeks, isToday, isYesterday, isAfter } from 'date-fns';
|
|
8
|
+
import * as ContextMenuPrimitive from '@radix-ui/react-context-menu';
|
|
9
|
+
import { cva } from 'class-variance-authority';
|
|
10
|
+
import { Slot } from '@radix-ui/react-slot';
|
|
11
|
+
import * as SheetPrimitive from '@radix-ui/react-dialog';
|
|
12
|
+
import * as LabelPrimitive from '@radix-ui/react-label';
|
|
13
|
+
import { useSensors, useSensor, PointerSensor, KeyboardSensor, DndContext, closestCenter, useDroppable } from '@dnd-kit/core';
|
|
14
|
+
import * as ProgressPrimitive from '@radix-ui/react-progress';
|
|
15
|
+
import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';
|
|
16
|
+
import { sortableKeyboardCoordinates, SortableContext, rectSortingStrategy, arrayMove, useSortable } from '@dnd-kit/sortable';
|
|
17
|
+
import { CSS } from '@dnd-kit/utilities';
|
|
18
|
+
import { z } from 'zod';
|
|
3
19
|
|
|
4
|
-
// src/client/
|
|
5
|
-
import { clsx } from "clsx";
|
|
6
|
-
import { twMerge } from "tailwind-merge";
|
|
7
|
-
import { File, Folder, Image, Video, Music, FileText, FileCode, FileArchive } from "lucide-react";
|
|
8
|
-
import { jsx } from "react/jsx-runtime";
|
|
20
|
+
// src/client/context.tsx
|
|
9
21
|
function cn(...inputs) {
|
|
10
22
|
return twMerge(clsx(inputs));
|
|
11
23
|
}
|
|
@@ -67,9 +79,6 @@ var driveCreateSrcSet = (driveFile, apiEndpoint, format = "webp") => {
|
|
|
67
79
|
const sizes = "(max-width: 320px) 200px, (max-width: 480px) 400px, (max-width: 768px) 800px, 1200px";
|
|
68
80
|
return { srcSet, sizes };
|
|
69
81
|
};
|
|
70
|
-
|
|
71
|
-
// src/client/context.tsx
|
|
72
|
-
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
73
82
|
var DriveContext = createContext(null);
|
|
74
83
|
var DriveProvider = (props) => {
|
|
75
84
|
const { children, apiEndpoint, initialActiveAccountId = null, initialSelectionMode = { type: "SINGLE" }, defaultSelectedFileIds = [] } = props;
|
|
@@ -91,7 +100,7 @@ var DriveProvider = (props) => {
|
|
|
91
100
|
setPath([{ id: null, name: "Home" }]);
|
|
92
101
|
setSearchResults([]);
|
|
93
102
|
}, []);
|
|
94
|
-
|
|
103
|
+
React2__default.useEffect(() => {
|
|
95
104
|
const stored = localStorage.getItem("drive_active_account");
|
|
96
105
|
if (stored) setActiveAccountIdState(stored);
|
|
97
106
|
}, []);
|
|
@@ -276,13 +285,13 @@ var DriveProvider = (props) => {
|
|
|
276
285
|
}
|
|
277
286
|
}
|
|
278
287
|
}, [callAPI, activeCacheKey, currentView]);
|
|
279
|
-
|
|
288
|
+
React2__default.useEffect(() => {
|
|
280
289
|
refreshItems();
|
|
281
290
|
}, [currentFolderId, currentView, refreshItems, activeAccountId]);
|
|
282
|
-
|
|
291
|
+
React2__default.useEffect(() => {
|
|
283
292
|
refreshQuota();
|
|
284
293
|
}, [refreshQuota, activeAccountId]);
|
|
285
|
-
|
|
294
|
+
React2__default.useEffect(() => {
|
|
286
295
|
refreshAccounts();
|
|
287
296
|
}, [refreshAccounts]);
|
|
288
297
|
const createUrl = useCallback((driveFile, options) => {
|
|
@@ -291,7 +300,7 @@ var DriveProvider = (props) => {
|
|
|
291
300
|
const createSrcSet = useCallback((driveFile, format) => {
|
|
292
301
|
return driveCreateSrcSet(driveFile, apiEndpoint, format);
|
|
293
302
|
}, [apiEndpoint]);
|
|
294
|
-
return /* @__PURE__ */
|
|
303
|
+
return /* @__PURE__ */ jsx(DriveContext.Provider, { value: {
|
|
295
304
|
apiEndpoint,
|
|
296
305
|
currentFolderId,
|
|
297
306
|
path,
|
|
@@ -340,9 +349,6 @@ var useDrive = () => {
|
|
|
340
349
|
if (!context) throw new Error("useDrive must be used within a DriveProvider");
|
|
341
350
|
return context;
|
|
342
351
|
};
|
|
343
|
-
|
|
344
|
-
// src/client/hooks/useUpload.ts
|
|
345
|
-
import { useState as useState2, useCallback as useCallback2, useRef, useEffect } from "react";
|
|
346
352
|
var MAX_CONCURRENT_UPLOADS = 2;
|
|
347
353
|
var getChunkSize = (fileSize) => {
|
|
348
354
|
if (fileSize < 50 * 1024 * 1024) return 2 * 1024 * 1024;
|
|
@@ -351,11 +357,11 @@ var getChunkSize = (fileSize) => {
|
|
|
351
357
|
return 16 * 1024 * 1024;
|
|
352
358
|
};
|
|
353
359
|
var useUpload = (apiEndpoint, activeAccountId, onUploadComplete) => {
|
|
354
|
-
const [uploads, setUploads] =
|
|
360
|
+
const [uploads, setUploads] = useState([]);
|
|
355
361
|
const abortControllers = useRef(/* @__PURE__ */ new Map());
|
|
356
362
|
const filesRef = useRef(/* @__PURE__ */ new Map());
|
|
357
363
|
const metaRef = useRef(/* @__PURE__ */ new Map());
|
|
358
|
-
const updateUpload =
|
|
364
|
+
const updateUpload = useCallback((id, updates) => {
|
|
359
365
|
setUploads((prev) => prev.map((u) => u.id === id ? { ...u, ...updates } : u));
|
|
360
366
|
}, []);
|
|
361
367
|
const uploadChunk = async (formData) => {
|
|
@@ -436,7 +442,7 @@ var useUpload = (apiEndpoint, activeAccountId, onUploadComplete) => {
|
|
|
436
442
|
abortControllers.current.delete(item.id);
|
|
437
443
|
}
|
|
438
444
|
};
|
|
439
|
-
const uploadFiles =
|
|
445
|
+
const uploadFiles = useCallback(async (files, folderId) => {
|
|
440
446
|
const newUploads = [];
|
|
441
447
|
files.forEach((file) => {
|
|
442
448
|
const id = `upload_${Date.now()}_${Math.random().toString(36).slice(2)}`;
|
|
@@ -454,7 +460,7 @@ var useUpload = (apiEndpoint, activeAccountId, onUploadComplete) => {
|
|
|
454
460
|
});
|
|
455
461
|
setUploads((prev) => [...prev, ...newUploads]);
|
|
456
462
|
}, []);
|
|
457
|
-
const cancelUpload =
|
|
463
|
+
const cancelUpload = useCallback(async (id) => {
|
|
458
464
|
const controller = abortControllers.current.get(id);
|
|
459
465
|
if (controller) {
|
|
460
466
|
controller.abort();
|
|
@@ -467,7 +473,7 @@ var useUpload = (apiEndpoint, activeAccountId, onUploadComplete) => {
|
|
|
467
473
|
});
|
|
468
474
|
}
|
|
469
475
|
}, [apiEndpoint, updateUpload, uploads]);
|
|
470
|
-
const cancelAllUploads =
|
|
476
|
+
const cancelAllUploads = useCallback(async () => {
|
|
471
477
|
uploads.forEach((u) => {
|
|
472
478
|
if (["queued", "uploading", "pending"].includes(u.status)) {
|
|
473
479
|
cancelUpload(u.id);
|
|
@@ -488,20 +494,6 @@ var useUpload = (apiEndpoint, activeAccountId, onUploadComplete) => {
|
|
|
488
494
|
}, [uploads]);
|
|
489
495
|
return { uploads, uploadFiles, cancelUpload, cancelAllUploads };
|
|
490
496
|
};
|
|
491
|
-
|
|
492
|
-
// src/client/file-chooser.tsx
|
|
493
|
-
import { useState as useState6, useCallback as useCallback4, useMemo as useMemo3, useEffect as useEffect5 } from "react";
|
|
494
|
-
|
|
495
|
-
// src/client/components/drive/explorer.tsx
|
|
496
|
-
import React7, { useMemo as useMemo2, useEffect as useEffect4, useRef as useRef3 } from "react";
|
|
497
|
-
import { Folder as Folder2, Loader2 as Loader22, RotateCcw, ChevronRight as ChevronRight3 } from "lucide-react";
|
|
498
|
-
import { isToday, isYesterday, startOfWeek, subWeeks, isAfter } from "date-fns";
|
|
499
|
-
|
|
500
|
-
// src/client/components/ui/context-menu.tsx
|
|
501
|
-
import * as React2 from "react";
|
|
502
|
-
import * as ContextMenuPrimitive from "@radix-ui/react-context-menu";
|
|
503
|
-
import { Check, ChevronRight, Circle } from "lucide-react";
|
|
504
|
-
import { jsx as jsx3, jsxs } from "react/jsx-runtime";
|
|
505
497
|
var ContextMenu = ContextMenuPrimitive.Root;
|
|
506
498
|
var ContextMenuTrigger = ContextMenuPrimitive.Trigger;
|
|
507
499
|
var ContextMenuSubTrigger = React2.forwardRef(({ className, inset, children, ...props }, ref) => /* @__PURE__ */ jsxs(
|
|
@@ -516,12 +508,12 @@ var ContextMenuSubTrigger = React2.forwardRef(({ className, inset, children, ...
|
|
|
516
508
|
...props,
|
|
517
509
|
children: [
|
|
518
510
|
children,
|
|
519
|
-
/* @__PURE__ */
|
|
511
|
+
/* @__PURE__ */ jsx(ChevronRight, { className: "ml-auto h-4 w-4" })
|
|
520
512
|
]
|
|
521
513
|
}
|
|
522
514
|
));
|
|
523
515
|
ContextMenuSubTrigger.displayName = ContextMenuPrimitive.SubTrigger.displayName;
|
|
524
|
-
var ContextMenuSubContent = React2.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
|
|
516
|
+
var ContextMenuSubContent = React2.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
525
517
|
ContextMenuPrimitive.SubContent,
|
|
526
518
|
{
|
|
527
519
|
ref,
|
|
@@ -533,7 +525,7 @@ var ContextMenuSubContent = React2.forwardRef(({ className, ...props }, ref) =>
|
|
|
533
525
|
}
|
|
534
526
|
));
|
|
535
527
|
ContextMenuSubContent.displayName = ContextMenuPrimitive.SubContent.displayName;
|
|
536
|
-
var ContextMenuContent = React2.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
|
|
528
|
+
var ContextMenuContent = React2.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(ContextMenuPrimitive.Portal, { children: /* @__PURE__ */ jsx(
|
|
537
529
|
ContextMenuPrimitive.Content,
|
|
538
530
|
{
|
|
539
531
|
ref,
|
|
@@ -545,7 +537,7 @@ var ContextMenuContent = React2.forwardRef(({ className, ...props }, ref) => /*
|
|
|
545
537
|
}
|
|
546
538
|
) }));
|
|
547
539
|
ContextMenuContent.displayName = ContextMenuPrimitive.Content.displayName;
|
|
548
|
-
var ContextMenuItem = React2.forwardRef(({ className, inset, ...props }, ref) => /* @__PURE__ */
|
|
540
|
+
var ContextMenuItem = React2.forwardRef(({ className, inset, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
549
541
|
ContextMenuPrimitive.Item,
|
|
550
542
|
{
|
|
551
543
|
ref,
|
|
@@ -569,7 +561,7 @@ var ContextMenuCheckboxItem = React2.forwardRef(({ className, children, checked,
|
|
|
569
561
|
checked,
|
|
570
562
|
...props,
|
|
571
563
|
children: [
|
|
572
|
-
/* @__PURE__ */
|
|
564
|
+
/* @__PURE__ */ jsx("span", { className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ jsx(ContextMenuPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx(Check, { className: "h-4 w-4" }) }) }),
|
|
573
565
|
children
|
|
574
566
|
]
|
|
575
567
|
}
|
|
@@ -585,13 +577,13 @@ var ContextMenuRadioItem = React2.forwardRef(({ className, children, ...props },
|
|
|
585
577
|
),
|
|
586
578
|
...props,
|
|
587
579
|
children: [
|
|
588
|
-
/* @__PURE__ */
|
|
580
|
+
/* @__PURE__ */ jsx("span", { className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ jsx(ContextMenuPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx(Circle, { className: "h-2 w-2 fill-current" }) }) }),
|
|
589
581
|
children
|
|
590
582
|
]
|
|
591
583
|
}
|
|
592
584
|
));
|
|
593
585
|
ContextMenuRadioItem.displayName = ContextMenuPrimitive.RadioItem.displayName;
|
|
594
|
-
var ContextMenuLabel = React2.forwardRef(({ className, inset, ...props }, ref) => /* @__PURE__ */
|
|
586
|
+
var ContextMenuLabel = React2.forwardRef(({ className, inset, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
595
587
|
ContextMenuPrimitive.Label,
|
|
596
588
|
{
|
|
597
589
|
ref,
|
|
@@ -604,7 +596,7 @@ var ContextMenuLabel = React2.forwardRef(({ className, inset, ...props }, ref) =
|
|
|
604
596
|
}
|
|
605
597
|
));
|
|
606
598
|
ContextMenuLabel.displayName = ContextMenuPrimitive.Label.displayName;
|
|
607
|
-
var ContextMenuSeparator = React2.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
|
|
599
|
+
var ContextMenuSeparator = React2.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
608
600
|
ContextMenuPrimitive.Separator,
|
|
609
601
|
{
|
|
610
602
|
ref,
|
|
@@ -613,30 +605,6 @@ var ContextMenuSeparator = React2.forwardRef(({ className, ...props }, ref) => /
|
|
|
613
605
|
}
|
|
614
606
|
));
|
|
615
607
|
ContextMenuSeparator.displayName = ContextMenuPrimitive.Separator.displayName;
|
|
616
|
-
var ContextMenuShortcut = ({
|
|
617
|
-
className,
|
|
618
|
-
...props
|
|
619
|
-
}) => {
|
|
620
|
-
return /* @__PURE__ */ jsx3(
|
|
621
|
-
"span",
|
|
622
|
-
{
|
|
623
|
-
className: cn(
|
|
624
|
-
"ml-auto text-xs tracking-widest text-muted-foreground",
|
|
625
|
-
className
|
|
626
|
-
),
|
|
627
|
-
...props
|
|
628
|
-
}
|
|
629
|
-
);
|
|
630
|
-
};
|
|
631
|
-
ContextMenuShortcut.displayName = "ContextMenuShortcut";
|
|
632
|
-
|
|
633
|
-
// src/client/components/dialog.tsx
|
|
634
|
-
import { useEffect as useEffect2, useState as useState3 } from "react";
|
|
635
|
-
import { AlertCircle } from "lucide-react";
|
|
636
|
-
|
|
637
|
-
// src/client/components/ui/alert.tsx
|
|
638
|
-
import { cva } from "class-variance-authority";
|
|
639
|
-
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
640
608
|
var alertVariants = cva(
|
|
641
609
|
"relative w-full rounded-lg border px-4 py-3 text-sm grid has-[>svg]:grid-cols-[calc(var(--spacing)*4)_1fr] grid-cols-[0_1fr] has-[>svg]:gap-x-3 gap-y-0.5 items-start [&>svg]:size-4 [&>svg]:translate-y-0.5 [&>svg]:text-current",
|
|
642
610
|
{
|
|
@@ -656,7 +624,7 @@ function Alert({
|
|
|
656
624
|
variant,
|
|
657
625
|
...props
|
|
658
626
|
}) {
|
|
659
|
-
return /* @__PURE__ */
|
|
627
|
+
return /* @__PURE__ */ jsx(
|
|
660
628
|
"div",
|
|
661
629
|
{
|
|
662
630
|
"data-slot": "alert",
|
|
@@ -667,7 +635,7 @@ function Alert({
|
|
|
667
635
|
);
|
|
668
636
|
}
|
|
669
637
|
function AlertTitle({ className, ...props }) {
|
|
670
|
-
return /* @__PURE__ */
|
|
638
|
+
return /* @__PURE__ */ jsx(
|
|
671
639
|
"div",
|
|
672
640
|
{
|
|
673
641
|
"data-slot": "alert-title",
|
|
@@ -683,7 +651,7 @@ function AlertDescription({
|
|
|
683
651
|
className,
|
|
684
652
|
...props
|
|
685
653
|
}) {
|
|
686
|
-
return /* @__PURE__ */
|
|
654
|
+
return /* @__PURE__ */ jsx(
|
|
687
655
|
"div",
|
|
688
656
|
{
|
|
689
657
|
"data-slot": "alert-description",
|
|
@@ -695,12 +663,7 @@ function AlertDescription({
|
|
|
695
663
|
}
|
|
696
664
|
);
|
|
697
665
|
}
|
|
698
|
-
|
|
699
|
-
// src/client/components/ui/button.tsx
|
|
700
|
-
import { Slot } from "@radix-ui/react-slot";
|
|
701
|
-
import { cva as cva2 } from "class-variance-authority";
|
|
702
|
-
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
703
|
-
var buttonVariants = cva2(
|
|
666
|
+
var buttonVariants = cva(
|
|
704
667
|
"inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
|
|
705
668
|
{
|
|
706
669
|
variants: {
|
|
@@ -735,7 +698,7 @@ function Button({
|
|
|
735
698
|
...props
|
|
736
699
|
}) {
|
|
737
700
|
const Comp = asChild ? Slot : "button";
|
|
738
|
-
return /* @__PURE__ */
|
|
701
|
+
return /* @__PURE__ */ jsx(
|
|
739
702
|
Comp,
|
|
740
703
|
{
|
|
741
704
|
"data-slot": "button",
|
|
@@ -744,27 +707,22 @@ function Button({
|
|
|
744
707
|
}
|
|
745
708
|
);
|
|
746
709
|
}
|
|
747
|
-
|
|
748
|
-
// src/client/components/ui/dialog.tsx
|
|
749
|
-
import * as DialogPrimitive from "@radix-ui/react-dialog";
|
|
750
|
-
import { X } from "lucide-react";
|
|
751
|
-
import { jsx as jsx6, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
752
710
|
function Dialog({
|
|
753
711
|
...props
|
|
754
712
|
}) {
|
|
755
|
-
return /* @__PURE__ */
|
|
713
|
+
return /* @__PURE__ */ jsx(SheetPrimitive.Root, { "data-slot": "dialog", ...props });
|
|
756
714
|
}
|
|
757
715
|
function DialogPortal({
|
|
758
716
|
...props
|
|
759
717
|
}) {
|
|
760
|
-
return /* @__PURE__ */
|
|
718
|
+
return /* @__PURE__ */ jsx(SheetPrimitive.Portal, { "data-slot": "dialog-portal", ...props });
|
|
761
719
|
}
|
|
762
720
|
function DialogOverlay({
|
|
763
721
|
className,
|
|
764
722
|
...props
|
|
765
723
|
}) {
|
|
766
|
-
return /* @__PURE__ */
|
|
767
|
-
|
|
724
|
+
return /* @__PURE__ */ jsx(
|
|
725
|
+
SheetPrimitive.Overlay,
|
|
768
726
|
{
|
|
769
727
|
"data-slot": "dialog-overlay",
|
|
770
728
|
className: cn(
|
|
@@ -781,10 +739,10 @@ function DialogContent({
|
|
|
781
739
|
showCloseButton = true,
|
|
782
740
|
...props
|
|
783
741
|
}) {
|
|
784
|
-
return /* @__PURE__ */
|
|
785
|
-
/* @__PURE__ */
|
|
786
|
-
/* @__PURE__ */
|
|
787
|
-
|
|
742
|
+
return /* @__PURE__ */ jsxs(DialogPortal, { "data-slot": "dialog-portal", children: [
|
|
743
|
+
/* @__PURE__ */ jsx(DialogOverlay, {}),
|
|
744
|
+
/* @__PURE__ */ jsxs(
|
|
745
|
+
SheetPrimitive.Content,
|
|
788
746
|
{
|
|
789
747
|
"data-slot": "dialog-content",
|
|
790
748
|
className: cn(
|
|
@@ -794,14 +752,14 @@ function DialogContent({
|
|
|
794
752
|
...props,
|
|
795
753
|
children: [
|
|
796
754
|
children,
|
|
797
|
-
showCloseButton && /* @__PURE__ */
|
|
798
|
-
|
|
755
|
+
showCloseButton && /* @__PURE__ */ jsxs(
|
|
756
|
+
SheetPrimitive.Close,
|
|
799
757
|
{
|
|
800
758
|
"data-slot": "dialog-close",
|
|
801
759
|
className: "ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
802
760
|
children: [
|
|
803
|
-
/* @__PURE__ */
|
|
804
|
-
/* @__PURE__ */
|
|
761
|
+
/* @__PURE__ */ jsx(X, { className: "size-4" }),
|
|
762
|
+
/* @__PURE__ */ jsx("span", { className: "sr-only", children: "Close" })
|
|
805
763
|
]
|
|
806
764
|
}
|
|
807
765
|
)
|
|
@@ -811,7 +769,7 @@ function DialogContent({
|
|
|
811
769
|
] });
|
|
812
770
|
}
|
|
813
771
|
function DialogHeader({ className, ...props }) {
|
|
814
|
-
return /* @__PURE__ */
|
|
772
|
+
return /* @__PURE__ */ jsx(
|
|
815
773
|
"div",
|
|
816
774
|
{
|
|
817
775
|
"data-slot": "dialog-header",
|
|
@@ -821,7 +779,7 @@ function DialogHeader({ className, ...props }) {
|
|
|
821
779
|
);
|
|
822
780
|
}
|
|
823
781
|
function DialogFooter({ className, ...props }) {
|
|
824
|
-
return /* @__PURE__ */
|
|
782
|
+
return /* @__PURE__ */ jsx(
|
|
825
783
|
"div",
|
|
826
784
|
{
|
|
827
785
|
"data-slot": "dialog-footer",
|
|
@@ -837,8 +795,8 @@ function DialogTitle({
|
|
|
837
795
|
className,
|
|
838
796
|
...props
|
|
839
797
|
}) {
|
|
840
|
-
return /* @__PURE__ */
|
|
841
|
-
|
|
798
|
+
return /* @__PURE__ */ jsx(
|
|
799
|
+
SheetPrimitive.Title,
|
|
842
800
|
{
|
|
843
801
|
"data-slot": "dialog-title",
|
|
844
802
|
className: cn("text-lg leading-none font-semibold", className),
|
|
@@ -850,8 +808,8 @@ function DialogDescription({
|
|
|
850
808
|
className,
|
|
851
809
|
...props
|
|
852
810
|
}) {
|
|
853
|
-
return /* @__PURE__ */
|
|
854
|
-
|
|
811
|
+
return /* @__PURE__ */ jsx(
|
|
812
|
+
SheetPrimitive.Description,
|
|
855
813
|
{
|
|
856
814
|
"data-slot": "dialog-description",
|
|
857
815
|
className: cn("text-muted-foreground text-sm", className),
|
|
@@ -859,11 +817,8 @@ function DialogDescription({
|
|
|
859
817
|
}
|
|
860
818
|
);
|
|
861
819
|
}
|
|
862
|
-
|
|
863
|
-
// src/client/components/ui/input.tsx
|
|
864
|
-
import { jsx as jsx7 } from "react/jsx-runtime";
|
|
865
820
|
function Input({ className, type, ...props }) {
|
|
866
|
-
return /* @__PURE__ */
|
|
821
|
+
return /* @__PURE__ */ jsx(
|
|
867
822
|
"input",
|
|
868
823
|
{
|
|
869
824
|
type,
|
|
@@ -878,15 +833,11 @@ function Input({ className, type, ...props }) {
|
|
|
878
833
|
}
|
|
879
834
|
);
|
|
880
835
|
}
|
|
881
|
-
|
|
882
|
-
// src/client/components/ui/label.tsx
|
|
883
|
-
import * as LabelPrimitive from "@radix-ui/react-label";
|
|
884
|
-
import { jsx as jsx8 } from "react/jsx-runtime";
|
|
885
836
|
function Label2({
|
|
886
837
|
className,
|
|
887
838
|
...props
|
|
888
839
|
}) {
|
|
889
|
-
return /* @__PURE__ */
|
|
840
|
+
return /* @__PURE__ */ jsx(
|
|
890
841
|
LabelPrimitive.Root,
|
|
891
842
|
{
|
|
892
843
|
"data-slot": "label",
|
|
@@ -898,14 +849,11 @@ function Label2({
|
|
|
898
849
|
}
|
|
899
850
|
);
|
|
900
851
|
}
|
|
901
|
-
|
|
902
|
-
// src/client/components/dialog.tsx
|
|
903
|
-
import { jsx as jsx9, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
904
852
|
var DialogConfirmation = (props) => {
|
|
905
853
|
const { title, description, onConfirm, disableEscapeKeyDown, inputs, onClose, open } = props;
|
|
906
|
-
const [error, setError] =
|
|
907
|
-
const [isLoading, setIsLoading] =
|
|
908
|
-
const [inputsValue, setInputsValue] =
|
|
854
|
+
const [error, setError] = useState(null);
|
|
855
|
+
const [isLoading, setIsLoading] = useState(false);
|
|
856
|
+
const [inputsValue, setInputsValue] = useState(
|
|
909
857
|
() => inputs?.reduce((acc, input) => ({
|
|
910
858
|
...acc,
|
|
911
859
|
[input.id]: input.default ?? ""
|
|
@@ -948,7 +896,7 @@ var DialogConfirmation = (props) => {
|
|
|
948
896
|
(input) => !input.required || inputsValue[input.id] && inputsValue[input.id].trim() !== ""
|
|
949
897
|
);
|
|
950
898
|
};
|
|
951
|
-
|
|
899
|
+
useEffect(() => {
|
|
952
900
|
setInputsValue(
|
|
953
901
|
inputs?.reduce((acc, input) => ({
|
|
954
902
|
...acc,
|
|
@@ -957,7 +905,7 @@ var DialogConfirmation = (props) => {
|
|
|
957
905
|
);
|
|
958
906
|
setError(null);
|
|
959
907
|
}, [inputs]);
|
|
960
|
-
return /* @__PURE__ */
|
|
908
|
+
return /* @__PURE__ */ jsx(Dialog, { open, onOpenChange: handleOpenChange, children: /* @__PURE__ */ jsxs(
|
|
961
909
|
DialogContent,
|
|
962
910
|
{
|
|
963
911
|
onInteractOutside: (e) => {
|
|
@@ -971,18 +919,18 @@ var DialogConfirmation = (props) => {
|
|
|
971
919
|
}
|
|
972
920
|
},
|
|
973
921
|
children: [
|
|
974
|
-
/* @__PURE__ */
|
|
975
|
-
/* @__PURE__ */
|
|
976
|
-
/* @__PURE__ */
|
|
922
|
+
/* @__PURE__ */ jsxs(DialogHeader, { children: [
|
|
923
|
+
/* @__PURE__ */ jsx(DialogTitle, { children: title }),
|
|
924
|
+
/* @__PURE__ */ jsx(DialogDescription, { children: description })
|
|
977
925
|
] }),
|
|
978
|
-
error && /* @__PURE__ */
|
|
979
|
-
/* @__PURE__ */
|
|
980
|
-
/* @__PURE__ */
|
|
981
|
-
/* @__PURE__ */
|
|
926
|
+
error && /* @__PURE__ */ jsxs(Alert, { variant: "destructive", children: [
|
|
927
|
+
/* @__PURE__ */ jsx(AlertCircle, { className: "h-4 w-4" }),
|
|
928
|
+
/* @__PURE__ */ jsx(AlertTitle, { children: "Error" }),
|
|
929
|
+
/* @__PURE__ */ jsx(AlertDescription, { children: error })
|
|
982
930
|
] }),
|
|
983
|
-
inputs && inputs.length > 0 && /* @__PURE__ */
|
|
984
|
-
/* @__PURE__ */
|
|
985
|
-
/* @__PURE__ */
|
|
931
|
+
inputs && inputs.length > 0 && /* @__PURE__ */ jsx("div", { className: "grid gap-4 py-4", children: inputs.map((input, index) => /* @__PURE__ */ jsxs("div", { className: "grid gap-2", children: [
|
|
932
|
+
/* @__PURE__ */ jsx(Label2, { htmlFor: input.id, children: input.name }),
|
|
933
|
+
/* @__PURE__ */ jsx(
|
|
986
934
|
Input,
|
|
987
935
|
{
|
|
988
936
|
id: input.id,
|
|
@@ -993,9 +941,9 @@ var DialogConfirmation = (props) => {
|
|
|
993
941
|
}
|
|
994
942
|
)
|
|
995
943
|
] }, input.id)) }),
|
|
996
|
-
/* @__PURE__ */
|
|
997
|
-
/* @__PURE__ */
|
|
998
|
-
/* @__PURE__ */
|
|
944
|
+
/* @__PURE__ */ jsxs(DialogFooter, { children: [
|
|
945
|
+
/* @__PURE__ */ jsx(Button, { variant: "outline", onClick: handleClose, disabled: isLoading, children: "Cancel" }),
|
|
946
|
+
/* @__PURE__ */ jsx(
|
|
999
947
|
Button,
|
|
1000
948
|
{
|
|
1001
949
|
onClick: handleConfirm,
|
|
@@ -1008,13 +956,6 @@ var DialogConfirmation = (props) => {
|
|
|
1008
956
|
}
|
|
1009
957
|
) });
|
|
1010
958
|
};
|
|
1011
|
-
|
|
1012
|
-
// src/client/components/drive/explorer.tsx
|
|
1013
|
-
import { Pencil, Trash2 as Trash22, FolderPlus } from "lucide-react";
|
|
1014
|
-
|
|
1015
|
-
// src/client/components/drive/path-bar.tsx
|
|
1016
|
-
import { useDroppable } from "@dnd-kit/core";
|
|
1017
|
-
import { jsx as jsx10, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
1018
959
|
var DroppablePathItem = (props) => {
|
|
1019
960
|
const { id, name, isLast, onClick } = props;
|
|
1020
961
|
const { currentFolderId } = useDrive();
|
|
@@ -1025,7 +966,7 @@ var DroppablePathItem = (props) => {
|
|
|
1025
966
|
});
|
|
1026
967
|
const isCurrentFolder = id === currentFolderId;
|
|
1027
968
|
if (isLast) {
|
|
1028
|
-
return /* @__PURE__ */
|
|
969
|
+
return /* @__PURE__ */ jsx(
|
|
1029
970
|
"span",
|
|
1030
971
|
{
|
|
1031
972
|
ref: setNodeRef,
|
|
@@ -1039,7 +980,7 @@ var DroppablePathItem = (props) => {
|
|
|
1039
980
|
}
|
|
1040
981
|
);
|
|
1041
982
|
}
|
|
1042
|
-
return /* @__PURE__ */
|
|
983
|
+
return /* @__PURE__ */ jsx(
|
|
1043
984
|
Button,
|
|
1044
985
|
{
|
|
1045
986
|
ref: setNodeRef,
|
|
@@ -1058,11 +999,11 @@ var DroppablePathItem = (props) => {
|
|
|
1058
999
|
};
|
|
1059
1000
|
var DrivePathBar = () => {
|
|
1060
1001
|
const { path, navigateToFolder } = useDrive();
|
|
1061
|
-
return /* @__PURE__ */
|
|
1002
|
+
return /* @__PURE__ */ jsx("ol", { className: "flex items-center gap-1 sm:gap-1.5 text-sm text-muted-foreground bg-muted/30 px-2 sm:px-3 py-1.5 sm:py-2 rounded-md border w-full overflow-x-auto flex-nowrap min-w-0", "aria-label": "Breadcrumb", role: "navigation", children: path.map((item, index) => {
|
|
1062
1003
|
const isLast = index === path.length - 1;
|
|
1063
|
-
return /* @__PURE__ */
|
|
1064
|
-
index > 0 && /* @__PURE__ */
|
|
1065
|
-
/* @__PURE__ */
|
|
1004
|
+
return /* @__PURE__ */ jsxs("li", { className: "flex items-center gap-1 sm:gap-1.5 shrink-0", children: [
|
|
1005
|
+
index > 0 && /* @__PURE__ */ jsx("span", { className: "text-muted-foreground/50 text-xs", "aria-hidden": "true", children: "/" }),
|
|
1006
|
+
/* @__PURE__ */ jsx(
|
|
1066
1007
|
DroppablePathItem,
|
|
1067
1008
|
{
|
|
1068
1009
|
id: item.id,
|
|
@@ -1074,21 +1015,13 @@ var DrivePathBar = () => {
|
|
|
1074
1015
|
] }, item.id ?? "root");
|
|
1075
1016
|
}) });
|
|
1076
1017
|
};
|
|
1077
|
-
|
|
1078
|
-
// src/client/components/drive/upload.tsx
|
|
1079
|
-
import React3, { useState as useState4, useRef as useRef2, useCallback as useCallback3 } from "react";
|
|
1080
|
-
import { Upload as UploadIcon, X as X2, Loader2, CheckCircle2, AlertCircle as AlertCircle2, Clock } from "lucide-react";
|
|
1081
|
-
|
|
1082
|
-
// src/client/components/ui/progress.tsx
|
|
1083
|
-
import * as ProgressPrimitive from "@radix-ui/react-progress";
|
|
1084
|
-
import { jsx as jsx11 } from "react/jsx-runtime";
|
|
1085
1018
|
function Progress({
|
|
1086
1019
|
className,
|
|
1087
1020
|
value,
|
|
1088
1021
|
indicatorClassName,
|
|
1089
1022
|
...props
|
|
1090
1023
|
}) {
|
|
1091
|
-
return /* @__PURE__ */
|
|
1024
|
+
return /* @__PURE__ */ jsx(
|
|
1092
1025
|
ProgressPrimitive.Root,
|
|
1093
1026
|
{
|
|
1094
1027
|
"data-slot": "progress",
|
|
@@ -1097,7 +1030,7 @@ function Progress({
|
|
|
1097
1030
|
className
|
|
1098
1031
|
),
|
|
1099
1032
|
...props,
|
|
1100
|
-
children: /* @__PURE__ */
|
|
1033
|
+
children: /* @__PURE__ */ jsx(
|
|
1101
1034
|
ProgressPrimitive.Indicator,
|
|
1102
1035
|
{
|
|
1103
1036
|
"data-slot": "progress-indicator",
|
|
@@ -1108,34 +1041,31 @@ function Progress({
|
|
|
1108
1041
|
}
|
|
1109
1042
|
);
|
|
1110
1043
|
}
|
|
1111
|
-
|
|
1112
|
-
// src/client/components/drive/upload.tsx
|
|
1113
|
-
import { Fragment, jsx as jsx12, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
1114
1044
|
var UploadStatusIcon = ({ status }) => {
|
|
1115
1045
|
switch (status) {
|
|
1116
1046
|
case "complete":
|
|
1117
|
-
return /* @__PURE__ */
|
|
1047
|
+
return /* @__PURE__ */ jsx(CheckCircle2, { className: "size-4 text-emerald-500" });
|
|
1118
1048
|
case "error":
|
|
1119
|
-
return /* @__PURE__ */
|
|
1049
|
+
return /* @__PURE__ */ jsx(AlertCircle, { className: "size-4 text-destructive" });
|
|
1120
1050
|
case "cancelled":
|
|
1121
|
-
return /* @__PURE__ */
|
|
1051
|
+
return /* @__PURE__ */ jsx(X, { className: "size-4 text-muted-foreground" });
|
|
1122
1052
|
case "uploading":
|
|
1123
|
-
return /* @__PURE__ */
|
|
1053
|
+
return /* @__PURE__ */ jsx(Loader2, { className: "size-4 text-primary animate-spin" });
|
|
1124
1054
|
default:
|
|
1125
|
-
return /* @__PURE__ */
|
|
1055
|
+
return /* @__PURE__ */ jsx(Clock, { className: "size-4 text-muted-foreground" });
|
|
1126
1056
|
}
|
|
1127
1057
|
};
|
|
1128
1058
|
var DriveUpload = (props) => {
|
|
1129
1059
|
const { compact = false, onComplete } = props;
|
|
1130
|
-
const [isDragging, setIsDragging] =
|
|
1131
|
-
const [showUploadsDialog, setShowUploadsDialog] =
|
|
1132
|
-
const inputRef =
|
|
1060
|
+
const [isDragging, setIsDragging] = useState(false);
|
|
1061
|
+
const [showUploadsDialog, setShowUploadsDialog] = useState(false);
|
|
1062
|
+
const inputRef = useRef(null);
|
|
1133
1063
|
const { currentFolderId, refreshItems, apiEndpoint, activeAccountId } = useDrive();
|
|
1134
1064
|
const { uploads, uploadFiles, cancelUpload, cancelAllUploads } = useUpload(apiEndpoint, activeAccountId, () => {
|
|
1135
1065
|
refreshItems();
|
|
1136
1066
|
onComplete?.(null);
|
|
1137
1067
|
});
|
|
1138
|
-
|
|
1068
|
+
React2__default.useEffect(() => {
|
|
1139
1069
|
if (!showUploadsDialog || uploads.length === 0) return;
|
|
1140
1070
|
const allFinished = uploads.every(
|
|
1141
1071
|
(u) => ["complete", "error", "cancelled"].includes(u.status)
|
|
@@ -1147,17 +1077,17 @@ var DriveUpload = (props) => {
|
|
|
1147
1077
|
return () => clearTimeout(timer);
|
|
1148
1078
|
}
|
|
1149
1079
|
}, [uploads, showUploadsDialog]);
|
|
1150
|
-
const handleFiles =
|
|
1080
|
+
const handleFiles = useCallback((files) => {
|
|
1151
1081
|
if (!files || files.length === 0) return;
|
|
1152
1082
|
uploadFiles(Array.from(files), currentFolderId);
|
|
1153
1083
|
setShowUploadsDialog(true);
|
|
1154
1084
|
}, [uploadFiles, currentFolderId, refreshItems, onComplete]);
|
|
1155
|
-
const handleDrag =
|
|
1085
|
+
const handleDrag = useCallback((e, dragging) => {
|
|
1156
1086
|
e.preventDefault();
|
|
1157
1087
|
e.stopPropagation();
|
|
1158
1088
|
setIsDragging(dragging);
|
|
1159
1089
|
}, []);
|
|
1160
|
-
const handleDrop =
|
|
1090
|
+
const handleDrop = useCallback((e) => {
|
|
1161
1091
|
e.preventDefault();
|
|
1162
1092
|
e.stopPropagation();
|
|
1163
1093
|
setIsDragging(false);
|
|
@@ -1165,10 +1095,10 @@ var DriveUpload = (props) => {
|
|
|
1165
1095
|
}, [handleFiles]);
|
|
1166
1096
|
const hasUploadsInProgress = uploads.some((u) => ["uploading", "queued", "pending"].includes(u.status));
|
|
1167
1097
|
const activeUploads = uploads.filter((u) => ["uploading", "queued", "pending"].includes(u.status));
|
|
1168
|
-
const renderDialog = () => /* @__PURE__ */
|
|
1169
|
-
/* @__PURE__ */
|
|
1170
|
-
/* @__PURE__ */
|
|
1171
|
-
hasUploadsInProgress && /* @__PURE__ */
|
|
1098
|
+
const renderDialog = () => /* @__PURE__ */ jsx(Dialog, { open: showUploadsDialog, onOpenChange: setShowUploadsDialog, children: /* @__PURE__ */ jsxs(DialogContent, { className: "sm:max-w-md p-0 gap-0", children: [
|
|
1099
|
+
/* @__PURE__ */ jsxs(DialogHeader, { className: "px-4 py-3 border-b flex-row items-center justify-between space-y-0", children: [
|
|
1100
|
+
/* @__PURE__ */ jsx(DialogTitle, { className: "text-base", children: "Upload Status" }),
|
|
1101
|
+
hasUploadsInProgress && /* @__PURE__ */ jsx(
|
|
1172
1102
|
Button,
|
|
1173
1103
|
{
|
|
1174
1104
|
type: "button",
|
|
@@ -1180,16 +1110,16 @@ var DriveUpload = (props) => {
|
|
|
1180
1110
|
}
|
|
1181
1111
|
)
|
|
1182
1112
|
] }),
|
|
1183
|
-
/* @__PURE__ */
|
|
1184
|
-
uploads.length === 0 && /* @__PURE__ */
|
|
1113
|
+
/* @__PURE__ */ jsxs("div", { className: "divide-y max-h-80 overflow-y-auto", children: [
|
|
1114
|
+
uploads.length === 0 && /* @__PURE__ */ jsx("div", { className: "p-4 text-center text-sm text-muted-foreground", children: "No uploads" }),
|
|
1185
1115
|
uploads.map((upload) => {
|
|
1186
1116
|
const percent = upload.status === "complete" ? 100 : upload.status === "error" || !upload.totalChunks ? 0 : Math.round(upload.currentChunk / upload.totalChunks * 100);
|
|
1187
|
-
return /* @__PURE__ */
|
|
1188
|
-
/* @__PURE__ */
|
|
1189
|
-
/* @__PURE__ */
|
|
1190
|
-
/* @__PURE__ */
|
|
1191
|
-
/* @__PURE__ */
|
|
1192
|
-
/* @__PURE__ */
|
|
1117
|
+
return /* @__PURE__ */ jsxs("div", { className: "px-4 py-2.5", children: [
|
|
1118
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-start gap-2 mb-1.5", children: [
|
|
1119
|
+
/* @__PURE__ */ jsx(UploadStatusIcon, { status: upload.status }),
|
|
1120
|
+
/* @__PURE__ */ jsxs("div", { className: "flex-1 min-w-0", children: [
|
|
1121
|
+
/* @__PURE__ */ jsx("p", { className: "text-sm font-medium truncate", children: upload.name }),
|
|
1122
|
+
/* @__PURE__ */ jsxs("p", { className: cn(
|
|
1193
1123
|
"text-xs",
|
|
1194
1124
|
upload.status === "error" ? "text-destructive" : "text-muted-foreground"
|
|
1195
1125
|
), children: [
|
|
@@ -1201,7 +1131,7 @@ var DriveUpload = (props) => {
|
|
|
1201
1131
|
upload.status === "cancelled" && "Upload cancelled"
|
|
1202
1132
|
] })
|
|
1203
1133
|
] }),
|
|
1204
|
-
["uploading", "queued", "pending"].includes(upload.status) && /* @__PURE__ */
|
|
1134
|
+
["uploading", "queued", "pending"].includes(upload.status) && /* @__PURE__ */ jsx(
|
|
1205
1135
|
Button,
|
|
1206
1136
|
{
|
|
1207
1137
|
type: "button",
|
|
@@ -1209,13 +1139,13 @@ var DriveUpload = (props) => {
|
|
|
1209
1139
|
variant: "ghost",
|
|
1210
1140
|
className: "shrink-0 text-muted-foreground hover:text-destructive",
|
|
1211
1141
|
onClick: () => cancelUpload(upload.id),
|
|
1212
|
-
children: /* @__PURE__ */
|
|
1142
|
+
children: /* @__PURE__ */ jsx(X, { className: "size-3.5" })
|
|
1213
1143
|
}
|
|
1214
1144
|
)
|
|
1215
1145
|
] }),
|
|
1216
|
-
upload.status === "uploading" && /* @__PURE__ */
|
|
1217
|
-
/* @__PURE__ */
|
|
1218
|
-
/* @__PURE__ */
|
|
1146
|
+
upload.status === "uploading" && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 pl-6", children: [
|
|
1147
|
+
/* @__PURE__ */ jsx(Progress, { value: percent, className: "flex-1" }),
|
|
1148
|
+
/* @__PURE__ */ jsxs("span", { className: "text-xs tabular-nums text-muted-foreground w-8", children: [
|
|
1219
1149
|
percent,
|
|
1220
1150
|
"%"
|
|
1221
1151
|
] })
|
|
@@ -1225,13 +1155,13 @@ var DriveUpload = (props) => {
|
|
|
1225
1155
|
] })
|
|
1226
1156
|
] }) });
|
|
1227
1157
|
if (compact) {
|
|
1228
|
-
return /* @__PURE__ */
|
|
1229
|
-
/* @__PURE__ */
|
|
1230
|
-
/* @__PURE__ */
|
|
1158
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1159
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
1160
|
+
/* @__PURE__ */ jsx("input", { ref: inputRef, type: "file", multiple: true, onChange: (e) => {
|
|
1231
1161
|
handleFiles(e.target.files);
|
|
1232
1162
|
e.target.value = "";
|
|
1233
1163
|
}, className: "hidden", "aria-hidden": "true" }),
|
|
1234
|
-
/* @__PURE__ */
|
|
1164
|
+
/* @__PURE__ */ jsxs(
|
|
1235
1165
|
Button,
|
|
1236
1166
|
{
|
|
1237
1167
|
onClick: () => inputRef.current?.click(),
|
|
@@ -1239,12 +1169,12 @@ var DriveUpload = (props) => {
|
|
|
1239
1169
|
size: "sm",
|
|
1240
1170
|
disabled: hasUploadsInProgress,
|
|
1241
1171
|
children: [
|
|
1242
|
-
/* @__PURE__ */
|
|
1172
|
+
/* @__PURE__ */ jsx(Upload, { className: "size-4 mr-1.5" }),
|
|
1243
1173
|
" Upload Files"
|
|
1244
1174
|
]
|
|
1245
1175
|
}
|
|
1246
1176
|
),
|
|
1247
|
-
uploads.length > 0 && /* @__PURE__ */
|
|
1177
|
+
uploads.length > 0 && /* @__PURE__ */ jsxs(
|
|
1248
1178
|
Button,
|
|
1249
1179
|
{
|
|
1250
1180
|
type: "button",
|
|
@@ -1252,7 +1182,7 @@ var DriveUpload = (props) => {
|
|
|
1252
1182
|
size: "sm",
|
|
1253
1183
|
onClick: () => setShowUploadsDialog(true),
|
|
1254
1184
|
children: [
|
|
1255
|
-
activeUploads.length > 0 && /* @__PURE__ */
|
|
1185
|
+
activeUploads.length > 0 && /* @__PURE__ */ jsx(Loader2, { className: "size-3.5 mr-1.5 animate-spin" }),
|
|
1256
1186
|
activeUploads.length > 0 ? `Uploading (${activeUploads.length})` : "Upload Status"
|
|
1257
1187
|
]
|
|
1258
1188
|
}
|
|
@@ -1261,8 +1191,8 @@ var DriveUpload = (props) => {
|
|
|
1261
1191
|
renderDialog()
|
|
1262
1192
|
] });
|
|
1263
1193
|
}
|
|
1264
|
-
return /* @__PURE__ */
|
|
1265
|
-
/* @__PURE__ */
|
|
1194
|
+
return /* @__PURE__ */ jsxs("div", { className: "w-full", children: [
|
|
1195
|
+
/* @__PURE__ */ jsxs(
|
|
1266
1196
|
"div",
|
|
1267
1197
|
{
|
|
1268
1198
|
className: cn(
|
|
@@ -1278,44 +1208,25 @@ var DriveUpload = (props) => {
|
|
|
1278
1208
|
tabIndex: 0,
|
|
1279
1209
|
onKeyDown: (e) => e.key === "Enter" && inputRef.current?.click(),
|
|
1280
1210
|
children: [
|
|
1281
|
-
/* @__PURE__ */
|
|
1211
|
+
/* @__PURE__ */ jsx("input", { ref: inputRef, type: "file", multiple: true, onChange: (e) => {
|
|
1282
1212
|
handleFiles(e.target.files);
|
|
1283
1213
|
e.target.value = "";
|
|
1284
1214
|
}, className: "hidden", "aria-hidden": "true" }),
|
|
1285
|
-
/* @__PURE__ */
|
|
1286
|
-
/* @__PURE__ */
|
|
1287
|
-
/* @__PURE__ */
|
|
1215
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center gap-2 text-center", children: [
|
|
1216
|
+
/* @__PURE__ */ jsx("div", { className: "p-3 rounded-full bg-background border shadow-sm", children: /* @__PURE__ */ jsx(Upload, { className: "size-6 text-muted-foreground" }) }),
|
|
1217
|
+
/* @__PURE__ */ jsx("div", { className: "text-sm font-medium text-foreground", children: isDragging ? "Drop files here" : "Click or drag files to upload" })
|
|
1288
1218
|
] })
|
|
1289
1219
|
]
|
|
1290
1220
|
}
|
|
1291
1221
|
),
|
|
1292
|
-
hasUploadsInProgress && /* @__PURE__ */
|
|
1222
|
+
hasUploadsInProgress && /* @__PURE__ */ jsx("div", { className: "mt-4 text-center", children: /* @__PURE__ */ jsx(Button, { variant: "link", onClick: () => setShowUploadsDialog(true), children: "View Upload Progress" }) }),
|
|
1293
1223
|
renderDialog()
|
|
1294
1224
|
] });
|
|
1295
1225
|
};
|
|
1296
|
-
|
|
1297
|
-
// src/client/components/drive/sidebar.tsx
|
|
1298
|
-
import {
|
|
1299
|
-
Database,
|
|
1300
|
-
HardDrive,
|
|
1301
|
-
Plus,
|
|
1302
|
-
LogOut,
|
|
1303
|
-
Check as Check3,
|
|
1304
|
-
ChevronsUpDown,
|
|
1305
|
-
FolderOpen,
|
|
1306
|
-
Trash2,
|
|
1307
|
-
Menu
|
|
1308
|
-
} from "lucide-react";
|
|
1309
|
-
|
|
1310
|
-
// src/client/components/ui/dropdown-menu.tsx
|
|
1311
|
-
import * as React4 from "react";
|
|
1312
|
-
import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu";
|
|
1313
|
-
import { Check as Check2, ChevronRight as ChevronRight2, Circle as Circle2 } from "lucide-react";
|
|
1314
|
-
import { jsx as jsx13, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
1315
1226
|
var DropdownMenu = DropdownMenuPrimitive.Root;
|
|
1316
1227
|
var DropdownMenuTrigger = DropdownMenuPrimitive.Trigger;
|
|
1317
1228
|
var DropdownMenuSub = DropdownMenuPrimitive.Sub;
|
|
1318
|
-
var DropdownMenuSubTrigger =
|
|
1229
|
+
var DropdownMenuSubTrigger = React2.forwardRef(({ className, inset, children, ...props }, ref) => /* @__PURE__ */ jsxs(
|
|
1319
1230
|
DropdownMenuPrimitive.SubTrigger,
|
|
1320
1231
|
{
|
|
1321
1232
|
ref,
|
|
@@ -1327,12 +1238,12 @@ var DropdownMenuSubTrigger = React4.forwardRef(({ className, inset, children, ..
|
|
|
1327
1238
|
...props,
|
|
1328
1239
|
children: [
|
|
1329
1240
|
children,
|
|
1330
|
-
/* @__PURE__ */
|
|
1241
|
+
/* @__PURE__ */ jsx(ChevronRight, { className: "ml-auto h-4 w-4" })
|
|
1331
1242
|
]
|
|
1332
1243
|
}
|
|
1333
1244
|
));
|
|
1334
1245
|
DropdownMenuSubTrigger.displayName = DropdownMenuPrimitive.SubTrigger.displayName;
|
|
1335
|
-
var DropdownMenuSubContent =
|
|
1246
|
+
var DropdownMenuSubContent = React2.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
1336
1247
|
DropdownMenuPrimitive.SubContent,
|
|
1337
1248
|
{
|
|
1338
1249
|
ref,
|
|
@@ -1344,7 +1255,7 @@ var DropdownMenuSubContent = React4.forwardRef(({ className, ...props }, ref) =>
|
|
|
1344
1255
|
}
|
|
1345
1256
|
));
|
|
1346
1257
|
DropdownMenuSubContent.displayName = DropdownMenuPrimitive.SubContent.displayName;
|
|
1347
|
-
var DropdownMenuContent =
|
|
1258
|
+
var DropdownMenuContent = React2.forwardRef(({ className, sideOffset = 4, ...props }, ref) => /* @__PURE__ */ jsx(DropdownMenuPrimitive.Portal, { children: /* @__PURE__ */ jsx(
|
|
1348
1259
|
DropdownMenuPrimitive.Content,
|
|
1349
1260
|
{
|
|
1350
1261
|
ref,
|
|
@@ -1357,7 +1268,7 @@ var DropdownMenuContent = React4.forwardRef(({ className, sideOffset = 4, ...pro
|
|
|
1357
1268
|
}
|
|
1358
1269
|
) }));
|
|
1359
1270
|
DropdownMenuContent.displayName = DropdownMenuPrimitive.Content.displayName;
|
|
1360
|
-
var DropdownMenuItem =
|
|
1271
|
+
var DropdownMenuItem = React2.forwardRef(({ className, inset, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
1361
1272
|
DropdownMenuPrimitive.Item,
|
|
1362
1273
|
{
|
|
1363
1274
|
ref,
|
|
@@ -1370,7 +1281,7 @@ var DropdownMenuItem = React4.forwardRef(({ className, inset, ...props }, ref) =
|
|
|
1370
1281
|
}
|
|
1371
1282
|
));
|
|
1372
1283
|
DropdownMenuItem.displayName = DropdownMenuPrimitive.Item.displayName;
|
|
1373
|
-
var DropdownMenuCheckboxItem =
|
|
1284
|
+
var DropdownMenuCheckboxItem = React2.forwardRef(({ className, children, checked, ...props }, ref) => /* @__PURE__ */ jsxs(
|
|
1374
1285
|
DropdownMenuPrimitive.CheckboxItem,
|
|
1375
1286
|
{
|
|
1376
1287
|
ref,
|
|
@@ -1381,13 +1292,13 @@ var DropdownMenuCheckboxItem = React4.forwardRef(({ className, children, checked
|
|
|
1381
1292
|
checked,
|
|
1382
1293
|
...props,
|
|
1383
1294
|
children: [
|
|
1384
|
-
/* @__PURE__ */
|
|
1295
|
+
/* @__PURE__ */ jsx("span", { className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ jsx(DropdownMenuPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx(Check, { className: "h-4 w-4" }) }) }),
|
|
1385
1296
|
children
|
|
1386
1297
|
]
|
|
1387
1298
|
}
|
|
1388
1299
|
));
|
|
1389
1300
|
DropdownMenuCheckboxItem.displayName = DropdownMenuPrimitive.CheckboxItem.displayName;
|
|
1390
|
-
var DropdownMenuRadioItem =
|
|
1301
|
+
var DropdownMenuRadioItem = React2.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs(
|
|
1391
1302
|
DropdownMenuPrimitive.RadioItem,
|
|
1392
1303
|
{
|
|
1393
1304
|
ref,
|
|
@@ -1397,13 +1308,13 @@ var DropdownMenuRadioItem = React4.forwardRef(({ className, children, ...props }
|
|
|
1397
1308
|
),
|
|
1398
1309
|
...props,
|
|
1399
1310
|
children: [
|
|
1400
|
-
/* @__PURE__ */
|
|
1311
|
+
/* @__PURE__ */ jsx("span", { className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ jsx(DropdownMenuPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx(Circle, { className: "h-2 w-2 fill-current" }) }) }),
|
|
1401
1312
|
children
|
|
1402
1313
|
]
|
|
1403
1314
|
}
|
|
1404
1315
|
));
|
|
1405
1316
|
DropdownMenuRadioItem.displayName = DropdownMenuPrimitive.RadioItem.displayName;
|
|
1406
|
-
var DropdownMenuLabel =
|
|
1317
|
+
var DropdownMenuLabel = React2.forwardRef(({ className, inset, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
1407
1318
|
DropdownMenuPrimitive.Label,
|
|
1408
1319
|
{
|
|
1409
1320
|
ref,
|
|
@@ -1416,7 +1327,7 @@ var DropdownMenuLabel = React4.forwardRef(({ className, inset, ...props }, ref)
|
|
|
1416
1327
|
}
|
|
1417
1328
|
));
|
|
1418
1329
|
DropdownMenuLabel.displayName = DropdownMenuPrimitive.Label.displayName;
|
|
1419
|
-
var DropdownMenuSeparator =
|
|
1330
|
+
var DropdownMenuSeparator = React2.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
1420
1331
|
DropdownMenuPrimitive.Separator,
|
|
1421
1332
|
{
|
|
1422
1333
|
ref,
|
|
@@ -1425,30 +1336,10 @@ var DropdownMenuSeparator = React4.forwardRef(({ className, ...props }, ref) =>
|
|
|
1425
1336
|
}
|
|
1426
1337
|
));
|
|
1427
1338
|
DropdownMenuSeparator.displayName = DropdownMenuPrimitive.Separator.displayName;
|
|
1428
|
-
var DropdownMenuShortcut = ({
|
|
1429
|
-
className,
|
|
1430
|
-
...props
|
|
1431
|
-
}) => {
|
|
1432
|
-
return /* @__PURE__ */ jsx13(
|
|
1433
|
-
"span",
|
|
1434
|
-
{
|
|
1435
|
-
className: cn("ml-auto text-xs tracking-widest opacity-60", className),
|
|
1436
|
-
...props
|
|
1437
|
-
}
|
|
1438
|
-
);
|
|
1439
|
-
};
|
|
1440
|
-
DropdownMenuShortcut.displayName = "DropdownMenuShortcut";
|
|
1441
|
-
|
|
1442
|
-
// src/client/components/ui/sheet.tsx
|
|
1443
|
-
import * as React5 from "react";
|
|
1444
|
-
import * as SheetPrimitive from "@radix-ui/react-dialog";
|
|
1445
|
-
import { cva as cva3 } from "class-variance-authority";
|
|
1446
|
-
import { X as X3 } from "lucide-react";
|
|
1447
|
-
import { jsx as jsx14, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1448
1339
|
var Sheet = SheetPrimitive.Root;
|
|
1449
1340
|
var SheetTrigger = SheetPrimitive.Trigger;
|
|
1450
1341
|
var SheetPortal = SheetPrimitive.Portal;
|
|
1451
|
-
var SheetOverlay =
|
|
1342
|
+
var SheetOverlay = React2.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
1452
1343
|
SheetPrimitive.Overlay,
|
|
1453
1344
|
{
|
|
1454
1345
|
className: cn(
|
|
@@ -1460,7 +1351,7 @@ var SheetOverlay = React5.forwardRef(({ className, ...props }, ref) => /* @__PUR
|
|
|
1460
1351
|
}
|
|
1461
1352
|
));
|
|
1462
1353
|
SheetOverlay.displayName = SheetPrimitive.Overlay.displayName;
|
|
1463
|
-
var sheetVariants =
|
|
1354
|
+
var sheetVariants = cva(
|
|
1464
1355
|
"fixed z-50 gap-4 bg-background p-6 shadow-lg transition ease-in-out data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:duration-500",
|
|
1465
1356
|
{
|
|
1466
1357
|
variants: {
|
|
@@ -1476,9 +1367,9 @@ var sheetVariants = cva3(
|
|
|
1476
1367
|
}
|
|
1477
1368
|
}
|
|
1478
1369
|
);
|
|
1479
|
-
var SheetContent =
|
|
1480
|
-
/* @__PURE__ */
|
|
1481
|
-
/* @__PURE__ */
|
|
1370
|
+
var SheetContent = React2.forwardRef(({ side = "right", className, children, ...props }, ref) => /* @__PURE__ */ jsxs(SheetPortal, { children: [
|
|
1371
|
+
/* @__PURE__ */ jsx(SheetOverlay, {}),
|
|
1372
|
+
/* @__PURE__ */ jsxs(
|
|
1482
1373
|
SheetPrimitive.Content,
|
|
1483
1374
|
{
|
|
1484
1375
|
ref,
|
|
@@ -1486,44 +1377,16 @@ var SheetContent = React5.forwardRef(({ side = "right", className, children, ...
|
|
|
1486
1377
|
...props,
|
|
1487
1378
|
children: [
|
|
1488
1379
|
children,
|
|
1489
|
-
/* @__PURE__ */
|
|
1490
|
-
/* @__PURE__ */
|
|
1491
|
-
/* @__PURE__ */
|
|
1380
|
+
/* @__PURE__ */ jsxs(SheetPrimitive.Close, { className: "absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-secondary", children: [
|
|
1381
|
+
/* @__PURE__ */ jsx(X, { className: "h-4 w-4" }),
|
|
1382
|
+
/* @__PURE__ */ jsx("span", { className: "sr-only", children: "Close" })
|
|
1492
1383
|
] })
|
|
1493
1384
|
]
|
|
1494
1385
|
}
|
|
1495
1386
|
)
|
|
1496
1387
|
] }));
|
|
1497
1388
|
SheetContent.displayName = SheetPrimitive.Content.displayName;
|
|
1498
|
-
var
|
|
1499
|
-
className,
|
|
1500
|
-
...props
|
|
1501
|
-
}) => /* @__PURE__ */ jsx14(
|
|
1502
|
-
"div",
|
|
1503
|
-
{
|
|
1504
|
-
className: cn(
|
|
1505
|
-
"flex flex-col space-y-2 text-center sm:text-left",
|
|
1506
|
-
className
|
|
1507
|
-
),
|
|
1508
|
-
...props
|
|
1509
|
-
}
|
|
1510
|
-
);
|
|
1511
|
-
SheetHeader.displayName = "SheetHeader";
|
|
1512
|
-
var SheetFooter = ({
|
|
1513
|
-
className,
|
|
1514
|
-
...props
|
|
1515
|
-
}) => /* @__PURE__ */ jsx14(
|
|
1516
|
-
"div",
|
|
1517
|
-
{
|
|
1518
|
-
className: cn(
|
|
1519
|
-
"flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",
|
|
1520
|
-
className
|
|
1521
|
-
),
|
|
1522
|
-
...props
|
|
1523
|
-
}
|
|
1524
|
-
);
|
|
1525
|
-
SheetFooter.displayName = "SheetFooter";
|
|
1526
|
-
var SheetTitle = React5.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx14(
|
|
1389
|
+
var SheetTitle = React2.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
1527
1390
|
SheetPrimitive.Title,
|
|
1528
1391
|
{
|
|
1529
1392
|
ref,
|
|
@@ -1532,7 +1395,7 @@ var SheetTitle = React5.forwardRef(({ className, ...props }, ref) => /* @__PURE_
|
|
|
1532
1395
|
}
|
|
1533
1396
|
));
|
|
1534
1397
|
SheetTitle.displayName = SheetPrimitive.Title.displayName;
|
|
1535
|
-
var SheetDescription =
|
|
1398
|
+
var SheetDescription = React2.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
1536
1399
|
SheetPrimitive.Description,
|
|
1537
1400
|
{
|
|
1538
1401
|
ref,
|
|
@@ -1541,15 +1404,10 @@ var SheetDescription = React5.forwardRef(({ className, ...props }, ref) => /* @_
|
|
|
1541
1404
|
}
|
|
1542
1405
|
));
|
|
1543
1406
|
SheetDescription.displayName = SheetPrimitive.Description.displayName;
|
|
1544
|
-
|
|
1545
|
-
// src/client/components/drive/storage/indicator.tsx
|
|
1546
|
-
import { useEffect as useEffect3 } from "react";
|
|
1547
|
-
import { Cloud, AlertCircle as AlertCircle3 } from "lucide-react";
|
|
1548
|
-
import { Fragment as Fragment2, jsx as jsx15, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
1549
1407
|
var DriveStorageIndicator = (props) => {
|
|
1550
1408
|
const { compact = false, className } = props;
|
|
1551
1409
|
const { quota, refreshQuota } = useDrive();
|
|
1552
|
-
|
|
1410
|
+
useEffect(() => {
|
|
1553
1411
|
refreshQuota();
|
|
1554
1412
|
}, []);
|
|
1555
1413
|
if (!quota) return null;
|
|
@@ -1557,33 +1415,32 @@ var DriveStorageIndicator = (props) => {
|
|
|
1557
1415
|
const isNearFull = percentage >= 90;
|
|
1558
1416
|
const isFull = percentage >= 100;
|
|
1559
1417
|
const stateColor = isFull ? "text-destructive" : isNearFull ? "text-yellow-600 dark:text-yellow-500" : "text-primary";
|
|
1560
|
-
const solidColor = isFull ? "bg-destructive" : isNearFull ? "bg-yellow-500" : "bg-primary";
|
|
1561
1418
|
if (compact) {
|
|
1562
|
-
return /* @__PURE__ */
|
|
1563
|
-
/* @__PURE__ */
|
|
1564
|
-
/* @__PURE__ */
|
|
1419
|
+
return /* @__PURE__ */ jsxs("div", { className: cn("flex items-center gap-3 text-xs font-medium text-muted-foreground", className), children: [
|
|
1420
|
+
/* @__PURE__ */ jsxs("span", { className: "shrink-0 flex items-center gap-1.5", children: [
|
|
1421
|
+
/* @__PURE__ */ jsx(Cloud, { className: "size-3.5" }),
|
|
1565
1422
|
"Storage"
|
|
1566
1423
|
] }),
|
|
1567
|
-
/* @__PURE__ */
|
|
1568
|
-
/* @__PURE__ */
|
|
1424
|
+
/* @__PURE__ */ jsx(Progress, { value: percentage, indicatorClassName: cn("bg-gradient-to-r from-blue-500 to-cyan-500", isNearFull && "from-yellow-500 to-orange-500", isFull && "bg-destructive"), className: "w-24 sm:w-32" }),
|
|
1425
|
+
/* @__PURE__ */ jsxs("span", { className: "shrink-0 whitespace-nowrap", children: [
|
|
1569
1426
|
formatBytes(usedInBytes),
|
|
1570
1427
|
" / ",
|
|
1571
1428
|
formatBytes(totalInBytes)
|
|
1572
1429
|
] })
|
|
1573
1430
|
] });
|
|
1574
1431
|
}
|
|
1575
|
-
return /* @__PURE__ */
|
|
1576
|
-
/* @__PURE__ */
|
|
1577
|
-
/* @__PURE__ */
|
|
1578
|
-
/* @__PURE__ */
|
|
1579
|
-
/* @__PURE__ */
|
|
1432
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1433
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-2 mb-2", children: [
|
|
1434
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
1435
|
+
/* @__PURE__ */ jsx(Cloud, { className: cn("size-4", stateColor) }),
|
|
1436
|
+
/* @__PURE__ */ jsx("span", { className: "text-xs font-medium text-muted-foreground", children: "Storage" })
|
|
1580
1437
|
] }),
|
|
1581
|
-
/* @__PURE__ */
|
|
1438
|
+
/* @__PURE__ */ jsxs("span", { className: "text-xs font-semibold tabular-nums", children: [
|
|
1582
1439
|
percentage,
|
|
1583
1440
|
"%"
|
|
1584
1441
|
] })
|
|
1585
1442
|
] }),
|
|
1586
|
-
/* @__PURE__ */
|
|
1443
|
+
/* @__PURE__ */ jsx(
|
|
1587
1444
|
Progress,
|
|
1588
1445
|
{
|
|
1589
1446
|
value: percentage,
|
|
@@ -1594,22 +1451,19 @@ var DriveStorageIndicator = (props) => {
|
|
|
1594
1451
|
)
|
|
1595
1452
|
}
|
|
1596
1453
|
),
|
|
1597
|
-
/* @__PURE__ */
|
|
1598
|
-
/* @__PURE__ */
|
|
1599
|
-
/* @__PURE__ */
|
|
1454
|
+
/* @__PURE__ */ jsxs("div", { className: "flex justify-between items-center mt-1.5", children: [
|
|
1455
|
+
/* @__PURE__ */ jsx("span", { className: "text-[10px] text-muted-foreground tabular-nums", children: formatBytes(usedInBytes) }),
|
|
1456
|
+
/* @__PURE__ */ jsx("span", { className: "text-[10px] text-muted-foreground tabular-nums", children: formatBytes(totalInBytes) })
|
|
1600
1457
|
] }),
|
|
1601
|
-
isNearFull && /* @__PURE__ */
|
|
1458
|
+
isNearFull && /* @__PURE__ */ jsxs("div", { className: cn(
|
|
1602
1459
|
"flex items-center gap-1.5 text-[10px] font-medium px-2 py-1 rounded-md mt-2",
|
|
1603
1460
|
isFull ? "bg-destructive/10 text-destructive" : "bg-yellow-500/10 text-yellow-600 dark:text-yellow-500"
|
|
1604
1461
|
), children: [
|
|
1605
|
-
/* @__PURE__ */
|
|
1606
|
-
/* @__PURE__ */
|
|
1462
|
+
/* @__PURE__ */ jsx(AlertCircle, { className: "size-3 shrink-0" }),
|
|
1463
|
+
/* @__PURE__ */ jsx("span", { children: isFull ? "Storage full" : "Almost full" })
|
|
1607
1464
|
] })
|
|
1608
1465
|
] });
|
|
1609
1466
|
};
|
|
1610
|
-
|
|
1611
|
-
// src/client/components/drive/sidebar.tsx
|
|
1612
|
-
import { Fragment as Fragment3, jsx as jsx16, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
1613
1467
|
var SidebarContent = () => {
|
|
1614
1468
|
const {
|
|
1615
1469
|
accounts,
|
|
@@ -1622,33 +1476,33 @@ var SidebarContent = () => {
|
|
|
1622
1476
|
} = useDrive();
|
|
1623
1477
|
const currentAccountName = activeAccountId ? accounts.find((a) => a.id === activeAccountId)?.name || "Unknown Account" : "Local Storage";
|
|
1624
1478
|
const currentAccountEmail = activeAccountId ? accounts.find((a) => a.id === activeAccountId)?.email : "On this device";
|
|
1625
|
-
return /* @__PURE__ */
|
|
1626
|
-
/* @__PURE__ */
|
|
1627
|
-
/* @__PURE__ */
|
|
1628
|
-
/* @__PURE__ */
|
|
1629
|
-
/* @__PURE__ */
|
|
1630
|
-
/* @__PURE__ */
|
|
1631
|
-
/* @__PURE__ */
|
|
1632
|
-
/* @__PURE__ */
|
|
1479
|
+
return /* @__PURE__ */ jsxs("div", { className: "w-full h-full flex flex-col bg-muted/10 border-r", children: [
|
|
1480
|
+
/* @__PURE__ */ jsx("div", { className: "p-3 border-b", children: /* @__PURE__ */ jsxs(DropdownMenu, { children: [
|
|
1481
|
+
/* @__PURE__ */ jsx(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(Button, { variant: "ghost", className: "w-full justify-between px-2 h-auto min-h-12 py-2 hover:bg-muted/50", children: [
|
|
1482
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 sm:gap-3 text-left min-w-0 flex-1", children: [
|
|
1483
|
+
/* @__PURE__ */ jsx("div", { className: "size-8 sm:size-9 rounded-md bg-primary/10 flex items-center justify-center shrink-0", children: activeAccountId ? /* @__PURE__ */ jsx(Database, { className: "size-4" }) : /* @__PURE__ */ jsx(HardDrive, { className: "size-4" }) }),
|
|
1484
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col truncate min-w-0", children: [
|
|
1485
|
+
/* @__PURE__ */ jsx("span", { className: "text-sm font-semibold truncate", children: currentAccountName }),
|
|
1486
|
+
/* @__PURE__ */ jsx("span", { className: "text-xs text-muted-foreground truncate font-normal", children: currentAccountEmail })
|
|
1633
1487
|
] })
|
|
1634
1488
|
] }),
|
|
1635
|
-
/* @__PURE__ */
|
|
1489
|
+
/* @__PURE__ */ jsx(ChevronsUpDown, { className: "size-4 text-muted-foreground shrink-0 opacity-50 ml-1" })
|
|
1636
1490
|
] }) }),
|
|
1637
|
-
/* @__PURE__ */
|
|
1638
|
-
/* @__PURE__ */
|
|
1639
|
-
/* @__PURE__ */
|
|
1640
|
-
/* @__PURE__ */
|
|
1641
|
-
/* @__PURE__ */
|
|
1642
|
-
activeAccountId === null && /* @__PURE__ */
|
|
1491
|
+
/* @__PURE__ */ jsxs(DropdownMenuContent, { className: "w-60", align: "start", children: [
|
|
1492
|
+
/* @__PURE__ */ jsx(DropdownMenuLabel, { className: "text-xs font-normal text-muted-foreground", children: "Switch Account" }),
|
|
1493
|
+
/* @__PURE__ */ jsxs(DropdownMenuItem, { onClick: () => setActiveAccountId(null), className: "gap-2", children: [
|
|
1494
|
+
/* @__PURE__ */ jsx("div", { className: "flex items-center justify-center size-6 rounded bg-muted", children: /* @__PURE__ */ jsx(HardDrive, { className: "size-3.5" }) }),
|
|
1495
|
+
/* @__PURE__ */ jsx("div", { className: "flex flex-col flex-1", children: /* @__PURE__ */ jsx("span", { className: "text-sm font-medium", children: "Local Storage" }) }),
|
|
1496
|
+
activeAccountId === null && /* @__PURE__ */ jsx(Check, { className: "size-3.5 text-primary" })
|
|
1643
1497
|
] }),
|
|
1644
|
-
accounts.length > 0 && /* @__PURE__ */
|
|
1645
|
-
accounts.map((account) => /* @__PURE__ */
|
|
1646
|
-
/* @__PURE__ */
|
|
1647
|
-
/* @__PURE__ */
|
|
1648
|
-
/* @__PURE__ */
|
|
1649
|
-
/* @__PURE__ */
|
|
1498
|
+
accounts.length > 0 && /* @__PURE__ */ jsx(DropdownMenuSeparator, {}),
|
|
1499
|
+
accounts.map((account) => /* @__PURE__ */ jsxs(DropdownMenuItem, { onClick: () => setActiveAccountId(account.id), className: "gap-2 group", children: [
|
|
1500
|
+
/* @__PURE__ */ jsx("div", { className: "flex items-center justify-center size-6 rounded bg-muted", children: /* @__PURE__ */ jsx(Database, { className: "size-3.5" }) }),
|
|
1501
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col flex-1 overflow-hidden", children: [
|
|
1502
|
+
/* @__PURE__ */ jsx("span", { className: "text-sm font-medium truncate", children: account.name }),
|
|
1503
|
+
/* @__PURE__ */ jsx("span", { className: "text-xs text-muted-foreground truncate", children: account.email })
|
|
1650
1504
|
] }),
|
|
1651
|
-
activeAccountId === account.id ? /* @__PURE__ */
|
|
1505
|
+
activeAccountId === account.id ? /* @__PURE__ */ jsx(Check, { className: "size-3.5 text-primary" }) : /* @__PURE__ */ jsx(
|
|
1652
1506
|
LogOut,
|
|
1653
1507
|
{
|
|
1654
1508
|
className: "size-3.5 text-destructive transition-opacity hover:bg-destructive/10 rounded-sm",
|
|
@@ -1663,13 +1517,13 @@ var SidebarContent = () => {
|
|
|
1663
1517
|
}
|
|
1664
1518
|
)
|
|
1665
1519
|
] }, account.id)),
|
|
1666
|
-
/* @__PURE__ */
|
|
1667
|
-
/* @__PURE__ */
|
|
1668
|
-
/* @__PURE__ */
|
|
1669
|
-
/* @__PURE__ */
|
|
1670
|
-
/* @__PURE__ */
|
|
1520
|
+
/* @__PURE__ */ jsx(DropdownMenuSeparator, {}),
|
|
1521
|
+
/* @__PURE__ */ jsxs(DropdownMenuSub, { children: [
|
|
1522
|
+
/* @__PURE__ */ jsxs(DropdownMenuSubTrigger, { className: "gap-2 text-primary focus:text-primary", children: [
|
|
1523
|
+
/* @__PURE__ */ jsx(Plus, { className: "size-4" }),
|
|
1524
|
+
/* @__PURE__ */ jsx("span", { className: "font-medium", children: "Add Storage Account" })
|
|
1671
1525
|
] }),
|
|
1672
|
-
/* @__PURE__ */
|
|
1526
|
+
/* @__PURE__ */ jsx(DropdownMenuSubContent, { children: /* @__PURE__ */ jsx(DropdownMenuItem, { onClick: async () => {
|
|
1673
1527
|
const res = await callAPI("getAuthUrl", { query: { provider: "GOOGLE" } });
|
|
1674
1528
|
if (res.status !== 200 || !res.data?.url) {
|
|
1675
1529
|
alert(res.message || "Failed to initialize account connection");
|
|
@@ -1697,72 +1551,53 @@ var SidebarContent = () => {
|
|
|
1697
1551
|
] })
|
|
1698
1552
|
] })
|
|
1699
1553
|
] }) }),
|
|
1700
|
-
/* @__PURE__ */
|
|
1701
|
-
/* @__PURE__ */
|
|
1554
|
+
/* @__PURE__ */ jsxs("div", { className: "flex-1 px-3 py-2 space-y-1", children: [
|
|
1555
|
+
/* @__PURE__ */ jsxs(
|
|
1702
1556
|
Button,
|
|
1703
1557
|
{
|
|
1704
1558
|
variant: currentView !== "TRASH" ? "secondary" : "ghost",
|
|
1705
1559
|
className: cn("w-full justify-start gap-3", currentView !== "TRASH" && "bg-primary/10 text-primary hover:bg-primary/15"),
|
|
1706
1560
|
onClick: () => setCurrentView("BROWSE"),
|
|
1707
1561
|
children: [
|
|
1708
|
-
/* @__PURE__ */
|
|
1562
|
+
/* @__PURE__ */ jsx(FolderOpen, { className: "size-4" }),
|
|
1709
1563
|
"My Files"
|
|
1710
1564
|
]
|
|
1711
1565
|
}
|
|
1712
1566
|
),
|
|
1713
|
-
/* @__PURE__ */
|
|
1567
|
+
/* @__PURE__ */ jsxs(
|
|
1714
1568
|
Button,
|
|
1715
1569
|
{
|
|
1716
1570
|
variant: currentView === "TRASH" ? "secondary" : "ghost",
|
|
1717
1571
|
className: cn("w-full justify-start gap-3", currentView === "TRASH" && "bg-destructive/10 text-destructive hover:bg-destructive/15"),
|
|
1718
1572
|
onClick: () => setCurrentView("TRASH"),
|
|
1719
1573
|
children: [
|
|
1720
|
-
/* @__PURE__ */
|
|
1574
|
+
/* @__PURE__ */ jsx(Trash2, { className: "size-4" }),
|
|
1721
1575
|
"Trash"
|
|
1722
1576
|
]
|
|
1723
1577
|
}
|
|
1724
1578
|
)
|
|
1725
1579
|
] }),
|
|
1726
|
-
/* @__PURE__ */
|
|
1580
|
+
/* @__PURE__ */ jsx("div", { className: "px-3 py-2.5 mt-auto border-t bg-background/50", children: /* @__PURE__ */ jsx(DriveStorageIndicator, {}) })
|
|
1727
1581
|
] });
|
|
1728
1582
|
};
|
|
1729
1583
|
var DriveSidebar = () => {
|
|
1730
|
-
return /* @__PURE__ */
|
|
1731
|
-
/* @__PURE__ */
|
|
1732
|
-
/* @__PURE__ */
|
|
1584
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1585
|
+
/* @__PURE__ */ jsx("div", { className: "lg:hidden", children: /* @__PURE__ */ jsxs(Sheet, { children: [
|
|
1586
|
+
/* @__PURE__ */ jsx(SheetTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
1733
1587
|
Button,
|
|
1734
1588
|
{
|
|
1735
1589
|
variant: "ghost",
|
|
1736
1590
|
size: "icon",
|
|
1737
1591
|
className: "h-9 w-9",
|
|
1738
1592
|
"aria-label": "Open menu",
|
|
1739
|
-
children: /* @__PURE__ */
|
|
1593
|
+
children: /* @__PURE__ */ jsx(Menu, { className: "h-5 w-5" })
|
|
1740
1594
|
}
|
|
1741
1595
|
) }),
|
|
1742
|
-
/* @__PURE__ */
|
|
1596
|
+
/* @__PURE__ */ jsx(SheetContent, { side: "left", className: "w-70 sm:w-80 p-0", children: /* @__PURE__ */ jsx(SidebarContent, {}) })
|
|
1743
1597
|
] }) }),
|
|
1744
|
-
/* @__PURE__ */
|
|
1598
|
+
/* @__PURE__ */ jsx("div", { className: "hidden lg:flex w-full h-full", children: /* @__PURE__ */ jsx(SidebarContent, {}) })
|
|
1745
1599
|
] });
|
|
1746
1600
|
};
|
|
1747
|
-
|
|
1748
|
-
// src/client/components/drive/explorer.tsx
|
|
1749
|
-
import {
|
|
1750
|
-
DndContext,
|
|
1751
|
-
closestCenter,
|
|
1752
|
-
KeyboardSensor,
|
|
1753
|
-
PointerSensor,
|
|
1754
|
-
useSensor,
|
|
1755
|
-
useSensors
|
|
1756
|
-
} from "@dnd-kit/core";
|
|
1757
|
-
import {
|
|
1758
|
-
arrayMove,
|
|
1759
|
-
SortableContext,
|
|
1760
|
-
sortableKeyboardCoordinates,
|
|
1761
|
-
rectSortingStrategy,
|
|
1762
|
-
useSortable
|
|
1763
|
-
} from "@dnd-kit/sortable";
|
|
1764
|
-
import { CSS } from "@dnd-kit/utilities";
|
|
1765
|
-
import { Fragment as Fragment4, jsx as jsx17, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
1766
1601
|
var SortableItem = ({ id, children, disabled, isDragOverTarget }) => {
|
|
1767
1602
|
const {
|
|
1768
1603
|
attributes,
|
|
@@ -1779,7 +1614,7 @@ var SortableItem = ({ id, children, disabled, isDragOverTarget }) => {
|
|
|
1779
1614
|
zIndex: isDragging ? 50 : "auto",
|
|
1780
1615
|
position: "relative"
|
|
1781
1616
|
};
|
|
1782
|
-
return /* @__PURE__ */
|
|
1617
|
+
return /* @__PURE__ */ jsx("div", { ref: setNodeRef, style, ...attributes, ...listeners, children });
|
|
1783
1618
|
};
|
|
1784
1619
|
var DriveExplorer = (props) => {
|
|
1785
1620
|
const { onItemClick, onItemDoubleClick, mimeFilter, className, selectableFolders = false } = props;
|
|
@@ -1807,15 +1642,15 @@ var DriveExplorer = (props) => {
|
|
|
1807
1642
|
moveItem,
|
|
1808
1643
|
deleteItems
|
|
1809
1644
|
} = useDrive();
|
|
1810
|
-
const [dialogs, setDialogs] =
|
|
1645
|
+
const [dialogs, setDialogs] = React2__default.useState({
|
|
1811
1646
|
newFolder: false,
|
|
1812
1647
|
rename: false,
|
|
1813
1648
|
delete: false
|
|
1814
1649
|
});
|
|
1815
|
-
const [itemToDelete, setItemToDelete] =
|
|
1816
|
-
const [renameItem, setRenameItem] =
|
|
1817
|
-
const [dragOverFolderId, setDragOverFolderId] =
|
|
1818
|
-
const [draggingItemId, setDraggingItemId] =
|
|
1650
|
+
const [itemToDelete, setItemToDelete] = React2__default.useState(null);
|
|
1651
|
+
const [renameItem, setRenameItem] = React2__default.useState(null);
|
|
1652
|
+
const [dragOverFolderId, setDragOverFolderId] = React2__default.useState(null);
|
|
1653
|
+
const [draggingItemId, setDraggingItemId] = React2__default.useState(null);
|
|
1819
1654
|
const sensors = useSensors(
|
|
1820
1655
|
useSensor(PointerSensor, { activationConstraint: { distance: 8 } }),
|
|
1821
1656
|
// Prevent drag on simple click
|
|
@@ -1872,7 +1707,7 @@ var DriveExplorer = (props) => {
|
|
|
1872
1707
|
body: JSON.stringify({ ids: newOrderIds })
|
|
1873
1708
|
});
|
|
1874
1709
|
};
|
|
1875
|
-
const processedItems =
|
|
1710
|
+
const processedItems = useMemo(() => {
|
|
1876
1711
|
let filtered = items;
|
|
1877
1712
|
if (mimeFilter) {
|
|
1878
1713
|
filtered = filtered.filter((item) => matchesMimeFilter(item.information.type === "FILE" ? item.information.mime : "", item.information.type === "FOLDER", mimeFilter));
|
|
@@ -1901,7 +1736,7 @@ var DriveExplorer = (props) => {
|
|
|
1901
1736
|
return 0;
|
|
1902
1737
|
});
|
|
1903
1738
|
}, [items, mimeFilter, sortBy]);
|
|
1904
|
-
const groupedItems =
|
|
1739
|
+
const groupedItems = useMemo(() => {
|
|
1905
1740
|
if (groupBy === "NONE") return { "All": processedItems };
|
|
1906
1741
|
const groups = {
|
|
1907
1742
|
"Today": [],
|
|
@@ -1923,8 +1758,8 @@ var DriveExplorer = (props) => {
|
|
|
1923
1758
|
});
|
|
1924
1759
|
return Object.fromEntries(Object.entries(groups).filter(([_, items2]) => items2.length > 0));
|
|
1925
1760
|
}, [processedItems, groupBy]);
|
|
1926
|
-
const observerTarget =
|
|
1927
|
-
|
|
1761
|
+
const observerTarget = useRef(null);
|
|
1762
|
+
useEffect(() => {
|
|
1928
1763
|
const observer = new IntersectionObserver((entries) => {
|
|
1929
1764
|
if (entries[0].isIntersecting && hasMore && !isLoadingMore) loadMore();
|
|
1930
1765
|
}, { threshold: 0.1 });
|
|
@@ -1933,9 +1768,9 @@ var DriveExplorer = (props) => {
|
|
|
1933
1768
|
if (observerTarget.current) observer.unobserve(observerTarget.current);
|
|
1934
1769
|
};
|
|
1935
1770
|
}, [hasMore, isLoadingMore, loadMore]);
|
|
1936
|
-
const lastTapTime =
|
|
1937
|
-
const lastTapItemId =
|
|
1938
|
-
const tapTimeout =
|
|
1771
|
+
const lastTapTime = useRef(0);
|
|
1772
|
+
const lastTapItemId = useRef(null);
|
|
1773
|
+
const tapTimeout = useRef(null);
|
|
1939
1774
|
const handleItemClick = (e, item) => {
|
|
1940
1775
|
const isTouchEvent = e.type === "touchend";
|
|
1941
1776
|
if (isTouchEvent) {
|
|
@@ -2000,7 +1835,7 @@ var DriveExplorer = (props) => {
|
|
|
2000
1835
|
if (currentView === "BROWSE") navigateToFolder(item);
|
|
2001
1836
|
} else onItemDoubleClick?.(item);
|
|
2002
1837
|
};
|
|
2003
|
-
|
|
1838
|
+
useEffect(() => {
|
|
2004
1839
|
return () => {
|
|
2005
1840
|
if (tapTimeout.current) clearTimeout(tapTimeout.current);
|
|
2006
1841
|
};
|
|
@@ -2008,57 +1843,57 @@ var DriveExplorer = (props) => {
|
|
|
2008
1843
|
const enableDrag = currentView === "BROWSE";
|
|
2009
1844
|
const stateContent = (() => {
|
|
2010
1845
|
if (isLoading && items.length === 0) {
|
|
2011
|
-
return /* @__PURE__ */
|
|
1846
|
+
return /* @__PURE__ */ jsx("div", { className: "flex items-center justify-center py-12 flex-1", children: /* @__PURE__ */ jsx(Loader2, { className: "size-6 animate-spin text-muted-foreground" }) });
|
|
2012
1847
|
}
|
|
2013
1848
|
if (error) {
|
|
2014
|
-
return /* @__PURE__ */
|
|
1849
|
+
return /* @__PURE__ */ jsx("div", { className: "flex items-center justify-center p-12 text-destructive bg-destructive/10 rounded-lg flex-1", children: error });
|
|
2015
1850
|
}
|
|
2016
1851
|
if (processedItems.length === 0) {
|
|
2017
|
-
return /* @__PURE__ */
|
|
2018
|
-
/* @__PURE__ */
|
|
2019
|
-
/* @__PURE__ */
|
|
2020
|
-
/* @__PURE__ */
|
|
2021
|
-
currentView === "BROWSE" && /* @__PURE__ */
|
|
1852
|
+
return /* @__PURE__ */ jsxs(ContextMenu, { children: [
|
|
1853
|
+
/* @__PURE__ */ jsx(ContextMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxs("div", { className: cn("flex flex-col items-center justify-center py-12 text-center flex-1", className), children: [
|
|
1854
|
+
/* @__PURE__ */ jsx("div", { className: "size-12 rounded-full bg-muted flex items-center justify-center mb-3", children: /* @__PURE__ */ jsx(Folder, { className: "size-6 text-muted-foreground" }) }),
|
|
1855
|
+
/* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: currentView === "SEARCH" ? "No files match your search" : currentView === "TRASH" ? "Trash is empty" : "No files found" }),
|
|
1856
|
+
currentView === "BROWSE" && /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground/60 mt-1", children: "Right-click to create a folder" })
|
|
2022
1857
|
] }) }),
|
|
2023
|
-
/* @__PURE__ */
|
|
2024
|
-
/* @__PURE__ */
|
|
1858
|
+
/* @__PURE__ */ jsx(ContextMenuContent, { children: currentView === "BROWSE" ? /* @__PURE__ */ jsxs(ContextMenuItem, { onClick: () => setDialogs((prev) => ({ ...prev, newFolder: true })), children: [
|
|
1859
|
+
/* @__PURE__ */ jsx(FolderPlus, { className: "mr-2 size-4" }),
|
|
2025
1860
|
" New Folder"
|
|
2026
|
-
] }) : /* @__PURE__ */
|
|
1861
|
+
] }) : /* @__PURE__ */ jsx("div", { className: "px-2 py-6 text-center", children: /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: "No actions available" }) }) })
|
|
2027
1862
|
] });
|
|
2028
1863
|
}
|
|
2029
1864
|
return null;
|
|
2030
1865
|
})();
|
|
2031
|
-
return /* @__PURE__ */
|
|
2032
|
-
/* @__PURE__ */
|
|
2033
|
-
/* @__PURE__ */
|
|
2034
|
-
/* @__PURE__ */
|
|
2035
|
-
/* @__PURE__ */
|
|
1866
|
+
return /* @__PURE__ */ jsx(DndContext, { sensors, collisionDetection: closestCenter, onDragStart: handleDragStart, onDragOver: handleDragOver, onDragEnd: handleDragEnd, children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col h-full w-full overflow-hidden bg-background/50", children: [
|
|
1867
|
+
/* @__PURE__ */ jsxs("div", { className: "h-14 px-3 sm:px-4 border-b bg-background/95 backdrop-blur-sm shrink-0 flex items-center gap-3", children: [
|
|
1868
|
+
/* @__PURE__ */ jsx("div", { className: "lg:hidden", children: /* @__PURE__ */ jsx(DriveSidebar, {}) }),
|
|
1869
|
+
/* @__PURE__ */ jsx("div", { className: "hidden lg:flex flex-1 min-w-0", children: /* @__PURE__ */ jsx(DrivePathBar, {}) }),
|
|
1870
|
+
/* @__PURE__ */ jsx(DriveUpload, { compact: true, onComplete: () => refreshItems() })
|
|
2036
1871
|
] }),
|
|
2037
|
-
/* @__PURE__ */
|
|
2038
|
-
stateContent || /* @__PURE__ */
|
|
2039
|
-
/* @__PURE__ */
|
|
2040
|
-
/* @__PURE__ */
|
|
2041
|
-
groupBy !== "NONE" && /* @__PURE__ */
|
|
1872
|
+
/* @__PURE__ */ jsx("div", { className: "lg:hidden px-3 py-2 border-b bg-background/95 backdrop-blur-sm shrink-0", children: /* @__PURE__ */ jsx(DrivePathBar, {}) }),
|
|
1873
|
+
stateContent || /* @__PURE__ */ jsxs(ContextMenu, { children: [
|
|
1874
|
+
/* @__PURE__ */ jsx(ContextMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxs("div", { className: cn("flex-1 overflow-y-auto min-h-0 container mx-auto p-2 sm:p-3 md:p-4", className), children: [
|
|
1875
|
+
/* @__PURE__ */ jsx("div", { className: "space-y-4 sm:space-y-6 pb-8 sm:pb-12", children: Object.entries(groupedItems).map(([groupName, groupItems]) => /* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
|
|
1876
|
+
groupBy !== "NONE" && /* @__PURE__ */ jsxs("h3", { className: "text-sm font-medium text-muted-foreground flex items-center gap-2", children: [
|
|
2042
1877
|
groupName,
|
|
2043
1878
|
" ",
|
|
2044
|
-
/* @__PURE__ */
|
|
1879
|
+
/* @__PURE__ */ jsxs("span", { className: "text-xs opacity-50", children: [
|
|
2045
1880
|
"(",
|
|
2046
1881
|
groupItems.length,
|
|
2047
1882
|
")"
|
|
2048
1883
|
] })
|
|
2049
1884
|
] }),
|
|
2050
|
-
/* @__PURE__ */
|
|
1885
|
+
/* @__PURE__ */ jsx(SortableContext, { items: groupItems.map((i) => i.id), strategy: rectSortingStrategy, disabled: !enableDrag, children: /* @__PURE__ */ jsx("div", { className: cn(
|
|
2051
1886
|
viewMode === "GRID" ? "grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 xl:grid-cols-6 2xl:grid-cols-7 gap-2 sm:gap-3 md:gap-4" : "flex flex-col gap-1"
|
|
2052
1887
|
), children: groupItems.map((item) => {
|
|
2053
1888
|
const isSelected = selectedFileIds.includes(item.id);
|
|
2054
1889
|
const isFolder = item.information.type === "FOLDER";
|
|
2055
1890
|
const isDragOver = isFolder && dragOverFolderId === item.id;
|
|
2056
1891
|
const tokenParam = item.token ? `&token=${item.token}` : "";
|
|
2057
|
-
|
|
1892
|
+
`${apiEndpoint}?action=serve&id=${item.id}${tokenParam}`;
|
|
2058
1893
|
const thumbnailUrl = `${apiEndpoint}?action=thumbnail&id=${item.id}&size=${viewMode === "GRID" ? "medium" : "small"}${tokenParam}`;
|
|
2059
1894
|
const isThumbnailable = !isFolder && item.information.type === "FILE" && (item.information.mime.startsWith("image/") || item.information.mime.startsWith("video/"));
|
|
2060
|
-
return /* @__PURE__ */
|
|
2061
|
-
/* @__PURE__ */
|
|
1895
|
+
return /* @__PURE__ */ jsx(SortableItem, { id: item.id, disabled: !enableDrag, isDragOverTarget: isDragOver, children: /* @__PURE__ */ jsxs(ContextMenu, { children: [
|
|
1896
|
+
/* @__PURE__ */ jsx(ContextMenuTrigger, { children: /* @__PURE__ */ jsx(
|
|
2062
1897
|
"div",
|
|
2063
1898
|
{
|
|
2064
1899
|
className: cn(
|
|
@@ -2075,65 +1910,65 @@ var DriveExplorer = (props) => {
|
|
|
2075
1910
|
onDoubleClick: (e) => handleItemDoubleClick(e, item),
|
|
2076
1911
|
role: "button",
|
|
2077
1912
|
tabIndex: 0,
|
|
2078
|
-
children: viewMode === "GRID" ? /* @__PURE__ */
|
|
2079
|
-
/* @__PURE__ */
|
|
2080
|
-
isThumbnailable ? /* @__PURE__ */
|
|
2081
|
-
isSelected && /* @__PURE__ */
|
|
2082
|
-
isFolder && currentView === "BROWSE" && /* @__PURE__ */
|
|
1913
|
+
children: viewMode === "GRID" ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1914
|
+
/* @__PURE__ */ jsxs("div", { className: "aspect-square w-full bg-muted/20 flex items-center justify-center overflow-hidden relative", children: [
|
|
1915
|
+
isThumbnailable ? /* @__PURE__ */ jsx("img", { src: thumbnailUrl, alt: item.name, className: "size-full object-contain transition-transform group-hover:scale-105 duration-300", loading: "lazy" }) : /* @__PURE__ */ jsx("div", { className: "transition-transform group-hover:scale-110 duration-200", children: getFileIcon(item.information.type === "FILE" ? item.information.mime : "", isFolder, "size-10 text-muted-foreground/70") }),
|
|
1916
|
+
isSelected && /* @__PURE__ */ jsx("div", { className: "absolute top-2 right-2 size-5 bg-primary rounded-full flex items-center justify-center shadow-sm animate-in zoom-in-50", children: /* @__PURE__ */ jsx("div", { className: "size-2 bg-primary-foreground rounded-full" }) }),
|
|
1917
|
+
isFolder && currentView === "BROWSE" && /* @__PURE__ */ jsx("div", { className: "absolute bottom-2 right-2 lg:hidden size-6 bg-primary/90 rounded-full flex items-center justify-center shadow-md", children: /* @__PURE__ */ jsx(ChevronRight, { className: "size-3.5 text-primary-foreground" }) })
|
|
2083
1918
|
] }),
|
|
2084
|
-
/* @__PURE__ */
|
|
2085
|
-
/* @__PURE__ */
|
|
2086
|
-
/* @__PURE__ */
|
|
1919
|
+
/* @__PURE__ */ jsxs("div", { className: "p-3", children: [
|
|
1920
|
+
/* @__PURE__ */ jsx("div", { className: "flex items-start justify-between gap-2", children: /* @__PURE__ */ jsx("span", { className: "text-sm font-medium truncate w-full text-card-foreground", title: item.name, children: item.name }) }),
|
|
1921
|
+
/* @__PURE__ */ jsx("div", { className: "flex items-center justify-between mt-1 text-xs text-muted-foreground", children: /* @__PURE__ */ jsx("span", { children: isFolder ? "Folder" : formatBytes(item.information.type === "FILE" ? item.information.sizeInBytes : 0) }) })
|
|
2087
1922
|
] })
|
|
2088
|
-
] }) : /* @__PURE__ */
|
|
2089
|
-
/* @__PURE__ */
|
|
2090
|
-
/* @__PURE__ */
|
|
2091
|
-
/* @__PURE__ */
|
|
2092
|
-
isFolder && currentView === "BROWSE" && /* @__PURE__ */
|
|
1923
|
+
] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1924
|
+
/* @__PURE__ */ jsx("div", { className: "size-9 shrink-0 rounded-md overflow-hidden bg-muted/40 flex items-center justify-center border", children: isThumbnailable ? /* @__PURE__ */ jsx("img", { src: thumbnailUrl, alt: item.name, className: "size-full object-contain", loading: "lazy" }) : getFileIcon(item.information.type === "FILE" ? item.information.mime : "", isFolder, "size-4 text-muted-foreground") }),
|
|
1925
|
+
/* @__PURE__ */ jsx("span", { className: "text-sm font-medium truncate flex-1 text-card-foreground", title: item.name, children: item.name }),
|
|
1926
|
+
/* @__PURE__ */ jsx("span", { className: "text-xs text-muted-foreground w-20 text-right", children: isFolder ? "-" : formatBytes(item.information.type === "FILE" ? item.information.sizeInBytes : 0) }),
|
|
1927
|
+
isFolder && currentView === "BROWSE" && /* @__PURE__ */ jsx(ChevronRight, { className: "size-4 text-muted-foreground lg:hidden shrink-0" })
|
|
2093
1928
|
] })
|
|
2094
1929
|
}
|
|
2095
1930
|
) }),
|
|
2096
|
-
/* @__PURE__ */
|
|
2097
|
-
/* @__PURE__ */
|
|
1931
|
+
/* @__PURE__ */ jsx(ContextMenuContent, { children: currentView === "TRASH" ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1932
|
+
/* @__PURE__ */ jsxs(ContextMenuItem, { onClick: async () => {
|
|
2098
1933
|
await callAPI("restore", { method: "POST", query: { id: item.id } });
|
|
2099
1934
|
await refreshItems();
|
|
2100
1935
|
}, children: [
|
|
2101
|
-
/* @__PURE__ */
|
|
1936
|
+
/* @__PURE__ */ jsx(RotateCcw, { className: "mr-2 size-4" }),
|
|
2102
1937
|
" Restore"
|
|
2103
1938
|
] }),
|
|
2104
|
-
/* @__PURE__ */
|
|
2105
|
-
/* @__PURE__ */
|
|
1939
|
+
/* @__PURE__ */ jsx(ContextMenuSeparator, {}),
|
|
1940
|
+
/* @__PURE__ */ jsxs(ContextMenuItem, { className: "text-destructive focus:text-destructive", onClick: () => {
|
|
2106
1941
|
setItemToDelete(item);
|
|
2107
1942
|
setDialogs((prev) => ({ ...prev, delete: true }));
|
|
2108
1943
|
}, children: [
|
|
2109
|
-
/* @__PURE__ */
|
|
1944
|
+
/* @__PURE__ */ jsx(Trash2, { className: "mr-2 size-4" }),
|
|
2110
1945
|
" Delete Forever"
|
|
2111
1946
|
] })
|
|
2112
|
-
] }) : /* @__PURE__ */
|
|
2113
|
-
/* @__PURE__ */
|
|
1947
|
+
] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1948
|
+
/* @__PURE__ */ jsxs(ContextMenuItem, { onClick: () => {
|
|
2114
1949
|
setRenameItem(item);
|
|
2115
1950
|
setDialogs((prev) => ({ ...prev, rename: true }));
|
|
2116
1951
|
}, children: [
|
|
2117
|
-
/* @__PURE__ */
|
|
1952
|
+
/* @__PURE__ */ jsx(Pencil, { className: "mr-2 size-4" }),
|
|
2118
1953
|
" Rename"
|
|
2119
1954
|
] }),
|
|
2120
|
-
/* @__PURE__ */
|
|
2121
|
-
/* @__PURE__ */
|
|
1955
|
+
/* @__PURE__ */ jsx(ContextMenuSeparator, {}),
|
|
1956
|
+
/* @__PURE__ */ jsxs(ContextMenuItem, { className: "text-destructive focus:text-destructive", onClick: () => {
|
|
2122
1957
|
setItemToDelete(item);
|
|
2123
1958
|
setDialogs((prev) => ({ ...prev, delete: true }));
|
|
2124
1959
|
}, children: [
|
|
2125
|
-
/* @__PURE__ */
|
|
1960
|
+
/* @__PURE__ */ jsx(Trash2, { className: "mr-2 size-4" }),
|
|
2126
1961
|
" Delete"
|
|
2127
1962
|
] })
|
|
2128
1963
|
] }) })
|
|
2129
1964
|
] }) }, item.id);
|
|
2130
1965
|
}) }) })
|
|
2131
1966
|
] }, groupName)) }),
|
|
2132
|
-
hasMore && /* @__PURE__ */
|
|
2133
|
-
isLoadingMore && /* @__PURE__ */
|
|
2134
|
-
!isLoadingMore && /* @__PURE__ */
|
|
1967
|
+
hasMore && /* @__PURE__ */ jsxs("div", { ref: observerTarget, className: "flex justify-center py-4", children: [
|
|
1968
|
+
isLoadingMore && /* @__PURE__ */ jsx(Loader2, { className: "size-6 animate-spin text-muted-foreground" }),
|
|
1969
|
+
!isLoadingMore && /* @__PURE__ */ jsx("div", { className: "h-4 w-full" })
|
|
2135
1970
|
] }),
|
|
2136
|
-
/* @__PURE__ */
|
|
1971
|
+
/* @__PURE__ */ jsx(
|
|
2137
1972
|
DialogConfirmation,
|
|
2138
1973
|
{
|
|
2139
1974
|
open: dialogs.newFolder,
|
|
@@ -2155,7 +1990,7 @@ var DriveExplorer = (props) => {
|
|
|
2155
1990
|
}
|
|
2156
1991
|
}
|
|
2157
1992
|
),
|
|
2158
|
-
/* @__PURE__ */
|
|
1993
|
+
/* @__PURE__ */ jsx(
|
|
2159
1994
|
DialogConfirmation,
|
|
2160
1995
|
{
|
|
2161
1996
|
open: dialogs.rename,
|
|
@@ -2183,7 +2018,7 @@ var DriveExplorer = (props) => {
|
|
|
2183
2018
|
}
|
|
2184
2019
|
}
|
|
2185
2020
|
),
|
|
2186
|
-
/* @__PURE__ */
|
|
2021
|
+
/* @__PURE__ */ jsx(
|
|
2187
2022
|
DialogConfirmation,
|
|
2188
2023
|
{
|
|
2189
2024
|
open: dialogs.delete,
|
|
@@ -2207,32 +2042,13 @@ var DriveExplorer = (props) => {
|
|
|
2207
2042
|
}
|
|
2208
2043
|
)
|
|
2209
2044
|
] }) }),
|
|
2210
|
-
/* @__PURE__ */
|
|
2211
|
-
/* @__PURE__ */
|
|
2045
|
+
/* @__PURE__ */ jsx(ContextMenuContent, { children: currentView === "BROWSE" ? /* @__PURE__ */ jsxs(ContextMenuItem, { onClick: () => setDialogs((prev) => ({ ...prev, newFolder: true })), children: [
|
|
2046
|
+
/* @__PURE__ */ jsx(FolderPlus, { className: "mr-2 size-4" }),
|
|
2212
2047
|
" New Folder"
|
|
2213
|
-
] }) : /* @__PURE__ */
|
|
2048
|
+
] }) : /* @__PURE__ */ jsx("div", { className: "px-2 py-6 text-center", children: /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: "No actions available" }) }) })
|
|
2214
2049
|
] })
|
|
2215
2050
|
] }) });
|
|
2216
2051
|
};
|
|
2217
|
-
|
|
2218
|
-
// src/client/components/drive/header.tsx
|
|
2219
|
-
import { useState as useState5 } from "react";
|
|
2220
|
-
import {
|
|
2221
|
-
Trash2 as Trash23,
|
|
2222
|
-
ArrowUpDown,
|
|
2223
|
-
LayoutGrid,
|
|
2224
|
-
List,
|
|
2225
|
-
Group as Group3,
|
|
2226
|
-
Calendar,
|
|
2227
|
-
ArrowDownAZ,
|
|
2228
|
-
ArrowUpAZ,
|
|
2229
|
-
ArrowDown01,
|
|
2230
|
-
ArrowUp01,
|
|
2231
|
-
Check as Check4,
|
|
2232
|
-
RotateCcw as RotateCcw2,
|
|
2233
|
-
Menu as Menu2
|
|
2234
|
-
} from "lucide-react";
|
|
2235
|
-
import { jsx as jsx18, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
2236
2052
|
var DriveHeader = () => {
|
|
2237
2053
|
const {
|
|
2238
2054
|
viewMode,
|
|
@@ -2254,21 +2070,21 @@ var DriveHeader = () => {
|
|
|
2254
2070
|
searchScope,
|
|
2255
2071
|
setSearchScope
|
|
2256
2072
|
} = useDrive();
|
|
2257
|
-
const [dialogs, setDialogs] =
|
|
2258
|
-
return /* @__PURE__ */
|
|
2259
|
-
(selectedFileIds.length > 0 || currentView === "TRASH") && /* @__PURE__ */
|
|
2260
|
-
/* @__PURE__ */
|
|
2073
|
+
const [dialogs, setDialogs] = useState({ delete: false, emptyTrash: false });
|
|
2074
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center gap-2 border-b bg-muted/30 p-2", children: [
|
|
2075
|
+
(selectedFileIds.length > 0 || currentView === "TRASH") && /* @__PURE__ */ jsxs(DropdownMenu, { children: [
|
|
2076
|
+
/* @__PURE__ */ jsx(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
2261
2077
|
Button,
|
|
2262
2078
|
{
|
|
2263
2079
|
type: "button",
|
|
2264
2080
|
variant: "outline",
|
|
2265
2081
|
size: "sm",
|
|
2266
2082
|
className: "gap-1.5",
|
|
2267
|
-
children: /* @__PURE__ */
|
|
2083
|
+
children: /* @__PURE__ */ jsx(Menu, { className: "size-4" })
|
|
2268
2084
|
}
|
|
2269
2085
|
) }),
|
|
2270
|
-
/* @__PURE__ */
|
|
2271
|
-
selectedFileIds.length > 0 && currentView === "TRASH" && /* @__PURE__ */
|
|
2086
|
+
/* @__PURE__ */ jsxs(DropdownMenuContent, { align: "start", children: [
|
|
2087
|
+
selectedFileIds.length > 0 && currentView === "TRASH" && /* @__PURE__ */ jsxs(
|
|
2272
2088
|
DropdownMenuItem,
|
|
2273
2089
|
{
|
|
2274
2090
|
onClick: async () => {
|
|
@@ -2283,20 +2099,20 @@ var DriveHeader = () => {
|
|
|
2283
2099
|
}
|
|
2284
2100
|
},
|
|
2285
2101
|
children: [
|
|
2286
|
-
/* @__PURE__ */
|
|
2102
|
+
/* @__PURE__ */ jsx(RotateCcw, { className: "size-3.5 mr-2" }),
|
|
2287
2103
|
"Restore (",
|
|
2288
2104
|
selectedFileIds.length,
|
|
2289
2105
|
")"
|
|
2290
2106
|
]
|
|
2291
2107
|
}
|
|
2292
2108
|
),
|
|
2293
|
-
selectedFileIds.length > 0 && /* @__PURE__ */
|
|
2109
|
+
selectedFileIds.length > 0 && /* @__PURE__ */ jsxs(
|
|
2294
2110
|
DropdownMenuItem,
|
|
2295
2111
|
{
|
|
2296
2112
|
onClick: () => setDialogs((prev) => ({ ...prev, delete: true })),
|
|
2297
2113
|
className: "text-destructive focus:text-destructive",
|
|
2298
2114
|
children: [
|
|
2299
|
-
/* @__PURE__ */
|
|
2115
|
+
/* @__PURE__ */ jsx(Trash2, { className: "size-3.5 mr-2" }),
|
|
2300
2116
|
currentView === "TRASH" ? "Delete Forever" : "Delete",
|
|
2301
2117
|
" (",
|
|
2302
2118
|
selectedFileIds.length,
|
|
@@ -2304,21 +2120,21 @@ var DriveHeader = () => {
|
|
|
2304
2120
|
]
|
|
2305
2121
|
}
|
|
2306
2122
|
),
|
|
2307
|
-
currentView === "TRASH" && selectedFileIds.length === 0 && /* @__PURE__ */
|
|
2123
|
+
currentView === "TRASH" && selectedFileIds.length === 0 && /* @__PURE__ */ jsxs(
|
|
2308
2124
|
DropdownMenuItem,
|
|
2309
2125
|
{
|
|
2310
2126
|
onClick: () => setDialogs((prev) => ({ ...prev, emptyTrash: true })),
|
|
2311
2127
|
className: "text-destructive focus:text-destructive",
|
|
2312
2128
|
children: [
|
|
2313
|
-
/* @__PURE__ */
|
|
2129
|
+
/* @__PURE__ */ jsx(Trash2, { className: "size-3.5 mr-2" }),
|
|
2314
2130
|
"Empty Trash"
|
|
2315
2131
|
]
|
|
2316
2132
|
}
|
|
2317
2133
|
)
|
|
2318
2134
|
] })
|
|
2319
2135
|
] }),
|
|
2320
|
-
/* @__PURE__ */
|
|
2321
|
-
/* @__PURE__ */
|
|
2136
|
+
/* @__PURE__ */ jsxs(DropdownMenu, { children: [
|
|
2137
|
+
/* @__PURE__ */ jsx(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(
|
|
2322
2138
|
Button,
|
|
2323
2139
|
{
|
|
2324
2140
|
type: "button",
|
|
@@ -2326,24 +2142,24 @@ var DriveHeader = () => {
|
|
|
2326
2142
|
size: "sm",
|
|
2327
2143
|
className: "gap-1.5",
|
|
2328
2144
|
children: [
|
|
2329
|
-
/* @__PURE__ */
|
|
2330
|
-
/* @__PURE__ */
|
|
2145
|
+
/* @__PURE__ */ jsx(Group, { className: "size-3.5" }),
|
|
2146
|
+
/* @__PURE__ */ jsx("span", { className: "hidden sm:inline", children: groupBy === "NONE" ? "Group" : "Grouped" })
|
|
2331
2147
|
]
|
|
2332
2148
|
}
|
|
2333
2149
|
) }),
|
|
2334
|
-
/* @__PURE__ */
|
|
2335
|
-
/* @__PURE__ */
|
|
2336
|
-
groupBy === "NONE" && /* @__PURE__ */
|
|
2337
|
-
/* @__PURE__ */
|
|
2150
|
+
/* @__PURE__ */ jsxs(DropdownMenuContent, { align: "start", children: [
|
|
2151
|
+
/* @__PURE__ */ jsxs(DropdownMenuItem, { onClick: () => setGroupBy("NONE"), children: [
|
|
2152
|
+
groupBy === "NONE" && /* @__PURE__ */ jsx(Check, { className: "size-3.5 mr-2" }),
|
|
2153
|
+
/* @__PURE__ */ jsx("span", { className: cn(groupBy !== "NONE" && "pl-5.5"), children: "No Grouping" })
|
|
2338
2154
|
] }),
|
|
2339
|
-
/* @__PURE__ */
|
|
2340
|
-
groupBy === "CREATED_AT" && /* @__PURE__ */
|
|
2341
|
-
/* @__PURE__ */
|
|
2155
|
+
/* @__PURE__ */ jsxs(DropdownMenuItem, { onClick: () => setGroupBy("CREATED_AT"), children: [
|
|
2156
|
+
groupBy === "CREATED_AT" && /* @__PURE__ */ jsx(Check, { className: "size-3.5 mr-2" }),
|
|
2157
|
+
/* @__PURE__ */ jsx("span", { className: cn(groupBy !== "CREATED_AT" && "pl-5.5"), children: "Created Date" })
|
|
2342
2158
|
] })
|
|
2343
2159
|
] })
|
|
2344
2160
|
] }),
|
|
2345
|
-
/* @__PURE__ */
|
|
2346
|
-
/* @__PURE__ */
|
|
2161
|
+
/* @__PURE__ */ jsxs("div", { className: "flex-1 min-w-0 sm:min-w-50 relative", children: [
|
|
2162
|
+
/* @__PURE__ */ jsx(
|
|
2347
2163
|
Input,
|
|
2348
2164
|
{
|
|
2349
2165
|
type: "text",
|
|
@@ -2364,11 +2180,11 @@ var DriveHeader = () => {
|
|
|
2364
2180
|
}
|
|
2365
2181
|
}
|
|
2366
2182
|
),
|
|
2367
|
-
/* @__PURE__ */
|
|
2368
|
-
/* @__PURE__ */
|
|
2369
|
-
/* @__PURE__ */
|
|
2183
|
+
/* @__PURE__ */ jsx("div", { className: "absolute left-2.5 top-1/2 -translate-y-1/2 text-muted-foreground pointer-events-none", children: /* @__PURE__ */ jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", className: "lucide lucide-search", children: [
|
|
2184
|
+
/* @__PURE__ */ jsx("circle", { cx: "11", cy: "11", r: "8" }),
|
|
2185
|
+
/* @__PURE__ */ jsx("path", { d: "m21 21-4.3-4.3" })
|
|
2370
2186
|
] }) }),
|
|
2371
|
-
searchQuery && /* @__PURE__ */
|
|
2187
|
+
searchQuery && /* @__PURE__ */ jsx(
|
|
2372
2188
|
Button,
|
|
2373
2189
|
{
|
|
2374
2190
|
type: "button",
|
|
@@ -2379,65 +2195,65 @@ var DriveHeader = () => {
|
|
|
2379
2195
|
setSearchQuery("");
|
|
2380
2196
|
setCurrentView(searchScope === "TRASH" ? "TRASH" : "BROWSE");
|
|
2381
2197
|
},
|
|
2382
|
-
children: /* @__PURE__ */
|
|
2383
|
-
/* @__PURE__ */
|
|
2384
|
-
/* @__PURE__ */
|
|
2198
|
+
children: /* @__PURE__ */ jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", className: "lucide lucide-x", children: [
|
|
2199
|
+
/* @__PURE__ */ jsx("path", { d: "M18 6 6 18" }),
|
|
2200
|
+
/* @__PURE__ */ jsx("path", { d: "m6 6 12 12" })
|
|
2385
2201
|
] })
|
|
2386
2202
|
}
|
|
2387
2203
|
)
|
|
2388
2204
|
] }),
|
|
2389
|
-
/* @__PURE__ */
|
|
2390
|
-
/* @__PURE__ */
|
|
2391
|
-
/* @__PURE__ */
|
|
2392
|
-
/* @__PURE__ */
|
|
2205
|
+
/* @__PURE__ */ jsxs(DropdownMenu, { children: [
|
|
2206
|
+
/* @__PURE__ */ jsx(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(Button, { type: "button", variant: "ghost", size: "sm", className: "gap-1.5", children: [
|
|
2207
|
+
/* @__PURE__ */ jsx(ArrowUpDown, { className: "size-3.5" }),
|
|
2208
|
+
/* @__PURE__ */ jsx("span", { className: "hidden sm:inline max-w-24 truncate", children: sortBy.field === "id" ? "Default" : sortBy.field === "order" ? "Custom" : sortBy.field === "createdAt" ? sortBy.order === -1 ? "Date: Newest" : "Date: Oldest" : sortBy.field === "name" ? sortBy.order === 1 ? "Name: A to Z" : "Name: Z to A" : sortBy.field === "size" ? sortBy.order === -1 ? "Size: Large" : "Size: Small" : "Sort" })
|
|
2393
2209
|
] }) }),
|
|
2394
|
-
/* @__PURE__ */
|
|
2395
|
-
/* @__PURE__ */
|
|
2396
|
-
sortBy.field === "order" && /* @__PURE__ */
|
|
2397
|
-
/* @__PURE__ */
|
|
2210
|
+
/* @__PURE__ */ jsxs(DropdownMenuContent, { align: "end", children: [
|
|
2211
|
+
/* @__PURE__ */ jsxs(DropdownMenuItem, { onClick: () => setSortBy({ field: "order", order: 1 }), children: [
|
|
2212
|
+
sortBy.field === "order" && /* @__PURE__ */ jsx(Check, { className: "size-3.5 mr-2" }),
|
|
2213
|
+
/* @__PURE__ */ jsx("span", { className: cn(sortBy.field !== "order" && "pl-5.5"), children: "Custom Order" })
|
|
2398
2214
|
] }),
|
|
2399
|
-
/* @__PURE__ */
|
|
2400
|
-
sortBy.field === "id" && /* @__PURE__ */
|
|
2401
|
-
/* @__PURE__ */
|
|
2215
|
+
/* @__PURE__ */ jsxs(DropdownMenuItem, { onClick: () => setSortBy({ field: "id", order: 1 }), children: [
|
|
2216
|
+
sortBy.field === "id" && /* @__PURE__ */ jsx(Check, { className: "size-3.5 mr-2" }),
|
|
2217
|
+
/* @__PURE__ */ jsx("span", { className: cn(sortBy.field !== "id" && "pl-5.5"), children: "Default" })
|
|
2402
2218
|
] }),
|
|
2403
|
-
/* @__PURE__ */
|
|
2404
|
-
/* @__PURE__ */
|
|
2405
|
-
sortBy.field === "createdAt" && sortBy.order === -1 && /* @__PURE__ */
|
|
2406
|
-
/* @__PURE__ */
|
|
2219
|
+
/* @__PURE__ */ jsx(DropdownMenuSeparator, {}),
|
|
2220
|
+
/* @__PURE__ */ jsxs(DropdownMenuItem, { onClick: () => setSortBy({ field: "createdAt", order: -1 }), children: [
|
|
2221
|
+
sortBy.field === "createdAt" && sortBy.order === -1 && /* @__PURE__ */ jsx(Check, { className: "size-3.5 mr-2" }),
|
|
2222
|
+
/* @__PURE__ */ jsx(Calendar, { className: cn("size-3.5 mr-2", sortBy.field === "createdAt" && sortBy.order === -1 ? "" : "ml-5.5") }),
|
|
2407
2223
|
"Date: Newest"
|
|
2408
2224
|
] }),
|
|
2409
|
-
/* @__PURE__ */
|
|
2410
|
-
sortBy.field === "createdAt" && sortBy.order === 1 && /* @__PURE__ */
|
|
2411
|
-
/* @__PURE__ */
|
|
2225
|
+
/* @__PURE__ */ jsxs(DropdownMenuItem, { onClick: () => setSortBy({ field: "createdAt", order: 1 }), children: [
|
|
2226
|
+
sortBy.field === "createdAt" && sortBy.order === 1 && /* @__PURE__ */ jsx(Check, { className: "size-3.5 mr-2" }),
|
|
2227
|
+
/* @__PURE__ */ jsx(Calendar, { className: cn("size-3.5 mr-2", sortBy.field === "createdAt" && sortBy.order === 1 ? "" : "ml-5.5") }),
|
|
2412
2228
|
"Date: Oldest"
|
|
2413
2229
|
] }),
|
|
2414
|
-
/* @__PURE__ */
|
|
2415
|
-
/* @__PURE__ */
|
|
2416
|
-
sortBy.field === "name" && sortBy.order === 1 && /* @__PURE__ */
|
|
2417
|
-
/* @__PURE__ */
|
|
2230
|
+
/* @__PURE__ */ jsx(DropdownMenuSeparator, {}),
|
|
2231
|
+
/* @__PURE__ */ jsxs(DropdownMenuItem, { onClick: () => setSortBy({ field: "name", order: 1 }), children: [
|
|
2232
|
+
sortBy.field === "name" && sortBy.order === 1 && /* @__PURE__ */ jsx(Check, { className: "size-3.5 mr-2" }),
|
|
2233
|
+
/* @__PURE__ */ jsx(ArrowDownAZ, { className: cn("size-3.5 mr-2", sortBy.field === "name" && sortBy.order === 1 ? "" : "ml-5.5") }),
|
|
2418
2234
|
"Name: A to Z"
|
|
2419
2235
|
] }),
|
|
2420
|
-
/* @__PURE__ */
|
|
2421
|
-
sortBy.field === "name" && sortBy.order === -1 && /* @__PURE__ */
|
|
2422
|
-
/* @__PURE__ */
|
|
2236
|
+
/* @__PURE__ */ jsxs(DropdownMenuItem, { onClick: () => setSortBy({ field: "name", order: -1 }), children: [
|
|
2237
|
+
sortBy.field === "name" && sortBy.order === -1 && /* @__PURE__ */ jsx(Check, { className: "size-3.5 mr-2" }),
|
|
2238
|
+
/* @__PURE__ */ jsx(ArrowUpAZ, { className: cn("size-3.5 mr-2", sortBy.field === "name" && sortBy.order === -1 ? "" : "ml-5.5") }),
|
|
2423
2239
|
"Name: Z to A"
|
|
2424
2240
|
] }),
|
|
2425
|
-
/* @__PURE__ */
|
|
2426
|
-
/* @__PURE__ */
|
|
2427
|
-
sortBy.field === "size" && sortBy.order === -1 && /* @__PURE__ */
|
|
2428
|
-
/* @__PURE__ */
|
|
2241
|
+
/* @__PURE__ */ jsx(DropdownMenuSeparator, {}),
|
|
2242
|
+
/* @__PURE__ */ jsxs(DropdownMenuItem, { onClick: () => setSortBy({ field: "size", order: -1 }), children: [
|
|
2243
|
+
sortBy.field === "size" && sortBy.order === -1 && /* @__PURE__ */ jsx(Check, { className: "size-3.5 mr-2" }),
|
|
2244
|
+
/* @__PURE__ */ jsx(ArrowDown01, { className: cn("size-3.5 mr-2", sortBy.field === "size" && sortBy.order === -1 ? "" : "ml-5.5") }),
|
|
2429
2245
|
"Size: Large"
|
|
2430
2246
|
] }),
|
|
2431
|
-
/* @__PURE__ */
|
|
2432
|
-
sortBy.field === "size" && sortBy.order === 1 && /* @__PURE__ */
|
|
2433
|
-
/* @__PURE__ */
|
|
2247
|
+
/* @__PURE__ */ jsxs(DropdownMenuItem, { onClick: () => setSortBy({ field: "size", order: 1 }), children: [
|
|
2248
|
+
sortBy.field === "size" && sortBy.order === 1 && /* @__PURE__ */ jsx(Check, { className: "size-3.5 mr-2" }),
|
|
2249
|
+
/* @__PURE__ */ jsx(ArrowUp01, { className: cn("size-3.5 mr-2", sortBy.field === "size" && sortBy.order === 1 ? "" : "ml-5.5") }),
|
|
2434
2250
|
"Size: Small"
|
|
2435
2251
|
] })
|
|
2436
2252
|
] })
|
|
2437
2253
|
] }),
|
|
2438
|
-
/* @__PURE__ */
|
|
2439
|
-
/* @__PURE__ */
|
|
2440
|
-
/* @__PURE__ */
|
|
2254
|
+
/* @__PURE__ */ jsx("div", { className: "w-px h-5 bg-border" }),
|
|
2255
|
+
/* @__PURE__ */ jsxs("div", { className: "flex bg-muted rounded-md p-0.5 gap-0.5", children: [
|
|
2256
|
+
/* @__PURE__ */ jsx(
|
|
2441
2257
|
Button,
|
|
2442
2258
|
{
|
|
2443
2259
|
type: "button",
|
|
@@ -2447,10 +2263,10 @@ var DriveHeader = () => {
|
|
|
2447
2263
|
onClick: () => setViewMode("GRID"),
|
|
2448
2264
|
"aria-label": "Grid View",
|
|
2449
2265
|
"aria-pressed": viewMode === "GRID",
|
|
2450
|
-
children: /* @__PURE__ */
|
|
2266
|
+
children: /* @__PURE__ */ jsx(LayoutGrid, { className: "size-4" })
|
|
2451
2267
|
}
|
|
2452
2268
|
),
|
|
2453
|
-
/* @__PURE__ */
|
|
2269
|
+
/* @__PURE__ */ jsx(
|
|
2454
2270
|
Button,
|
|
2455
2271
|
{
|
|
2456
2272
|
type: "button",
|
|
@@ -2460,11 +2276,11 @@ var DriveHeader = () => {
|
|
|
2460
2276
|
onClick: () => setViewMode("LIST"),
|
|
2461
2277
|
"aria-label": "List View",
|
|
2462
2278
|
"aria-pressed": viewMode === "LIST",
|
|
2463
|
-
children: /* @__PURE__ */
|
|
2279
|
+
children: /* @__PURE__ */ jsx(List, { className: "size-4" })
|
|
2464
2280
|
}
|
|
2465
2281
|
)
|
|
2466
2282
|
] }),
|
|
2467
|
-
/* @__PURE__ */
|
|
2283
|
+
/* @__PURE__ */ jsx(
|
|
2468
2284
|
DialogConfirmation,
|
|
2469
2285
|
{
|
|
2470
2286
|
open: dialogs.delete,
|
|
@@ -2501,7 +2317,7 @@ var DriveHeader = () => {
|
|
|
2501
2317
|
}
|
|
2502
2318
|
}
|
|
2503
2319
|
),
|
|
2504
|
-
/* @__PURE__ */
|
|
2320
|
+
/* @__PURE__ */ jsx(
|
|
2505
2321
|
DialogConfirmation,
|
|
2506
2322
|
{
|
|
2507
2323
|
open: dialogs.emptyTrash,
|
|
@@ -2521,10 +2337,6 @@ var DriveHeader = () => {
|
|
|
2521
2337
|
)
|
|
2522
2338
|
] });
|
|
2523
2339
|
};
|
|
2524
|
-
|
|
2525
|
-
// src/client/file-chooser.tsx
|
|
2526
|
-
import { Upload as UploadIcon2, X as X4 } from "lucide-react";
|
|
2527
|
-
import { jsx as jsx19, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
2528
2340
|
var DriveFileChooser = (props) => {
|
|
2529
2341
|
const {
|
|
2530
2342
|
value,
|
|
@@ -2544,15 +2356,15 @@ var DriveFileChooser = (props) => {
|
|
|
2544
2356
|
...props
|
|
2545
2357
|
};
|
|
2546
2358
|
const { items, selectedFileIds, setSelectedFileIds, createUrl } = useDrive();
|
|
2547
|
-
const [isOpen, setIsOpen] =
|
|
2548
|
-
|
|
2359
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
2360
|
+
useEffect(() => {
|
|
2549
2361
|
if (isOpen) {
|
|
2550
2362
|
if (!value) setSelectedFileIds([]);
|
|
2551
2363
|
else if (Array.isArray(value)) setSelectedFileIds(value.map((f) => f.id));
|
|
2552
2364
|
else setSelectedFileIds([value.id]);
|
|
2553
2365
|
}
|
|
2554
2366
|
}, [isOpen, value, setSelectedFileIds]);
|
|
2555
|
-
const handleConfirm =
|
|
2367
|
+
const handleConfirm = useCallback(() => {
|
|
2556
2368
|
const selectedItems = items.filter((item) => selectedFileIds.includes(item.id));
|
|
2557
2369
|
const files = selectedItems.map((item) => ({
|
|
2558
2370
|
id: item.id,
|
|
@@ -2569,13 +2381,13 @@ var DriveFileChooser = (props) => {
|
|
|
2569
2381
|
}
|
|
2570
2382
|
};
|
|
2571
2383
|
const hasSelection = value && (Array.isArray(value) ? value.length > 0 : true);
|
|
2572
|
-
const displayFiles =
|
|
2384
|
+
const displayFiles = useMemo(() => {
|
|
2573
2385
|
if (!value) return [];
|
|
2574
2386
|
return Array.isArray(value) ? value : [value];
|
|
2575
2387
|
}, [value]);
|
|
2576
2388
|
const isSingle = !multiple;
|
|
2577
|
-
return /* @__PURE__ */
|
|
2578
|
-
!hasSelection && /* @__PURE__ */
|
|
2389
|
+
return /* @__PURE__ */ jsxs("div", { className: cn("space-y-1.5", className), children: [
|
|
2390
|
+
!hasSelection && /* @__PURE__ */ jsxs(
|
|
2579
2391
|
Button,
|
|
2580
2392
|
{
|
|
2581
2393
|
type: "button",
|
|
@@ -2587,23 +2399,23 @@ var DriveFileChooser = (props) => {
|
|
|
2587
2399
|
error && "border-destructive"
|
|
2588
2400
|
),
|
|
2589
2401
|
children: [
|
|
2590
|
-
/* @__PURE__ */
|
|
2402
|
+
/* @__PURE__ */ jsx("div", { className: cn(
|
|
2591
2403
|
"flex items-center justify-center size-9 rounded-md bg-muted",
|
|
2592
2404
|
error && "bg-destructive/10"
|
|
2593
|
-
), children: /* @__PURE__ */
|
|
2594
|
-
/* @__PURE__ */
|
|
2595
|
-
/* @__PURE__ */
|
|
2596
|
-
/* @__PURE__ */
|
|
2405
|
+
), children: /* @__PURE__ */ jsx(Upload, { className: cn("size-4", error ? "text-destructive" : "text-muted-foreground") }) }),
|
|
2406
|
+
/* @__PURE__ */ jsxs("div", { className: "flex-1 min-w-0", children: [
|
|
2407
|
+
/* @__PURE__ */ jsx("p", { className: cn("text-sm font-medium", error && "text-destructive"), children: isSingle ? "Select a file" : "Select files" }),
|
|
2408
|
+
/* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: placeholder })
|
|
2597
2409
|
] })
|
|
2598
2410
|
]
|
|
2599
2411
|
}
|
|
2600
2412
|
),
|
|
2601
|
-
hasSelection && isSingle && displayFiles[0] && /* @__PURE__ */
|
|
2413
|
+
hasSelection && isSingle && displayFiles[0] && /* @__PURE__ */ jsxs("div", { className: cn(
|
|
2602
2414
|
"flex items-center gap-2.5 px-2.5 py-2 rounded-md border bg-muted/30",
|
|
2603
2415
|
error && "border-destructive",
|
|
2604
2416
|
disabled && "opacity-50"
|
|
2605
2417
|
), children: [
|
|
2606
|
-
/* @__PURE__ */
|
|
2418
|
+
/* @__PURE__ */ jsx("div", { className: "size-10 shrink-0 rounded overflow-hidden bg-muted flex items-center justify-center", children: displayFiles[0].file.mime.startsWith("image/") ? /* @__PURE__ */ jsx(
|
|
2607
2419
|
"img",
|
|
2608
2420
|
{
|
|
2609
2421
|
src: createUrl({ id: displayFiles[0].id, file: displayFiles[0].file }, { quality: "low", format: "webp" }),
|
|
@@ -2611,12 +2423,12 @@ var DriveFileChooser = (props) => {
|
|
|
2611
2423
|
className: "size-full object-cover"
|
|
2612
2424
|
}
|
|
2613
2425
|
) : getFileIcon(displayFiles[0].file.mime, false, "size-5 text-muted-foreground") }),
|
|
2614
|
-
/* @__PURE__ */
|
|
2615
|
-
/* @__PURE__ */
|
|
2616
|
-
/* @__PURE__ */
|
|
2426
|
+
/* @__PURE__ */ jsxs("div", { className: "flex-1 min-w-0", children: [
|
|
2427
|
+
/* @__PURE__ */ jsx("p", { className: "text-sm font-medium truncate", children: displayFiles[0].file.name }),
|
|
2428
|
+
/* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground truncate", children: displayFiles[0].file.mime })
|
|
2617
2429
|
] }),
|
|
2618
|
-
/* @__PURE__ */
|
|
2619
|
-
/* @__PURE__ */
|
|
2430
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1 shrink-0", children: [
|
|
2431
|
+
/* @__PURE__ */ jsx(
|
|
2620
2432
|
Button,
|
|
2621
2433
|
{
|
|
2622
2434
|
type: "button",
|
|
@@ -2627,30 +2439,30 @@ var DriveFileChooser = (props) => {
|
|
|
2627
2439
|
children: "Change"
|
|
2628
2440
|
}
|
|
2629
2441
|
),
|
|
2630
|
-
!disabled && /* @__PURE__ */
|
|
2442
|
+
!disabled && /* @__PURE__ */ jsx(
|
|
2631
2443
|
Button,
|
|
2632
2444
|
{
|
|
2633
2445
|
type: "button",
|
|
2634
2446
|
variant: "ghost",
|
|
2635
2447
|
size: "icon",
|
|
2636
2448
|
onClick: () => handleRemove(displayFiles[0].id),
|
|
2637
|
-
children: /* @__PURE__ */
|
|
2449
|
+
children: /* @__PURE__ */ jsx(X, { className: "size-3.5" })
|
|
2638
2450
|
}
|
|
2639
2451
|
)
|
|
2640
2452
|
] })
|
|
2641
2453
|
] }),
|
|
2642
|
-
hasSelection && !isSingle && /* @__PURE__ */
|
|
2454
|
+
hasSelection && !isSingle && /* @__PURE__ */ jsxs("div", { className: cn(
|
|
2643
2455
|
"rounded-md border",
|
|
2644
2456
|
error && "border-destructive",
|
|
2645
2457
|
disabled && "opacity-50"
|
|
2646
2458
|
), children: [
|
|
2647
|
-
/* @__PURE__ */
|
|
2648
|
-
/* @__PURE__ */
|
|
2459
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between px-2.5 py-1.5 border-b bg-muted/30", children: [
|
|
2460
|
+
/* @__PURE__ */ jsxs("span", { className: "text-xs text-muted-foreground", children: [
|
|
2649
2461
|
displayFiles.length,
|
|
2650
2462
|
" files selected"
|
|
2651
2463
|
] }),
|
|
2652
|
-
/* @__PURE__ */
|
|
2653
|
-
/* @__PURE__ */
|
|
2464
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1", children: [
|
|
2465
|
+
/* @__PURE__ */ jsx(
|
|
2654
2466
|
Button,
|
|
2655
2467
|
{
|
|
2656
2468
|
type: "button",
|
|
@@ -2661,7 +2473,7 @@ var DriveFileChooser = (props) => {
|
|
|
2661
2473
|
children: "Add more"
|
|
2662
2474
|
}
|
|
2663
2475
|
),
|
|
2664
|
-
!disabled && /* @__PURE__ */
|
|
2476
|
+
!disabled && /* @__PURE__ */ jsx(
|
|
2665
2477
|
Button,
|
|
2666
2478
|
{
|
|
2667
2479
|
type: "button",
|
|
@@ -2673,8 +2485,8 @@ var DriveFileChooser = (props) => {
|
|
|
2673
2485
|
)
|
|
2674
2486
|
] })
|
|
2675
2487
|
] }),
|
|
2676
|
-
/* @__PURE__ */
|
|
2677
|
-
/* @__PURE__ */
|
|
2488
|
+
/* @__PURE__ */ jsx("div", { className: "divide-y max-h-40 overflow-y-auto", children: displayFiles.map((file) => /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 px-2.5 py-1.5 hover:bg-muted/30", children: [
|
|
2489
|
+
/* @__PURE__ */ jsx("div", { className: "size-7 shrink-0 rounded overflow-hidden bg-muted flex items-center justify-center", children: file.file.mime.startsWith("image/") ? /* @__PURE__ */ jsx(
|
|
2678
2490
|
"img",
|
|
2679
2491
|
{
|
|
2680
2492
|
src: createUrl({ id: file.id, file: file.file }, { quality: "ultralow", format: "webp" }),
|
|
@@ -2682,27 +2494,27 @@ var DriveFileChooser = (props) => {
|
|
|
2682
2494
|
className: "size-full object-cover"
|
|
2683
2495
|
}
|
|
2684
2496
|
) : getFileIcon(file.file.mime, false, "size-3.5 text-muted-foreground") }),
|
|
2685
|
-
/* @__PURE__ */
|
|
2686
|
-
!disabled && /* @__PURE__ */
|
|
2497
|
+
/* @__PURE__ */ jsx("span", { className: "flex-1 text-sm truncate", children: file.file.name }),
|
|
2498
|
+
!disabled && /* @__PURE__ */ jsx(
|
|
2687
2499
|
Button,
|
|
2688
2500
|
{
|
|
2689
2501
|
type: "button",
|
|
2690
2502
|
variant: "ghost",
|
|
2691
2503
|
size: "icon",
|
|
2692
2504
|
onClick: () => handleRemove(file.id),
|
|
2693
|
-
children: /* @__PURE__ */
|
|
2505
|
+
children: /* @__PURE__ */ jsx(X, { className: "size-3" })
|
|
2694
2506
|
}
|
|
2695
2507
|
)
|
|
2696
2508
|
] }, file.id)) })
|
|
2697
2509
|
] }),
|
|
2698
|
-
error && helperText && /* @__PURE__ */
|
|
2699
|
-
/* @__PURE__ */
|
|
2700
|
-
/* @__PURE__ */
|
|
2701
|
-
/* @__PURE__ */
|
|
2702
|
-
/* @__PURE__ */
|
|
2703
|
-
/* @__PURE__ */
|
|
2704
|
-
/* @__PURE__ */
|
|
2705
|
-
/* @__PURE__ */
|
|
2510
|
+
error && helperText && /* @__PURE__ */ jsx("p", { className: "text-xs text-destructive", children: helperText }),
|
|
2511
|
+
/* @__PURE__ */ jsx(Dialog, { open: isOpen, onOpenChange: setIsOpen, children: /* @__PURE__ */ jsxs(DialogContent, { className: "sm:max-w-5xl max-h-[85vh] w-[95vw] flex flex-col gap-0 p-0", children: [
|
|
2512
|
+
/* @__PURE__ */ jsx(DialogHeader, { className: "px-0 py-0 border-b shrink-0 flex flex-col gap-0", children: /* @__PURE__ */ jsx("div", { className: "flex items-center justify-between px-3 sm:px-4 py-3 border-b", children: /* @__PURE__ */ jsx(DialogTitle, { className: "text-sm sm:text-base", children: "File Explorer" }) }) }),
|
|
2513
|
+
/* @__PURE__ */ jsxs("div", { className: "flex-1 overflow-hidden flex min-h-0 bg-muted/5", children: [
|
|
2514
|
+
/* @__PURE__ */ jsx("div", { className: "hidden md:flex w-48 lg:w-52 border-r bg-background/50 flex-col", children: /* @__PURE__ */ jsx(DriveSidebar, {}) }),
|
|
2515
|
+
/* @__PURE__ */ jsxs("div", { className: "flex-1 flex flex-col min-w-0", children: [
|
|
2516
|
+
/* @__PURE__ */ jsx(DriveHeader, {}),
|
|
2517
|
+
/* @__PURE__ */ jsx(
|
|
2706
2518
|
DriveExplorer,
|
|
2707
2519
|
{
|
|
2708
2520
|
mimeFilter: accept
|
|
@@ -2710,9 +2522,9 @@ var DriveFileChooser = (props) => {
|
|
|
2710
2522
|
)
|
|
2711
2523
|
] })
|
|
2712
2524
|
] }),
|
|
2713
|
-
/* @__PURE__ */
|
|
2714
|
-
/* @__PURE__ */
|
|
2715
|
-
/* @__PURE__ */
|
|
2525
|
+
/* @__PURE__ */ jsxs(DialogFooter, { className: "px-3 sm:px-4 py-3 border-t bg-background shrink-0 gap-2 flex-row justify-end", children: [
|
|
2526
|
+
/* @__PURE__ */ jsx(Button, { type: "button", variant: "outline", size: "sm", onClick: () => setIsOpen(false), children: "Cancel" }),
|
|
2527
|
+
/* @__PURE__ */ jsxs(
|
|
2716
2528
|
Button,
|
|
2717
2529
|
{
|
|
2718
2530
|
type: "button",
|
|
@@ -2729,9 +2541,6 @@ var DriveFileChooser = (props) => {
|
|
|
2729
2541
|
] }) })
|
|
2730
2542
|
] });
|
|
2731
2543
|
};
|
|
2732
|
-
|
|
2733
|
-
// src/schemas.ts
|
|
2734
|
-
import { z } from "zod";
|
|
2735
2544
|
var driveFileSchemaZod = z.object({
|
|
2736
2545
|
id: z.string(),
|
|
2737
2546
|
file: z.object({
|
|
@@ -2740,17 +2549,7 @@ var driveFileSchemaZod = z.object({
|
|
|
2740
2549
|
size: z.number()
|
|
2741
2550
|
})
|
|
2742
2551
|
});
|
|
2743
|
-
|
|
2744
|
-
|
|
2745
|
-
|
|
2746
|
-
DriveHeader,
|
|
2747
|
-
DrivePathBar,
|
|
2748
|
-
DriveProvider,
|
|
2749
|
-
DriveSidebar,
|
|
2750
|
-
DriveStorageIndicator,
|
|
2751
|
-
DriveUpload,
|
|
2752
|
-
driveFileSchemaZod,
|
|
2753
|
-
useDrive,
|
|
2754
|
-
useUpload
|
|
2755
|
-
};
|
|
2552
|
+
|
|
2553
|
+
export { DriveExplorer, DriveFileChooser, DriveHeader, DrivePathBar, DriveProvider, DriveSidebar, DriveStorageIndicator, DriveUpload, driveFileSchemaZod, useDrive, useUpload };
|
|
2554
|
+
//# sourceMappingURL=index.js.map
|
|
2756
2555
|
//# sourceMappingURL=index.js.map
|