From b8d563d45f14a2b1db1f684aa0a8dcd7e5b6ad56 Mon Sep 17 00:00:00 2001 From: soryu Date: Sat, 7 Feb 2026 00:01:50 +0000 Subject: Remove directives for reimplementation --- makima/frontend/src/routes/directives.tsx | 184 ------------------------------ 1 file changed, 184 deletions(-) delete mode 100644 makima/frontend/src/routes/directives.tsx (limited to 'makima/frontend/src/routes') diff --git a/makima/frontend/src/routes/directives.tsx b/makima/frontend/src/routes/directives.tsx deleted file mode 100644 index 90f0854..0000000 --- a/makima/frontend/src/routes/directives.tsx +++ /dev/null @@ -1,184 +0,0 @@ -import { useState, useCallback, useEffect } from "react"; -import { useParams, useNavigate } from "react-router"; -import { Masthead } from "../components/Masthead"; -import { useDirectives } from "../hooks/useDirectives"; -import { useDirectiveDetail } from "../hooks/useDirectiveDetail"; -import { useAuth } from "../contexts/AuthContext"; -import type { - DirectiveSummary, - CreateDirectiveRequest, - AutonomyLevel, -} from "../lib/api"; -import { DirectiveList } from "../components/directives/DirectiveList"; -import { DirectiveDetail } from "../components/directives/DirectiveDetail"; -import { CreateDirectiveModal } from "../components/directives/CreateDirectiveModal"; - -export default function DirectivesPage() { - const { isAuthenticated, isAuthConfigured, isLoading: authLoading } = useAuth(); - const navigate = useNavigate(); - - // Redirect to login if not authenticated (when auth is configured) - useEffect(() => { - if (!authLoading && isAuthConfigured && !isAuthenticated) { - navigate("/login"); - } - }, [authLoading, isAuthConfigured, isAuthenticated, navigate]); - - // Show loading while checking auth - if (authLoading) { - return ( -
- -
-

Loading...

-
-
- ); - } - - // Don't render if not authenticated (will redirect) - if (isAuthConfigured && !isAuthenticated) { - return null; - } - - return ; -} - -function DirectivesPageContent() { - const { id } = useParams<{ id: string }>(); - const navigate = useNavigate(); - const { - directives, - loading, - error, - createNewDirective, - archiveExistingDirective, - } = useDirectives(); - - const { - directive: directiveDetail, - graph: directiveGraph, - loading: detailLoading, - refresh: refreshDetail, - start: handleStart, - pause: handlePause, - resume: handleResume, - stop: handleStop, - } = useDirectiveDetail(id); - - const [isCreating, setIsCreating] = useState(false); - - const handleSelect = useCallback( - (directiveId: string) => { - navigate(`/directives/${directiveId}`); - }, - [navigate] - ); - - const handleBack = useCallback(() => { - navigate("/directives"); - }, [navigate]); - - const handleCreate = useCallback(() => { - setIsCreating(true); - }, []); - - const handleCreateSubmit = useCallback( - async (goal: string, repositoryUrl: string | undefined, autonomyLevel: AutonomyLevel) => { - const data: CreateDirectiveRequest = { - goal: goal.trim(), - repositoryUrl: repositoryUrl?.trim() || undefined, - autonomyLevel, - }; - - try { - const result = await createNewDirective(data); - if (result) { - setIsCreating(false); - navigate(`/directives/${result.id}`); - } - } catch (err) { - console.error("Failed to create directive:", err); - } - }, - [createNewDirective, navigate] - ); - - const handleCreateCancel = useCallback(() => { - setIsCreating(false); - }, []); - - const handleArchive = useCallback( - async (directive: DirectiveSummary) => { - if (confirm(`Are you sure you want to archive this directive?`)) { - const success = await archiveExistingDirective(directive.id); - if (success && directive.id === id) { - navigate("/directives"); - } - } - }, - [archiveExistingDirective, id, navigate] - ); - - return ( -
- -
- {error && ( -
- {error} -
- )} - - {/* Create directive modal */} - {isCreating && ( - - )} - -
- {/* Directive list */} - - - {/* Directive detail or empty state */} - {directiveDetail ? ( - - ) : ( -
-
-

- Select a directive or create a new one -

- -
-
- )} -
-
-
- ); -} -- cgit v1.2.3