diff --git a/src/App.js b/src/App.js index 755c629..f050687 100644 --- a/src/App.js +++ b/src/App.js @@ -74,6 +74,11 @@ export default function App() { + + Loading...}> + + + diff --git a/src/actions/index.js b/src/actions/index.js index c548d8e..27665af 100644 --- a/src/actions/index.js +++ b/src/actions/index.js @@ -33,6 +33,13 @@ export const changeViewMethod = method => { }; }; +export const changeSubTitle = title =>{ + return { + type: "CHANGE_SUB_TITLE", + title: title + }; +}; + export const toggleDaylightMode = ()=>{ return { type: "TOGGLE_DAYLIGHT_MODE", diff --git a/src/component/FileManager/FileManager.js b/src/component/FileManager/FileManager.js index c7f357f..e72f610 100644 --- a/src/component/FileManager/FileManager.js +++ b/src/component/FileManager/FileManager.js @@ -8,10 +8,27 @@ import Explorer from "./Explorer" import Modals from "./Modals" import {decode} from "../../untils/index" import { withStyles } from '@material-ui/core'; +import {connect} from "react-redux"; +import { + changeSubTitle, +} from "../../actions"; const styles = theme => ({ }) +const mapStateToProps = ()=>{ + +} + +const mapDispatchToProps = dispatch => { + return { + changeSubTitle: text => { + dispatch(changeSubTitle(text)); + }, + + }; +}; + class FileManager extends Component { constructor(props){ @@ -19,6 +36,10 @@ class FileManager extends Component { this.image = React.createRef(); } + componentDidMount() { + this.props.changeSubTitle(null); + } + handleImageLoaded = ()=>{ window.upload_load=""; window.cliLoad =""; @@ -37,7 +58,7 @@ class FileManager extends Component { if(window.upload_load===""){ window.location.href="/FixComplete"; } - } + }; render() { return ( @@ -58,4 +79,7 @@ class FileManager extends Component { FileManager.propTypes = { }; -export default withStyles(styles)(FileManager); \ No newline at end of file +export default connect( + mapStateToProps, + mapDispatchToProps +)(withStyles(styles)(FileManager)); \ No newline at end of file diff --git a/src/component/Navbar/Navbar.js b/src/component/Navbar/Navbar.js index 5ff1d44..1986484 100644 --- a/src/component/Navbar/Navbar.js +++ b/src/component/Navbar/Navbar.js @@ -87,7 +87,8 @@ const mapStateToProps = state => { withFile: state.explorer.selectProps.withFile, path: state.navigator.path, keywords: state.explorer.keywords, - title: state.siteConfig.title + title: state.siteConfig.title, + subTitle:state.viewUpdate.subTitle, }; }; @@ -305,15 +306,6 @@ class NavbarCompoment extends Component { this.setState(state => ({ mobileOpen: !state.mobileOpen })); }; - clickUpload = () => { - if (this.state.queued === 0) { - //document.getElementsByClassName("uploadForm")[0].click(); - this.props.changeContextMenu("empty", true); - } else { - this.UploaderRef.current.getWrappedInstance().openFileList(); - } - }; - loadUploader() { if (pathHelper.isHomePage(this.props.location.pathname)) { return ; @@ -702,7 +694,7 @@ class NavbarCompoment extends Component { } /> )} - {this.props.title} + {this.props.subTitle?this.props.subTitle : this.props.title} )} diff --git a/src/component/Viewer/Video.js b/src/component/Viewer/Video.js index b7544e0..8d20cd7 100644 --- a/src/component/Viewer/Video.js +++ b/src/component/Viewer/Video.js @@ -1,10 +1,11 @@ -import React from "react"; +import React, {useCallback, useEffect} from "react"; import DPlayer from "react-dplayer"; import { Paper } from "@material-ui/core"; import { makeStyles } from "@material-ui/core/styles"; import { useRouteMatch } from "react-router"; import { getBaseURL } from "../../middleware/Api"; -import Typography from "@material-ui/core/Typography"; +import {useDispatch} from "react-redux"; +import {changeSubTitle} from "../../actions"; const useStyles = makeStyles(theme => ({ layout: { @@ -26,7 +27,15 @@ const useStyles = makeStyles(theme => ({ export default function VideoViewer(props) { const math = useRouteMatch(); - + const dispatch = useDispatch(); + const SetSubTitle = useCallback( + title=>dispatch(changeSubTitle(title)), + [dispatch] + ); + useEffect(()=>{ + let path = math.params[0].split("/"); + SetSubTitle(path[path.length - 1]); + },[math.params[0]]); const classes = useStyles(); return ( diff --git a/src/index.js b/src/index.js index b3bfa53..34df995 100644 --- a/src/index.js +++ b/src/index.js @@ -63,6 +63,7 @@ const defaultStatus = InitSiteConfig({ open: false, explorerViewMethod: "icon", sortMethod: "timePos", + subTitle:null, contextType: "none", menuOpen: false, navigatorLoading: true, diff --git a/src/reducers/index.js b/src/reducers/index.js index 31287e8..2ed47c8 100644 --- a/src/reducers/index.js +++ b/src/reducers/index.js @@ -360,6 +360,12 @@ const cloudreveApp = (state = [], action) => { }), }), }); + case 'CHANGE_SUB_TITLE': + return Object.assign({}, state, { + viewUpdate: Object.assign({}, state.viewUpdate, { + subTitle: action.title, + }), + }); case 'TOGGLE_SNACKBAR': return Object.assign({}, state, { viewUpdate: Object.assign({}, state.viewUpdate, {