-
Notifications
You must be signed in to change notification settings - Fork 23
Expand file tree
/
Copy pathindex.tsx
More file actions
65 lines (59 loc) · 1.76 KB
/
index.tsx
File metadata and controls
65 lines (59 loc) · 1.76 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
import { Grid, Heading, Page, Section } from "@python-italia/pycon-styleguide";
import React from "react";
import { FormattedMessage } from "react-intl";
import { useCurrentLanguage } from "~/locale/context";
import { DeadlineStatus, useMyProfileWithTicketsQuery } from "~/types";
import { MetaTags } from "../meta-tags";
import { NoTickets } from "./no-tickets";
import { TicketCard } from "./ticket-card";
const VISIBLE_BADGE_PREVIEW_DEADLINES = [
DeadlineStatus.InThePast,
DeadlineStatus.HappeningNow,
];
export const MyTicketsProfilePageHandler = () => {
const language = useCurrentLanguage();
const {
data: {
conference: { badgePreviewDeadline },
me: { tickets, email },
},
} = useMyProfileWithTicketsQuery({
variables: {
conference: process.env.conferenceCode,
language: language,
},
});
return (
<Page endSeparator={false}>
<FormattedMessage id="profile.myTickets.title">
{(text) => <MetaTags title={text} />}
</FormattedMessage>
<Section background="pink">
<Heading size="display2">
<FormattedMessage id="profile.myTickets" />
</Heading>
</Section>
{tickets.length > 0 && (
<Section>
<Grid cols={3} mdCols={2} equalHeight>
{tickets.map((ticket) => (
<TicketCard
key={ticket.id}
ticket={ticket}
userEmail={email}
showBadgePreview={VISIBLE_BADGE_PREVIEW_DEADLINES.includes(
badgePreviewDeadline?.status,
)}
/>
))}
</Grid>
</Section>
)}
{tickets.length === 0 && (
<Section>
<NoTickets email={email} />
</Section>
)}
</Page>
);
};