Skip to content

Commit 9f22e24

Browse files
committed
translate
1 parent 8958959 commit 9f22e24

File tree

3 files changed

+43
-45
lines changed

3 files changed

+43
-45
lines changed

frontend/src/components/cfp-form/availability-section.tsx

Lines changed: 26 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import { FormattedMessage } from "react-intl";
2020
import type { CfpFormQuery } from "~/types";
2121

2222
const CHOICES = ["available", "preferred", "unavailable"];
23+
const RANGES = ["am", "pm"];
2324

2425
type Props = {
2526
conferenceData: CfpFormQuery;
@@ -39,15 +40,6 @@ export const AvailabilitySection = ({
3940
const parsedStart = parseISO(start);
4041
const parsedEnd = parseISO(end);
4142
const daysBetween = eachDayOfInterval({ start: parsedStart, end: parsedEnd });
42-
const hoursBetween = eachMinuteOfInterval(
43-
{
44-
start: setHours(parsedStart, 9),
45-
end: setHours(parsedStart, 17),
46-
},
47-
{
48-
step: 30,
49-
},
50-
);
5143

5244
return (
5345
<MultiplePartsCard>
@@ -64,7 +56,7 @@ export const AvailabilitySection = ({
6456
<div
6557
className="grid gap-2 lg:gap-4 select-none"
6658
style={{
67-
gridTemplateColumns: `70px repeat(${daysBetween.length}, 1fr)`,
59+
gridTemplateColumns: `150px repeat(${daysBetween.length}, 1fr)`,
6860
}}
6961
>
7062
<div />
@@ -80,34 +72,39 @@ export const AvailabilitySection = ({
8072
</Text>
8173
))}
8274

83-
{hoursBetween.map((hour) => (
84-
<Fragment key={hour.toISOString()}>
75+
{RANGES.map((hour) => (
76+
<Fragment key={hour}>
8577
<div>
86-
<Text weight="strong" size={"label3"}>
87-
{format(hour, "HH:mm")}
78+
<Text weight="strong" size={"label3"} as="p">
79+
{hour === "am" ? (
80+
<FormattedMessage id="cfp.availability.table.morning" />
81+
) : (
82+
<FormattedMessage id="cfp.availability.table.afternoon" />
83+
)}
84+
</Text>
85+
<Spacer size="thin" />
86+
<Text weight="strong" size={"label3"} as="p">
87+
{hour === "am" ? (
88+
<FormattedMessage id="cfp.availability.table.morning.range" />
89+
) : (
90+
<FormattedMessage id="cfp.availability.table.afternoon.range" />
91+
)}
8892
</Text>
8993
</div>
9094
{daysBetween.map((day) => {
91-
const mergedDate = setHours(
92-
setMinutes(day, hour.getMinutes()),
93-
hour.getHours(),
94-
);
95-
95+
const availabilityDate = `${format(day, "yyyy-MM-dd")}-${hour}`;
9696
const currentChoice =
97-
selectedAvailabilities?.[mergedDate.getTime()] || "available";
97+
selectedAvailabilities?.[availabilityDate] || "available";
9898

9999
return (
100100
<div
101-
className={clsx("w-full cursor-pointer text-center p-1", {
102-
"bg-grey-50 hover:bg-grey-100": true,
103-
})}
101+
className="w-full cursor-pointer text-center p-1 bg-grey-50 hover:bg-grey-100"
104102
onClick={(_) => {
105-
const options = ["available", "preferred", "unavailable"];
106103
const nextChoice =
107-
options[
108-
(options.indexOf(currentChoice) + 1) % options.length
104+
CHOICES[
105+
(CHOICES.indexOf(currentChoice) + 1) % CHOICES.length
109106
];
110-
onChangeAvailability(mergedDate, nextChoice);
107+
onChangeAvailability(availabilityDate, nextChoice);
111108
}}
112109
>
113110
{currentChoice === "available" && <>&nbsp;</>}
@@ -118,21 +115,10 @@ export const AvailabilitySection = ({
118115
})}
119116
</Fragment>
120117
))}
121-
122-
<div />
123-
{daysBetween.map((day) => (
124-
<div className="flex items-center justify-center gap-1">
125-
<Text key={day.toISOString()} size={"label3"}>
126-
(Prefer all)
127-
</Text>
128-
/
129-
<Text key={day.toISOString()} size={"label3"}>
130-
(Unavailable all)
131-
</Text>
132-
</div>
133-
))}
134118
</div>
135119

120+
<Spacer size="small" />
121+
136122
<Text size={3}>
137123
<FormattedMessage
138124
id="cfp.availability.explanation"

frontend/src/components/cfp-form/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ export const CfpForm = ({
308308
const onChangeAvailability = (date, choice) => {
309309
formState.setField("selectedAvailabilities", {
310310
...formState.values.selectedAvailabilities,
311-
[date.getTime()]: choice,
311+
[date]: choice,
312312
});
313313
};
314314

frontend/src/locale/index.ts

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -469,10 +469,12 @@ Failing to notify us may impact your eligibility for financial aid at future eve
469469
"cfp.availability.title": "Availability",
470470
"cfp.availability.description":
471471
"Help our program committee by letting us know your availability during the conference. If your proposal gets accepted, we will try and use this information to schedule your proposal at a time that suits you. All times are in the conference timezone.",
472-
"cfp.availability.explanation": `
473-
✔️ Preferred ❌ Unavailable
474-
If left empty, we will assume you are available. Please consider your presentation length when marking availability. {duration}
475-
`,
472+
"cfp.availability.explanation": `✔️ Preferred ❌ Unavailable
473+
Click the box to change. If left empty, we will assume you are available. Please consider your presentation length when marking availability. {duration}`,
474+
"cfp.availability.table.morning": "Morning",
475+
"cfp.availability.table.morning.range": "(11.00am - 1.00pm)",
476+
"cfp.availability.table.afternoon": "Afternoon",
477+
"cfp.availability.table.afternoon.range": "(3.00pm - 6.00pm)",
476478
"header.dashboard": "Dashboard",
477479
"header.login": "Login",
478480
"header.tickets": "Tickets",
@@ -2153,6 +2155,16 @@ Mettiamoci in contatto per trovare la soluzione migliore per le esigenze della t
21532155
"orderQuestions.attendeeFamilyName": "Cognome partecipante",
21542156
"orderQuestions.attendeeFamilyName.placeholder":
21552157
"Il tuo cognome, e.g. Lovelace",
2158+
2159+
"cfp.availability.title": "Disponibilità",
2160+
"cfp.availability.description":
2161+
"Aiuta il nostro comitato di programma facendoci sapere la tua disponibilità durante la conferenza. Se la tua proposta verrà accettata, useremo queste informazioni per programmare il tuo intervento in un momento che ti sia comodo. Tutti gli orari sono nel fuso orario della conferenza.",
2162+
"cfp.availability.explanation": `✔️ Preferito ❌ Non disponibile
2163+
Clicca sulla casella per cambiare. Se lasciato vuoto, presumeremo che tu sia disponibile. Considera la durata della tua presentazione quando indichi la disponibilità. {duration}`,
2164+
"cfp.availability.table.morning": "Mattina",
2165+
"cfp.availability.table.morning.range": "(11:00 - 13:00)",
2166+
"cfp.availability.table.afternoon": "Pomeriggio",
2167+
"cfp.availability.table.afternoon.range": "(15:00 - 18:00)",
21562168
},
21572169
};
21582170

0 commit comments

Comments
 (0)