-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0870085
commit 8f2f860
Showing
25 changed files
with
272 additions
and
380 deletions.
There are no files selected for viewing
97 changes: 0 additions & 97 deletions
97
src/app/[locale]/(app)/explore/_components/categories-grid.tsx
This file was deleted.
Oops, something went wrong.
92 changes: 92 additions & 0 deletions
92
src/app/[locale]/(app)/explore/_components/links-to-categories-modal.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
'use client' | ||
|
||
import { | ||
Button, | ||
Modal, | ||
ModalBody, | ||
ModalContent, | ||
ModalFooter, | ||
ModalHeader, | ||
ScrollShadow, | ||
useDisclosure, | ||
} from '@nextui-org/react' | ||
import { useTranslations } from 'next-intl' | ||
import { FC } from 'react' | ||
import { PlaceMarker } from '~/components/generic/place-marker' | ||
import { Link } from '~/navigation' | ||
import { ApiRouterOutput } from '~/server/api/router' | ||
|
||
type PlaceCategoryGroup = NonNullable< | ||
ApiRouterOutput['explore']['listCategoryGroups'] | ||
>[number] | ||
|
||
export const LinksToCategoriesModal: FC<{ | ||
group: PlaceCategoryGroup | ||
}> = ({ group }) => { | ||
const t = useTranslations('explore') | ||
const { isOpen, onOpen, onOpenChange } = useDisclosure() | ||
|
||
return ( | ||
<> | ||
<Button | ||
variant="bordered" | ||
radius="full" | ||
onClick={onOpen} | ||
className="mx-auto flex" | ||
> | ||
{t('see-all-categories')} | ||
</Button> | ||
|
||
<Modal | ||
isOpen={isOpen} | ||
onOpenChange={onOpenChange} | ||
scrollBehavior="inside" | ||
> | ||
<ModalContent> | ||
{(onClose) => ( | ||
<> | ||
<ModalHeader className="flex flex-col gap-1"> | ||
{group.name} | ||
</ModalHeader> | ||
<ModalBody> | ||
<ScrollShadow> | ||
<ul> | ||
{group.placeCategories.map(({ category }) => ( | ||
<Button | ||
as={Link} | ||
key={category.id} | ||
href={`/explore/search?placeCategory=${category.id}`} | ||
variant="light" | ||
fullWidth | ||
className="flex items-center justify-start px-2" | ||
startContent={ | ||
<PlaceMarker | ||
icon={category.icon} | ||
color={category.color} | ||
size="md" | ||
/> | ||
} | ||
> | ||
{category.namePlural} | ||
</Button> | ||
))} | ||
</ul> | ||
</ScrollShadow> | ||
</ModalBody> | ||
<ModalFooter> | ||
<Button | ||
fullWidth | ||
color="primary" | ||
variant="light" | ||
onPress={onClose} | ||
> | ||
{t('close')} | ||
</Button> | ||
</ModalFooter> | ||
</> | ||
)} | ||
</ModalContent> | ||
</Modal> | ||
</> | ||
) | ||
} |
81 changes: 81 additions & 0 deletions
81
src/app/[locale]/(app)/explore/_components/list-category-groups.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
import { Card } from '@nextui-org/card' | ||
import { CardBody, Skeleton } from '@nextui-org/react' | ||
import { FC } from 'react' | ||
import { CategoryIcon } from '~/components/icons/category-icon' | ||
import { cn } from '~/helpers/cn' | ||
import { colorClasses } from '~/helpers/color-classes' | ||
import { ApiRouterOutput } from '~/server/api/router' | ||
import { LinksToCategoriesModal } from './links-to-categories-modal' | ||
|
||
type PlaceCategoryGroup = NonNullable< | ||
ApiRouterOutput['explore']['listCategoryGroups'] | ||
>[number] | ||
|
||
export const ListCategoryGroups: FC<{ | ||
group: PlaceCategoryGroup | ||
}> = ({ group }) => { | ||
const highlightedCategories = group.placeCategories | ||
.filter((category) => category.highlight) | ||
.map(({ category }) => category) | ||
|
||
return ( | ||
<> | ||
<h3 className="mt-4 px-2 text-center font-title text-2xl font-semibold uppercase leading-none text-stone-900 first:mt-0"> | ||
{group.name} | ||
</h3> | ||
<ul className="my-2 grid grid-cols-2 gap-2 px-4"> | ||
{highlightedCategories.map((category) => ( | ||
<Card | ||
as="li" | ||
key={category.id} | ||
shadow="md" | ||
className={cn( | ||
'shadow-md', | ||
colorClasses.shadow[category.color], | ||
'bg-gradient-to-br text-white', | ||
colorClasses.gradientBg[category.color] | ||
)} | ||
> | ||
<CardBody | ||
className={cn( | ||
'relative flex min-h-16 flex-row gap-2', | ||
'overflow-hidden' | ||
)} | ||
> | ||
<CategoryIcon | ||
icon={category.icon} | ||
size={24} | ||
className="shrink-0" | ||
/> | ||
<span className="flex-1 font-semibold uppercase leading-5 tracking-wide"> | ||
{category.namePlural} | ||
</span> | ||
<CategoryIcon | ||
icon={category.icon} | ||
strokeWidth={2} | ||
size={64} | ||
className="absolute bottom-0 right-1 z-0 shrink-0 opacity-10" | ||
/> | ||
</CardBody> | ||
</Card> | ||
))} | ||
</ul> | ||
|
||
<LinksToCategoriesModal group={group} /> | ||
</> | ||
) | ||
} | ||
|
||
export const ListCategoryGroupsSkeleton: FC = () => { | ||
return ( | ||
<> | ||
<Skeleton className="mx-auto mt-4 h-6 w-full max-w-32 rounded-full first:mt-0" /> | ||
<div className="my-2 grid grid-cols-2 gap-2 px-4"> | ||
{Array.from({ length: 6 }).map((_, i) => ( | ||
<Skeleton key={i} className="h-16 w-full rounded-lg" /> | ||
))} | ||
</div> | ||
<Skeleton className="mx-auto mt-2 h-10 w-full max-w-48 rounded-full" /> | ||
</> | ||
) | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.