import { Dialog as BaseDialog } from '@base-ui/react/dialog'; import { useQuery } from '@tanstack/react-query'; import { FileIcon, FolderIcon, FolderPlusIcon, HardDriveIcon, LockIcon, Trash2Icon, UploadIcon, } from 'lucide-react'; import { useRef, useState } from 'react'; import { Button } from '#/components/atoms/button.jsx'; import { Notice } from '#/components/atoms/notice.jsx'; import { RowIcon } from '#/components/atoms/row-icon.jsx'; import { Dialog } from '#/components/molecules/dialog.jsx'; import { EmptyState } from '#/components/molecules/empty-state.jsx'; import { ListRow } from '#/components/molecules/list-row.jsx'; import { TextLink } from '#/components/molecules/text-link.jsx'; import { get, post, upload } from '#/lib/api.js'; import { bytes, num, timeAgo } from '#/lib/format.js'; import { queryKeys, useApiMutation } from '#/lib/query.js'; /** The drive page URL for one folder, in the public repo or in a space. */ export function folderHref(folder, space) { const query = new URLSearchParams(); if (folder) query.set('folder', folder); if (space) query.set('space', space); const qs = query.toString(); return qs ? `/account/drive?${qs}` : '/account/drive'; } /** Where the browser fetches one file's bytes. */ function downloadHref(file, space) { const query = new URLSearchParams({ rkey: file.rkey }); if (space) query.set('space', space); return `/account/api/drive/file?${query.toString()}`; } /** A read-only value with a button that puts it on the clipboard. */ function CopyField({ label, value, rows }) { const [copied, setCopied] = useState(false); return (
{label}