From e22cbbd6ac5434f40d3ca97a2211f14fd4857800 Mon Sep 17 00:00:00 2001 From: Nick O'Ferrall Date: Tue, 23 Apr 2024 11:45:44 +0100 Subject: [PATCH 1/2] chore: update activity library custom tab empty state --- .../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..d5e7c346401 --- /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 hideResultsNotFound = categoryId === 'custom' && searchQuery === '' + + return ( +
+
+ {!hideResultsNotFound && ( + <> + +
No results found!
+
+ Try tapping a category above, using a different search, or creating exactly what you + have in mind. +
+ + )} +
+ +
+
+
+ ) +} + +export default ActivityLibraryEmptyState From 6df14502df2c1561a50ec4169caa96180a37d211 Mon Sep 17 00:00:00 2001 From: Nick O'Ferrall Date: Tue, 23 Apr 2024 11:48:20 +0100 Subject: [PATCH 2/2] change var name to showResults instead of hideResults --- .../components/ActivityLibrary/ActivityLibraryEmptyState.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/client/components/ActivityLibrary/ActivityLibraryEmptyState.tsx b/packages/client/components/ActivityLibrary/ActivityLibraryEmptyState.tsx index d5e7c346401..8b112783c50 100644 --- a/packages/client/components/ActivityLibrary/ActivityLibraryEmptyState.tsx +++ b/packages/client/components/ActivityLibrary/ActivityLibraryEmptyState.tsx @@ -10,12 +10,12 @@ type Props = { const ActivityLibraryEmptyState = (props: Props) => { const {categoryId, searchQuery} = props - const hideResultsNotFound = categoryId === 'custom' && searchQuery === '' + const showResultsNotFound = categoryId !== 'custom' || searchQuery !== '' return (
- {!hideResultsNotFound && ( + {showResultsNotFound && ( <>
No results found!