Skip to content

Commit

Permalink
Only show filter after index has bene created
Browse files Browse the repository at this point in the history
  • Loading branch information
shilman committed Jun 16, 2024
1 parent eb4715e commit ad1617d
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 16 deletions.
32 changes: 17 additions & 15 deletions code/ui/manager/src/components/sidebar/Sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -152,21 +152,23 @@ export const Sidebar = React.memo(function Sidebar({
isLoading={isLoading}
onMenuClick={onMenuClick}
/>
<TagsFilter
api={api}
index={index}
updateQueryParams={(params) => {
const url = new URL(window.location.href);
Object.entries(params).forEach(([key, value]) => {
if (value) {
url.searchParams.set(key, value);
} else {
url.searchParams.delete(key);
}
});
window.history.pushState({}, '', url);
}}
/>
{index && (
<TagsFilter
api={api}
index={index}
updateQueryParams={(params) => {
const url = new URL(window.location.href);
Object.entries(params).forEach(([key, value]) => {
if (value) {
url.searchParams.set(key, value);
} else {
url.searchParams.delete(key);
}
});
window.history.pushState({}, '', url);
}}
/>
)}
<Search
dataset={dataset}
enableShortcuts={enableShortcuts}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { TagsFilter } from './TagsFilter';

const meta = {
component: TagsFilter,
tags: ['haha'],
} satisfies Meta<typeof TagsFilter>;

export default meta;
Expand Down
9 changes: 8 additions & 1 deletion code/ui/manager/src/components/sidebar/TagsFilterPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,14 @@ import { transparentize } from 'polished';
import { styled } from '@storybook/theming';
import { CollapseIcon } from './components/CollapseIcon';

const BUILT_IN_TAGS = new Set(['dev', 'autodocs', 'test', 'attached-mdx', 'unattached-mdx']);
const BUILT_IN_TAGS = new Set([
'dev',
'autodocs',
'test',
'attached-mdx',
'unattached-mdx',
'play-fn',
]);

const CollapseButton = styled.button(({ theme }) => ({
all: 'unset',
Expand Down

0 comments on commit ad1617d

Please sign in to comment.