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';
|
|
|
|
|
|
|
|
export type Props = {
|
|
|
|
i18n: LocalizerType;
|
|
|
|
expireTimer: number;
|
|
|
|
};
|
|
|
|
|
|
|
|
export const UniversalTimerNotification: React.FC<Props> = props => {
|
|
|
|
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"
|
|
|
|
contents={i18n('UniversalTimerNotification__text', {
|
|
|
|
timeValue,
|
|
|
|
})}
|
|
|
|
/>
|
2021-06-01 20:45:43 +00:00
|
|
|
);
|
|
|
|
};
|