Skip to content

Commit

Permalink
Fix broken types from c61af77 (#898)
Browse files Browse the repository at this point in the history
Fixes broken types regressed from
c61af77
  • Loading branch information
junlarsen authored Apr 30, 2024
1 parent c61af77 commit f0cadf1
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 16 deletions.
9 changes: 3 additions & 6 deletions apps/web/src/app/events/[id]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,17 +43,14 @@ const EventDetailPageInner = ({ id }: { id: string }) => {
)
}

return (
<EventDetailWithoutAttendancePage user={session.data.user} event={event.event} committees={event.eventCommittees} />
)
return <EventDetailWithoutAttendancePage event={event.event} committees={event.eventCommittees} />
}

interface WithoutAttendanceProps {
user: NonNullable<Session["user"]>
event: Event
committees: Committee[]
}
const EventDetailWithoutAttendancePage: FC<WithoutAttendanceProps> = ({ user, event, committees }) => {
const EventDetailWithoutAttendancePage: FC<WithoutAttendanceProps> = ({ event, committees }) => {
return (
<div>
<div className="flex w-full">
Expand Down Expand Up @@ -83,7 +80,7 @@ const EventDetailWithAttendancePage: FC<WithAttendanceProps> = ({ user, attendan
<EventInfoBox event={event} />
<div className="flex flex-1 flex-col">
<AttendanceBox sessionUser={user} attendance={attendance} pools={pools} event={event} />
{attendee && <TicketButton userid={user.id} />}
{attendee && user && <TicketButton userId={user.id} />}
{committees.length && <OrganizerBox committees={committees} />}
<TimeLocationBox
datetimeStart={event.start}
Expand Down
8 changes: 4 additions & 4 deletions apps/web/src/app/events/components/TicketButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ import { QRCodeSVG } from "qrcode.react"
import { useState } from "react"

interface TicketButtonProps {
userid: UserId | null
userId: UserId | null
}

const TicketButton = ({ userid }: TicketButtonProps) => {
const TicketButton = ({ userId }: TicketButtonProps) => {
const [open, setOpen] = useState(false)
return (
<div className="">
Expand All @@ -29,9 +29,9 @@ const TicketButton = ({ userid }: TicketButtonProps) => {
<p className="text-lg">Dette er din billett til arrangementet</p>
</div>
<div className="flex flex-col items-center pt-10">
{userid && (
{userId && (
<QRCodeSVG
value={userid}
value={userId}
size={256}
imageSettings={{
src: "https://old.online.ntnu.no/wiki/70/plugin/attachments/download/680/",
Expand Down
15 changes: 9 additions & 6 deletions apps/web/src/app/events/components/queries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,13 @@ interface Props {
attendanceId: string
}
export const useGetAttendee = ({ userId, attendanceId }: Props) => {
return trpc.event.attendance.getAttendee.useQuery({
attendanceId,
userId: userId ?? ""
}, {
enabled: Boolean(userId)
})
return trpc.event.attendance.getAttendee.useQuery(
{
attendanceId,
userId: userId ?? "",
},
{
enabled: Boolean(userId),
}
)
}

0 comments on commit f0cadf1

Please sign in to comment.