Skip to content

Commit 43d42b2

Browse files
committed
fix: no templates match criteria
1 parent a2d4b99 commit 43d42b2

File tree

4 files changed

+23
-1
lines changed

4 files changed

+23
-1
lines changed

site/src/components/Filter/storyHelpers.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,19 @@ export const getDefaultFilterProps = <TFilterProps>({
1717
query = "",
1818
values,
1919
menus,
20+
used = false,
2021
}: {
2122
query?: string;
2223
values: Record<string, string | undefined>;
2324
menus: Record<string, UseFilterMenuResult>;
25+
used?: boolean;
2426
}) =>
2527
({
2628
filter: {
2729
query,
2830
update: () => action("update"),
2931
debounceUpdate: action("debounce") as UseFilterResult["debounceUpdate"],
30-
used: false,
32+
used: used,
3133
values,
3234
},
3335
menus,

site/src/pages/TemplatesPage/EmptyTemplates.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,18 @@ const findFeaturedExamples = (examples: TemplateExample[]) => {
3838
interface EmptyTemplatesProps {
3939
canCreateTemplates: boolean;
4040
examples: TemplateExample[];
41+
isUsingFilter: boolean;
4142
}
4243

4344
export const EmptyTemplates: FC<EmptyTemplatesProps> = ({
4445
canCreateTemplates,
4546
examples,
47+
isUsingFilter,
4648
}) => {
49+
if (isUsingFilter) {
50+
return <TableEmpty message="No results matched your search" />;
51+
}
52+
4753
const featuredExamples = findFeaturedExamples(examples);
4854

4955
if (canCreateTemplates) {

site/src/pages/TemplatesPage/TemplatesPageView.stories.tsx

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,19 @@ export const MultipleOrganizations: Story = {
8484
},
8585
};
8686

87+
export const WithFilteredAllTemplates: Story = {
88+
args: {
89+
...WithTemplates.args,
90+
templates: [],
91+
...getDefaultFilterProps({
92+
query: "deprecated:false searchnotfound",
93+
menus: {},
94+
values: {},
95+
used: true,
96+
}),
97+
},
98+
};
99+
87100
export const EmptyCanCreate: Story = {
88101
args: {
89102
canCreateTemplates: true,

site/src/pages/TemplatesPage/TemplatesPageView.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,7 @@ export const TemplatesPageView: FC<TemplatesPageViewProps> = ({
246246
<EmptyTemplates
247247
canCreateTemplates={canCreateTemplates}
248248
examples={examples ?? []}
249+
isUsingFilter={filter.used}
249250
/>
250251
) : (
251252
templates?.map((template) => (

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy