feat: Implement core application structure with new dashboard, settings, and help pages, and enhance opportunities management with persistence and filtering.

This commit is contained in:
2026-02-03 20:05:30 +00:00
parent 609b9da020
commit 885bbbf954
21 changed files with 1282 additions and 106 deletions

View File

@@ -0,0 +1,46 @@
"use client";
import { createContext, useContext, useEffect, useMemo, useState } from "react";
const STORAGE_KEY = "selectedProjectId";
type ProjectContextValue = {
selectedProjectId: string | null;
setSelectedProjectId: (id: string | null) => void;
};
const ProjectContext = createContext<ProjectContextValue | null>(null);
export function ProjectProvider({ children }: { children: React.ReactNode }) {
const [selectedProjectId, setSelectedProjectId] = useState<string | null>(null);
useEffect(() => {
const stored = window.localStorage.getItem(STORAGE_KEY);
if (stored) {
setSelectedProjectId(stored);
}
}, []);
useEffect(() => {
if (selectedProjectId) {
window.localStorage.setItem(STORAGE_KEY, selectedProjectId);
} else {
window.localStorage.removeItem(STORAGE_KEY);
}
}, [selectedProjectId]);
const value = useMemo(
() => ({ selectedProjectId, setSelectedProjectId }),
[selectedProjectId]
);
return <ProjectContext.Provider value={value}>{children}</ProjectContext.Provider>;
}
export function useProject() {
const context = useContext(ProjectContext);
if (!context) {
throw new Error("useProject must be used within a ProjectProvider.");
}
return context;
}