Skip to content

Commit

Permalink
Clarify type for buyersPerm.
Browse files Browse the repository at this point in the history
  • Loading branch information
julianweng committed Apr 18, 2024
1 parent 242f994 commit e432d2e
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions frontend/pages/tickets/[[...slug]].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -104,14 +104,31 @@ const Ticket: React.FC<TicketProps> = ({
<Container>
<Title>All Tickets for {event.name}</Title>
{Object.values(tickTypes).map((ticket, i) => (
<TicketCard key={i} ticket={ticket} buyersPerm={buyers.buyers} />
<TicketCard
key={i}
ticket={ticket as Ticket}
buyersPerm={buyers.buyers != null}
/>
))}
</Container>
</>
)
}

const TicketCard = ({ ticket, buyersPerm }) => {
type Ticket = {
type: string
total: number
price: number
available: number
buyers: string[]
}

type TicketCardProps = {
ticket: Ticket
buyersPerm: boolean
}

const TicketCard = ({ ticket, buyersPerm }: TicketCardProps) => {
const [viewBuyers, setViewBuyers] = useState(false)
return (
<Card>
Expand Down

0 comments on commit e432d2e

Please sign in to comment.