- layout-content wraps integrations/pricing in DashboardShell - GlassTopBar derives title per page (Integrations, Pricing, etc.) - Site card gear icon opens settings modal with siteId context - Removed delete button from site cards (accessible via site settings) - Extended InitialTab to accept optional siteId for cross-page use
45 lines
1.2 KiB
TypeScript
45 lines
1.2 KiB
TypeScript
'use client'
|
|
|
|
import { createContext, useContext, useState, useCallback } from 'react'
|
|
|
|
type InitialTab = { context?: 'site' | 'workspace' | 'account'; tab?: string; siteId?: string } | null
|
|
|
|
interface UnifiedSettingsContextType {
|
|
isOpen: boolean
|
|
openUnifiedSettings: (initialTab?: InitialTab) => void
|
|
closeUnifiedSettings: () => void
|
|
initialTab: InitialTab
|
|
}
|
|
|
|
const UnifiedSettingsContext = createContext<UnifiedSettingsContextType>({
|
|
isOpen: false,
|
|
openUnifiedSettings: () => {},
|
|
closeUnifiedSettings: () => {},
|
|
initialTab: null,
|
|
})
|
|
|
|
export function UnifiedSettingsProvider({ children }: { children: React.ReactNode }) {
|
|
const [isOpen, setIsOpen] = useState(false)
|
|
const [initialTab, setInitialTab] = useState<InitialTab>(null)
|
|
|
|
const openUnifiedSettings = useCallback((init?: InitialTab) => {
|
|
setInitialTab(init || null)
|
|
setIsOpen(true)
|
|
}, [])
|
|
|
|
const closeUnifiedSettings = useCallback(() => {
|
|
setIsOpen(false)
|
|
setInitialTab(null)
|
|
}, [])
|
|
|
|
return (
|
|
<UnifiedSettingsContext.Provider value={{ isOpen, openUnifiedSettings, closeUnifiedSettings, initialTab }}>
|
|
{children}
|
|
</UnifiedSettingsContext.Provider>
|
|
)
|
|
}
|
|
|
|
export function useUnifiedSettings() {
|
|
return useContext(UnifiedSettingsContext)
|
|
}
|