From 58a8d986cfc44ce3d79f7bc7039975a6ec97271b Mon Sep 17 00:00:00 2001 From: vmaggioli Date: Sun, 8 Mar 2020 18:57:09 -0400 Subject: [PATCH 01/11] Add play all function --- app/components/FileLoader.js | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/app/components/FileLoader.js b/app/components/FileLoader.js index f85388759..eeb643cd1 100644 --- a/app/components/FileLoader.js +++ b/app/components/FileLoader.js @@ -172,6 +172,11 @@ export default class FileLoader extends Component { }); }; + queueAllFiles = () => { + const filteredFiles = this.processFiles(this.state.files) + this.props.queueFiles(_.reverse(filteredFiles)); + } + renderGlobalError() { const errors = this.props.errors || {}; const errorKey = 'fileLoader-global'; @@ -405,10 +410,14 @@ export default class FileLoader extends Component { } renderQueueButtons() { - if (this.state.selections.length === 0) { - return; - } - return ( + return this.state.selections.length === 0 ? ( +
+ +
+ ) : (
) : ( From ab640f821416774c0cc0ac6019c077f1f124660a Mon Sep 17 00:00:00 2001 From: Fair2Dare Date: Sat, 14 Mar 2020 15:59:59 -0400 Subject: [PATCH 03/11] Switch select all to checkbox --- app/components/FileLoader.js | 34 ++++++++++++++++++++++++---------- app/components/FileLoader.scss | 32 +++++++++++++++++++++++++++++++- 2 files changed, 55 insertions(+), 11 deletions(-) diff --git a/app/components/FileLoader.js b/app/components/FileLoader.js index 5f31dce9f..b9e83d853 100644 --- a/app/components/FileLoader.js +++ b/app/components/FileLoader.js @@ -12,6 +12,7 @@ import { Loader, Visibility, } from 'semantic-ui-react'; +import classNames from 'classnames'; import styles from './FileLoader.scss'; import FileRow from './FileRow'; import DismissibleMessage from './common/DismissibleMessage'; @@ -51,6 +52,7 @@ export default class FileLoader extends Component { this.state = { selections: [], + areAllSelected: false, }; } @@ -127,6 +129,7 @@ export default class FileLoader extends Component { this.setState({ selections: newSelections, + areAllSelected: newSelections.length === this.props.store.files.length, }); }; @@ -162,6 +165,7 @@ export default class FileLoader extends Component { queueClear = () => { this.setState({ selections: [], + areAllSelected: false, }); }; @@ -173,7 +177,10 @@ export default class FileLoader extends Component { }; selectAll = () => { - this.setState({ selections: this.props.store.files }); + this.setState((prevState) => ({ + selections: prevState.areAllSelected ? [] : this.props.store.files, + areAllSelected: !prevState.areAllSelected, + })); } renderGlobalError() { @@ -339,10 +346,21 @@ export default class FileLoader extends Component { return this.renderEmptyLoader(); } + const cellStyles = classNames({ + [styles['select-cell']]: true, + [styles['selected']]: this.state.areAllSelected, + }); + + const selectAllIcon = this.state.areAllSelected ? ( + + ) : ( + + ) + // Generate header row const headerRow = ( - + {selectAllIcon} Details Time @@ -409,14 +427,10 @@ export default class FileLoader extends Component { } renderQueueButtons() { - return this.state.selections.length === 0 ? ( -
- -
- ) : ( + if (this.state.selections.length === 0) { + return; + } + return (