ruvector/studio/components/interfaces/App/AppBannerWrapperContext.tsx
rUv 814f595995 feat(studio): Add complete RuVector Studio application
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>
2025-12-06 23:04:48 +00:00

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
}