2023-01-03 19:55:46 +00:00
|
|
|
// Copyright 2019 Signal Messenger, LLC
|
2020-10-30 20:34:04 +00:00
|
|
|
// SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
|
2022-03-08 20:05:05 +00:00
|
|
|
import React, { forwardRef } from 'react';
|
2019-03-20 17:42:28 +00:00
|
|
|
|
2021-10-26 19:15:33 +00:00
|
|
|
import type { LocalizerType } from '../../types/Util';
|
2019-03-20 17:42:28 +00:00
|
|
|
|
2020-08-24 13:57:00 +00:00
|
|
|
export type Props = {
|
2019-03-20 17:42:28 +00:00
|
|
|
count: number;
|
|
|
|
i18n: LocalizerType;
|
|
|
|
};
|
|
|
|
|
2022-03-08 20:05:05 +00:00
|
|
|
export const LastSeenIndicator = forwardRef<HTMLDivElement, Props>(
|
2022-11-18 00:45:19 +00:00
|
|
|
function LastSeenIndicatorInner({ count, i18n }, ref) {
|
2022-03-08 20:05:05 +00:00
|
|
|
const message =
|
|
|
|
count === 1
|
|
|
|
? i18n('unreadMessage')
|
|
|
|
: i18n('unreadMessages', [String(count)]);
|
2019-03-20 17:42:28 +00:00
|
|
|
|
2022-03-08 20:05:05 +00:00
|
|
|
return (
|
|
|
|
<div className="module-last-seen-indicator" ref={ref}>
|
|
|
|
<div className="module-last-seen-indicator__bar" />
|
|
|
|
<div className="module-last-seen-indicator__text">{message}</div>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
);
|