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