@ -4,15 +4,19 @@ import { useCallback, useContext } from "react";
import { useTranslation } from "react-i18next" ;
import { useTranslation } from "react-i18next" ;
import { clearSelected } from "../../../redux/fileManagerSlice.ts" ;
import { clearSelected } from "../../../redux/fileManagerSlice.ts" ;
import { useAppDispatch , useAppSelector } from "../../../redux/hooks.ts" ;
import { useAppDispatch , useAppSelector } from "../../../redux/hooks.ts" ;
import { NavigatorCapability } from "../../../api/explorer.ts" ;
import { downloadAll } from "../../../redux/thunks/download.ts" ;
import { createShareShortcut , isMacbook } from "../../../redux/thunks/file.ts" ;
import { createShareShortcut , isMacbook } from "../../../redux/thunks/file.ts" ;
import { inverseSelection , pinCurrentView , refreshFileList , selectAll } from "../../../redux/thunks/filemanager.ts" ;
import { inverseSelection , pinCurrentView , refreshFileList , selectAll } from "../../../redux/thunks/filemanager.ts" ;
import SessionManager from "../../../session" ;
import SessionManager from "../../../session" ;
import Boolset from "../../../util/boolset.ts" ;
import { Filesystem } from "../../../util/uri.ts" ;
import { Filesystem } from "../../../util/uri.ts" ;
import { KeyIndicator } from "../../Frame/NavBar/SearchBar.tsx" ;
import { KeyIndicator } from "../../Frame/NavBar/SearchBar.tsx" ;
import ArrowSync from "../../Icons/ArrowSync.tsx" ;
import ArrowSync from "../../Icons/ArrowSync.tsx" ;
import Border from "../../Icons/Border.tsx" ;
import Border from "../../Icons/Border.tsx" ;
import BorderAll from "../../Icons/BorderAll.tsx" ;
import BorderAll from "../../Icons/BorderAll.tsx" ;
import BorderInside from "../../Icons/BorderInside.tsx" ;
import BorderInside from "../../Icons/BorderInside.tsx" ;
import CloudDownloadOutlined from "../../Icons/CloudDownloadOutlined.tsx" ;
import FolderLink from "../../Icons/FolderLink.tsx" ;
import FolderLink from "../../Icons/FolderLink.tsx" ;
import PinOutlined from "../../Icons/PinOutlined.tsx" ;
import PinOutlined from "../../Icons/PinOutlined.tsx" ;
import { DenseDivider , SquareMenu , SquareMenuItem } from "../ContextMenu/ContextMenu.tsx" ;
import { DenseDivider , SquareMenu , SquareMenuItem } from "../ContextMenu/ContextMenu.tsx" ;
@ -22,6 +26,8 @@ const MoreActionMenu = ({ onClose, ...rest }: MenuProps) => {
const { t } = useTranslation ( ) ;
const { t } = useTranslation ( ) ;
const fmIndex = useContext ( FmIndexContext ) ;
const fmIndex = useContext ( FmIndexContext ) ;
const fs = useAppSelector ( ( state ) = > state . fileManager [ fmIndex ] . current_fs ) ;
const fs = useAppSelector ( ( state ) = > state . fileManager [ fmIndex ] . current_fs ) ;
const parentCapability = useAppSelector ( ( state ) = > state . fileManager [ fmIndex ] . list ? . parent ? . capability ) ;
const canDownloadAll = new Boolset ( parentCapability ) . enabled ( NavigatorCapability . download_file ) ;
const dispatch = useAppDispatch ( ) ;
const dispatch = useAppDispatch ( ) ;
const isLogin = ! ! SessionManager . currentLoginOrNull ( ) ;
const isLogin = ! ! SessionManager . currentLoginOrNull ( ) ;
const theme = useTheme ( ) ;
const theme = useTheme ( ) ;
@ -62,6 +68,11 @@ const MoreActionMenu = ({ onClose, ...rest }: MenuProps) => {
dispatch ( refreshFileList ( fmIndex ) ) ;
dispatch ( refreshFileList ( fmIndex ) ) ;
} , [ dispatch , onClose , fmIndex ] ) ;
} , [ dispatch , onClose , fmIndex ] ) ;
const onDownloadAllClicked = useCallback ( ( ) = > {
onClose && onClose ( { } , "escapeKeyDown" ) ;
dispatch ( downloadAll ( fmIndex ) ) ;
} , [ dispatch , onClose , fmIndex ] ) ;
return (
return (
< SquareMenu
< SquareMenu
MenuListProps = { {
MenuListProps = { {
@ -104,6 +115,14 @@ const MoreActionMenu = ({ onClose, ...rest }: MenuProps) => {
< ListItemText > { t ( "application:fileManager.saveShortcut" ) } < / ListItemText >
< ListItemText > { t ( "application:fileManager.saveShortcut" ) } < / ListItemText >
< / SquareMenuItem >
< / SquareMenuItem >
) }
) }
{ fs == Filesystem . share && canDownloadAll && (
< SquareMenuItem onClick = { onDownloadAllClicked } >
< ListItemIcon >
< CloudDownloadOutlined fontSize = "small" / >
< / ListItemIcon >
< ListItemText > { t ( "application:fileManager.downloadAll" ) } < / ListItemText >
< / SquareMenuItem >
) }
{ isLogin && < DenseDivider / > }
{ isLogin && < DenseDivider / > }
< SquareMenuItem onClick = { onSelectAllClicked } >
< SquareMenuItem onClick = { onSelectAllClicked } >
< ListItemIcon >
< ListItemIcon >