Skip to content

Commit

Permalink
don't continue if venue is empty
Browse files Browse the repository at this point in the history
  • Loading branch information
skullface committed Aug 26, 2023
1 parent 0daeddf commit 6131ae7
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 17 deletions.
35 changes: 19 additions & 16 deletions src/components/venue-filter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,22 +29,25 @@ export function VenueFilter({
<DropdownMenu.Content className='dropdown-content flex min-w-[200px] flex-col rounded-xl bg-zinc-900 shadow-lg shadow-black/5 dark:bg-zinc-50 md:min-w-[360px]'>
{venues
.sort((a, b) => a.localeCompare(b))
.map((venue) => (
<DropdownMenu.CheckboxItem
className='dropdown-item flex cursor-pointer items-center justify-start gap-x-2 px-4 py-2 font-medium text-zinc-100 first-of-type:rounded-t-xl first-of-type:pt-3 last-of-type:rounded-b-xl last-of-type:pb-4 hover:bg-zinc-800 hover:text-white focus:bg-zinc-800 focus:text-white focus:outline-none dark:text-zinc-800 dark:hover:bg-zinc-200 dark:hover:text-zinc-950 dark:focus:bg-zinc-200 dark:focus:text-zinc-950'
key={venue.replace(/[^\w]+/g, '-').toLowerCase()}
checked={selectedVenues.includes(venue)}
onSelect={(event) => {
event.preventDefault() // Prevent menu from closing
onVenueToggle(venue)
}}
>
{venue}
<span className='order-first w-5 text-center font-mono'>
{selectedVenues.includes(venue) ? '✓' : '×'}
</span>
</DropdownMenu.CheckboxItem>
))}
.map(
(venue) =>
venue && (
<DropdownMenu.CheckboxItem
className='dropdown-item flex cursor-pointer items-center justify-start gap-x-2 px-4 py-2 font-medium text-zinc-100 first-of-type:rounded-t-xl first-of-type:pt-3 last-of-type:rounded-b-xl last-of-type:pb-4 hover:bg-zinc-800 hover:text-white focus:bg-zinc-800 focus:text-white focus:outline-none dark:text-zinc-800 dark:hover:bg-zinc-200 dark:hover:text-zinc-950 dark:focus:bg-zinc-200 dark:focus:text-zinc-950'
key={venue.replace(/[^\w]+/g, '-').toLowerCase()}
checked={selectedVenues.includes(venue)}
onSelect={(event) => {
event.preventDefault() // Prevent menu from closing after selection
onVenueToggle(venue)
}}
>
{venue}
<span className='order-first w-5 text-center font-mono'>
{selectedVenues.includes(venue) ? '✓' : '×'}
</span>
</DropdownMenu.CheckboxItem>
),
)}
<div className='mb-5 mt-3 grid grid-cols-2 gap-3 px-5'>
<button
className='rounded-md border border-zinc-700 p-1.5 text-sm text-zinc-400 transition hover:border-zinc-600 hover:bg-zinc-800 hover:text-zinc-50 dark:border-zinc-200 dark:text-zinc-500 dark:hover:border-zinc-300 dark:hover:bg-zinc-100 dark:hover:text-zinc-800'
Expand Down
2 changes: 1 addition & 1 deletion src/utils/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ export type ShowProps = {
link: string
sold_out?: boolean
artist?: string[]
venue: string
venue?: string
date: string
}

0 comments on commit 6131ae7

Please sign in to comment.