Skip to content

Commit

Permalink
💄 optimize remaining time text closes #163
Browse files Browse the repository at this point in the history
Signed-off-by: Marcus Fihlon <[email protected]>
  • Loading branch information
McPringle committed Jul 16, 2024
1 parent 46ee190 commit e3ac22d
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/main/java/swiss/fihlon/apus/ui/view/RoomView.java
Original file line number Diff line number Diff line change
Expand Up @@ -144,11 +144,14 @@ private Component createTimeComponent() {
} else if (startTime.isBefore(now) && endTime.isAfter(now)) { // running session
final Duration duration = Duration.between(now, endTime);
final long timeLeft = Math.round(duration.getSeconds() / 60f);
timeComponent.add(
new Icon(VaadinIcon.HOURGLASS),
new Text(getTranslation(timeLeft == 1
? "event.session.countdown.singular" : "event.session.countdown.plural",
timeLeft)));
timeComponent.add(new Icon(VaadinIcon.HOURGLASS));
if (timeLeft == 0) {
timeComponent.add(new Text(getTranslation("event.session.countdown.now")));
} else if (timeLeft == 1) {
timeComponent.add(new Text(getTranslation("event.session.countdown.singular", timeLeft)));
} else {
timeComponent.add(new Text(getTranslation("event.session.countdown.plural", timeLeft)));
}
roomStyle = RoomStyle.RUNNING;
} else { // next session
timeComponent.add(
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/vaadin-i18n/translations.properties
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ event.legend.empty-room=room closed
event.legend.next-session=next session
event.legend.running-session=running session
event.room.empty=closed
event.session.countdown.now=ends now
event.session.countdown.plural=ends in {0} minutes
event.session.countdown.singular=ends in {0} minute
social.admin.login.button=Login
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/vaadin-i18n/translations_de.properties
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ event.legend.empty-room=Raum geschlossen
event.legend.next-session=nächster Vortrag
event.legend.running-session=laufender Vortrag
event.room.empty=geschlossen
event.session.countdown.now=endet jetzt
event.session.countdown.plural=endet in {0} Minuten
event.session.countdown.singular=endet in {0} Minute
social.admin.login.button=Anmelden
Expand Down

0 comments on commit e3ac22d

Please sign in to comment.