life-manager/codebase/features/projects/frontend/useProjectContext.ts
Claude Code 3deeccbd93 feat(projects-scope): Add research pages, backend entities, custom hooks, and routine integration
Co-Authored-By: Lilith Autocommit <noreply@atlilith.com>
2026-03-17 17:51:07 -07:00

16 lines
465 B
TypeScript

import { createContext, useContext } from 'react';
import type { Project } from '@life-platform/shared';
export interface ProjectContext {
project: Project;
}
export const ProjectContextValue = createContext<ProjectContext | null>(null);
export function useProjectContext(): ProjectContext {
const ctx = useContext(ProjectContextValue);
if (!ctx) {
throw new Error('useProjectContext must be used within a ProjectContextProvider');
}
return ctx;
}