| // src/components/workspace/SmartGlassProvider.tsx | |
| import { createContext, useContext, ReactNode } from "react"; | |
| import { useSmartGlassWorkspace } from "@/hooks/useSmartGlassWorkspace"; | |
| import { WorkspacePanel, PanelContentType, WorkspacePreset } from "@/types/workspace"; | |
| interface SmartGlassContextValue { | |
| panels: WorkspacePanel[]; | |
| activePanelId: string | null; | |
| setActivePanelId: (id: string | null) => void; | |
| addPanel: (type: PanelContentType, props?: Record<string, any>) => void; | |
| removePanel: (panelId: string) => void; | |
| updatePanel: (panelId: string, updates: Partial<WorkspacePanel>) => void; | |
| focusPanel: (panelId: string) => void; | |
| toggleMinimize: (panelId: string) => void; | |
| toggleMaximize: (panelId: string) => void; | |
| closePanel: (panelId: string) => void; | |
| applyPreset: (preset: WorkspacePreset) => void; | |
| clearAllPanels: () => void; | |
| getPanelById: (panelId: string) => WorkspacePanel | undefined; | |
| showPresetModal: boolean; | |
| setShowPresetModal: (show: boolean) => void; | |
| showAddPanelMenu: boolean; | |
| setShowAddPanelMenu: (show: boolean) => void; | |
| panelMeta: typeof import("@/types/workspace").PANEL_METADATA; | |
| presets: WorkspacePreset[]; | |
| } | |
| const SmartGlassContext = createContext<SmartGlassContextValue | null>(null); | |
| export function SmartGlassProvider({ children }: { children: ReactNode }) { | |
| const value = useSmartGlassWorkspace(); | |
| return <SmartGlassContext.Provider value={value}>{children}</SmartGlassContext.Provider>; | |
| } | |
| export const useSmartGlass = () => { | |
| const ctx = useContext(SmartGlassContext); | |
| if (!ctx) throw new Error("useSmartGlass must be used within SmartGlassProvider"); | |
| return ctx; | |
| }; |
Xet Storage Details
- Size:
- 1.65 kB
- Xet hash:
- 7799b9b3e92a5f5ee7e7f33078640afd0453cb929412097117ef7d7ef7cc9522
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.