diff --git a/src/component/FileManager/DnD/DragLayer.js b/src/component/FileManager/DnD/DragLayer.js
index 6c49936..53e7833 100644
--- a/src/component/FileManager/DnD/DragLayer.js
+++ b/src/component/FileManager/DnD/DragLayer.js
@@ -32,8 +32,7 @@ function getItemStyles(
const transform = `translate(${x}px, ${y}px)`;
return {
transform,
- WebkitTransform: transform,
- opacity: 0.5
+ WebkitTransform: transform
};
}
const CustomDragLayer = props => {
diff --git a/src/component/FileManager/DnD/Preview.js b/src/component/FileManager/DnD/Preview.js
index 227e59a..0620bfb 100644
--- a/src/component/FileManager/DnD/Preview.js
+++ b/src/component/FileManager/DnD/Preview.js
@@ -19,7 +19,7 @@ const diliverIcon = (object, viewMethod, classes) => {
if (object.type === "dir") {
return (
-
+
);
}
diff --git a/src/component/FileManager/Navigator/Navigator.js b/src/component/FileManager/Navigator/Navigator.js
index a491991..85a414c 100644
--- a/src/component/FileManager/Navigator/Navigator.js
+++ b/src/component/FileManager/Navigator/Navigator.js
@@ -3,17 +3,12 @@ import PropTypes from "prop-types";
import { connect } from "react-redux";
import { withRouter } from "react-router-dom";
import RightIcon from "@material-ui/icons/KeyboardArrowRight";
-import ViewListIcon from "@material-ui/icons/ViewList";
-import ViewModuleIcon from "@material-ui/icons/ViewModule";
-import ViewSmallIcon from "@material-ui/icons/ViewComfy";
-import TextTotateVerticalIcon from "@material-ui/icons/TextRotateVertical";
import ShareIcon from "@material-ui/icons/Share";
import NewFolderIcon from "@material-ui/icons/CreateNewFolder";
import RefreshIcon from "@material-ui/icons/Refresh";
import {
navigateTo,
navigateUp,
- changeViewMethod,
setNavigatorError,
setNavigatorLoadingStatus,
refreshFileList,
@@ -21,8 +16,6 @@ import {
openCreateFolderDialog,
openShareDialog,
drawerToggleAction,
- setShareUserPopover,
- openResaveDialog,
openCompressDialog
} from "../../../actions/index";
import explorer from "../../../redux/explorer";
@@ -33,8 +26,7 @@ import {
Divider,
Menu,
MenuItem,
- ListItemIcon,
- IconButton
+ ListItemIcon
} from "@material-ui/core";
import PathButton from "./PathButton";
import DropDown from "./DropDown";
@@ -45,6 +37,7 @@ import Avatar from "@material-ui/core/Avatar";
import { Archive } from "@material-ui/icons";
import { FilePlus } from "mdi-material-ui";
import { openCreateFileDialog } from "../../../actions";
+import SubActions from "./SubActions";
const mapStateToProps = state => {
return {
@@ -65,12 +58,6 @@ const mapDispatchToProps = dispatch => {
navigateUp: () => {
dispatch(navigateUp());
},
- changeView: method => {
- dispatch(changeViewMethod(method));
- },
- changeSort: method => {
- dispatch(explorer.actions.changeSortMethod(method));
- },
setNavigatorError: (status, msg) => {
dispatch(setNavigatorError(status, msg));
},
@@ -98,12 +85,6 @@ const mapDispatchToProps = dispatch => {
handleDesktopToggle: open => {
dispatch(drawerToggleAction(open));
},
- setShareUserPopover: e => {
- dispatch(setShareUserPopover(e));
- },
- openResave: key => {
- dispatch(openResaveDialog(key));
- },
openCompressDialog: () => {
dispatch(openCompressDialog());
}
@@ -112,15 +93,6 @@ const mapDispatchToProps = dispatch => {
const delay = ms => new Promise(resolve => setTimeout(resolve, ms));
-const sortOptions = [
- "文件名称正序",
- "文件名称倒序",
- "上传时间正序",
- "上传时间倒序",
- "文件大小正序",
- "文件大小倒序"
-];
-
const styles = theme => ({
container: {
[theme.breakpoints.down("xs")]: {
@@ -151,10 +123,6 @@ const styles = theme => ({
expandMore: {
color: "#8d8d8d"
},
- sideButton: {
- padding: "8px",
- marginRight: "5px"
- },
roundBorder: {
borderRadius: "4px 4px 0 0"
}
@@ -170,9 +138,7 @@ class NavigatorComponent extends Component {
folders: [],
anchorEl: null,
hiddenMode: false,
- anchorHidden: null,
- anchorSort: null,
- selectedIndex: 0
+ anchorHidden: null
};
constructor(props) {
@@ -318,10 +284,6 @@ class NavigatorComponent extends Component {
this.setState({ anchorHidden: e.currentTarget });
};
- showSortOptions = e => {
- this.setState({ anchorSort: e.currentTarget });
- };
-
performAction = e => {
this.handleClose();
if (e === "refresh") {
@@ -358,31 +320,6 @@ class NavigatorComponent extends Component {
}
};
- toggleViewMethod = () => {
- const newMethod =
- this.props.viewMethod === "icon"
- ? "list"
- : this.props.viewMethod === "list"
- ? "smallIcon"
- : "icon";
- Auth.SetPreference("view_method", newMethod);
- this.props.changeView(newMethod);
- };
-
- handleMenuItemClick = (e, index) => {
- this.setState({ selectedIndex: index, anchorEl: null });
- const optionsTable = {
- 0: "namePos",
- 1: "nameRev",
- 2: "timePos",
- 3: "timeRev",
- 4: "sizePos",
- 5: "sizeRes"
- };
- this.props.changeSort(optionsTable[index]);
- this.handleClose();
- };
-
render() {
const { classes } = this.props;
const isHomePage = pathHelper.isHomePage(this.props.location.pathname);
@@ -540,86 +477,7 @@ class NavigatorComponent extends Component {
))}
- {this.props.viewMethod === "icon" && (
-
-
-
- )}
- {this.props.viewMethod === "list" && (
-
-
-
- )}
- {this.props.viewMethod === "smallIcon" && (
-
-
-
- )}
-
-
-
-
-
- {this.props.share && (
-
- this.props.setShareUserPopover(
- e.currentTarget
- )
- }
- style={{ padding: 5 }}
- >
-
-
- )}
+
diff --git a/src/component/FileManager/Navigator/SubActions.js b/src/component/FileManager/Navigator/SubActions.js
new file mode 100644
index 0000000..154f4e4
--- /dev/null
+++ b/src/component/FileManager/Navigator/SubActions.js
@@ -0,0 +1,141 @@
+import React, { useCallback, useState } from "react";
+import { IconButton, makeStyles, Menu, MenuItem } from "@material-ui/core";
+import ViewListIcon from "@material-ui/icons/ViewList";
+import ViewSmallIcon from "@material-ui/icons/ViewComfy";
+import ViewModuleIcon from "@material-ui/icons/ViewModule";
+import TextTotateVerticalIcon from "@material-ui/icons/TextRotateVertical";
+import Avatar from "@material-ui/core/Avatar";
+import { useDispatch, useSelector } from "react-redux";
+import Auth from "../../../middleware/Auth";
+import { changeViewMethod, setShareUserPopover } from "../../../actions";
+import { changeSortMethod } from "../../../redux/explorer/action";
+
+const useStyles = makeStyles(theme => ({
+ sideButton: {
+ padding: "8px",
+ marginRight: "5px"
+ }
+}));
+
+const sortOptions = ["A-Z", "Z-A", "最早", "最新", "最小", "最大"];
+
+export default function SubActions({ isSmall, share }) {
+ const dispatch = useDispatch();
+ const viewMethod = useSelector(
+ state => state.viewUpdate.explorerViewMethod
+ );
+ const OpenLoadingDialog = useCallback(
+ method => dispatch(changeViewMethod(method)),
+ [dispatch]
+ );
+ const ChangeSortMethod = useCallback(
+ method => dispatch(changeSortMethod(method)),
+ [dispatch]
+ );
+ const SetShareUserPopover = useCallback(
+ e => dispatch(setShareUserPopover(e)),
+ [dispatch]
+ );
+ const [anchorSort, setAnchorSort] = useState(null);
+ const [selectedIndex, setSelectedIndex] = useState(0);
+ const showSortOptions = e => {
+ setAnchorSort(e.currentTarget);
+ };
+ const handleMenuItemClick = (e, index) => {
+ setSelectedIndex(index);
+ const optionsTable = {
+ 0: "namePos",
+ 1: "nameRev",
+ 2: "timePos",
+ 3: "timeRev",
+ 4: "sizePos",
+ 5: "sizeRes"
+ };
+ ChangeSortMethod(optionsTable[index]);
+ setAnchorSort(null);
+ };
+
+ const toggleViewMethod = () => {
+ const newMethod =
+ viewMethod === "icon"
+ ? "list"
+ : viewMethod === "list"
+ ? "smallIcon"
+ : "icon";
+ Auth.SetPreference("view_method", newMethod);
+ OpenLoadingDialog(newMethod);
+ };
+
+ const classes = useStyles();
+ return (
+ <>
+ {viewMethod === "icon" && (
+
+
+
+ )}
+ {viewMethod === "list" && (
+
+
+
+ )}
+
+ {viewMethod === "smallIcon" && (
+
+
+
+ )}
+
+
+
+
+
+ {share && (
+ SetShareUserPopover(e.currentTarget)}
+ style={{ padding: 5 }}
+ >
+
+
+ )}
+ >
+ );
+}
diff --git a/src/component/FileManager/SmallIcon.js b/src/component/FileManager/SmallIcon.js
index 6ef2aca..d66a184 100644
--- a/src/component/FileManager/SmallIcon.js
+++ b/src/component/FileManager/SmallIcon.js
@@ -14,6 +14,7 @@ import { lighten } from "@material-ui/core/styles";
import CheckCircleRoundedIcon from "@material-ui/icons/CheckCircleRounded";
import statusHelper from "../../utils/page";
import Grow from "@material-ui/core/Grow";
+import { Folder } from "@material-ui/icons";
const styles = theme => ({
container: {
@@ -118,7 +119,12 @@ class SmallIconCompoment extends Component {
})}
>
{(!isSelected || !isMobile) && (
-
+ <>
+ {this.props.isFolder && }
+ {!this.props.isFolder && (
+
+ )}
+ >
)}
{isSelected && isMobile && (