Skip to content

Commit c70afe4

Browse files
authored
feat(watchmanDetails): include preferences (#234)
1 parent ff3c196 commit c70afe4

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed

pages/watchman/[ticketId].tsx

+42
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import {
1818
publicTicketNoTicket as publicTicket,
1919
redeemsForTicket,
2020
redeemForId,
21+
oneTicket,
2122
} from "../../src/helpers/API";
2223
import { colors } from "../../styles/theme";
2324

@@ -98,6 +99,20 @@ const StyledTicket = styled.div<{ color: string }>`
9899
margin-bottom: 16px;
99100
`;
100101

102+
const FlexWrap = styled.div`
103+
display: flex;
104+
flex-wrap: wrap;
105+
`;
106+
107+
const FlexItem = styled.div`
108+
flex: 1 1 50%;
109+
`;
110+
111+
const BC = styled.span`
112+
font-weight: bold;
113+
text-transform: capitalize;
114+
`;
115+
101116
const NOT_REDEEMED = "not_redeemed";
102117

103118
interface Hash {
@@ -178,6 +193,12 @@ const Watchman: NextPage = (props) => {
178193
retry: false,
179194
cacheTime: 0,
180195
}) as { isLoading: boolean; data?: any };
196+
const { data: preferences } = useQuery({
197+
queryKey: ["oneTicket", ticketId],
198+
queryFn: async () => await oneTicket(ticketId),
199+
retry: false,
200+
cacheTime: 0,
201+
});
181202

182203
const mutation = useMutation(
183204
async (redeemId: string) => {
@@ -248,6 +269,27 @@ const Watchman: NextPage = (props) => {
248269
userUsername={publicTicketData.username}
249270
userName={publicTicketData.name}
250271
/>
272+
{publicTicketData.ticketType !== "meetup" &&
273+
publicTicketData.ticketType !== "workshop" ? (
274+
<>
275+
<H2>Preferences</H2>
276+
<FlexWrap>
277+
<FlexItem>
278+
Pronombre: <BC>{preferences?.preferences?.pronouns}</BC>
279+
</FlexItem>
280+
<FlexItem>
281+
Alergias: <BC>{preferences?.preferences?.foodAllergy}</BC>
282+
</FlexItem>
283+
<FlexItem>
284+
Comida: <BC>{preferences?.preferences?.foodPreference}</BC>
285+
</FlexItem>
286+
<FlexItem>
287+
Polera: <BC>{preferences?.preferences?.shirtSize}</BC>
288+
</FlexItem>
289+
</FlexWrap>
290+
</>
291+
) : null}
292+
251293
<H2>Redemptions</H2>
252294
{ticketInfo?.redemptions?.map((r: RedemptionSummary) => (
253295
<RedemptionRow key={r.id}>

0 commit comments

Comments
 (0)