disable clicks when a menu is opened

This commit is contained in:
controlol 2021-11-03 20:40:14 +01:00
parent c7a4d3413f
commit f9b91cc7ca

View File

@ -254,6 +254,8 @@ class FileBrowser extends Component {
// change the way files should be ordered // change the way files should be ordered
updateOrder = orderBy => { updateOrder = orderBy => {
if (this.props.menuOpen || this.state.showMenu) return;
if (this.state.orderBy === orderBy) { if (this.state.orderBy === orderBy) {
this.setState({ orderAscending: !this.state.orderAscending }) this.setState({ orderAscending: !this.state.orderAscending })
} else { } else {
@ -299,7 +301,7 @@ class FileBrowser extends Component {
// after the user clicks on a folder // after the user clicks on a folder
updatePath = (isDir, name) => { updatePath = (isDir, name) => {
if (isDir) { if (isDir && !(this.props.menuOpen || this.state.showMenu)) {
const newPath = path.join(this.props.currentPath, name) const newPath = path.join(this.props.currentPath, name)
this.props.updateFiles(newPath) this.props.updateFiles(newPath)
@ -309,6 +311,8 @@ class FileBrowser extends Component {
// after the user clicks on the back button // after the user clicks on the back button
previousDirectory = () => { previousDirectory = () => {
if (this.props.menuOpen || this.state.showMenu) return;
let currentPath = this.props.currentPath.split("/") let currentPath = this.props.currentPath.split("/")
currentPath.pop() currentPath.pop()
@ -318,12 +322,16 @@ class FileBrowser extends Component {
// after the user click on the home button // after the user click on the home button
rootDirectory = () => { rootDirectory = () => {
if (this.props.menuOpen || this.state.showMenu) return;
this.props.updateFiles("/") this.props.updateFiles("/")
this.setState({filter: ""}) this.setState({filter: ""})
} }
// after the user clicks on a path piece // after the user clicks on a path piece
goToPath = index => { goToPath = index => {
if (this.props.menuOpen || this.state.showMenu) return;
let currentPath = this.props.currentPath.split("/") let currentPath = this.props.currentPath.split("/")
if (index !== currentPath.length - 2) { if (index !== currentPath.length - 2) {