Move src/ → apps/server/ and packages/web/ → apps/web/ to adopt standard monorepo conventions (apps/ for runnable apps, packages/ for reusable libraries). Update all config files, shared package imports, test fixtures, and documentation to reflect new paths. Key fixes: - Update workspace config to ["apps/*", "packages/*"] - Update tsconfig.json rootDir/include for apps/server/ - Add apps/web/** to vitest exclude list - Update drizzle.config.ts schema path - Fix ensure-schema.ts migration path detection (3 levels up in dev, 2 levels up in dist) - Fix tests/integration/cli-server.test.ts import paths - Update packages/shared imports to apps/server/ paths - Update all docs/ files with new paths
67 lines
1.8 KiB
TypeScript
67 lines
1.8 KiB
TypeScript
import { useState } from "react";
|
|
import { ChevronDown } from "lucide-react";
|
|
import { Button } from "@/components/ui/button";
|
|
import {
|
|
DropdownMenu,
|
|
DropdownMenuContent,
|
|
DropdownMenuItem,
|
|
DropdownMenuTrigger,
|
|
} from "@/components/ui/dropdown-menu";
|
|
import { trpc } from "@/lib/trpc";
|
|
import { useSpawnMutation } from "@/hooks/useSpawnMutation";
|
|
|
|
interface SpawnArchitectDropdownProps {
|
|
initiativeId: string;
|
|
initiativeName?: string;
|
|
}
|
|
|
|
export function SpawnArchitectDropdown({
|
|
initiativeId,
|
|
}: SpawnArchitectDropdownProps) {
|
|
const [open, setOpen] = useState(false);
|
|
const [successText, setSuccessText] = useState<string | null>(null);
|
|
|
|
const handleSuccess = () => {
|
|
setOpen(false);
|
|
setSuccessText("Spawned!");
|
|
setTimeout(() => setSuccessText(null), 2000);
|
|
};
|
|
|
|
const discussSpawn = useSpawnMutation(trpc.spawnArchitectDiscuss.useMutation, {
|
|
onSuccess: handleSuccess,
|
|
});
|
|
|
|
const planSpawn = useSpawnMutation(trpc.spawnArchitectPlan.useMutation, {
|
|
onSuccess: handleSuccess,
|
|
});
|
|
|
|
const isPending = discussSpawn.isSpawning || planSpawn.isSpawning;
|
|
|
|
function handleDiscuss() {
|
|
discussSpawn.spawn({ initiativeId });
|
|
}
|
|
|
|
function handlePlan() {
|
|
planSpawn.spawn({ initiativeId });
|
|
}
|
|
|
|
return (
|
|
<DropdownMenu open={open} onOpenChange={setOpen}>
|
|
<DropdownMenuTrigger asChild>
|
|
<Button variant="outline" size="sm" disabled={isPending}>
|
|
{successText ?? "Spawn Architect"}
|
|
<ChevronDown className="ml-1 h-3 w-3" />
|
|
</Button>
|
|
</DropdownMenuTrigger>
|
|
<DropdownMenuContent align="start">
|
|
<DropdownMenuItem onClick={handleDiscuss} disabled={isPending}>
|
|
Discuss
|
|
</DropdownMenuItem>
|
|
<DropdownMenuItem onClick={handlePlan} disabled={isPending}>
|
|
Plan
|
|
</DropdownMenuItem>
|
|
</DropdownMenuContent>
|
|
</DropdownMenu>
|
|
);
|
|
}
|