feat: implement watch claude code project folders and sync state

This commit is contained in:
d-kimsuon
2025-08-31 16:37:53 +09:00
parent 14b074c03c
commit be9914670c
13 changed files with 503 additions and 8 deletions

View File

@@ -0,0 +1,13 @@
"use client";
import { useServerEvents } from "@/hooks/useServerEvents";
interface ServerEventsProviderProps {
children: React.ReactNode;
}
export function ServerEventsProvider({ children }: ServerEventsProviderProps) {
useServerEvents();
return <>{children}</>;
}

View File

@@ -2,6 +2,7 @@ import type { Metadata } from "next";
import { Geist, Geist_Mono } from "next/font/google";
import { QueryClientProviderWrapper } from "../lib/api/QueryClientProviderWrapper";
import { RootErrorBoundary } from "./components/RootErrorBoundary";
import { ServerEventsProvider } from "./components/ServerEventsProvider";
import "./globals.css";
@@ -16,8 +17,8 @@ const geistMono = Geist_Mono({
});
export const metadata: Metadata = {
title: "Create Next App",
description: "Generated by create next app",
title: "Claude Code Viewer",
description: "Web Viewer for Claude Code history",
};
export default function RootLayout({
@@ -26,12 +27,14 @@ export default function RootLayout({
children: React.ReactNode;
}>) {
return (
<html lang="en">
<html lang="ja">
<body
className={`${geistSans.variable} ${geistMono.variable} antialiased`}
>
<RootErrorBoundary>
<QueryClientProviderWrapper>{children}</QueryClientProviderWrapper>
<QueryClientProviderWrapper>
<ServerEventsProvider>{children}</ServerEventsProvider>
</QueryClientProviderWrapper>
</RootErrorBoundary>
</body>
</html>

View File

@@ -12,6 +12,5 @@ export const useProject = (projectId: string) => {
return await response.json();
},
refetchOnReconnect: true,
refetchInterval: 10 * 1000,
});
};

View File

@@ -3,7 +3,7 @@ import { honoClient } from "../../../../../../lib/api/client";
export const useSessionQuery = (projectId: string, sessionId: string) => {
return useSuspenseQuery({
queryKey: ["conversations", sessionId],
queryKey: ["sessions", sessionId],
queryFn: async () => {
const response = await honoClient.api.projects[":projectId"].sessions[
":sessionId"

View File

@@ -1,6 +1,9 @@
import { HistoryIcon } from "lucide-react";
import { ProjectList } from "./components/ProjectList";
export const dynamic = "force-dynamic";
export const fetchCache = "force-no-store";
export default async function ProjectsPage() {
return (
<div className="container mx-auto px-4 py-8">