Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: update activity library custom tab empty state #9666

Merged
merged 2 commits into from
Apr 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 6 additions & 15 deletions packages/client/components/ActivityLibrary/ActivityLibrary.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -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`
Expand Down Expand Up @@ -359,19 +359,10 @@ export const ActivityLibrary = (props: Props) => {
</div>
)}
{templatesToRender.length === 0 ? (
<div className='mx-auto flex p-2 text-slate-700'>
<div className='ml-10'>
<img className='w-32' src={halloweenRetrospectiveTemplate} />
<div className='mb-4 text-xl font-semibold'>No results found!</div>
<div className='mb-6 max-w-[360px]'>
Try tapping a category above, using a different search, or creating exactly what
you have in mind.
</div>
<div className='h-40 w-64'>
<CreateActivityCard category={QUICK_START_CATEGORY_ID} className='h-full' />
</div>
</div>
</div>
<ActivityLibraryEmptyState
searchQuery={searchQuery}
categoryId={categoryId as AllCategoryID}
/>
) : (
<>
{sectionedTemplates ? (
Expand Down
Original file line number Diff line number Diff line change
@@ -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 (
<div className='mx-auto flex p-2 text-slate-700'>
<div className='ml-10'>
{showResultsNotFound && (
<>
<img className='w-32' src={halloweenRetrospectiveTemplate} />
<div className='mb-4 text-xl font-semibold'>No results found!</div>
<div className='mb-6 max-w-[360px]'>
Try tapping a category above, using a different search, or creating exactly what you
have in mind.
</div>
</>
)}
<div className='h-40 w-64'>
<CreateActivityCard category={QUICK_START_CATEGORY_ID} className='h-full' />
</div>
</div>
</div>
)
}

export default ActivityLibraryEmptyState
Loading