mirror of
https://github.com/shumaiOne/shumai.git
synced 2026-11-28 20:04:26 +00:00
feat(ui): add collection and share link pages and management actions
This commit is contained in:
@@ -134,7 +134,7 @@ export function FileBrowser({
|
||||
}, [files, localUploadingFiles])
|
||||
|
||||
const { data: shareLinksData } = useQuery({
|
||||
queryKey: ['shares', teamId, projectId],
|
||||
queryKey: ['shares', projectId],
|
||||
queryFn: async () => {
|
||||
const res = await client.api.projects[':projectId'].shares.$get({
|
||||
param: { projectId },
|
||||
@@ -143,7 +143,7 @@ export function FileBrowser({
|
||||
if (!res.ok) throw new Error('Failed to fetch share links')
|
||||
return (await res.json()) as unknown as { data: ShareLinkInfo[] }
|
||||
},
|
||||
enabled: !!teamId && !!projectId && !isPublic,
|
||||
enabled: !!projectId && !isPublic,
|
||||
})
|
||||
|
||||
const $reparent = client.api.projects[':projectId'].reparent.$post
|
||||
@@ -265,7 +265,7 @@ export function FileBrowser({
|
||||
return share
|
||||
},
|
||||
onSuccess: (share) => {
|
||||
queryClient.invalidateQueries({ queryKey: ['shares', teamId, projectId] })
|
||||
queryClient.invalidateQueries({ queryKey: ['shares', projectId] })
|
||||
toast.success('Share link created', {
|
||||
action: {
|
||||
label: 'View',
|
||||
@@ -706,7 +706,7 @@ export function FileBrowser({
|
||||
|
||||
const handlePaste = useCallback(
|
||||
(e: React.ClipboardEvent | ClipboardEvent) => {
|
||||
if (isShareView) return
|
||||
if (isShareView || !!collection) return
|
||||
if (!e.clipboardData) return
|
||||
const items = e.clipboardData.items
|
||||
const files: File[] = []
|
||||
@@ -739,13 +739,13 @@ export function FileBrowser({
|
||||
processAndUploadFiles(files)
|
||||
}
|
||||
},
|
||||
[processAndUploadFiles],
|
||||
[processAndUploadFiles, isShareView, collection],
|
||||
)
|
||||
|
||||
// Add global paste listener if browser is active
|
||||
useEffect(() => {
|
||||
const onGlobalPaste = (e: ClipboardEvent) => {
|
||||
if (isShareView) return
|
||||
if (isShareView || !!collection) return
|
||||
// Don't intercept if user is typing in an input
|
||||
if (
|
||||
document.activeElement &&
|
||||
@@ -762,12 +762,12 @@ export function FileBrowser({
|
||||
return () => {
|
||||
window.removeEventListener('paste', onGlobalPaste)
|
||||
}
|
||||
}, [handlePaste, isShareView])
|
||||
}, [handlePaste, isShareView, collection])
|
||||
|
||||
const renderContent = () => {
|
||||
return (
|
||||
<ContextMenu modal={false}>
|
||||
<ContextMenuTrigger asChild disabled={isShareView || isPublic}>
|
||||
<ContextMenuTrigger asChild disabled={isShareView || isPublic || !!collection}>
|
||||
<div
|
||||
className="flex-1 bg-background relative flex flex-col min-h-0 overflow-hidden"
|
||||
onContextMenu={(e) => onContextMenu(e)}
|
||||
|
||||
@@ -16,6 +16,7 @@ import {
|
||||
Share2,
|
||||
LayoutGrid,
|
||||
Bookmark,
|
||||
MoreHorizontal,
|
||||
} from 'lucide-react'
|
||||
import { useEffect, useMemo, useState } from 'react'
|
||||
import { useInView } from 'react-intersection-observer'
|
||||
@@ -24,6 +25,31 @@ import type { DragState } from './dnd-types'
|
||||
import { toast } from 'sonner'
|
||||
import type { ShareLinkInfo } from '@shumai/dtos'
|
||||
import type { CollectionInfo } from '@shumai/dtos'
|
||||
import {
|
||||
DropdownMenu,
|
||||
DropdownMenuContent,
|
||||
DropdownMenuItem,
|
||||
DropdownMenuTrigger,
|
||||
} from '@/ui/components/ui/dropdown-menu'
|
||||
import {
|
||||
Dialog,
|
||||
DialogContent,
|
||||
DialogHeader,
|
||||
DialogTitle,
|
||||
DialogFooter,
|
||||
} from '@/ui/components/ui/dialog'
|
||||
import {
|
||||
AlertDialog,
|
||||
AlertDialogAction,
|
||||
AlertDialogCancel,
|
||||
AlertDialogContent,
|
||||
AlertDialogDescription,
|
||||
AlertDialogFooter,
|
||||
AlertDialogHeader,
|
||||
AlertDialogTitle,
|
||||
} from '@/ui/components/ui/alert-dialog'
|
||||
import { Input } from '@/ui/components/ui/input'
|
||||
import { Button } from '@/ui/components/ui/button'
|
||||
|
||||
interface FolderTreeProps {
|
||||
teamId: string
|
||||
@@ -144,6 +170,110 @@ export function FolderTree({
|
||||
},
|
||||
})
|
||||
|
||||
const params = useParams({
|
||||
from: '/projects/$projectId/collections/$collectionId',
|
||||
shouldThrow: false,
|
||||
})
|
||||
const shareParams = useParams({
|
||||
from: '/projects/$projectId/shares/$shareId',
|
||||
shouldThrow: false,
|
||||
})
|
||||
|
||||
const [renameId, setRenameId] = useState<string | null>(null)
|
||||
const [renameType, setRenameType] = useState<'collection' | 'share'>('collection')
|
||||
const [renameName, setRenameName] = useState('')
|
||||
const [isRenameOpen, setIsRenameOpen] = useState(false)
|
||||
|
||||
const [deleteId, setDeleteId] = useState<string | null>(null)
|
||||
const [deleteType, setDeleteType] = useState<'collection' | 'share'>('collection')
|
||||
const [isDeleteOpen, setIsDeleteOpen] = useState(false)
|
||||
|
||||
const { mutate: renameCollection } = useMutation({
|
||||
mutationFn: async ({ id, name }: { id: string; name: string }) => {
|
||||
const res = await client.api.collections[':collectionId'].$patch({
|
||||
param: { collectionId: id },
|
||||
json: { name },
|
||||
})
|
||||
if (!res.ok) throw new Error('Failed to rename collection')
|
||||
return await res.json()
|
||||
},
|
||||
onSuccess: () => {
|
||||
queryClient.invalidateQueries({ queryKey: ['collections', projectId] })
|
||||
toast.success('Collection renamed')
|
||||
setIsRenameOpen(false)
|
||||
},
|
||||
onError: (err) => {
|
||||
toast.error(`Error: ${err.message}`)
|
||||
},
|
||||
})
|
||||
|
||||
const { mutate: deleteCollection } = useMutation({
|
||||
mutationFn: async (id: string) => {
|
||||
const res = await client.api.collections[':collectionId'].$delete({
|
||||
param: { collectionId: id },
|
||||
})
|
||||
if (!res.ok) throw new Error('Failed to delete collection')
|
||||
return await res.json()
|
||||
},
|
||||
onSuccess: (_, deletedId) => {
|
||||
queryClient.invalidateQueries({ queryKey: ['collections', projectId] })
|
||||
toast.success('Collection deleted')
|
||||
setIsDeleteOpen(false)
|
||||
if (params?.collectionId === deletedId) {
|
||||
navigate({
|
||||
to: '/projects/$projectId',
|
||||
params: { projectId },
|
||||
})
|
||||
}
|
||||
},
|
||||
onError: (err) => {
|
||||
toast.error(`Error: ${err.message}`)
|
||||
},
|
||||
})
|
||||
|
||||
const { mutate: renameShareLink } = useMutation({
|
||||
mutationFn: async ({ id, name }: { id: string; name: string }) => {
|
||||
const res = await client.api.shares[':shareId'].$put({
|
||||
param: { shareId: id },
|
||||
json: { name },
|
||||
})
|
||||
if (!res.ok) throw new Error('Failed to rename share link')
|
||||
return await res.json()
|
||||
},
|
||||
onSuccess: () => {
|
||||
queryClient.invalidateQueries({ queryKey: ['shares', projectId] })
|
||||
toast.success('Share link renamed')
|
||||
setIsRenameOpen(false)
|
||||
},
|
||||
onError: (err) => {
|
||||
toast.error(`Error: ${err.message}`)
|
||||
},
|
||||
})
|
||||
|
||||
const { mutate: deleteShareLink } = useMutation({
|
||||
mutationFn: async (id: string) => {
|
||||
const res = await client.api.shares[':shareId'].$delete({
|
||||
param: { shareId: id },
|
||||
})
|
||||
if (!res.ok) throw new Error('Failed to delete share link')
|
||||
return id
|
||||
},
|
||||
onSuccess: (deletedId) => {
|
||||
queryClient.invalidateQueries({ queryKey: ['shares', projectId] })
|
||||
toast.success('Share link deleted')
|
||||
setIsDeleteOpen(false)
|
||||
if (shareParams?.shareId === deletedId) {
|
||||
navigate({
|
||||
to: '/projects/$projectId',
|
||||
params: { projectId },
|
||||
})
|
||||
}
|
||||
},
|
||||
onError: (err) => {
|
||||
toast.error(`Error: ${err.message}`)
|
||||
},
|
||||
})
|
||||
|
||||
const shareLinks = shareLinksData?.data ?? []
|
||||
|
||||
return (
|
||||
@@ -255,23 +385,89 @@ export function FolderTree({
|
||||
: 'opacity-0 invisible pointer-events-none h-0',
|
||||
)}
|
||||
>
|
||||
{collectionsData?.data.map((collection) => (
|
||||
<div
|
||||
key={collection.id}
|
||||
className="group flex cursor-pointer items-center gap-2 rounded-md px-2 py-1.5 text-sm transition-colors hover:bg-sidebar-accent hover:text-sidebar-accent-foreground"
|
||||
onClick={() =>
|
||||
navigate({
|
||||
to: '/projects/$projectId/collections/$collectionId',
|
||||
params: { projectId, collectionId: collection.id },
|
||||
})
|
||||
}
|
||||
>
|
||||
<div className="flex h-4 w-4 items-center justify-center">
|
||||
<Bookmark className="h-4 w-4 text-sidebar-primary" />
|
||||
</div>
|
||||
<span className="flex-1 truncate text-sidebar-foreground">{collection.name}</span>
|
||||
<div
|
||||
className="group flex cursor-pointer items-center gap-2 rounded-md px-2 py-1.5 text-sm transition-colors hover:bg-sidebar-accent hover:text-sidebar-accent-foreground"
|
||||
onClick={() =>
|
||||
navigate({
|
||||
to: '/projects/$projectId/collections',
|
||||
params: { projectId },
|
||||
})
|
||||
}
|
||||
>
|
||||
<div className="flex h-4 w-4 items-center justify-center">
|
||||
<LayoutGrid className="h-4 w-4 text-sidebar-primary" />
|
||||
</div>
|
||||
))}
|
||||
<span className="flex-1 truncate text-sidebar-foreground">
|
||||
All Collections ({collectionsData?.data.length || 0})
|
||||
</span>
|
||||
</div>
|
||||
|
||||
{collectionsData?.data.map((collection) => {
|
||||
const isColActive = params?.collectionId === collection.id
|
||||
return (
|
||||
<div
|
||||
key={collection.id}
|
||||
className={cn(
|
||||
'group flex cursor-pointer items-center justify-between rounded-md px-2 py-1 text-sm transition-colors hover:bg-sidebar-accent hover:text-sidebar-accent-foreground',
|
||||
isColActive && 'bg-sidebar-accent text-sidebar-accent-foreground font-medium',
|
||||
)}
|
||||
onClick={() =>
|
||||
navigate({
|
||||
to: '/projects/$projectId/collections/$collectionId',
|
||||
params: { projectId, collectionId: collection.id },
|
||||
})
|
||||
}
|
||||
>
|
||||
<div className="flex items-center gap-2 min-w-0 flex-1">
|
||||
<div className="flex h-4 w-4 items-center justify-center shrink-0">
|
||||
<Bookmark className="h-4 w-4 text-sidebar-primary" />
|
||||
</div>
|
||||
<span className="truncate text-sidebar-foreground flex-1">
|
||||
{collection.name}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div
|
||||
className="opacity-0 group-hover:opacity-100 transition-opacity"
|
||||
onClick={(e) => e.stopPropagation()}
|
||||
>
|
||||
<DropdownMenu modal={false}>
|
||||
<DropdownMenuTrigger asChild>
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="icon-sm"
|
||||
className="h-6 w-6 shrink-0 hover:bg-muted hover:text-muted-foreground p-0"
|
||||
>
|
||||
<MoreHorizontal className="h-3.5 w-3.5" />
|
||||
</Button>
|
||||
</DropdownMenuTrigger>
|
||||
<DropdownMenuContent align="end" className="w-32">
|
||||
<DropdownMenuItem
|
||||
onClick={() => {
|
||||
setRenameId(collection.id)
|
||||
setRenameType('collection')
|
||||
setRenameName(collection.name)
|
||||
setIsRenameOpen(true)
|
||||
}}
|
||||
>
|
||||
Rename
|
||||
</DropdownMenuItem>
|
||||
<DropdownMenuItem
|
||||
className="text-destructive focus:text-destructive focus:bg-destructive/10"
|
||||
onClick={() => {
|
||||
setDeleteId(collection.id)
|
||||
setDeleteType('collection')
|
||||
setIsDeleteOpen(true)
|
||||
}}
|
||||
>
|
||||
Delete
|
||||
</DropdownMenuItem>
|
||||
</DropdownMenuContent>
|
||||
</DropdownMenu>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
})}
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
@@ -313,7 +509,15 @@ export function FolderTree({
|
||||
: 'opacity-0 invisible pointer-events-none h-0',
|
||||
)}
|
||||
>
|
||||
<div className="group flex cursor-pointer items-center gap-2 rounded-md px-2 py-1.5 text-sm transition-colors hover:bg-sidebar-accent hover:text-sidebar-accent-foreground">
|
||||
<div
|
||||
className="group flex cursor-pointer items-center gap-2 rounded-md px-2 py-1.5 text-sm transition-colors hover:bg-sidebar-accent hover:text-sidebar-accent-foreground"
|
||||
onClick={() =>
|
||||
navigate({
|
||||
to: '/projects/$projectId/shares',
|
||||
params: { projectId },
|
||||
})
|
||||
}
|
||||
>
|
||||
<div className="flex h-4 w-4 items-center justify-center">
|
||||
<LayoutGrid className="h-4 w-4 text-sidebar-primary" />
|
||||
</div>
|
||||
@@ -328,11 +532,97 @@ export function FolderTree({
|
||||
link={link}
|
||||
projectId={projectId}
|
||||
dragState={dragState}
|
||||
onRenameTrigger={(id, currentName) => {
|
||||
setRenameId(id)
|
||||
setRenameType('share')
|
||||
setRenameName(currentName)
|
||||
setIsRenameOpen(true)
|
||||
}}
|
||||
onDeleteTrigger={(id) => {
|
||||
setDeleteId(id)
|
||||
setDeleteType('share')
|
||||
setIsDeleteOpen(true)
|
||||
}}
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* Rename Dialog */}
|
||||
<Dialog open={isRenameOpen} onOpenChange={setIsRenameOpen}>
|
||||
<DialogContent onClick={(e) => e.stopPropagation()}>
|
||||
<DialogHeader>
|
||||
<DialogTitle>
|
||||
Rename {renameType === 'collection' ? 'Collection' : 'Share Link'}
|
||||
</DialogTitle>
|
||||
</DialogHeader>
|
||||
<div className="py-4">
|
||||
<Input
|
||||
value={renameName}
|
||||
onChange={(e) => setRenameName(e.target.value)}
|
||||
placeholder="Enter new name"
|
||||
onKeyDown={(e) => {
|
||||
if (e.key === 'Enter' && renameName.trim()) {
|
||||
if (renameType === 'collection') {
|
||||
renameCollection({ id: renameId!, name: renameName })
|
||||
} else {
|
||||
renameShareLink({ id: renameId!, name: renameName })
|
||||
}
|
||||
}
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
<DialogFooter>
|
||||
<Button variant="ghost" onClick={() => setIsRenameOpen(false)}>
|
||||
Cancel
|
||||
</Button>
|
||||
<Button
|
||||
disabled={!renameName.trim()}
|
||||
onClick={() => {
|
||||
if (renameType === 'collection') {
|
||||
renameCollection({ id: renameId!, name: renameName })
|
||||
} else {
|
||||
renameShareLink({ id: renameId!, name: renameName })
|
||||
}
|
||||
}}
|
||||
>
|
||||
Rename
|
||||
</Button>
|
||||
</DialogFooter>
|
||||
</DialogContent>
|
||||
</Dialog>
|
||||
|
||||
{/* Delete Confirmation Alert Dialog */}
|
||||
<AlertDialog open={isDeleteOpen} onOpenChange={setIsDeleteOpen}>
|
||||
<AlertDialogContent onClick={(e) => e.stopPropagation()}>
|
||||
<AlertDialogHeader>
|
||||
<AlertDialogTitle>
|
||||
Delete {deleteType === 'collection' ? 'Collection' : 'Share Link'}?
|
||||
</AlertDialogTitle>
|
||||
<AlertDialogDescription>
|
||||
Are you sure you want to delete this{' '}
|
||||
{deleteType === 'collection' ? 'collection' : 'share link'}? This action cannot be
|
||||
undone.
|
||||
</AlertDialogDescription>
|
||||
</AlertDialogHeader>
|
||||
<AlertDialogFooter>
|
||||
<AlertDialogCancel>Cancel</AlertDialogCancel>
|
||||
<AlertDialogAction
|
||||
className="bg-destructive text-destructive-foreground hover:bg-destructive/90"
|
||||
onClick={() => {
|
||||
if (deleteType === 'collection') {
|
||||
deleteCollection(deleteId!)
|
||||
} else {
|
||||
deleteShareLink(deleteId!)
|
||||
}
|
||||
}}
|
||||
>
|
||||
Delete
|
||||
</AlertDialogAction>
|
||||
</AlertDialogFooter>
|
||||
</AlertDialogContent>
|
||||
</AlertDialog>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@@ -341,10 +631,14 @@ function ShareLinkItem({
|
||||
link,
|
||||
projectId,
|
||||
dragState,
|
||||
onRenameTrigger,
|
||||
onDeleteTrigger,
|
||||
}: {
|
||||
link: ShareLinkInfo
|
||||
projectId: string
|
||||
dragState?: DragState
|
||||
onRenameTrigger: (id: string, currentName: string) => void
|
||||
onDeleteTrigger: (id: string) => void
|
||||
}) {
|
||||
const navigate = useNavigate()
|
||||
const params = useParams({
|
||||
@@ -367,7 +661,7 @@ function ShareLinkItem({
|
||||
<div
|
||||
ref={setDroppableRef}
|
||||
className={cn(
|
||||
'group flex cursor-pointer items-center gap-2 rounded-md px-2 py-1.5 text-sm transition-colors hover:bg-sidebar-accent hover:text-sidebar-accent-foreground',
|
||||
'group flex cursor-pointer items-center justify-between rounded-md px-2 py-1 text-sm transition-colors hover:bg-sidebar-accent hover:text-sidebar-accent-foreground',
|
||||
isActive && 'bg-sidebar-accent text-sidebar-accent-foreground font-medium',
|
||||
isOver && isValidDropTarget && 'bg-sidebar-accent ring-2 ring-primary ring-inset',
|
||||
)}
|
||||
@@ -378,10 +672,46 @@ function ShareLinkItem({
|
||||
})
|
||||
}
|
||||
>
|
||||
<div className="flex h-4 w-4 items-center justify-center">
|
||||
<Share2 className="h-4 w-4 text-sidebar-primary" />
|
||||
<div className="flex items-center gap-2 min-w-0 flex-1">
|
||||
<div className="flex h-4 w-4 items-center justify-center shrink-0">
|
||||
<Share2 className="h-4 w-4 text-sidebar-primary" />
|
||||
</div>
|
||||
<span className="truncate text-sidebar-foreground flex-1">{link.name}</span>
|
||||
</div>
|
||||
|
||||
<div
|
||||
className="opacity-0 group-hover:opacity-100 transition-opacity"
|
||||
onClick={(e) => e.stopPropagation()}
|
||||
>
|
||||
<DropdownMenu modal={false}>
|
||||
<DropdownMenuTrigger asChild>
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="icon-sm"
|
||||
className="h-6 w-6 shrink-0 hover:bg-muted hover:text-muted-foreground p-0"
|
||||
>
|
||||
<MoreHorizontal className="h-3.5 w-3.5" />
|
||||
</Button>
|
||||
</DropdownMenuTrigger>
|
||||
<DropdownMenuContent align="end" className="w-32">
|
||||
<DropdownMenuItem
|
||||
onClick={() => {
|
||||
onRenameTrigger(link.id, link.name)
|
||||
}}
|
||||
>
|
||||
Rename
|
||||
</DropdownMenuItem>
|
||||
<DropdownMenuItem
|
||||
className="text-destructive focus:text-destructive focus:bg-destructive/10"
|
||||
onClick={() => {
|
||||
onDeleteTrigger(link.id)
|
||||
}}
|
||||
>
|
||||
Delete
|
||||
</DropdownMenuItem>
|
||||
</DropdownMenuContent>
|
||||
</DropdownMenu>
|
||||
</div>
|
||||
<span className="flex-1 truncate text-sidebar-foreground">{link.name}</span>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -18,6 +18,8 @@ import { Route as ShareShareIdIndexRouteImport } from './routes/share/$shareId/i
|
||||
import { Route as ProjectsProjectIdIndexRouteImport } from './routes/projects/$projectId/index'
|
||||
import { Route as TeamsTeamIdSettingsRouteImport } from './routes/teams/$teamId/settings'
|
||||
import { Route as ProjectsProjectIdRecentlyDeletedRouteImport } from './routes/projects/$projectId/recently-deleted'
|
||||
import { Route as ProjectsProjectIdSharesIndexRouteImport } from './routes/projects/$projectId/shares/index'
|
||||
import { Route as ProjectsProjectIdCollectionsIndexRouteImport } from './routes/projects/$projectId/collections/index'
|
||||
import { Route as ShareShareIdFoldersFolderIdRouteImport } from './routes/share/$shareId/folders/$folderId'
|
||||
import { Route as ShareShareIdFilesFileIdRouteImport } from './routes/share/$shareId/files/$fileId'
|
||||
import { Route as ProjectsProjectIdSharesShareIdRouteImport } from './routes/projects/$projectId/shares/$shareId'
|
||||
@@ -70,6 +72,16 @@ const ProjectsProjectIdRecentlyDeletedRoute = ProjectsProjectIdRecentlyDeletedRo
|
||||
path: '/projects/$projectId/recently-deleted',
|
||||
getParentRoute: () => rootRouteImport,
|
||||
} as any)
|
||||
const ProjectsProjectIdSharesIndexRoute = ProjectsProjectIdSharesIndexRouteImport.update({
|
||||
id: '/projects/$projectId/shares/',
|
||||
path: '/projects/$projectId/shares/',
|
||||
getParentRoute: () => rootRouteImport,
|
||||
} as any)
|
||||
const ProjectsProjectIdCollectionsIndexRoute = ProjectsProjectIdCollectionsIndexRouteImport.update({
|
||||
id: '/projects/$projectId/collections/',
|
||||
path: '/projects/$projectId/collections/',
|
||||
getParentRoute: () => rootRouteImport,
|
||||
} as any)
|
||||
const ShareShareIdFoldersFolderIdRoute = ShareShareIdFoldersFolderIdRouteImport.update({
|
||||
id: '/folders/$folderId',
|
||||
path: '/folders/$folderId',
|
||||
@@ -118,6 +130,8 @@ export interface FileRoutesByFullPath {
|
||||
'/projects/$projectId/shares/$shareId': typeof ProjectsProjectIdSharesShareIdRoute
|
||||
'/share/$shareId/files/$fileId': typeof ShareShareIdFilesFileIdRoute
|
||||
'/share/$shareId/folders/$folderId': typeof ShareShareIdFoldersFolderIdRoute
|
||||
'/projects/$projectId/collections/': typeof ProjectsProjectIdCollectionsIndexRoute
|
||||
'/projects/$projectId/shares/': typeof ProjectsProjectIdSharesIndexRoute
|
||||
}
|
||||
export interface FileRoutesByTo {
|
||||
'/': typeof IndexRoute
|
||||
@@ -134,6 +148,8 @@ export interface FileRoutesByTo {
|
||||
'/projects/$projectId/shares/$shareId': typeof ProjectsProjectIdSharesShareIdRoute
|
||||
'/share/$shareId/files/$fileId': typeof ShareShareIdFilesFileIdRoute
|
||||
'/share/$shareId/folders/$folderId': typeof ShareShareIdFoldersFolderIdRoute
|
||||
'/projects/$projectId/collections': typeof ProjectsProjectIdCollectionsIndexRoute
|
||||
'/projects/$projectId/shares': typeof ProjectsProjectIdSharesIndexRoute
|
||||
}
|
||||
export interface FileRoutesById {
|
||||
__root__: typeof rootRouteImport
|
||||
@@ -152,6 +168,8 @@ export interface FileRoutesById {
|
||||
'/projects/$projectId/shares/$shareId': typeof ProjectsProjectIdSharesShareIdRoute
|
||||
'/share/$shareId/files/$fileId': typeof ShareShareIdFilesFileIdRoute
|
||||
'/share/$shareId/folders/$folderId': typeof ShareShareIdFoldersFolderIdRoute
|
||||
'/projects/$projectId/collections/': typeof ProjectsProjectIdCollectionsIndexRoute
|
||||
'/projects/$projectId/shares/': typeof ProjectsProjectIdSharesIndexRoute
|
||||
}
|
||||
export interface FileRouteTypes {
|
||||
fileRoutesByFullPath: FileRoutesByFullPath
|
||||
@@ -171,6 +189,8 @@ export interface FileRouteTypes {
|
||||
| '/projects/$projectId/shares/$shareId'
|
||||
| '/share/$shareId/files/$fileId'
|
||||
| '/share/$shareId/folders/$folderId'
|
||||
| '/projects/$projectId/collections/'
|
||||
| '/projects/$projectId/shares/'
|
||||
fileRoutesByTo: FileRoutesByTo
|
||||
to:
|
||||
| '/'
|
||||
@@ -187,6 +207,8 @@ export interface FileRouteTypes {
|
||||
| '/projects/$projectId/shares/$shareId'
|
||||
| '/share/$shareId/files/$fileId'
|
||||
| '/share/$shareId/folders/$folderId'
|
||||
| '/projects/$projectId/collections'
|
||||
| '/projects/$projectId/shares'
|
||||
id:
|
||||
| '__root__'
|
||||
| '/'
|
||||
@@ -204,6 +226,8 @@ export interface FileRouteTypes {
|
||||
| '/projects/$projectId/shares/$shareId'
|
||||
| '/share/$shareId/files/$fileId'
|
||||
| '/share/$shareId/folders/$folderId'
|
||||
| '/projects/$projectId/collections/'
|
||||
| '/projects/$projectId/shares/'
|
||||
fileRoutesById: FileRoutesById
|
||||
}
|
||||
export interface RootRouteChildren {
|
||||
@@ -219,6 +243,8 @@ export interface RootRouteChildren {
|
||||
ProjectsProjectIdFilesFileIdRoute: typeof ProjectsProjectIdFilesFileIdRoute
|
||||
ProjectsProjectIdFoldersFolderIdRoute: typeof ProjectsProjectIdFoldersFolderIdRoute
|
||||
ProjectsProjectIdSharesShareIdRoute: typeof ProjectsProjectIdSharesShareIdRoute
|
||||
ProjectsProjectIdCollectionsIndexRoute: typeof ProjectsProjectIdCollectionsIndexRoute
|
||||
ProjectsProjectIdSharesIndexRoute: typeof ProjectsProjectIdSharesIndexRoute
|
||||
}
|
||||
|
||||
declare module '@tanstack/react-router' {
|
||||
@@ -286,6 +312,20 @@ declare module '@tanstack/react-router' {
|
||||
preLoaderRoute: typeof ProjectsProjectIdRecentlyDeletedRouteImport
|
||||
parentRoute: typeof rootRouteImport
|
||||
}
|
||||
'/projects/$projectId/shares/': {
|
||||
id: '/projects/$projectId/shares/'
|
||||
path: '/projects/$projectId/shares'
|
||||
fullPath: '/projects/$projectId/shares/'
|
||||
preLoaderRoute: typeof ProjectsProjectIdSharesIndexRouteImport
|
||||
parentRoute: typeof rootRouteImport
|
||||
}
|
||||
'/projects/$projectId/collections/': {
|
||||
id: '/projects/$projectId/collections/'
|
||||
path: '/projects/$projectId/collections'
|
||||
fullPath: '/projects/$projectId/collections/'
|
||||
preLoaderRoute: typeof ProjectsProjectIdCollectionsIndexRouteImport
|
||||
parentRoute: typeof rootRouteImport
|
||||
}
|
||||
'/share/$shareId/folders/$folderId': {
|
||||
id: '/share/$shareId/folders/$folderId'
|
||||
path: '/folders/$folderId'
|
||||
@@ -358,6 +398,8 @@ const rootRouteChildren: RootRouteChildren = {
|
||||
ProjectsProjectIdFilesFileIdRoute: ProjectsProjectIdFilesFileIdRoute,
|
||||
ProjectsProjectIdFoldersFolderIdRoute: ProjectsProjectIdFoldersFolderIdRoute,
|
||||
ProjectsProjectIdSharesShareIdRoute: ProjectsProjectIdSharesShareIdRoute,
|
||||
ProjectsProjectIdCollectionsIndexRoute: ProjectsProjectIdCollectionsIndexRoute,
|
||||
ProjectsProjectIdSharesIndexRoute: ProjectsProjectIdSharesIndexRoute,
|
||||
}
|
||||
export const routeTree = rootRouteImport
|
||||
._addFileChildren(rootRouteChildren)
|
||||
|
||||
@@ -0,0 +1,184 @@
|
||||
import { client } from '@/ui/api/client'
|
||||
import { FolderTree } from '@/ui/components/folder-tree'
|
||||
import { ResizeHandle } from '@/ui/components/resize-handle'
|
||||
import {
|
||||
Table,
|
||||
TableBody,
|
||||
TableCell,
|
||||
TableHead,
|
||||
TableHeader,
|
||||
TableRow,
|
||||
} from '@/ui/components/ui/table'
|
||||
import { useUiStore } from '@/ui/stores/ui'
|
||||
import { useTeamContextStore } from '@/ui/stores/team-context'
|
||||
import { useQuery, useSuspenseQuery } from '@tanstack/react-query'
|
||||
import { createFileRoute, useNavigate } from '@tanstack/react-router'
|
||||
import { useEffect, useState } from 'react'
|
||||
import { Bookmark, Calendar, User, LayoutGrid } from 'lucide-react'
|
||||
import type { CollectionInfo } from '@shumai/dtos'
|
||||
import { ProjectFolderSkeleton } from '@/ui/components/loading-skeletons'
|
||||
|
||||
const projectInfoQueryOptions = (projectId: string) => ({
|
||||
queryKey: ['projects', projectId],
|
||||
queryFn: async () => {
|
||||
const res = await client.api.projects[':projectId'].$get({
|
||||
param: { projectId },
|
||||
})
|
||||
if (!res.ok) throw new Error('Failed to fetch project')
|
||||
return await res.json()
|
||||
},
|
||||
})
|
||||
|
||||
function CollectionsPage() {
|
||||
const { projectId } = Route.useParams()
|
||||
const { teamId, ensureTeamIdForProject } = useTeamContextStore()
|
||||
const navigate = useNavigate()
|
||||
|
||||
useEffect(() => {
|
||||
ensureTeamIdForProject(projectId)
|
||||
}, [projectId, ensureTeamIdForProject])
|
||||
|
||||
const { data: projectInfo } = useSuspenseQuery(projectInfoQueryOptions(projectId))
|
||||
|
||||
const rootFolderId = projectInfo?.rootFolder
|
||||
const [leftSidebarWidth, setLeftSidebarWidth] = useState(240)
|
||||
|
||||
const {
|
||||
fileListLeftSidebarCollapsed: isLeftSidebarCollapsed,
|
||||
setFileListLeftSidebarCollapsed: setIsLeftSidebarCollapsed,
|
||||
} = useUiStore()
|
||||
|
||||
const { data: collectionsData, isLoading: isCollectionsLoading } = useQuery({
|
||||
queryKey: ['collections', projectId],
|
||||
queryFn: async () => {
|
||||
const res = await client.api.projects[':projectId'].collections.$get({
|
||||
param: { projectId },
|
||||
query: { first: '100' },
|
||||
})
|
||||
if (!res.ok) throw new Error('Failed to fetch collections')
|
||||
return (await res.json()) as unknown as { data: CollectionInfo[] }
|
||||
},
|
||||
enabled: !!projectId,
|
||||
})
|
||||
|
||||
if (!teamId || !rootFolderId || !projectInfo) {
|
||||
return <ProjectFolderSkeleton />
|
||||
}
|
||||
|
||||
const collections = collectionsData?.data ?? []
|
||||
|
||||
return (
|
||||
<div className="flex flex-1 flex-col bg-background min-h-0">
|
||||
<div className="flex flex-1 overflow-hidden relative">
|
||||
{!isLeftSidebarCollapsed && (
|
||||
<div
|
||||
className="md:hidden fixed inset-0 bg-black/50 z-40"
|
||||
onClick={() => setIsLeftSidebarCollapsed(true)}
|
||||
/>
|
||||
)}
|
||||
|
||||
{!isLeftSidebarCollapsed && (
|
||||
<>
|
||||
<div className="bg-background" style={{ width: leftSidebarWidth }}>
|
||||
<FolderTree
|
||||
teamId={teamId}
|
||||
projectId={projectId}
|
||||
projectName={projectInfo.name ?? ''}
|
||||
rootFolderId={rootFolderId}
|
||||
/>
|
||||
</div>
|
||||
<ResizeHandle
|
||||
onResize={(delta) => {
|
||||
setLeftSidebarWidth((prev) => Math.max(180, Math.min(400, prev + delta)))
|
||||
}}
|
||||
className="hidden md:block"
|
||||
/>
|
||||
</>
|
||||
)}
|
||||
|
||||
{/* Main Content Area */}
|
||||
<div className="flex-1 flex flex-col min-h-0 bg-card overflow-hidden">
|
||||
<header className="h-14 border-b flex items-center justify-between px-6 shrink-0 bg-background/50 backdrop-blur-sm sticky top-0 z-10">
|
||||
<div className="flex items-center gap-2">
|
||||
<Bookmark className="h-5 w-5 text-primary" />
|
||||
<h1 className="font-bold text-lg text-foreground">All Collections</h1>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<div className="flex-1 overflow-y-auto p-6">
|
||||
{isCollectionsLoading ? (
|
||||
<div className="flex justify-center items-center h-64">
|
||||
<div className="animate-spin rounded-full h-8 w-8 border-b-2 border-primary"></div>
|
||||
</div>
|
||||
) : collections.length === 0 ? (
|
||||
<div className="flex flex-col items-center justify-center h-64 text-muted-foreground gap-3">
|
||||
<LayoutGrid className="h-10 w-10 text-muted-foreground/50" />
|
||||
<p>No collections created yet.</p>
|
||||
</div>
|
||||
) : (
|
||||
<div className="border border-border rounded-xl bg-background overflow-hidden shadow-xs">
|
||||
<Table>
|
||||
<TableHeader>
|
||||
<TableRow className="hover:bg-transparent bg-muted/20">
|
||||
<TableHead className="font-semibold px-4 py-3">Collection Name</TableHead>
|
||||
<TableHead className="font-semibold px-4 py-3">Creator</TableHead>
|
||||
<TableHead className="font-semibold px-4 py-3 w-[200px]">
|
||||
Created Date
|
||||
</TableHead>
|
||||
</TableRow>
|
||||
</TableHeader>
|
||||
<TableBody>
|
||||
{collections.map((collection) => (
|
||||
<TableRow
|
||||
key={collection.id}
|
||||
className="hover:bg-muted/10 transition-colors cursor-pointer"
|
||||
onClick={() =>
|
||||
navigate({
|
||||
to: '/projects/$projectId/collections/$collectionId',
|
||||
params: { projectId, collectionId: collection.id },
|
||||
})
|
||||
}
|
||||
>
|
||||
<TableCell className="font-medium px-4 py-3.5">
|
||||
<div className="flex items-center gap-2">
|
||||
<Bookmark className="h-4 w-4 text-primary shrink-0" />
|
||||
<span className="text-foreground font-semibold hover:underline">
|
||||
{collection.name}
|
||||
</span>
|
||||
</div>
|
||||
</TableCell>
|
||||
<TableCell className="px-4 py-3.5">
|
||||
<div className="flex items-center gap-2">
|
||||
<div className="h-6 w-6 rounded-full bg-primary/10 flex items-center justify-center shrink-0">
|
||||
<User className="h-3.5 w-3.5 text-primary" />
|
||||
</div>
|
||||
<span className="text-sm font-medium text-foreground truncate max-w-[200px]">
|
||||
{collection.creator?.name || 'Unknown'}
|
||||
</span>
|
||||
</div>
|
||||
</TableCell>
|
||||
<TableCell className="px-4 py-3.5 text-muted-foreground text-sm">
|
||||
<div className="flex items-center gap-2">
|
||||
<Calendar className="h-3.5 w-3.5 text-muted-foreground/70" />
|
||||
<span>{new Date(collection.createdAt).toLocaleDateString()}</span>
|
||||
</div>
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
))}
|
||||
</TableBody>
|
||||
</Table>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
export const Route = createFileRoute('/projects/$projectId/collections/')({
|
||||
component: CollectionsPage,
|
||||
loader: ({ context: { queryClient }, params: { projectId } }) =>
|
||||
queryClient.ensureQueryData(projectInfoQueryOptions(projectId)),
|
||||
pendingComponent: () => <ProjectFolderSkeleton />,
|
||||
})
|
||||
@@ -0,0 +1,252 @@
|
||||
import { client } from '@/ui/api/client'
|
||||
import { FolderTree } from '@/ui/components/folder-tree'
|
||||
import { ResizeHandle } from '@/ui/components/resize-handle'
|
||||
import { Switch } from '@/ui/components/ui/switch'
|
||||
import { Button } from '@/ui/components/ui/button'
|
||||
import {
|
||||
Table,
|
||||
TableBody,
|
||||
TableCell,
|
||||
TableHead,
|
||||
TableHeader,
|
||||
TableRow,
|
||||
} from '@/ui/components/ui/table'
|
||||
import { useUiStore } from '@/ui/stores/ui'
|
||||
import { useTeamContextStore } from '@/ui/stores/team-context'
|
||||
import { useMutation, useQuery, useQueryClient, useSuspenseQuery } from '@tanstack/react-query'
|
||||
import { createFileRoute, useNavigate } from '@tanstack/react-router'
|
||||
import { useEffect, useState } from 'react'
|
||||
import { Copy, ExternalLink, Calendar, User, Link2, Share2 } from 'lucide-react'
|
||||
import { toast } from 'sonner'
|
||||
import type { ShareLinkInfo } from '@shumai/dtos'
|
||||
import { ProjectFolderSkeleton } from '@/ui/components/loading-skeletons'
|
||||
|
||||
const projectInfoQueryOptions = (projectId: string) => ({
|
||||
queryKey: ['projects', projectId],
|
||||
queryFn: async () => {
|
||||
const res = await client.api.projects[':projectId'].$get({
|
||||
param: { projectId },
|
||||
})
|
||||
if (!res.ok) throw new Error('Failed to fetch project')
|
||||
return await res.json()
|
||||
},
|
||||
})
|
||||
|
||||
function SharesPage() {
|
||||
const { projectId } = Route.useParams()
|
||||
const { teamId, ensureTeamIdForProject } = useTeamContextStore()
|
||||
const queryClient = useQueryClient()
|
||||
const navigate = useNavigate()
|
||||
|
||||
useEffect(() => {
|
||||
ensureTeamIdForProject(projectId)
|
||||
}, [projectId, ensureTeamIdForProject])
|
||||
|
||||
const { data: projectInfo } = useSuspenseQuery(projectInfoQueryOptions(projectId))
|
||||
|
||||
const rootFolderId = projectInfo?.rootFolder
|
||||
const [leftSidebarWidth, setLeftSidebarWidth] = useState(240)
|
||||
|
||||
const {
|
||||
fileListLeftSidebarCollapsed: isLeftSidebarCollapsed,
|
||||
setFileListLeftSidebarCollapsed: setIsLeftSidebarCollapsed,
|
||||
} = useUiStore()
|
||||
|
||||
const { data: sharesData, isLoading: isSharesLoading } = useQuery({
|
||||
queryKey: ['shares', projectId],
|
||||
queryFn: async () => {
|
||||
const res = await client.api.projects[':projectId'].shares.$get({
|
||||
param: { projectId },
|
||||
query: { first: '100' },
|
||||
})
|
||||
if (!res.ok) throw new Error('Failed to fetch share links')
|
||||
return (await res.json()) as unknown as { data: ShareLinkInfo[] }
|
||||
},
|
||||
enabled: !!projectId,
|
||||
})
|
||||
|
||||
const { mutate: toggleVisibility } = useMutation({
|
||||
mutationFn: async ({ id, isDisabled }: { id: string; isDisabled: boolean }) => {
|
||||
const res = await client.api.shares[':shareId'].$put({
|
||||
param: { shareId: id },
|
||||
json: { isDisabled },
|
||||
})
|
||||
if (!res.ok) throw new Error('Failed to update share link')
|
||||
return await res.json()
|
||||
},
|
||||
onSuccess: () => {
|
||||
queryClient.invalidateQueries({ queryKey: ['shares', projectId] })
|
||||
toast.success('Share link status updated')
|
||||
},
|
||||
onError: (err) => {
|
||||
toast.error(`Error: ${err.message}`)
|
||||
},
|
||||
})
|
||||
|
||||
if (!teamId || !rootFolderId || !projectInfo) {
|
||||
return <ProjectFolderSkeleton />
|
||||
}
|
||||
|
||||
const shares = sharesData?.data ?? []
|
||||
|
||||
const handleCopyLink = (shareId: string) => {
|
||||
const url = `${window.location.origin}/share/${shareId}`
|
||||
navigator.clipboard.writeText(url)
|
||||
toast.success('Link copied to clipboard')
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="flex flex-1 flex-col bg-background min-h-0">
|
||||
<div className="flex flex-1 overflow-hidden relative">
|
||||
{!isLeftSidebarCollapsed && (
|
||||
<div
|
||||
className="md:hidden fixed inset-0 bg-black/50 z-40"
|
||||
onClick={() => setIsLeftSidebarCollapsed(true)}
|
||||
/>
|
||||
)}
|
||||
|
||||
{!isLeftSidebarCollapsed && (
|
||||
<>
|
||||
<div className="bg-background" style={{ width: leftSidebarWidth }}>
|
||||
<FolderTree
|
||||
teamId={teamId}
|
||||
projectId={projectId}
|
||||
projectName={projectInfo.name ?? ''}
|
||||
rootFolderId={rootFolderId}
|
||||
/>
|
||||
</div>
|
||||
<ResizeHandle
|
||||
onResize={(delta) => {
|
||||
setLeftSidebarWidth((prev) => Math.max(180, Math.min(400, prev + delta)))
|
||||
}}
|
||||
className="hidden md:block"
|
||||
/>
|
||||
</>
|
||||
)}
|
||||
|
||||
{/* Main Content Area */}
|
||||
<div className="flex-1 flex flex-col min-h-0 bg-card overflow-hidden">
|
||||
<header className="h-14 border-b flex items-center justify-between px-6 shrink-0 bg-background/50 backdrop-blur-sm sticky top-0 z-10">
|
||||
<div className="flex items-center gap-2">
|
||||
<Share2 className="h-5 w-5 text-primary" />
|
||||
<h1 className="font-bold text-lg text-foreground">All Share Links</h1>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<div className="flex-1 overflow-y-auto p-6">
|
||||
{isSharesLoading ? (
|
||||
<div className="flex justify-center items-center h-64">
|
||||
<div className="animate-spin rounded-full h-8 w-8 border-b-2 border-primary"></div>
|
||||
</div>
|
||||
) : shares.length === 0 ? (
|
||||
<div className="flex flex-col items-center justify-center h-64 text-muted-foreground gap-3">
|
||||
<Link2 className="h-10 w-10 text-muted-foreground/50" />
|
||||
<p>No share links created yet.</p>
|
||||
</div>
|
||||
) : (
|
||||
<div className="border border-border rounded-xl bg-background overflow-hidden shadow-xs">
|
||||
<Table>
|
||||
<TableHeader>
|
||||
<TableRow className="hover:bg-transparent bg-muted/20">
|
||||
<TableHead className="font-semibold px-4 py-3">Name</TableHead>
|
||||
<TableHead className="font-semibold px-4 py-3">Public Link</TableHead>
|
||||
<TableHead className="font-semibold px-4 py-3">Creator</TableHead>
|
||||
<TableHead className="font-semibold px-4 py-3 w-[150px]">
|
||||
Created Date
|
||||
</TableHead>
|
||||
<TableHead className="font-semibold px-4 py-3 text-right w-[120px]">
|
||||
Active
|
||||
</TableHead>
|
||||
</TableRow>
|
||||
</TableHeader>
|
||||
<TableBody>
|
||||
{shares.map((share) => {
|
||||
const shareUrl = `${window.location.origin}/share/${share.id}`
|
||||
return (
|
||||
<TableRow key={share.id} className="hover:bg-muted/10 transition-colors">
|
||||
<TableCell className="font-medium px-4 py-3.5">
|
||||
<span
|
||||
className="cursor-pointer hover:underline text-foreground"
|
||||
onClick={() =>
|
||||
navigate({
|
||||
to: '/projects/$projectId/shares/$shareId',
|
||||
params: { projectId, shareId: share.id },
|
||||
})
|
||||
}
|
||||
>
|
||||
{share.name}
|
||||
</span>
|
||||
</TableCell>
|
||||
<TableCell className="px-4 py-3.5 max-w-[300px]">
|
||||
<div className="flex items-center gap-2 group">
|
||||
<span
|
||||
className="truncate text-xs font-mono bg-muted/50 text-muted-foreground px-2 py-1 rounded-md border border-border cursor-pointer hover:bg-muted transition-colors flex-1"
|
||||
onClick={() => handleCopyLink(share.id)}
|
||||
title="Click to copy link"
|
||||
>
|
||||
{shareUrl}
|
||||
</span>
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="icon-sm"
|
||||
className="h-7 w-7 opacity-0 group-hover:opacity-100 transition-opacity"
|
||||
onClick={() => handleCopyLink(share.id)}
|
||||
>
|
||||
<Copy className="h-3.5 w-3.5" />
|
||||
</Button>
|
||||
<a
|
||||
href={shareUrl}
|
||||
target="_blank"
|
||||
rel="noreferrer"
|
||||
className="text-muted-foreground hover:text-foreground inline-flex items-center"
|
||||
>
|
||||
<ExternalLink className="h-3.5 w-3.5" />
|
||||
</a>
|
||||
</div>
|
||||
</TableCell>
|
||||
<TableCell className="px-4 py-3.5">
|
||||
<div className="flex items-center gap-2">
|
||||
<div className="h-6 w-6 rounded-full bg-primary/10 flex items-center justify-center shrink-0">
|
||||
<User className="h-3.5 w-3.5 text-primary" />
|
||||
</div>
|
||||
<span className="text-sm font-medium text-foreground truncate max-w-[150px]">
|
||||
{share.creator?.name || 'Unknown'}
|
||||
</span>
|
||||
</div>
|
||||
</TableCell>
|
||||
<TableCell className="px-4 py-3.5 text-muted-foreground text-sm">
|
||||
<div className="flex items-center gap-2">
|
||||
<Calendar className="h-3.5 w-3.5 text-muted-foreground/70" />
|
||||
<span>{new Date(share.createdAt).toLocaleDateString()}</span>
|
||||
</div>
|
||||
</TableCell>
|
||||
<TableCell className="px-4 py-3.5 text-right">
|
||||
<div className="flex justify-end">
|
||||
<Switch
|
||||
checked={!share.isDisabled}
|
||||
onCheckedChange={(checked) =>
|
||||
toggleVisibility({ id: share.id, isDisabled: !checked })
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
)
|
||||
})}
|
||||
</TableBody>
|
||||
</Table>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
export const Route = createFileRoute('/projects/$projectId/shares/')({
|
||||
component: SharesPage,
|
||||
loader: ({ context: { queryClient }, params: { projectId } }) =>
|
||||
queryClient.ensureQueryData(projectInfoQueryOptions(projectId)),
|
||||
pendingComponent: () => <ProjectFolderSkeleton />,
|
||||
})
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"routesDirectory": "routes",
|
||||
"generatedRouteTree": "routeTree.gen.ts"
|
||||
}
|
||||
Reference in New Issue
Block a user