Loading...
import { useState, useCallback, useEffect } from "react"; import { useParams, useNavigate } from "react-router"; import { Masthead } from "../components/Masthead"; import { ContractList } from "../components/contracts/ContractList"; import { ContractDetail } from "../components/contracts/ContractDetail"; import { DirectoryInput } from "../components/mesh/DirectoryInput"; import { useContracts } from "../hooks/useContracts"; import { useAuth } from "../contexts/AuthContext"; import { createTask, getDaemonDirectories, getRepositorySuggestions } from "../lib/api"; import type { ContractWithRelations, ContractPhase, ContractStatus, ContractType, CreateContractRequest, RepositorySourceType, DaemonDirectory, RepositoryHistoryEntry, } from "../lib/api"; import { getValidPhases, getDefaultPhase } from "../lib/api"; export default function ContractsPage() { 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...
{contractType === "simple" ? "Plan → Execute: Simple workflow with a plan document" : "Research → Specify → Plan → Execute → Review: Full specification-driven development with TDD"}
{contractType === "simple" ? "Start in Plan to define what to build, or Execute if already planned" : "Skip earlier phases if you already have requirements defined"}
A managed repository will be created automatically by the daemon.
)}Select a contract or create a new one