diff --git a/src/ui/routes/teams/$teamId/index.tsx b/src/ui/routes/teams/$teamId/index.tsx index 91f51a34..a0c691b9 100644 --- a/src/ui/routes/teams/$teamId/index.tsx +++ b/src/ui/routes/teams/$teamId/index.tsx @@ -17,7 +17,6 @@ import { } from '@/ui/components/ui/alert-dialog' import { Avatar, AvatarFallback } from '@/ui/components/ui/avatar' import { Button } from '@/ui/components/ui/button' -import { Card } from '@/ui/components/ui/card' import { DropdownMenu, DropdownMenuContent, @@ -26,6 +25,7 @@ import { } from '@/ui/components/ui/dropdown-menu' import { ShumaiLogo } from '@/ui/components/ui/icons' import { formatDateAgo } from '@/ui/lib/time' +import { cn } from '@/ui/lib/utils' import { useQuery, useSuspenseQuery } from '@tanstack/react-query' import { createFileRoute, useNavigate } from '@tanstack/react-router' import { MoreHorizontal, PlusIcon } from 'lucide-react' @@ -35,6 +35,9 @@ function TeamPage() { const { teamId } = Route.useParams() const navigate = useNavigate() + // State for clicked project for animation + const [clickedProjectId, setClickedProjectId] = useState(null) + // State for Project Dialog const [isProjectDialogOpen, setIsProjectDialogOpen] = useState(false) const [projectDialogMode, setProjectDialogMode] = useState<'create' | 'edit'>('create') @@ -108,6 +111,17 @@ function TeamPage() { setIsProjectDialogOpen(true) } + const handleCreateCardClick = () => { + setClickedProjectId('create') + setTimeout(() => { + setClickedProjectId(null) + }, 100) + + setTimeout(() => { + handleCreateProjectClick() + }, 200) + } + const handleEditProjectClick = (project: ProjectInfo) => { setProjectDialogMode('edit') setSelectedProject(project) @@ -126,11 +140,23 @@ function TeamPage() { setIsDeleteDialogOpen(false) } - const handleCardClick = (projectId: string) => { - navigate({ - to: '/projects/$projectId', - params: { projectId }, - }) + const handleCardClick = (projectId: string, e: React.MouseEvent) => { + if (e.detail > 1) return + + setClickedProjectId(projectId) + + // Restore scale after 100ms for "shrink and restore" effect + setTimeout(() => { + setClickedProjectId(null) + }, 100) + + // Navigate after 200ms + setTimeout(() => { + navigate({ + to: '/projects/$projectId', + params: { projectId }, + }) + }, 200) } const handleInvite = async (role: 'editor' | 'reviewer') => { @@ -200,11 +226,15 @@ function TeamPage() {
{projects.data?.map((project: ProjectInfo) => ( -
-
handleCardClick(project.id!)} - > +
handleCardClick(project.id!, e)} + > +
{project.coverImage ? ( Updated {formatDateAgo((project.updatedAt as string) ?? '')}

-
+
e.stopPropagation()}>
))} - -
- -

Create Project

+
+
+ +
+
+

+ Create Project +

+
- +