mirror of
https://github.com/ruvnet/RuVector.git
synced 2026-05-30 12:13:34 +00:00
Major additions: - Complete Next.js studio application with 1600+ components - Docker support (Dockerfile.combined, docker-compose.yml) - GCP deployment documentation and benchmarks - SQL benchmark scripts for performance testing - Sentry integration for monitoring - Comprehensive test suite and mocks Studio features: - Dashboard and admin interfaces - Data visualization components - Authentication and user management - API integration with RuVector backend - Static data and public assets 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
50 lines
1.8 KiB
TypeScript
50 lines
1.8 KiB
TypeScript
import { LOCAL_STORAGE_KEYS } from 'common'
|
|
import { noop } from 'lodash'
|
|
import { PropsWithChildren, createContext, useContext, useEffect, useState } from 'react'
|
|
|
|
const MAINTENANCE_WINDOW_BANNER_KEY = LOCAL_STORAGE_KEYS.MAINTENANCE_WINDOW_BANNER
|
|
|
|
// [Joshen] This file is meant to be dynamic - update this as and when we need to use the NoticeBanner
|
|
|
|
type AppBannerContextType = {
|
|
maintenanceWindowBannerAcknowledged: boolean
|
|
onUpdateAcknowledged: (key: typeof MAINTENANCE_WINDOW_BANNER_KEY) => void
|
|
}
|
|
|
|
const AppBannerContext = createContext<AppBannerContextType>({
|
|
maintenanceWindowBannerAcknowledged: false,
|
|
onUpdateAcknowledged: noop,
|
|
})
|
|
|
|
export const useAppBannerContext = () => useContext(AppBannerContext)
|
|
|
|
export const AppBannerContextProvider = ({ children }: PropsWithChildren<{}>) => {
|
|
const [maintenanceWindowBannerAcknowledged, setMaintenanceWindowBannerAcknowledged] =
|
|
useState<boolean>(false)
|
|
|
|
useEffect(() => {
|
|
if (typeof window !== 'undefined') {
|
|
const maintenanceAcknowledged = localStorage.getItem(MAINTENANCE_WINDOW_BANNER_KEY) === 'true'
|
|
setMaintenanceWindowBannerAcknowledged(maintenanceAcknowledged)
|
|
}
|
|
}, [])
|
|
|
|
const value = {
|
|
maintenanceWindowBannerAcknowledged,
|
|
onUpdateAcknowledged: (key: typeof MAINTENANCE_WINDOW_BANNER_KEY) => {
|
|
if (key === MAINTENANCE_WINDOW_BANNER_KEY) {
|
|
if (typeof window !== 'undefined') {
|
|
window.localStorage.setItem(MAINTENANCE_WINDOW_BANNER_KEY, 'true')
|
|
}
|
|
setMaintenanceWindowBannerAcknowledged(true)
|
|
}
|
|
},
|
|
}
|
|
|
|
return <AppBannerContext.Provider value={value}>{children}</AppBannerContext.Provider>
|
|
}
|
|
|
|
export const useIsNoticeBannerShown = () => {
|
|
const { maintenanceWindowBannerAcknowledged } = useAppBannerContext()
|
|
return maintenanceWindowBannerAcknowledged
|
|
}
|