Header Tools, Right Header: Remove Statistics from menu
This commit is contained in:
parent
2a966e5119
commit
62b9766ec8
@ -40,7 +40,6 @@ interface StateProps {
|
|||||||
canSearch?: boolean;
|
canSearch?: boolean;
|
||||||
canMute?: boolean;
|
canMute?: boolean;
|
||||||
canSelect?: boolean;
|
canSelect?: boolean;
|
||||||
canSeeStatistics?: boolean;
|
|
||||||
canLeave?: boolean;
|
canLeave?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -59,7 +58,6 @@ const HeaderActions: FC<OwnProps & StateProps & DispatchProps> = ({
|
|||||||
canSearch,
|
canSearch,
|
||||||
canMute,
|
canMute,
|
||||||
canSelect,
|
canSelect,
|
||||||
canSeeStatistics,
|
|
||||||
canLeave,
|
canLeave,
|
||||||
isRightColumnShown,
|
isRightColumnShown,
|
||||||
joinChannel,
|
joinChannel,
|
||||||
@ -172,7 +170,6 @@ const HeaderActions: FC<OwnProps & StateProps & DispatchProps> = ({
|
|||||||
canSearch={canSearch}
|
canSearch={canSearch}
|
||||||
canMute={canMute}
|
canMute={canMute}
|
||||||
canSelect={canSelect}
|
canSelect={canSelect}
|
||||||
canSeeStatistics={canSeeStatistics}
|
|
||||||
canLeave={canLeave}
|
canLeave={canLeave}
|
||||||
onSubscribeChannel={handleSubscribeClick}
|
onSubscribeChannel={handleSubscribeClick}
|
||||||
onSearchClick={handleSearchClick}
|
onSearchClick={handleSearchClick}
|
||||||
@ -207,7 +204,6 @@ export default memo(withGlobal<OwnProps>(
|
|||||||
const canSearch = isMainThread || isDiscussionThread;
|
const canSearch = isMainThread || isDiscussionThread;
|
||||||
const canMute = isMainThread && !isChatWithSelf && !canSubscribe;
|
const canMute = isMainThread && !isChatWithSelf && !canSubscribe;
|
||||||
const canSelect = !selectIsInSelectMode(global);
|
const canSelect = !selectIsInSelectMode(global);
|
||||||
const canSeeStatistics = isMainThread;
|
|
||||||
const canLeave = isMainThread && !canSubscribe;
|
const canLeave = isMainThread && !canSubscribe;
|
||||||
|
|
||||||
const noMenu = !(
|
const noMenu = !(
|
||||||
@ -215,7 +211,6 @@ export default memo(withGlobal<OwnProps>(
|
|||||||
|| (IS_MOBILE_SCREEN && canSearch)
|
|| (IS_MOBILE_SCREEN && canSearch)
|
||||||
|| canMute
|
|| canMute
|
||||||
|| canSelect
|
|| canSelect
|
||||||
|| canSeeStatistics
|
|
||||||
|| canLeave
|
|| canLeave
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -228,7 +223,6 @@ export default memo(withGlobal<OwnProps>(
|
|||||||
canSearch,
|
canSearch,
|
||||||
canMute,
|
canMute,
|
||||||
canSelect,
|
canSelect,
|
||||||
canSeeStatistics,
|
|
||||||
canLeave,
|
canLeave,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|||||||
@ -22,7 +22,7 @@ import DeleteChatModal from '../common/DeleteChatModal';
|
|||||||
|
|
||||||
import './HeaderMenuContainer.scss';
|
import './HeaderMenuContainer.scss';
|
||||||
|
|
||||||
type DispatchProps = Pick<GlobalActions, 'updateChatMutedState' | 'toggleStatistics' | 'enterMessageSelectMode'>;
|
type DispatchProps = Pick<GlobalActions, 'updateChatMutedState' | 'enterMessageSelectMode'>;
|
||||||
|
|
||||||
export type OwnProps = {
|
export type OwnProps = {
|
||||||
chatId: number;
|
chatId: number;
|
||||||
@ -34,7 +34,6 @@ export type OwnProps = {
|
|||||||
canSearch?: boolean;
|
canSearch?: boolean;
|
||||||
canMute?: boolean;
|
canMute?: boolean;
|
||||||
canSelect?: boolean;
|
canSelect?: boolean;
|
||||||
canSeeStatistics?: boolean;
|
|
||||||
canLeave?: boolean;
|
canLeave?: boolean;
|
||||||
onSubscribeChannel: () => void;
|
onSubscribeChannel: () => void;
|
||||||
onSearchClick: () => void;
|
onSearchClick: () => void;
|
||||||
@ -58,7 +57,6 @@ const HeaderMenuContainer: FC<OwnProps & StateProps & DispatchProps> = ({
|
|||||||
canSearch,
|
canSearch,
|
||||||
canMute,
|
canMute,
|
||||||
canSelect,
|
canSelect,
|
||||||
canSeeStatistics,
|
|
||||||
canLeave,
|
canLeave,
|
||||||
chat,
|
chat,
|
||||||
isPrivate,
|
isPrivate,
|
||||||
@ -69,7 +67,6 @@ const HeaderMenuContainer: FC<OwnProps & StateProps & DispatchProps> = ({
|
|||||||
onClose,
|
onClose,
|
||||||
onCloseAnimationEnd,
|
onCloseAnimationEnd,
|
||||||
updateChatMutedState,
|
updateChatMutedState,
|
||||||
toggleStatistics,
|
|
||||||
enterMessageSelectMode,
|
enterMessageSelectMode,
|
||||||
}) => {
|
}) => {
|
||||||
const [isMenuOpen, setIsMenuOpen] = useState(true);
|
const [isMenuOpen, setIsMenuOpen] = useState(true);
|
||||||
@ -108,11 +105,6 @@ const HeaderMenuContainer: FC<OwnProps & StateProps & DispatchProps> = ({
|
|||||||
closeMenu();
|
closeMenu();
|
||||||
}, [closeMenu, onSearchClick]);
|
}, [closeMenu, onSearchClick]);
|
||||||
|
|
||||||
const handleStatistics = useCallback(() => {
|
|
||||||
toggleStatistics();
|
|
||||||
closeMenu();
|
|
||||||
}, [closeMenu, toggleStatistics]);
|
|
||||||
|
|
||||||
const handleSelectMessages = useCallback(() => {
|
const handleSelectMessages = useCallback(() => {
|
||||||
enterMessageSelectMode();
|
enterMessageSelectMode();
|
||||||
closeMenu();
|
closeMenu();
|
||||||
@ -167,14 +159,6 @@ const HeaderMenuContainer: FC<OwnProps & StateProps & DispatchProps> = ({
|
|||||||
{lang('ReportSelectMessages')}
|
{lang('ReportSelectMessages')}
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
)}
|
)}
|
||||||
{canSeeStatistics && (
|
|
||||||
<MenuItem
|
|
||||||
icon="poll"
|
|
||||||
onClick={handleStatistics}
|
|
||||||
>
|
|
||||||
{lang('Statistics')}
|
|
||||||
</MenuItem>
|
|
||||||
)}
|
|
||||||
{canLeave && (
|
{canLeave && (
|
||||||
<MenuItem
|
<MenuItem
|
||||||
destructive
|
destructive
|
||||||
@ -213,7 +197,6 @@ export default memo(withGlobal<OwnProps>(
|
|||||||
},
|
},
|
||||||
(setGlobal, actions): DispatchProps => pick(actions, [
|
(setGlobal, actions): DispatchProps => pick(actions, [
|
||||||
'updateChatMutedState',
|
'updateChatMutedState',
|
||||||
'toggleStatistics',
|
|
||||||
'enterMessageSelectMode',
|
'enterMessageSelectMode',
|
||||||
]),
|
]),
|
||||||
)(HeaderMenuContainer));
|
)(HeaderMenuContainer));
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import React, {
|
import React, {
|
||||||
FC, memo, useCallback, useEffect, useMemo, useRef, useState,
|
FC, memo, useCallback, useEffect, useRef, useState,
|
||||||
} from '../../lib/teact/teact';
|
} from '../../lib/teact/teact';
|
||||||
import { withGlobal } from '../../lib/teact/teactn';
|
import { withGlobal } from '../../lib/teact/teactn';
|
||||||
|
|
||||||
@ -25,8 +25,6 @@ import CalendarModal from '../common/CalendarModal.async';
|
|||||||
import SearchInput from '../ui/SearchInput';
|
import SearchInput from '../ui/SearchInput';
|
||||||
import Button from '../ui/Button';
|
import Button from '../ui/Button';
|
||||||
import Transition from '../ui/Transition';
|
import Transition from '../ui/Transition';
|
||||||
import DropdownMenu from '../ui/DropdownMenu';
|
|
||||||
import MenuItem from '../ui/MenuItem';
|
|
||||||
import './RightHeader.scss';
|
import './RightHeader.scss';
|
||||||
|
|
||||||
type OwnProps = {
|
type OwnProps = {
|
||||||
@ -54,7 +52,7 @@ type StateProps = {
|
|||||||
|
|
||||||
type DispatchProps = Pick<GlobalActions, (
|
type DispatchProps = Pick<GlobalActions, (
|
||||||
'setLocalTextSearchQuery' | 'setStickerSearchQuery' | 'setGifSearchQuery' |
|
'setLocalTextSearchQuery' | 'setStickerSearchQuery' | 'setGifSearchQuery' |
|
||||||
'searchTextMessagesLocal' | 'toggleManagement' | 'toggleStatistics' | 'searchMessagesByDate'
|
'searchTextMessagesLocal' | 'toggleManagement' | 'searchMessagesByDate'
|
||||||
)>;
|
)>;
|
||||||
|
|
||||||
const COLUMN_CLOSE_DELAY_MS = 300;
|
const COLUMN_CLOSE_DELAY_MS = 300;
|
||||||
@ -106,7 +104,6 @@ const RightHeader: FC<OwnProps & StateProps & DispatchProps> = ({
|
|||||||
setGifSearchQuery,
|
setGifSearchQuery,
|
||||||
searchTextMessagesLocal,
|
searchTextMessagesLocal,
|
||||||
toggleManagement,
|
toggleManagement,
|
||||||
toggleStatistics,
|
|
||||||
searchMessagesByDate,
|
searchMessagesByDate,
|
||||||
}) => {
|
}) => {
|
||||||
// eslint-disable-next-line no-null/no-null
|
// eslint-disable-next-line no-null/no-null
|
||||||
@ -190,22 +187,6 @@ const RightHeader: FC<OwnProps & StateProps & DispatchProps> = ({
|
|||||||
HeaderContent.Statistics
|
HeaderContent.Statistics
|
||||||
) : -1; // Never reached
|
) : -1; // Never reached
|
||||||
|
|
||||||
const MenuButton: FC<{ onTrigger: () => void; isOpen?: boolean }> = useMemo(() => {
|
|
||||||
return ({ onTrigger, isOpen }) => (
|
|
||||||
<Button
|
|
||||||
round
|
|
||||||
ripple={!IS_MOBILE_SCREEN}
|
|
||||||
size="smaller"
|
|
||||||
color="translucent"
|
|
||||||
className={isOpen ? 'active' : undefined}
|
|
||||||
onClick={onTrigger}
|
|
||||||
ariaLabel={lang('Common.More')}
|
|
||||||
>
|
|
||||||
<i className="icon-more" />
|
|
||||||
</Button>
|
|
||||||
);
|
|
||||||
}, [lang]);
|
|
||||||
|
|
||||||
function renderHeaderContent() {
|
function renderHeaderContent() {
|
||||||
switch (contentKey) {
|
switch (contentKey) {
|
||||||
case HeaderContent.PollResults:
|
case HeaderContent.PollResults:
|
||||||
@ -289,12 +270,6 @@ const RightHeader: FC<OwnProps & StateProps & DispatchProps> = ({
|
|||||||
<i className="icon-edit" />
|
<i className="icon-edit" />
|
||||||
</Button>
|
</Button>
|
||||||
)}
|
)}
|
||||||
<DropdownMenu
|
|
||||||
trigger={MenuButton}
|
|
||||||
positionX="right"
|
|
||||||
>
|
|
||||||
<MenuItem icon="poll" onClick={toggleStatistics}>{lang('Statistics')}</MenuItem>
|
|
||||||
</DropdownMenu>
|
|
||||||
</section>
|
</section>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
@ -380,7 +355,6 @@ export default memo(withGlobal<OwnProps>(
|
|||||||
'setGifSearchQuery',
|
'setGifSearchQuery',
|
||||||
'searchTextMessagesLocal',
|
'searchTextMessagesLocal',
|
||||||
'toggleManagement',
|
'toggleManagement',
|
||||||
'toggleStatistics',
|
|
||||||
'searchMessagesByDate',
|
'searchMessagesByDate',
|
||||||
]),
|
]),
|
||||||
)(RightHeader));
|
)(RightHeader));
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user