mirror of
https://github.com/multica-ai/multica.git
synced 2026-07-31 00:40:46 +02:00
- Create NavigationAdapter interface (push, replace, back, pathname, searchParams) - Create AppLink component replacing next/link in 4 files - Replace useRouter → useNavigation in 3 files (issue-detail, create-issue, create-workspace) - Create WebNavigationProvider wrapping Next.js useRouter/usePathname/useSearchParams - Move ~85 feature UI files (issues, editor, modals, my-issues, skills, runtimes) to packages/views/ - Add store singleton registration pattern (registerAuthStore, registerWorkspaceStore) - Create data-aware wrappers in packages/views/common/ (ActorAvatar, Markdown) - Update all app-layer imports to @multica/views/* - Add @source directive for Tailwind to scan views package - packages/views/ has zero next/* imports Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
28 lines
636 B
TypeScript
28 lines
636 B
TypeScript
"use client";
|
|
|
|
import { createContext, useContext } from "react";
|
|
import type { NavigationAdapter } from "./types";
|
|
|
|
const NavigationContext = createContext<NavigationAdapter | null>(null);
|
|
|
|
export function NavigationProvider({
|
|
value,
|
|
children,
|
|
}: {
|
|
value: NavigationAdapter;
|
|
children: React.ReactNode;
|
|
}) {
|
|
return (
|
|
<NavigationContext.Provider value={value}>
|
|
{children}
|
|
</NavigationContext.Provider>
|
|
);
|
|
}
|
|
|
|
export function useNavigation(): NavigationAdapter {
|
|
const ctx = useContext(NavigationContext);
|
|
if (!ctx)
|
|
throw new Error("useNavigation must be used within NavigationProvider");
|
|
return ctx;
|
|
}
|