refactor(direct): drop the bottom DM-nav status strip with the vojo.chat label and e2ee chip
This commit is contained in:
parent
ece9e922e3
commit
998813eff4
3 changed files with 2 additions and 70 deletions
|
|
@ -371,7 +371,6 @@
|
||||||
"self_row_label": "You",
|
"self_row_label": "You",
|
||||||
"self_row_preview": "Settings & profile",
|
"self_row_preview": "Settings & profile",
|
||||||
"message_me_label": "me",
|
"message_me_label": "me",
|
||||||
"status_e2ee": "e2ee",
|
|
||||||
"username": "Username",
|
"username": "Username",
|
||||||
"username_placeholder": "username",
|
"username_placeholder": "username",
|
||||||
"server": "Server",
|
"server": "Server",
|
||||||
|
|
|
||||||
|
|
@ -373,7 +373,6 @@
|
||||||
"self_row_label": "Я",
|
"self_row_label": "Я",
|
||||||
"self_row_preview": "Настройки и профиль",
|
"self_row_preview": "Настройки и профиль",
|
||||||
"message_me_label": "я",
|
"message_me_label": "я",
|
||||||
"status_e2ee": "e2ee",
|
|
||||||
"username": "Имя пользователя",
|
"username": "Имя пользователя",
|
||||||
"username_placeholder": "username",
|
"username_placeholder": "username",
|
||||||
"server": "Сервер",
|
"server": "Сервер",
|
||||||
|
|
|
||||||
|
|
@ -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 { useTranslation } from 'react-i18next';
|
||||||
import { useAtomValue } from 'jotai';
|
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 { useVirtualizer } from '@tanstack/react-virtual';
|
||||||
import { useNavigate } from 'react-router-dom';
|
import { useNavigate } from 'react-router-dom';
|
||||||
import { SyncState } from 'matrix-js-sdk';
|
|
||||||
import { useMatrixClient } from '../../../hooks/useMatrixClient';
|
import { useMatrixClient } from '../../../hooks/useMatrixClient';
|
||||||
import { useSyncState } from '../../../hooks/useSyncState';
|
|
||||||
import { factoryRoomIdByActivity } from '../../../utils/sort';
|
import { factoryRoomIdByActivity } from '../../../utils/sort';
|
||||||
import { NavCategory, NavEmptyCenter, NavEmptyLayout } from '../../../components/nav';
|
import { NavCategory, NavEmptyCenter, NavEmptyLayout } from '../../../components/nav';
|
||||||
import { getDirectCreatePath, getDirectRoomPath } from '../../pathUtils';
|
import { getDirectCreatePath, getDirectRoomPath } from '../../pathUtils';
|
||||||
|
|
@ -27,8 +25,6 @@ import { DirectStreamHeader } from './DirectStreamHeader';
|
||||||
import { DirectNewChatRow } from './DirectNewChatRow';
|
import { DirectNewChatRow } from './DirectNewChatRow';
|
||||||
import { DirectSelfRow } from './DirectSelfRow';
|
import { DirectSelfRow } from './DirectSelfRow';
|
||||||
|
|
||||||
const MONO_FONT = '"JetBrains Mono Variable", ui-monospace, monospace';
|
|
||||||
|
|
||||||
type ListItem =
|
type ListItem =
|
||||||
| { kind: 'invite'; entry: DirectInviteEntry }
|
| { kind: 'invite'; entry: DirectInviteEntry }
|
||||||
| { kind: 'spam-toggle'; spamCount: number; expanded: boolean }
|
| { 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 = {
|
type SpamToggleRowProps = {
|
||||||
spamCount: number;
|
spamCount: number;
|
||||||
expanded: boolean;
|
expanded: boolean;
|
||||||
|
|
@ -344,7 +279,6 @@ export function Direct() {
|
||||||
)}
|
)}
|
||||||
<DirectNewChatRow />
|
<DirectNewChatRow />
|
||||||
<DirectSelfRow />
|
<DirectSelfRow />
|
||||||
<DirectFooterStatus />
|
|
||||||
</PageNav>
|
</PageNav>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue