Skip to content

Commit

Permalink
Update relative timer rendering to change timer button text
Browse files Browse the repository at this point in the history
Update finish session button variant
  • Loading branch information
Daniel Fosco committed Dec 13, 2023
1 parent eef3647 commit 7db90a6
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,13 @@ export const BreakoutManager: React.FC = () => {
if (frame) {
await service.setRoomTarget(selectedRoom, frame.id);
await miro.board.notifications.showInfo(
`${frame.title} has been set as starting point for the room.`,
`${frame.title} is set as starting point for the room`,
);
await miro.board.deselect({ id: frame.id });
setSelectedRoom(undefined);
} else {
await miro.board.notifications.showError(
"We only support frames as starting point for now",
"Only frames are supported as starting point for rooms",
);
}
};
Expand All @@ -87,7 +87,7 @@ export const BreakoutManager: React.FC = () => {
const handleNudge = async (currentUser?: Json) => {
if (isUser(currentUser)) {
await miro.board.notifications.showInfo(
`<strong>${currentUser?.name}</strong> is waiting to start the session`,
`<strong>${currentUser?.name}</strong> is waiting for you to start the session`,
);
}
};
Expand Down Expand Up @@ -259,10 +259,10 @@ export const BreakoutManager: React.FC = () => {
{breakout?.state === "started" ? (
<Button
onClick={() => handleStopSession()}
variant="solid-danger"
variant="outline-danger"
size="x-large"
>
Stop session
Finish session
{canUseTimer && timer.state === "started"
? ` (${formatDisplayTime(timer.restDuration)})`
: null}
Expand Down
4 changes: 3 additions & 1 deletion examples/breakout-rooms/src/components/Timer/Timer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@ export const Timer: React.FunctionComponent<Props> = ({
setTimeChanged(true);
};

const minutes = formatTime(time) > 1 ? "minutes" : "minute";

return (
<>
<DropdownMenu onClose={() => handleSetTime()}>
Expand All @@ -107,7 +109,7 @@ export const Timer: React.FunctionComponent<Props> = ({
<IconTimer />
</Button.IconSlot>
<Button.Label>
{timeChanged ? formatTime(time) : "Set timer"}
{timeChanged ? `${formatTime(time)} ${minutes}` : "Set timer"}
</Button.Label>
</Button>
</DropdownMenu.Trigger>
Expand Down
2 changes: 1 addition & 1 deletion examples/breakout-rooms/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export const formatTime = (
value: number,
unit: TimeUnit = "milliseconds",
): string => {
const formatter = new Intl.RelativeTimeFormat("en", { numeric: "auto" });
const formatter = new Intl.NumberFormat("en");
let formattedValue = value;
let formattedUnit = unit;

Expand Down

0 comments on commit 7db90a6

Please sign in to comment.