'use client';

import {createContext,useContext} from 'react';
import type {Catalog} from '@/lib/catalog';

// Keep context identity independent of the refreshable dashboard layout.
// Mounted member layouts and newly loaded wallet routes must use one provider.
export const DashboardCatalogContext=createContext<Catalog|null>(null);

export function useDashboardCatalog(){
 const catalog=useContext(DashboardCatalogContext);
 if(!catalog)throw new Error('Dashboard layout is required');
 return catalog;
}
