Web: Files: Navigation: added onContextClick

This commit is contained in:
Nikita Gopienko 2024-06-27 13:49:53 +03:00
parent 15fca51225
commit 116c72c261
6 changed files with 18 additions and 4 deletions

View File

@ -223,6 +223,7 @@ const SectionHeaderContent = (props) => {
onCreateRoom,
onEmptyTrashAction,
getHeaderOptions,
setBufferSelection,
} = props;
const location = useLocation();
@ -257,6 +258,10 @@ const SectionHeaderContent = (props) => {
return getHeaderOptions(t, selectedFolder);
};
const onContextOptionsClick = () => {
setBufferSelection(selectedFolder);
};
const onSelect = (e) => {
const key = e.currentTarget.dataset.key;
@ -540,6 +545,7 @@ const SectionHeaderContent = (props) => {
onNavigationButtonClick={onNavigationButtonClick}
tariffBar={<TariffBar />}
showNavigationButton={!!showNavigationButton}
onContextOptionsClick={onContextOptionsClick}
/>
</div>
)}
@ -607,6 +613,7 @@ export default inject(
isEmptyPage,
categoryType,
setBufferSelection,
} = filesStore;
const {
@ -798,6 +805,7 @@ export default inject(
onCreateRoom,
onEmptyTrashAction,
getHeaderOptions,
setBufferSelection,
};
},
)(

View File

@ -1110,10 +1110,7 @@ class ContextOptionsStore {
getHeaderOptions = (t, item) => {
const { isRecycleBinFolder, isArchiveFolder } = this.treeFoldersStore;
const { roomsForDelete, roomsForRestore, setBufferSelection } =
this.filesStore;
setBufferSelection(item);
const { roomsForDelete, roomsForRestore } = this.filesStore;
const canRestoreAll = roomsForRestore.length > 0;
const canDeleteAll = roomsForDelete.length > 0;

View File

@ -82,6 +82,7 @@ const Navigation = ({
onNavigationButtonClick,
tariffBar,
showNavigationButton,
onContextClick,
...rest
}: INavigationProps) => {
const [isOpen, setIsOpen] = React.useState(false);
@ -291,6 +292,7 @@ const Navigation = ({
tariffBar={tariffBar}
title={title}
isEmptyPage={isEmptyPage}
onContextClick={onContextClick}
/>
</StyledContainer>
{isDesktop && !hideInfoPanel && (

View File

@ -50,6 +50,7 @@ export interface IContextButtonProps {
id: string;
title?: string;
onCloseDropBox?: () => void;
onContextOptionsClick?: () => void;
}
export interface IPlusButtonProps {
@ -95,6 +96,7 @@ export interface IControlButtonProps {
title?: string;
isEmptyPage?: boolean;
onCloseDropBox?: () => void;
onContextOptionsClick?: () => void;
}
export interface ITextProps {

View File

@ -41,6 +41,7 @@ const ContextButton = ({
isMobile,
id,
onCloseDropBox,
onContextOptionsClick,
...rest
}: IContextButtonProps) => {
const [isOpen, setIsOpen] = useState(false);
@ -58,6 +59,7 @@ const ContextButton = ({
};
const onClick = (e: React.MouseEvent<HTMLDivElement>) => {
onContextOptionsClick?.();
if (withMenu) toggle(e, !isOpen);
};

View File

@ -63,6 +63,7 @@ const ControlButtons = ({
title,
isEmptyPage,
onCloseDropBox,
onContextOptionsClick,
}: IControlButtonProps) => {
const toggleInfoPanelAction = () => {
toggleInfoPanel?.();
@ -125,6 +126,7 @@ const ControlButtons = ({
isTrashFolder={isTrashFolder}
isMobile={isMobile || false}
onCloseDropBox={onCloseDropBox}
onContextOptionsClick={onContextOptionsClick}
/>
{!isDesktop && (
@ -180,6 +182,7 @@ const ControlButtons = ({
isTrashFolder={isTrashFolder}
isMobile={isMobile || false}
onCloseDropBox={onCloseDropBox}
onContextOptionsClick={onContextOptionsClick}
/>
)}
</>