Skip to content

Commit 1fc543d

Browse files
authored
Remove badge lunch tag and add support for hiding the preview (#4158)
1 parent 6525807 commit 1fc543d

File tree

7 files changed

+88
-58
lines changed

7 files changed

+88
-58
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Generated by Django 5.1.1 on 2024-11-09 21:21
2+
3+
from django.db import migrations, models
4+
5+
6+
class Migration(migrations.Migration):
7+
8+
dependencies = [
9+
('conferences', '0049_remove_conference_pretix_hotel_bed_layout_question_id_and_more'),
10+
]
11+
12+
operations = [
13+
migrations.AlterField(
14+
model_name='deadline',
15+
name='type',
16+
field=models.CharField(choices=[('cfp', 'Call for proposal'), ('voting', 'Voting'), ('refund', 'Ticket refund'), ('grants', 'Grants'), ('badge_preview', 'Badge preview'), ('custom', 'Custom deadline')], max_length=256, verbose_name='type'),
17+
),
18+
]

backend/conferences/models/deadline.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ class Deadline(TimeFramedModel):
2121
("voting", _("Voting")),
2222
("refund", _("Ticket refund")),
2323
("grants", _("Grants")),
24+
("badge_preview", _("Badge preview")),
2425
("custom", _("Custom deadline")),
2526
)
2627

@@ -33,7 +34,7 @@ class Deadline(TimeFramedModel):
3334

3435
name = I18nCharField(_("name"), max_length=100)
3536
description = I18nTextField(_("description"), blank=True, null=True)
36-
type = models.CharField(_("type"), choices=TYPES, max_length=10)
37+
type = models.CharField(_("type"), choices=TYPES, max_length=256)
3738

3839
def __str__(self):
3940
return f"{self.type} ({self.name}) <{self.conference.code}>"

