Web:Client:Home: fix header

This commit is contained in:
Timofey Boyko 2023-05-04 18:50:51 +03:00
parent 541c08c7a1
commit 9b6fd917db
3 changed files with 29 additions and 12 deletions

View File

@ -104,6 +104,13 @@ const Item = ({
setIsDragActive(false);
}, []);
const onClickAction = React.useCallback(
(folderId) => {
onClick && onClick(folderId, item.title);
},
[onClick, item.title]
);
return (
<StyledDragAndDrop
key={item.id}
@ -123,7 +130,7 @@ const Item = ({
showText={showText}
text={item.title}
isActive={isActive}
onClick={onClick}
onClick={onClickAction}
onDrop={onMoveTo}
isEndOfBlock={getEndOfBlock(item)}
isDragging={isDragging}

View File

@ -56,12 +56,17 @@ const ArticleBodyContent = (props) => {
// .filter((campaign) => campaign.length > 0);
const onClick = React.useCallback(
(folderId) => {
(folderId, title) => {
const { toggleArticleOpen } = props;
let path = `/rooms`;
let params = null;
const state = {
title,
isRoot: true,
};
switch (folderId) {
case myFolderId:
const myFilter = FilesFilter.getDefault();
@ -109,7 +114,7 @@ const ArticleBodyContent = (props) => {
path += `/filter?${params}`;
navigate(path);
navigate(path, { state });
if (isMobileOnly || isMobile()) {
toggleArticleOpen();

View File

@ -781,6 +781,7 @@ const SectionHeaderContent = (props) => {
const headerMenu = isAccountsPage
? getAccountsHeaderMenu(t)
: getHeaderMenu(t);
const menuItems = getMenuItems();
let tableGroupMenuVisible = headerMenu.length;
@ -808,19 +809,23 @@ const SectionHeaderContent = (props) => {
tableGroupMenuProps.isBlocked = isGroupMenuBlocked;
}
const fromAccounts = location?.state?.fromAccounts;
const fromSettings = location?.state?.fromSettings;
const stateTitle = location?.state?.title;
const stateIsRoot = location?.state?.isRoot;
const isRoot =
pathParts === null && (fromAccounts || fromSettings)
pathParts === null && stateIsRoot
? true
: isRootFolder || isAccountsPage || isSettingsPage;
const currentTitle =
isSettingsPage || (!title && fromSettings)
? t("Common:Settings")
: isAccountsPage || (!title && fromAccounts)
? t("Common:Accounts")
: title;
const currentTitle = isSettingsPage
? t("Common:Settings")
: isAccountsPage
? t("Common:Accounts")
: !title && stateTitle
? stateTitle
: title;
console.log(isRoot, currentTitle);
return (
<Consumer key="header">