Reactor List Modal: Fix animation (#6525)
This commit is contained in:
parent
b75d506497
commit
665c510a1f
@ -14,6 +14,10 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.modal-dialog {
|
||||||
|
overflow: clip;
|
||||||
|
}
|
||||||
|
|
||||||
.modal-content {
|
.modal-content {
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
display: flex;
|
display: flex;
|
||||||
@ -24,9 +28,9 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.reactor-list-wrapper {
|
.reactor-list-wrapper {
|
||||||
|
position: relative;
|
||||||
flex-grow: 1;
|
flex-grow: 1;
|
||||||
min-height: 0;
|
min-height: 0;
|
||||||
border-top: 1px solid var(--color-borders);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.confirm-dialog-button {
|
.confirm-dialog-button {
|
||||||
@ -53,8 +57,10 @@
|
|||||||
.reactor-list {
|
.reactor-list {
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
overflow-x: hidden;
|
overflow-x: hidden;
|
||||||
|
|
||||||
max-height: 100%;
|
max-height: 100%;
|
||||||
padding: 0 0.5rem;
|
padding-top: 0.5rem;
|
||||||
|
padding-inline: 0.5rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.reactors-list-item {
|
.reactors-list-item {
|
||||||
|
|||||||
@ -26,6 +26,7 @@ import useInfiniteScroll from '../../hooks/useInfiniteScroll';
|
|||||||
import useLang from '../../hooks/useLang';
|
import useLang from '../../hooks/useLang';
|
||||||
import useLastCallback from '../../hooks/useLastCallback';
|
import useLastCallback from '../../hooks/useLastCallback';
|
||||||
import useOldLang from '../../hooks/useOldLang';
|
import useOldLang from '../../hooks/useOldLang';
|
||||||
|
import useScrollNotch from '../../hooks/useScrollNotch';
|
||||||
|
|
||||||
import Avatar from '../common/Avatar';
|
import Avatar from '../common/Avatar';
|
||||||
import FullNameTitle from '../common/FullNameTitle';
|
import FullNameTitle from '../common/FullNameTitle';
|
||||||
@ -37,6 +38,7 @@ import InfiniteScroll from '../ui/InfiniteScroll';
|
|||||||
import ListItem from '../ui/ListItem';
|
import ListItem from '../ui/ListItem';
|
||||||
import Loading from '../ui/Loading';
|
import Loading from '../ui/Loading';
|
||||||
import Modal from '../ui/Modal';
|
import Modal from '../ui/Modal';
|
||||||
|
import Transition from '../ui/Transition';
|
||||||
|
|
||||||
import './ReactorListModal.scss';
|
import './ReactorListModal.scss';
|
||||||
|
|
||||||
@ -81,6 +83,7 @@ const ReactorListModal: FC<OwnProps & StateProps> = ({
|
|||||||
&& reactions.results.length > 1;
|
&& reactions.results.length > 1;
|
||||||
const chatIdRef = useRef<string>();
|
const chatIdRef = useRef<string>();
|
||||||
const reactionsRef = useRef<HTMLDivElement>();
|
const reactionsRef = useRef<HTMLDivElement>();
|
||||||
|
const containerRef = useRef<HTMLDivElement>();
|
||||||
|
|
||||||
useHorizontalScroll(reactionsRef, !canShowFilters || !isOpen);
|
useHorizontalScroll(reactionsRef, !canShowFilters || !isOpen);
|
||||||
|
|
||||||
@ -128,6 +131,12 @@ const ReactorListModal: FC<OwnProps & StateProps> = ({
|
|||||||
return uniqueReactions;
|
return uniqueReactions;
|
||||||
}, [reactors]);
|
}, [reactors]);
|
||||||
|
|
||||||
|
const contentActiveKey = useMemo(() => {
|
||||||
|
if (!chosenTab) return 0;
|
||||||
|
const index = allReactions.findIndex((r) => isSameReaction(r, chosenTab));
|
||||||
|
return index + 1;
|
||||||
|
}, [chosenTab, allReactions]);
|
||||||
|
|
||||||
const peerIds = useMemo(() => {
|
const peerIds = useMemo(() => {
|
||||||
if (chosenTab) {
|
if (chosenTab) {
|
||||||
return reactors?.reactions
|
return reactors?.reactions
|
||||||
@ -144,6 +153,11 @@ const ReactorListModal: FC<OwnProps & StateProps> = ({
|
|||||||
handleLoadMore, peerIds, reactors && reactors.nextOffset === undefined,
|
handleLoadMore, peerIds, reactors && reactors.nextOffset === undefined,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
useScrollNotch({
|
||||||
|
containerRef,
|
||||||
|
selector: '.reactor-list',
|
||||||
|
}, [contentActiveKey, isOpen]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
getMore?.({ direction: LoadMoreDirection.Backwards });
|
getMore?.({ direction: LoadMoreDirection.Backwards });
|
||||||
}, [getMore]);
|
}, [getMore]);
|
||||||
@ -200,74 +214,80 @@ const ReactorListModal: FC<OwnProps & StateProps> = ({
|
|||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
<div dir={lang.isRtl ? 'rtl' : undefined} className="reactor-list-wrapper">
|
<div
|
||||||
{viewportIds?.length ? (
|
ref={containerRef}
|
||||||
<InfiniteScroll
|
dir={lang.isRtl ? 'rtl' : undefined}
|
||||||
className="reactor-list custom-scroll"
|
className="reactor-list-wrapper"
|
||||||
items={viewportIds}
|
>
|
||||||
onLoadMore={getMore}
|
<Transition activeKey={contentActiveKey} name="slide">
|
||||||
>
|
{viewportIds?.length ? (
|
||||||
{viewportIds?.flatMap(
|
<InfiniteScroll
|
||||||
(peerId) => {
|
className="reactor-list custom-scroll"
|
||||||
const peer = usersById[peerId] || chatsById[peerId];
|
items={viewportIds}
|
||||||
|
onLoadMore={getMore}
|
||||||
|
>
|
||||||
|
{viewportIds?.flatMap(
|
||||||
|
(peerId) => {
|
||||||
|
const peer = usersById[peerId] || chatsById[peerId];
|
||||||
|
|
||||||
const peerReactions = reactors?.reactions.filter((reactor) => reactor.peerId === peerId);
|
const peerReactions = reactors?.reactions.filter((reactor) => reactor.peerId === peerId);
|
||||||
const items: React.ReactNode[] = [];
|
const items: React.ReactNode[] = [];
|
||||||
const seenByUser = seenByDates?.[peerId];
|
const seenByUser = seenByDates?.[peerId];
|
||||||
|
|
||||||
peerReactions?.forEach((r) => {
|
peerReactions?.forEach((r) => {
|
||||||
if (chosenTab && !isSameReaction(r.reaction, chosenTab)) return;
|
if (chosenTab && !isSameReaction(r.reaction, chosenTab)) return;
|
||||||
|
|
||||||
items.push(
|
items.push(
|
||||||
<ListItem
|
<ListItem
|
||||||
key={`${peerId}-${getReactionKey(r.reaction)}`}
|
key={`${peerId}-${getReactionKey(r.reaction)}`}
|
||||||
className="chat-item-clickable reactors-list-item"
|
className="chat-item-clickable reactors-list-item"
|
||||||
|
|
||||||
onClick={() => handleClick(peerId)}
|
onClick={() => handleClick(peerId)}
|
||||||
>
|
>
|
||||||
<Avatar peer={peer} size="medium" />
|
<Avatar peer={peer} size="medium" />
|
||||||
<div className="info">
|
<div className="info">
|
||||||
<FullNameTitle peer={peer} withEmojiStatus />
|
<FullNameTitle peer={peer} withEmojiStatus />
|
||||||
<span className="status" dir="auto">
|
<span className="status" dir="auto">
|
||||||
<Icon name="heart-outline" className="status-icon" />
|
<Icon name="heart-outline" className="status-icon" />
|
||||||
{formatDateAtTime(oldLang, r.addedDate * 1000)}
|
{formatDateAtTime(oldLang, r.addedDate * 1000)}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
{r.reaction && (
|
{r.reaction && (
|
||||||
<ReactionStaticEmoji
|
<ReactionStaticEmoji
|
||||||
className="reactors-list-emoji"
|
className="reactors-list-emoji"
|
||||||
reaction={r.reaction}
|
reaction={r.reaction}
|
||||||
availableReactions={availableReactions}
|
availableReactions={availableReactions}
|
||||||
size={DEFAULT_REACTION_SIZE}
|
size={DEFAULT_REACTION_SIZE}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
</ListItem>,
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!chosenTab && !peerReactions?.length) {
|
||||||
|
items.push(
|
||||||
|
<ListItem
|
||||||
|
key={`${peerId}-seen-by`}
|
||||||
|
className="chat-item-clickable scroll-item small-icon"
|
||||||
|
|
||||||
|
onClick={() => handleClick(peerId)}
|
||||||
|
>
|
||||||
|
<PrivateChatInfo
|
||||||
|
userId={peerId}
|
||||||
|
noStatusOrTyping
|
||||||
|
avatarSize="medium"
|
||||||
|
status={seenByUser ? formatDateAtTime(oldLang, seenByUser * 1000) : undefined}
|
||||||
|
statusIcon="message-read"
|
||||||
/>
|
/>
|
||||||
)}
|
</ListItem>,
|
||||||
</ListItem>,
|
);
|
||||||
);
|
}
|
||||||
});
|
return items;
|
||||||
|
},
|
||||||
if (!chosenTab && !peerReactions?.length) {
|
)}
|
||||||
items.push(
|
</InfiniteScroll>
|
||||||
<ListItem
|
) : <Loading />}
|
||||||
key={`${peerId}-seen-by`}
|
</Transition>
|
||||||
className="chat-item-clickable scroll-item small-icon"
|
|
||||||
|
|
||||||
onClick={() => handleClick(peerId)}
|
|
||||||
>
|
|
||||||
<PrivateChatInfo
|
|
||||||
userId={peerId}
|
|
||||||
noStatusOrTyping
|
|
||||||
avatarSize="medium"
|
|
||||||
status={seenByUser ? formatDateAtTime(oldLang, seenByUser * 1000) : undefined}
|
|
||||||
statusIcon="message-read"
|
|
||||||
/>
|
|
||||||
</ListItem>,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
return items;
|
|
||||||
},
|
|
||||||
)}
|
|
||||||
</InfiniteScroll>
|
|
||||||
) : <Loading />}
|
|
||||||
</div>
|
</div>
|
||||||
</Modal>
|
</Modal>
|
||||||
);
|
);
|
||||||
|
|||||||
@ -268,6 +268,7 @@ $color-message-story-mention-to: #74bcff;
|
|||||||
--z-left-header: 11;
|
--z-left-header: 11;
|
||||||
--z-middle-header: 11;
|
--z-middle-header: 11;
|
||||||
--z-middle-footer: 11;
|
--z-middle-footer: 11;
|
||||||
|
--z-scroll-notch: 10;
|
||||||
--z-story-ribbon: 10;
|
--z-story-ribbon: 10;
|
||||||
--z-country-code-input-group: 10;
|
--z-country-code-input-group: 10;
|
||||||
--z-message-select-control: 9;
|
--z-message-select-control: 9;
|
||||||
|
|||||||
@ -376,7 +376,7 @@ body:not(.is-ios) {
|
|||||||
content: "";
|
content: "";
|
||||||
|
|
||||||
position: absolute;
|
position: absolute;
|
||||||
z-index: 1;
|
z-index: var(--z-scroll-notch);
|
||||||
top: 0;
|
top: 0;
|
||||||
left: 0;
|
left: 0;
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user