import { createContext, useContext } from 'react' import type { Note } from './data/notes.ts' export type AppShellContext = { appBasePath: string assetBasePath: string clientModuleUrl: string | null runningSha: string /** Server-only: list notes from packageStorage. Undefined in the browser. */ listNotes?: () => Promise> /** Server-only: format about page data. */ loadAbout?: () => Promise<{ sha: string shortSha: string message: string publishedAt: string committedAt: string codeUrl: string | null runningSha: string }> } export const AppShellReactContext = createContext(null) export function useAppShell(): AppShellContext { const value = useContext(AppShellReactContext) if (!value) { throw new Error('useAppShell must be used within AppShellReactContext') } return value }