Right Column: Optimize transitions
This commit is contained in:
parent
204bae525a
commit
cc3e5edf30
@ -18,6 +18,7 @@ import {
|
|||||||
selectIsChatWithSelf,
|
selectIsChatWithSelf,
|
||||||
} from '../../modules/selectors';
|
} from '../../modules/selectors';
|
||||||
import { isChatAdmin, isChatChannel, isChatPrivate } from '../../modules/helpers';
|
import { isChatAdmin, isChatChannel, isChatPrivate } from '../../modules/helpers';
|
||||||
|
import useCurrentOrPrev from '../../hooks/useCurrentOrPrev';
|
||||||
import useFlag from '../../hooks/useFlag';
|
import useFlag from '../../hooks/useFlag';
|
||||||
import useLang from '../../hooks/useLang';
|
import useLang from '../../hooks/useLang';
|
||||||
|
|
||||||
@ -182,13 +183,19 @@ const RightHeader: FC<OwnProps & StateProps & DispatchProps> = ({
|
|||||||
HeaderContent.ManageGroupAdminRights
|
HeaderContent.ManageGroupAdminRights
|
||||||
) : managementScreen === ManagementScreens.GroupMembers ? (
|
) : managementScreen === ManagementScreens.GroupMembers ? (
|
||||||
HeaderContent.ManageGroupMembers
|
HeaderContent.ManageGroupMembers
|
||||||
) : -1 // Never reached
|
) : undefined // Never reached
|
||||||
) : isStatistics ? (
|
) : isStatistics ? (
|
||||||
HeaderContent.Statistics
|
HeaderContent.Statistics
|
||||||
) : -1; // Never reached
|
) : undefined; // When column is closed
|
||||||
|
|
||||||
|
const renderingContentKey = useCurrentOrPrev(contentKey, true) ?? -1;
|
||||||
|
|
||||||
function renderHeaderContent() {
|
function renderHeaderContent() {
|
||||||
switch (contentKey) {
|
if (renderingContentKey === -1) {
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (renderingContentKey) {
|
||||||
case HeaderContent.PollResults:
|
case HeaderContent.PollResults:
|
||||||
return <h3>{lang('PollResults')}</h3>;
|
return <h3>{lang('PollResults')}</h3>;
|
||||||
case HeaderContent.Search:
|
case HeaderContent.Search:
|
||||||
@ -307,7 +314,7 @@ const RightHeader: FC<OwnProps & StateProps & DispatchProps> = ({
|
|||||||
</Button>
|
</Button>
|
||||||
<Transition
|
<Transition
|
||||||
name={shouldSkipTransition ? 'none' : 'slide-fade'}
|
name={shouldSkipTransition ? 'none' : 'slide-fade'}
|
||||||
activeKey={contentKey}
|
activeKey={renderingContentKey}
|
||||||
>
|
>
|
||||||
{renderHeaderContent}
|
{renderHeaderContent}
|
||||||
</Transition>
|
</Transition>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user