Files
supabase/apps/studio/components/interfaces/Explorer/ExplorerPreviewSuggestion.tsx
CharisandJoshen Lim 1fcd420530 feat(studio): suggest enabling Explorer preview on notebook pages (#53060)
## Problem

Direct notebook links open even when the Explorer feature preview is
off, while the navigation item stays hidden. Users who land on a
notebook this way get no hint that the Explorer preview exists or how to
turn it on.

Resolves FE-4939:
https://linear.app/supabase/issue/FE-4939/suggest-enabling-explorer-preview-when-opening-notebook-links

## Solution

- Add `ExplorerPreviewSuggestion`, an admonition titled "Explorer is a
feature preview" with the text "Enable the Explorer preview to find
notebooks from the navigation bar." and an "Enable Explorer" button. The
button opens the feature preview modal on the Explorer entry.
- Render it below the notebook toolbar in `ExplorerNotebookTab`, only in
the loaded notebook state.
- Show it only on platform, when the `explorer` flag is on and the user
has not opted in to the preview. It is not dismissible and disappears
once the preview is enabled.

## Testing

- Existing Explorer component tests pass.
- Lint ratchet passes.
- Manual check: with the `explorer` flag on and the preview off, open a
notebook URL directly, confirm the notice appears, and confirm the
button opens the feature preview modal.

## Review instructions

1. Enable the `explorer` flag and make sure the Explorer feature preview
is off.
2. Open a notebook URL directly.
3. Confirm the "Explorer is a feature preview" notice appears below the
notebook toolbar.
4. Click "Enable Explorer" and confirm the feature preview modal opens
on the Explorer entry.
5. Enable the preview and confirm the notice disappears.

## Checklist

Check all before review:

- [x] I have read
[CONTRIBUTING.md](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md)
- [ ] If I wrote a new docs topic or edited an existing topic, I used
the `/write-the-docs` or `/edit-the-docs` skill, which applies the docs
[style
guide](https://github.com/supabase/supabase/tree/master/apps/docs/style-guide)

---------

Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
2026-11-06 12:34:28 +08:00

44 lines
1.4 KiB
TypeScript

import { IS_PLATFORM, LOCAL_STORAGE_KEYS, useFlag } from 'common'
import { Button } from 'ui'
import { Admonition } from 'ui-patterns/Admonition'
import {
useFeaturePreviewContext,
useFeaturePreviewModal,
useIsExplorerEnabled,
} from '@/components/interfaces/App/FeaturePreview/FeaturePreviewContext'
/**
* Suggests turning on the Explorer feature preview. Shown on pages that are reachable by direct
* link while the preview is off (and its navigation item hidden).
*/
export const ExplorerPreviewSuggestion = ({ className }: { className?: string }) => {
const { isInitialized } = useFeaturePreviewContext()
const { selectFeaturePreview } = useFeaturePreviewModal()
const isExplorerAvailable = useFlag('explorer')
const isExplorerEnabled = useIsExplorerEnabled()
const shouldShowSuggestion =
IS_PLATFORM && isExplorerAvailable && isInitialized && !isExplorerEnabled
if (!shouldShowSuggestion) return null
return (
<Admonition
type="default"
layout="responsive"
className={className}
title="Explorer is a feature preview"
description="Enable the Explorer preview to find notebooks from the navigation bar."
actions={
<Button
variant="default"
onClick={() => selectFeaturePreview(LOCAL_STORAGE_KEYS.UI_PREVIEW_EXPLORER)}
>
Enable Explorer
</Button>
}
/>
)
}