import { Plural, Trans } from '@lingui/react/macro'; import { FolderType } from '@prisma/client'; import { ArrowRightIcon, FolderIcon, FolderPlusIcon, MoreVerticalIcon, PinIcon, SettingsIcon, TrashIcon, } from 'lucide-react'; import { Link } from 'react-router'; import { formatDocumentsPath, formatTemplatesPath } from '@documenso/lib/utils/teams'; import { type TFolderWithSubfolders } from '@documenso/trpc/server/folder-router/schema'; import { Button } from '@documenso/ui/primitives/button'; import { Card, CardContent } from '@documenso/ui/primitives/card'; import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuTrigger, } from '@documenso/ui/primitives/dropdown-menu'; import { useCurrentTeam } from '~/providers/team'; export type FolderCardProps = { folder: TFolderWithSubfolders; onMove: (folder: TFolderWithSubfolders) => void; onPin: (folderId: string) => void; onUnpin: (folderId: string) => void; onSettings: (folder: TFolderWithSubfolders) => void; onDelete: (folder: TFolderWithSubfolders) => void; }; export const FolderCard = ({ folder, onMove, onPin, onUnpin, onSettings, onDelete, }: FolderCardProps) => { const team = useCurrentTeam(); const formatPath = () => { const rootPath = folder.type === FolderType.DOCUMENT ? formatDocumentsPath(team.url) : formatTemplatesPath(team.url); return `${rootPath}/f/${folder.id}`; }; return (

{folder.name} {folder.pinned && }

{folder.type === FolderType.TEMPLATE ? ( # template} other={# templates} /> ) : ( # document} other={# documents} /> )} # folder} other={# folders} />
e.stopPropagation()} align="end"> onMove(folder)}> Move (folder.pinned ? onUnpin(folder.id) : onPin(folder.id))} > {folder.pinned ? Unpin : Pin} onSettings(folder)}> Settings onDelete(folder)}> Delete
); }; export const FolderCardEmpty = ({ type }: { type: FolderType }) => { return (

Create folder

{type === FolderType.DOCUMENT ? ( Organise your documents ) : ( Organise your templates )}
); };