From 8b4b0d6a650ad1bfeac2cae1f2d8f58e539a147d Mon Sep 17 00:00:00 2001 From: Che <30403707+Che-Zhu@users.noreply.github.com> Date: Sun, 9 Nov 2025 16:22:08 +0800 Subject: [PATCH 1/4] Refactor: Organize sidebar components into dedicated directory MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Move primary-sidebar.tsx and project-sidebar.tsx to components/sidebars/ - Update import paths in app/settings/layout.tsx and app/projects/[id]/layout.tsx - Improve code organization and modularity 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- app/projects/[id]/layout.tsx | 4 ++-- app/settings/layout.tsx | 2 +- components/{ => sidebars}/primary-sidebar.tsx | 0 components/{ => sidebars}/project-sidebar.tsx | 0 4 files changed, 3 insertions(+), 3 deletions(-) rename components/{ => sidebars}/primary-sidebar.tsx (100%) rename components/{ => sidebars}/project-sidebar.tsx (100%) diff --git a/app/projects/[id]/layout.tsx b/app/projects/[id]/layout.tsx index 7219e79..f6815d4 100644 --- a/app/projects/[id]/layout.tsx +++ b/app/projects/[id]/layout.tsx @@ -3,8 +3,8 @@ import { notFound } from 'next/navigation'; import ContentWrapper from '@/components/content-wrapper'; import PersistentTerminal from '@/components/persistent-terminal'; -import PrimarySidebar from '@/components/primary-sidebar'; -import ProjectSidebar from '@/components/project-sidebar'; +import PrimarySidebar from '@/components/sidebars/primary-sidebar'; +import ProjectSidebar from '@/components/sidebars/project-sidebar'; import { TerminalProvider } from '@/components/terminal-provider'; import { auth } from '@/lib/auth'; import { prisma } from '@/lib/db'; diff --git a/app/settings/layout.tsx b/app/settings/layout.tsx index c2b73d2..6f675ee 100644 --- a/app/settings/layout.tsx +++ b/app/settings/layout.tsx @@ -1,7 +1,7 @@ import { ReactNode } from 'react'; import { redirect } from 'next/navigation'; -import PrimarySidebar from '@/components/primary-sidebar'; +import PrimarySidebar from '@/components/sidebars/primary-sidebar'; import { auth } from '@/lib/auth'; export default async function SettingsLayout({ diff --git a/components/primary-sidebar.tsx b/components/sidebars/primary-sidebar.tsx similarity index 100% rename from components/primary-sidebar.tsx rename to components/sidebars/primary-sidebar.tsx diff --git a/components/project-sidebar.tsx b/components/sidebars/project-sidebar.tsx similarity index 100% rename from components/project-sidebar.tsx rename to components/sidebars/project-sidebar.tsx From ec03f98e9280aa690887f39014c58b43edc3f42d Mon Sep 17 00:00:00 2001 From: Che <30403707+Che-Zhu@users.noreply.github.com> Date: Sun, 9 Nov 2025 22:38:07 +0800 Subject: [PATCH 2/4] Refactor: Migrate to Prisma-generated Project types MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Remove custom Project type definition from types/project.ts - Update imports in ProjectCard and projects page to use @prisma/client - Enhance type safety by using ProjectStatus enum instead of string - Ensure consistency with database schema across all components 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- app/projects/page.tsx | 2 +- components/features/projectList/ProjectCard.tsx | 2 +- types/project.ts | 8 -------- 3 files changed, 2 insertions(+), 10 deletions(-) delete mode 100644 types/project.ts diff --git a/app/projects/page.tsx b/app/projects/page.tsx index 612907a..02e8727 100644 --- a/app/projects/page.tsx +++ b/app/projects/page.tsx @@ -1,13 +1,13 @@ 'use client'; import { useCallback, useEffect, useState } from 'react'; +import { Project } from '@prisma/client'; import { Loader2 } from 'lucide-react'; import NoProject from '@/components/features/projectList/NoProject'; import PageHeader from '@/components/features/projectList/PageHeader'; import ProjectCard from '@/components/features/projectList/ProjectCard'; import { GET } from '@/lib/fetch-client'; -import { Project } from '@/types/project'; // TODO: convert this page to ssr, add loading and error status, add a ProjectGrid UI, and handle data fetching there diff --git a/components/features/projectList/ProjectCard.tsx b/components/features/projectList/ProjectCard.tsx index 3099565..88a8cbb 100644 --- a/components/features/projectList/ProjectCard.tsx +++ b/components/features/projectList/ProjectCard.tsx @@ -1,9 +1,9 @@ import { memo } from 'react'; +import { Project } from '@prisma/client'; import { Clock } from 'lucide-react'; import Link from 'next/link'; import { cn } from '@/lib/utils'; -import { Project } from '@/types/project'; interface ProjectCardProps { project: Project; diff --git a/types/project.ts b/types/project.ts deleted file mode 100644 index 2cf5943..0000000 --- a/types/project.ts +++ /dev/null @@ -1,8 +0,0 @@ -export interface Project { - id: string; - name: string; - description: string | null; - status: string; - updatedAt: string; - githubRepo: string | null; -} \ No newline at end of file From 0e8d0f3af28b0b00920bc8567098bf58147eecde Mon Sep 17 00:00:00 2001 From: Che <30403707+Che-Zhu@users.noreply.github.com> Date: Sun, 9 Nov 2025 22:54:05 +0800 Subject: [PATCH 3/4] Fix: Update Project type import in use-projects hook MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Change from custom '@/types/project' to '@prisma/client' - Fix ESLint import sorting issues - Remove redundant variable to resolve linting warnings 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- hooks/use-projects.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hooks/use-projects.ts b/hooks/use-projects.ts index 54faaf6..4cfe8c5 100644 --- a/hooks/use-projects.ts +++ b/hooks/use-projects.ts @@ -6,8 +6,9 @@ import { useQuery } from '@tanstack/react-query'; +import type { Project } from '@prisma/client'; + import { GET } from '@/lib/fetch-client'; -import type { Project } from '@/types/project'; interface UseProjectsOptions { /** Enable automatic refetching every 3 seconds */ @@ -33,8 +34,7 @@ export function useProjects(options: UseProjectsOptions = {}) { const url = namespace ? `/api/projects?namespace=${encodeURIComponent(namespace)}` : '/api/projects'; - const data = await GET(url); - return data; + return GET(url); }, refetchInterval, refetchOnWindowFocus, From 0c638517156684f4d2f9f160ed53063f63744d42 Mon Sep 17 00:00:00 2001 From: Che <30403707+Che-Zhu@users.noreply.github.com> Date: Sun, 9 Nov 2025 22:57:49 +0800 Subject: [PATCH 4/4] Fix: Remove unused Project type imports MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Remove unused Project import from app/projects/page.tsx (type inferred from hook) - Update import order in hooks/use-projects.ts for ESLint compliance - Clean up redundant imports after Prisma type migration 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- app/projects/page.tsx | 2 -- hooks/use-projects.ts | 3 +-- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/app/projects/page.tsx b/app/projects/page.tsx index ea38bf3..5902d57 100644 --- a/app/projects/page.tsx +++ b/app/projects/page.tsx @@ -7,8 +7,6 @@ 'use client'; -import { Project } from '@prisma/client'; - import NoProject from '@/components/features/projectList/NoProject'; import PageHeader from '@/components/features/projectList/PageHeader'; import ProjectCard from '@/components/features/projectList/ProjectCard'; diff --git a/hooks/use-projects.ts b/hooks/use-projects.ts index 4cfe8c5..ff1361d 100644 --- a/hooks/use-projects.ts +++ b/hooks/use-projects.ts @@ -4,9 +4,8 @@ * Provides automatic caching, refetching, and state synchronization */ -import { useQuery } from '@tanstack/react-query'; - import type { Project } from '@prisma/client'; +import { useQuery } from '@tanstack/react-query'; import { GET } from '@/lib/fetch-client';