feat: add SectionChips component for improved navigation between members, pre-registrations, and waitlist
This commit is contained in:
@@ -1,20 +1,17 @@
|
||||
import { useNavigate } from '@tanstack/react-router'
|
||||
import { Clock, Loader2, Plus, Search, Share2, UserCheck, Users } from 'lucide-react'
|
||||
import { Button, Input } from '../../../components/ui'
|
||||
import { cn } from '../../../lib/utils'
|
||||
import { useGroupDetail } from './GroupDetailProvider'
|
||||
import { MembersTable } from './MembersTable'
|
||||
import { PreRegistrationsTable } from './PreRegistrationsTable'
|
||||
import { SectionChips } from './SectionChips'
|
||||
import { WaitlistTable } from './WaitlistTable'
|
||||
|
||||
const TAB_CLASS =
|
||||
'flex min-h-10 flex-1 items-center justify-center gap-1.5 rounded-md px-2 text-xs font-semibold transition-[color,background-color,box-shadow] duration-150'
|
||||
|
||||
export function MembersWaitlistSection() {
|
||||
const {
|
||||
groupId, attendees, attendeesTotal, attendeesPending,
|
||||
waitlistEntries, waitlistTotal, waitlistPending,
|
||||
preRegistrations, preRegistrationsTotal, preRegistrationsPending,
|
||||
groupId, attendees, attendeesPending,
|
||||
waitlistEntries, waitlistPending,
|
||||
preRegistrations, preRegistrationsPending,
|
||||
listSection, setListSection, searchFilter, setSearchFilter, openInviteModal,
|
||||
} = useGroupDetail()
|
||||
const navigate = useNavigate()
|
||||
@@ -41,65 +38,11 @@ export function MembersWaitlistSection() {
|
||||
// Sin bordes: el lavado `bg-primary-soft` separa la sección del fondo.
|
||||
<div className="rounded-2xl bg-primary-soft p-2">
|
||||
<div className="space-y-2 p-2 sm:p-3">
|
||||
<div className="flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between sm:gap-3">
|
||||
<div
|
||||
role="tablist"
|
||||
aria-label="Listado del grupo"
|
||||
className="flex w-full items-center gap-1 rounded-lg bg-surface p-0.5 shadow-xs sm:w-[36rem]"
|
||||
>
|
||||
<button
|
||||
type="button"
|
||||
role="tab"
|
||||
aria-selected={listSection === 'members'}
|
||||
onClick={() => setListSection('members')}
|
||||
className={cn(
|
||||
TAB_CLASS,
|
||||
listSection === 'members'
|
||||
? 'bg-accent text-on-accent shadow-xs'
|
||||
: 'text-foreground/80 hover:bg-primary-soft hover:text-primary',
|
||||
)}
|
||||
>
|
||||
<Users className="size-4 shrink-0" />
|
||||
<span className="whitespace-nowrap">
|
||||
Miembros ({attendeesTotal})
|
||||
</span>
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
role="tab"
|
||||
aria-selected={listSection === 'preregistrations'}
|
||||
onClick={() => setListSection('preregistrations')}
|
||||
className={cn(
|
||||
TAB_CLASS,
|
||||
listSection === 'preregistrations'
|
||||
? 'bg-accent text-on-accent shadow-xs'
|
||||
: 'text-foreground/80 hover:bg-primary-soft hover:text-primary',
|
||||
)}
|
||||
>
|
||||
<UserCheck className="size-4 shrink-0" />
|
||||
<span className="whitespace-nowrap">
|
||||
Pre-inscripciones ({preRegistrationsTotal})
|
||||
</span>
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
role="tab"
|
||||
aria-selected={listSection === 'waitlist'}
|
||||
onClick={() => setListSection('waitlist')}
|
||||
className={cn(
|
||||
TAB_CLASS,
|
||||
listSection === 'waitlist'
|
||||
? 'bg-accent text-on-accent shadow-xs'
|
||||
: 'text-foreground/80 hover:bg-primary-soft hover:text-primary',
|
||||
)}
|
||||
>
|
||||
<Clock className="size-4 shrink-0" />
|
||||
<span className="whitespace-nowrap">Lista de espera ({waitlistTotal})</span>
|
||||
</button>
|
||||
</div>
|
||||
<div className="flex flex-col gap-2.5 lg:flex-row lg:items-center lg:justify-between">
|
||||
<SectionChips />
|
||||
|
||||
{showSearch ? (
|
||||
<div className="relative w-full sm:w-64">
|
||||
<div className="relative w-full sm:w-72 lg:shrink-0">
|
||||
<Search className="pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-foreground/70" />
|
||||
<Input
|
||||
placeholder="Buscar por nombre o teléfono..."
|
||||
|
||||
Reference in New Issue
Block a user