Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve/fix registration status icon text #10527

Merged
merged 11 commits into from
Jan 29, 2025
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,18 @@ const competingStatusIcon = (competingStatus) => {
};

const registrationStatusIconText = (competition) => {
const toRelativeOptions = {
// don't be more precise than "days" (i.e. no hours/minutes/seconds)
unit: ["years", "quarters", "months", "weeks", "days"],
// round up, e.g. in 8 hours -> pads to 1 day 8 hours -> rounds to "in 1 day"
padding: 24 * 60 * 60 * 1000,
};

if (competition.registration_status === 'not_yet_opened') {
return I18n.t('competitions.index.tooltips.registration.opens_in', { duration: DateTime.fromISO(competition.registration_open).toRelative() });
return I18n.t('competitions.index.tooltips.registration.opens_in', { duration: DateTime.fromISO(competition.registration_open).toRelative(toRelativeOptions) });
kr-matthews marked this conversation as resolved.
Show resolved Hide resolved
}
if (competition.registration_status === 'past') {
return I18n.t('competitions.index.tooltips.registration.closed', { days: DateTime.fromISO(competition.start_date).toRelative() });
return I18n.t('competitions.index.tooltips.registration.closed', { days: DateTime.fromISO(competition.start_date).toRelative(toRelativeOptions) });
kr-matthews marked this conversation as resolved.
Show resolved Hide resolved
}
if (competition.registration_status === 'full') {
return I18n.t('competitions.index.tooltips.registration.full');
Expand Down
6 changes: 3 additions & 3 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1567,10 +1567,10 @@ en:
recent: "Last %{count} days"
#context: the registration status icon
registration:
opens_in: "Registration will open in %{duration}"
closed: "Registration has closed. Competition starts in %{days}"
opens_in: "Registration will open %{duration}."
closed: "Registration has closed. Competition starts %{days}."
open: "Registration is open!"
full: "Competitor limit reached, new registrations will go to the waiting list"
full: "Competitor limit reached, new registrations will go to the waiting list."
no_more_comps: "No more competitions."
no_comp_found: "No competitions found."
no_comp_match: "We didn't find any competitions with %{events}! Try searching for fewer events."
Expand Down
Loading