Skip to content

Commit

Permalink
Tidy recording text
Browse files Browse the repository at this point in the history
  • Loading branch information
microbit-robert committed Nov 21, 2024
1 parent e4c98ca commit 2b6cfa3
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions src/components/RecordingDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,17 @@ const RecordingDialog = ({
return recordingsToCapture - recordingsRemaining;
}, [recordingsRemaining, recordingsToCapture]);

const recordingText = useMemo(() => {
if (recordingStatus === RecordingStatus.Recording) {
return intl.formatMessage({ id: "recording" });
} else if (recordingStatus === RecordingStatus.Countdown) {
return countdownStages[countdownStageIndex].value;
} else if (recordingStatus === RecordingStatus.Done) {
return intl.formatMessage({ id: "recording-complete" });
}
return "";
}, [countdownStageIndex, countdownStages, intl, recordingStatus]);

return (
<Modal
closeOnOverlayClick={false}
Expand Down Expand Up @@ -288,14 +299,7 @@ const RecordingDialog = ({
role="timer"
aria-live="assertive"
>
{recordingStatus === RecordingStatus.Recording && (
<FormattedMessage id="recording" />
)}
{recordingStatus === RecordingStatus.Countdown &&
countdownStages[countdownStageIndex].value}
{recordingStatus === RecordingStatus.Done && (
<FormattedMessage id="recording-complete" />
)}
{recordingText}
</Text>
</VStack>
<Progress
Expand Down

0 comments on commit 2b6cfa3

Please sign in to comment.