From 034f2ef5ff5dce3698bd730eec2caa1d26e61911 Mon Sep 17 00:00:00 2001 From: yiling Date: Sat, 23 May 2026 14:12:12 +0800 Subject: [PATCH] fix(ui): improve project card interactions and layout consistency This PR addresses two main issues on the projects page: 1. Double-click bleed-through: Accidental double-clicks on project cards would previously trigger unintended interactions on the following file list page. A 200ms navigation delay and click debouncing now prevent this. 2. Layout inconsistency: The 'Create Project' card now matches the height and structure of existing project cards, ensuring a stable grid layout even when no projects are present. 3. Tactile feedback: Added a 'shrink-and-restore' scale animation to all project cards for better visual confirmation of clicks. --- src/ui/routes/teams/$teamId/index.tsx | 77 ++++++++++++++++++++------- 1 file changed, 58 insertions(+), 19 deletions(-) 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 +

+
- +