// SPDX-License-Identifier: AGPL-3.0-or-later import {remFromPx} from '@app/features/theme/layout/RemFromPx'; import styles from '@app/features/theme/styles/Typing.module.css'; import {msg} from '@lingui/core/macro'; import {useLingui} from '@lingui/react/macro'; import {observer} from 'mobx-react-lite'; import type {CSSProperties} from 'react'; import {useMemo} from 'react'; const TYPING_INDICATOR_DESCRIPTOR = msg({ message: 'Typing indicator', comment: 'Short label in the channel and chat typing. Keep it concise.', }); interface TypingProps { className?: string; size?: number; style?: CSSProperties; color?: string; } export const Typing = observer( ({className, size = 40, style, color = 'var(--typing-indicator-color, var(--text-chat))'}: TypingProps) => { const {i18n} = useLingui(); const scale = useMemo(() => size / 40, [size]); const x = useMemo(() => 3.75 * scale, [scale]); const y = useMemo(() => 7.5 * scale, [scale]); const width = useMemo(() => 17.5 * scale, [scale]); const height = useMemo(() => 5 * scale, [scale]); const viewBoxWidth = 20; const viewBoxHeight = 5; const mergedStyle = useMemo(() => ({...(style || {}), color}), [style, color]); return ( ); }, );