frontend/src/components/badge/index.tsx

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ export const Badge = ({
9595
marginBottom: "20px",
9696
marginTop: "40px",
9797
}}
98-
src="https://pythonit-email-assets.s3.eu-central-1.amazonaws.com/logo-pycon-2024.png"
98+
src="https://cdn.pycon.it/conferences/pycon2025/pycon-italia-2025-logo.png"
9999
/>
100100
<div
101101
style={{
@@ -166,25 +166,9 @@ export const Badge = ({
166166
width: "100%",
167167
display: "flex",
168168
alignItems: "flex-end",
169-
justifyContent: "space-between",
169+
justifyContent: "flex-end",
170170
}}
171171
>
172-
{side === "front" && (
173-
<div className="grid grid-cols-[13px_repeat(3,50px)] bg-coral gap-[2px]">
174-
<div className=" flex items-center justify-center text-[#FFFFFF]">
175-
<div className="text-[8px] py-2 pl-[3px] uppercase font-bold whitespace-nowrap leading-[0.9]">
176-
L<br />u<br />n<br />c<br />h
177-
</div>
178-
</div>
179-
{[23, 24, 25].map((number) => (
180-
<div key={number} className={clsx("bg-[#FFFFFF] relative")}>
181-
<span className="absolute top-0 left-[5px] text-[#b5b5b5] font-bold">
182-
{number}
183-
</span>
184-
</div>
185-
))}
186-
</div>
187-
)}
188172
{!empty && side === "front" && (
189173
<div className="p-[2px] bg-white">
190174
<QRCode

frontend/src/components/customize-ticket-modal/index.tsx

Lines changed: 40 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ export const snakeToCamel = (str: string) => {
3535

3636
export type CustomizeTicketModalProps = {
3737
ticket: MyProfileWithTicketsQuery["me"]["tickets"][0];
38+
showBadgePreview: boolean;
3839
};
3940

4041
type Form = {
@@ -50,6 +51,7 @@ type Form = {
5051
export const CustomizeTicketModal = ({
5152
onClose,
5253
ticket,
54+
showBadgePreview,
5355
}: Props & CustomizeTicketModalProps) => {
5456
const language = useCurrentLanguage();
5557
const [updateTicket, { loading: updatingTicket, error: updateTicketError }] =
@@ -204,7 +206,7 @@ export const CustomizeTicketModal = ({
204206
</div>
205207
}
206208
>
207-
<Grid cols={3}>
209+
<Grid cols={showBadgePreview ? 3 : 1}>
208210
<GridColumn colSpan={2}>
209211
<ProductQuestionnaire
210212
product={ticket.item}
@@ -232,42 +234,44 @@ export const CustomizeTicketModal = ({
232234
</Text>
233235
)}
234236
</GridColumn>
235-
<GridColumn>
236-
<div className="max-w-[302px] max-h-[453px]">
237-
<Badge
238-
name={displayAttendeeName({
239-
parts: {
240-
given_name: formState.values.attendeeGivenName,
241-
family_name: formState.values.attendeeFamilyName,
242-
},
243-
scheme: "given_family",
244-
})}
245-
pronouns={pronounsAnswer}
246-
tagline={taglineAnswer}
247-
cutLines={false}
248-
role={ticket.role}
249-
hashedTicketId={ticket.hashid}
250-
/>
251-
</div>
252-
<div>
253-
<Spacer size="small" />
254-
<Text size="label3" as="p">
255-
<FormattedMessage id="profile.ticketsEdit.qrCodeDescription" />
256-
</Text>
257-
<Spacer size="small" />
258-
<Link
259-
href={createHref({
260-
path: "/profile/edit",
261-
locale: language,
262-
})}
263-
target="_blank"
264-
>
265-
<Text size="label3" as="p" color="none">
266-
<FormattedMessage id="profile.ticketsEdit.editProfile" />
237+
{showBadgePreview && (
238+
<GridColumn>
239+
<div className="max-w-[302px] max-h-[453px]">
240+
<Badge
241+
name={displayAttendeeName({
242+
parts: {
243+
given_name: formState.values.attendeeGivenName,
244+
family_name: formState.values.attendeeFamilyName,
245+
},
246+
scheme: "given_family",
247+
})}
248+
pronouns={pronounsAnswer}
249+
tagline={taglineAnswer}
250+
cutLines={false}
251+
role={ticket.role}
252+
hashedTicketId={ticket.hashid}
253+
/>
254+
</div>
255+
<div>
256+
<Spacer size="small" />
257+
<Text size="label3" as="p">
258+
<FormattedMessage id="profile.ticketsEdit.qrCodeDescription" />
267259
</Text>
268-
</Link>
269-
</div>
270-
</GridColumn>
260+
<Spacer size="small" />
261+
<Link
262+
href={createHref({
263+
path: "/profile/edit",
264+
locale: language,
265+
})}
266+
target="_blank"
267+
>
268+
<Text size="label3" as="p" color="none">
269+
<FormattedMessage id="profile.ticketsEdit.editProfile" />
270+
</Text>
271+
</Link>
272+
</div>
273+
</GridColumn>
274+
)}
271275
</Grid>
272276
</Modal>
273277
);

frontend/src/components/my-tickets-profile-page-handler/index.tsx

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,22 @@ import React from "react";
33
import { FormattedMessage } from "react-intl";
44

55
import { useCurrentLanguage } from "~/locale/context";
6-
import { useMyProfileWithTicketsQuery } from "~/types";
6+
import { DeadlineStatus, useMyProfileWithTicketsQuery } from "~/types";
77

88
import { MetaTags } from "../meta-tags";
99
import { NoTickets } from "./no-tickets";
1010
import { TicketCard } from "./ticket-card";
1111

12+
const VISIBLE_BADGE_PREVIEW_DEADLINES = [
13+
DeadlineStatus.InThePast,
14+
DeadlineStatus.HappeningNow,
15+
];
16+
1217
export const MyTicketsProfilePageHandler = () => {
1318
const language = useCurrentLanguage();
1419
const {
1520
data: {
21+
conference: { badgePreviewDeadline },
1622
me: { tickets, email },
1723
},
1824
} = useMyProfileWithTicketsQuery({
@@ -37,7 +43,14 @@ export const MyTicketsProfilePageHandler = () => {
3743
<Section>
3844
<Grid cols={3} mdCols={2} equalHeight>
3945
{tickets.map((ticket) => (
40-
<TicketCard key={ticket.id} ticket={ticket} userEmail={email} />
46+
<TicketCard
47+
key={ticket.id}
48+
ticket={ticket}
49+
userEmail={email}
50+
showBadgePreview={VISIBLE_BADGE_PREVIEW_DEADLINES.includes(
51+
badgePreviewDeadline?.status,
52+
)}
53+
/>
4154
))}
4255
</Grid>
4356
</Section>

frontend/src/components/my-tickets-profile-page-handler/profile-with-tickets.graphql

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,12 @@
11
query MyProfileWithTickets($conference: String!, $language: String!) {
2+
conference(code: $conference) {
3+
id
4+
badgePreviewDeadline: deadline(type: "badge_preview") {
5+
id
6+
status
7+
}
8+
}
9+
210
me {
311
id
412
name

frontend/src/components/my-tickets-profile-page-handler/ticket-card.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,10 @@ import { useSetCurrentModal } from "../modal/context";
2525
type Props = {
2626
ticket: MyProfileWithTicketsQuery["me"]["tickets"][0];
2727
userEmail: string;
28+
showBadgePreview: boolean;
2829
};
2930

30-
export const TicketCard = ({ ticket, userEmail }: Props) => {
31+
export const TicketCard = ({ ticket, userEmail, showBadgePreview }: Props) => {
3132
const setCurrentModal = useSetCurrentModal();
3233

3334
const taglineQuestion = ticket.item.questions.find(
@@ -52,6 +53,7 @@ export const TicketCard = ({ ticket, userEmail }: Props) => {
5253
const openEditTicketModal = () => {
5354
setCurrentModal("customize-ticket", {
5455
ticket,
56+
showBadgePreview,
5557
});
5658
};
5759

0 commit comments

Comments
 (0)