import { ButtonTooltip } from 'components/ui/ButtonTooltip'
import { useLocalStorageQuery } from 'hooks/misc/useLocalStorage'
import { BASE_PATH, LOCAL_STORAGE_KEYS } from 'lib/constants'
import { ExternalLink, X } from 'lucide-react'
import Image from 'next/image'
import { Alert_Shadcn_, AlertDescription_Shadcn_, AlertTitle_Shadcn_, Badge, Button } from 'ui'
import { useIsNewLayoutEnabled } from './FeaturePreviewContext'
export const LayoutUpdatePreview = () => {
return (
The layout out of the dashboard is now scoped to the organization that you're currently on
instead of all organizations that you are a member of, in hopes to provide a clearer
navigation to your organization settings.
This feature preview only updates the layout for the home page, organization settings pages,
and account pages. Layout for project pages will not have any changes.
Enabling this preview will:
Display only the projects from the organization you are currently viewing on the home
page
Update homepage sidebar links to go directly to the settings for the organization
Access to account preferences, access tokens, security settings, and audit logs are
available via the user dropdown in the top navigation bar
)
}
export const LayoutUpdateBanner = () => {
const newLayoutPreview = useIsNewLayoutEnabled()
const [newLayoutPreviewState] = useLocalStorageQuery(LOCAL_STORAGE_KEYS.UI_NEW_LAYOUT_PREVIEW, '')
const [newLayoutAcknowledged, setNewLayoutAcknowledged] = useLocalStorageQuery(
LOCAL_STORAGE_KEYS.NEW_LAYOUT_NOTICE_ACKNOWLEDGED,
false
)
const isDefaultOptedInNewLayout = newLayoutPreview && newLayoutPreviewState === ''
if (!isDefaultOptedInNewLayout || newLayoutAcknowledged) return null
return (
NEW
Dashboard layout has been updated!
We've updated the dashboard layout to make it easier to find and manage your organization
settings.
}>
View announcement
}
className="absolute top-2 right-2 px-1"
onClick={() => setNewLayoutAcknowledged(true)}
tooltip={{ content: { side: 'bottom', text: 'Dismiss' } }}
/>
)
}