refactor(direct): drop the bottom DM-nav status strip with the vojo.chat label and e2ee chip

This commit is contained in:
v.lagerev 2026-05-06 16:37:22 +03:00
parent 14a28873ee
commit 1209654347
3 changed files with 2 additions and 70 deletions

View file

@ -371,7 +371,6 @@
"self_row_label": "You",
"self_row_preview": "Settings & profile",
"message_me_label": "me",
"status_e2ee": "e2ee",
"username": "Username",
"username_placeholder": "username",
"server": "Server",

View file

@ -373,7 +373,6 @@
"self_row_label": "Я",
"self_row_preview": "Настройки и профиль",
"message_me_label": "я",
"status_e2ee": "e2ee",
"username": "Имя пользователя",
"username_placeholder": "username",
"server": "Сервер",

View file

@ -1,12 +1,10 @@
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
import React, { useEffect, useMemo, useRef, useState } from 'react';
import { useTranslation } from 'react-i18next';
import { useAtomValue } from 'jotai';
import { Box, Button, Icon, Icons, Text, color, config, toRem } from 'folds';
import { Box, Button, Icon, Icons, Text, color, toRem } from 'folds';
import { useVirtualizer } from '@tanstack/react-virtual';
import { useNavigate } from 'react-router-dom';
import { SyncState } from 'matrix-js-sdk';
import { useMatrixClient } from '../../../hooks/useMatrixClient';
import { useSyncState } from '../../../hooks/useSyncState';
import { factoryRoomIdByActivity } from '../../../utils/sort';
import { NavCategory, NavEmptyCenter, NavEmptyLayout } from '../../../components/nav';
import { getDirectCreatePath, getDirectRoomPath } from '../../pathUtils';
@ -27,8 +25,6 @@ import { DirectStreamHeader } from './DirectStreamHeader';
import { DirectNewChatRow } from './DirectNewChatRow';
import { DirectSelfRow } from './DirectSelfRow';
const MONO_FONT = '"JetBrains Mono Variable", ui-monospace, monospace';
type ListItem =
| { kind: 'invite'; entry: DirectInviteEntry }
| { kind: 'spam-toggle'; spamCount: number; expanded: boolean }
@ -65,67 +61,6 @@ function DirectEmpty() {
);
}
function DirectFooterStatus() {
const { t } = useTranslation();
const mx = useMatrixClient();
const [syncState, setSyncState] = useState<SyncState | null>(() => mx.getSyncState());
useSyncState(
mx,
useCallback((state: SyncState) => {
setSyncState(state);
}, [])
);
// Re-read post-mount to close the same render-to-effect gap as in
// SyncIndicator — useState initializer runs before useSyncState attaches
// its listener.
useEffect(() => {
setSyncState(mx.getSyncState());
}, [mx]);
// Steady-state mapping (same source-of-truth philosophy as SyncIndicator):
// - SDK Syncing → green dot, all is well
// - SDK Error → red dot, give-up state
// - everything else (transitional Reconnecting / Catchup / etc) → muted
// `currentColor` so the dot reads as a transitional gray under the
// parent's 0.45 opacity.
const dotBackground =
syncState === SyncState.Error
? color.Critical.Main
: syncState === SyncState.Syncing
? color.Success.Main
: 'currentColor';
return (
<Box
alignItems="Center"
gap="200"
style={{
padding: `${toRem(8)} ${toRem(14)}`,
borderTop: `${config.borderWidth.B300} solid ${color.Surface.ContainerLine}`,
fontFamily: MONO_FONT,
fontSize: toRem(11),
color: color.Surface.OnContainer,
opacity: 0.45,
}}
>
<span
style={{
width: toRem(6),
height: toRem(6),
borderRadius: '50%',
background: dotBackground,
display: 'inline-block',
transition: 'background 200ms ease',
}}
aria-hidden
/>
<span>vojo.chat</span>
<Box grow="Yes" />
<span>{t('Direct.status_e2ee')}</span>
</Box>
);
}
type SpamToggleRowProps = {
spamCount: number;
expanded: boolean;
@ -344,7 +279,6 @@ export function Direct() {
)}
<DirectNewChatRow />
<DirectSelfRow />
<DirectFooterStatus />
</PageNav>
);
}