2021-06-01 13:45:43 -07:00
|
|
|
// Copyright 2021 Signal Messenger, LLC
|
|
|
|
// SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
|
|
|
|
import React from 'react';
|
|
|
|
|
2021-09-07 14:55:03 -05:00
|
|
|
import { SystemMessage } from './SystemMessage';
|
2021-10-26 14:15:33 -05:00
|
|
|
import type { LocalizerType } from '../../types/Util';
|
2021-06-01 13:45:43 -07:00
|
|
|
import * as expirationTimer from '../../util/expirationTimer';
|
2022-11-16 12:18:02 -08:00
|
|
|
import type { DurationInSeconds } from '../../util/durations';
|
2021-06-01 13:45:43 -07:00
|
|
|
|
|
|
|
export type Props = {
|
|
|
|
i18n: LocalizerType;
|
2022-11-16 12:18:02 -08:00
|
|
|
expireTimer: DurationInSeconds;
|
2021-06-01 13:45:43 -07:00
|
|
|
};
|
|
|
|
|
2022-11-17 16:45:19 -08:00
|
|
|
export function UniversalTimerNotification(props: Props): JSX.Element | null {
|
2021-06-01 13:45:43 -07:00
|
|
|
const { i18n, expireTimer } = props;
|
|
|
|
|
|
|
|
if (!expireTimer) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2021-06-25 16:52:56 -07:00
|
|
|
const timeValue = expirationTimer.format(i18n, expireTimer);
|
|
|
|
|
2021-06-01 13:45:43 -07:00
|
|
|
return (
|
2021-09-07 14:55:03 -05:00
|
|
|
<SystemMessage
|
|
|
|
icon="timer"
|
2023-03-29 17:03:25 -07:00
|
|
|
contents={i18n('icu:UniversalTimerNotification__text', {
|
2021-09-07 14:55:03 -05:00
|
|
|
timeValue,
|
|
|
|
})}
|
|
|
|
/>
|
2021-06-01 13:45:43 -07:00
|
|
|
);
|
2022-11-17 16:45:19 -08:00
|
|
|
}
|