Left Sidebar: Move buttons in login confirmation message (#5784)
This commit is contained in:
parent
391bfc9534
commit
4aa7ffd9df
@ -32,6 +32,7 @@ import { useHotkeys } from '../../../hooks/useHotkeys';
|
|||||||
import useInfiniteScroll from '../../../hooks/useInfiniteScroll';
|
import useInfiniteScroll from '../../../hooks/useInfiniteScroll';
|
||||||
import { useIntersectionObserver } from '../../../hooks/useIntersectionObserver';
|
import { useIntersectionObserver } from '../../../hooks/useIntersectionObserver';
|
||||||
import useLastCallback from '../../../hooks/useLastCallback';
|
import useLastCallback from '../../../hooks/useLastCallback';
|
||||||
|
import useShowTransition from '../../../hooks/useShowTransition';
|
||||||
import useOrderDiff from './hooks/useOrderDiff';
|
import useOrderDiff from './hooks/useOrderDiff';
|
||||||
|
|
||||||
import InfiniteScroll from '../../ui/InfiniteScroll';
|
import InfiniteScroll from '../../ui/InfiniteScroll';
|
||||||
@ -115,6 +116,14 @@ const ChatList: FC<OwnProps> = ({
|
|||||||
if (!shouldShowUnconfirmedSessions) setUnconfirmedSessionHeight(0);
|
if (!shouldShowUnconfirmedSessions) setUnconfirmedSessionHeight(0);
|
||||||
}, [shouldShowUnconfirmedSessions]);
|
}, [shouldShowUnconfirmedSessions]);
|
||||||
|
|
||||||
|
const {
|
||||||
|
ref: sessionRef,
|
||||||
|
shouldRender,
|
||||||
|
} = useShowTransition({
|
||||||
|
isOpen: shouldShowUnconfirmedSessions,
|
||||||
|
withShouldRender: true,
|
||||||
|
});
|
||||||
|
|
||||||
// Support <Alt>+<Up/Down> to navigate between chats
|
// Support <Alt>+<Up/Down> to navigate between chats
|
||||||
useHotkeys(useMemo(() => (isActive && orderedIds?.length ? {
|
useHotkeys(useMemo(() => (isActive && orderedIds?.length ? {
|
||||||
'Alt+ArrowUp': (e: KeyboardEvent) => {
|
'Alt+ArrowUp': (e: KeyboardEvent) => {
|
||||||
@ -248,9 +257,10 @@ const ChatList: FC<OwnProps> = ({
|
|||||||
onLoadMore={getMore}
|
onLoadMore={getMore}
|
||||||
onDragLeave={handleDragLeave}
|
onDragLeave={handleDragLeave}
|
||||||
>
|
>
|
||||||
{shouldShowUnconfirmedSessions && (
|
{shouldRender && (
|
||||||
<UnconfirmedSession
|
<UnconfirmedSession
|
||||||
key="unconfirmed"
|
key="unconfirmed"
|
||||||
|
sessionRef={sessionRef}
|
||||||
sessions={sessions!}
|
sessions={sessions!}
|
||||||
onHeightChange={setUnconfirmedSessionHeight}
|
onHeightChange={setUnconfirmedSessionHeight}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@ -22,6 +22,7 @@
|
|||||||
|
|
||||||
.buttons {
|
.buttons {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
justify-content: space-around;
|
justify-content: space-around;
|
||||||
column-gap: 1rem;
|
column-gap: 1rem;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
import React, { memo, useMemo, useRef } from '../../../lib/teact/teact';
|
import type { RefObject } from '../../../lib/teact/teact';
|
||||||
|
import React, { memo, useMemo } from '../../../lib/teact/teact';
|
||||||
import { getActions } from '../../../global';
|
import { getActions } from '../../../global';
|
||||||
|
|
||||||
import type { ApiSession } from '../../../api/types';
|
import type { ApiSession } from '../../../api/types';
|
||||||
@ -14,15 +15,14 @@ import styles from './UnconfirmedSession.module.scss';
|
|||||||
type OwnProps = {
|
type OwnProps = {
|
||||||
sessions: Record<string, ApiSession>;
|
sessions: Record<string, ApiSession>;
|
||||||
onHeightChange: (height: number) => void;
|
onHeightChange: (height: number) => void;
|
||||||
|
sessionRef: RefObject<HTMLDivElement | null>;
|
||||||
};
|
};
|
||||||
|
|
||||||
const UnconfirmedSession = ({ sessions, onHeightChange } : OwnProps) => {
|
const UnconfirmedSession = ({ sessionRef, sessions, onHeightChange } : OwnProps) => {
|
||||||
const { changeSessionSettings, terminateAuthorization, showNotification } = getActions();
|
const { changeSessionSettings, terminateAuthorization, showNotification } = getActions();
|
||||||
// eslint-disable-next-line no-null/no-null
|
|
||||||
const ref = useRef<HTMLDivElement>(null);
|
|
||||||
const lang = useOldLang();
|
const lang = useOldLang();
|
||||||
|
|
||||||
useResizeObserver(ref, (entry) => {
|
useResizeObserver(sessionRef, (entry) => {
|
||||||
const height = entry.borderBoxSize?.[0]?.blockSize || entry.contentRect.height;
|
const height = entry.borderBoxSize?.[0]?.blockSize || entry.contentRect.height;
|
||||||
onHeightChange(height);
|
onHeightChange(height);
|
||||||
});
|
});
|
||||||
@ -52,7 +52,7 @@ const UnconfirmedSession = ({ sessions, onHeightChange } : OwnProps) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={styles.root} ref={ref}>
|
<div className={styles.root} ref={sessionRef}>
|
||||||
<h2 className={styles.title}>{lang('UnconfirmedAuthTitle')}</h2>
|
<h2 className={styles.title}>{lang('UnconfirmedAuthTitle')}</h2>
|
||||||
<p className={styles.info}>
|
<p className={styles.info}>
|
||||||
{lang('UnconfirmedAuthSingle', locationString)}
|
{lang('UnconfirmedAuthSingle', locationString)}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user