From 240e78d9c7003b748a4c31353e869278c2bb528c Mon Sep 17 00:00:00 2001 From: Nick O'Ferrall Date: Tue, 23 Apr 2024 14:26:36 +0100 Subject: [PATCH] chore: update activity library custom tab empty state (#9666) --- .../ActivityLibrary/ActivityLibrary.tsx | 21 ++++------- .../ActivityLibraryEmptyState.tsx | 36 +++++++++++++++++++ 2 files changed, 42 insertions(+), 15 deletions(-) create mode 100644 packages/client/components/ActivityLibrary/ActivityLibraryEmptyState.tsx diff --git a/packages/client/components/ActivityLibrary/ActivityLibrary.tsx b/packages/client/components/ActivityLibrary/ActivityLibrary.tsx index 5ee39ff1bd7..5a8b361ada0 100644 --- a/packages/client/components/ActivityLibrary/ActivityLibrary.tsx +++ b/packages/client/components/ActivityLibrary/ActivityLibrary.tsx @@ -9,7 +9,6 @@ import {useDebounce} from 'use-debounce' import {ActivityLibraryQuery} from '~/__generated__/ActivityLibraryQuery.graphql' import {ActivityLibrary_template$data} from '~/__generated__/ActivityLibrary_template.graphql' import {ActivityLibrary_templateSearchDocument$data} from '~/__generated__/ActivityLibrary_templateSearchDocument.graphql' -import halloweenRetrospectiveTemplate from '../../../../static/images/illustrations/halloweenRetrospectiveTemplate.png' import useAtmosphere from '../../hooks/useAtmosphere' import useRouter from '../../hooks/useRouter' import useSearchFilter from '../../hooks/useSearchFilter' @@ -18,14 +17,15 @@ import SendClientSideEvent from '../../utils/SendClientSideEvent' import IconLabel from '../IconLabel' import AISearch from './AISearch' import ActivityGrid from './ActivityGrid' +import ActivityLibraryEmptyState from './ActivityLibraryEmptyState' import { + AllCategoryID, CATEGORY_ID_TO_NAME, CATEGORY_THEMES, CUSTOM_CATEGORY_ID, CategoryID, QUICK_START_CATEGORY_ID } from './Categories' -import CreateActivityCard from './CreateActivityCard' import SearchBar from './SearchBar' graphql` @@ -359,19 +359,10 @@ export const ActivityLibrary = (props: Props) => { )} {templatesToRender.length === 0 ? ( -
-
- -
No results found!
-
- Try tapping a category above, using a different search, or creating exactly what - you have in mind. -
-
- -
-
-
+ ) : ( <> {sectionedTemplates ? ( diff --git a/packages/client/components/ActivityLibrary/ActivityLibraryEmptyState.tsx b/packages/client/components/ActivityLibrary/ActivityLibraryEmptyState.tsx new file mode 100644 index 00000000000..8b112783c50 --- /dev/null +++ b/packages/client/components/ActivityLibrary/ActivityLibraryEmptyState.tsx @@ -0,0 +1,36 @@ +import React from 'react' +import halloweenRetrospectiveTemplate from '../../../../static/images/illustrations/halloweenRetrospectiveTemplate.png' +import {AllCategoryID, QUICK_START_CATEGORY_ID} from './Categories' +import CreateActivityCard from './CreateActivityCard' + +type Props = { + categoryId: AllCategoryID + searchQuery: string +} + +const ActivityLibraryEmptyState = (props: Props) => { + const {categoryId, searchQuery} = props + const showResultsNotFound = categoryId !== 'custom' || searchQuery !== '' + + return ( +
+
+ {showResultsNotFound && ( + <> + +
No results found!
+
+ Try tapping a category above, using a different search, or creating exactly what you + have in mind. +
+ + )} +
+ +
+
+
+ ) +} + +export default ActivityLibraryEmptyState