chore(repo): initialize planarchy workspace

This commit is contained in:
2026-03-14 14:31:09 +01:00
commit dd55d0e78b
769 changed files with 166461 additions and 0 deletions
@@ -0,0 +1,35 @@
"use client";
import type { AllocationLike, Assignment, DemandRequirement } from "@planarchy/shared";
import { trpc } from "~/lib/trpc/client.js";
/**
* Fetches full project context when a project is being dragged or the panel opens.
* Returns the project's resources, their own allocations, and all cross-project allocations.
*/
// eslint-disable-next-line @typescript-eslint/no-explicit-any
type ProjectDragContextResult = {
contextResourceIds: string[];
// eslint-disable-next-line @typescript-eslint/no-explicit-any
contextAllocations: any[];
projectAssignments: Assignment<AllocationLike>[];
projectDemands: DemandRequirement<AllocationLike>[];
// eslint-disable-next-line @typescript-eslint/no-explicit-any
project: any | null;
};
export function useProjectDragContext(projectId: string | null): ProjectDragContextResult {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const { data } = trpc.timeline.getProjectContext.useQuery(
{ projectId: projectId! },
{ enabled: !!projectId, staleTime: 10_000 },
) as { data: any };
return {
contextResourceIds: (data?.resourceIds ?? []) as string[],
contextAllocations: data?.allResourceAllocations ?? [],
projectAssignments: (data?.assignments ?? []) as Assignment<AllocationLike>[],
projectDemands: (data?.demands ?? []) as DemandRequirement<AllocationLike>[],
project: data?.project ?? null,
};
}