From 4e6681af15341584d0f7503277745415c197699c Mon Sep 17 00:00:00 2001 From: Jake Dexheimer Date: Thu, 23 Feb 2017 20:09:10 -0600 Subject: [PATCH] Add STAGING state --- src/components/Converter.jsx | 97 +++++++++++++++++------------------- styles/index.scss | 2 +- 2 files changed, 46 insertions(+), 53 deletions(-) diff --git a/src/components/Converter.jsx b/src/components/Converter.jsx index a199c5b..8c2ea73 100644 --- a/src/components/Converter.jsx +++ b/src/components/Converter.jsx @@ -14,9 +14,10 @@ import { uniqueFiles } from '../helpers/util' const drop = (props, monitor, component) => { const { files } = monitor.getItem() + const filesUnique = uniqueFiles(component.state.files, files) component.setState({ - status: 'IDLE', - files: uniqueFiles(component.state.files, files) + status: Object.keys(filesUnique).length ? 'STAGING' : 'IDLE', + files: filesUnique }) if (component.state.shifted) { @@ -62,21 +63,16 @@ class Sanitizer extends Component { getMessage() { switch (this.state.status) { - case 'IDLE': { - if (!Object.keys(this.state.files).length) { - return ( -
-

- { this.isHover() ? 'Drop' : 'Drag & drop' } -

-

- {`your files here to ${this.state.shifted ? 'convert' : 'add them'}`} -

-
- ) - } - return null - } + case 'IDLE': return ( +
+

+ { this.isHover() ? 'Drop' : 'Drag & drop' } +

+

+ {`your files here to ${this.state.shifted ? 'convert' : 'add them'}`} +

+
+ ) case 'CONVERTING': return (

@@ -110,42 +106,39 @@ class Sanitizer extends Component { case 'FAILED': return case 'DONE': return case 'CONVERTING': return - default: - if (Object.keys(this.state.files).length) { - return ( -
- -
-
- -
Merge
-
-
- -
Convert
-
-
-
- -
-
-
- -
-
- { - Object.keys(this.state.files).map(key => -

{this.state.files[key].name}

- ) - } - + case 'STAGING': return ( +
+ +
+
+ +
Merge
+
+
+ +
Convert
- ) - } - return +
+
+ +
+
+ { + Object.keys(this.state.files).map(key => +
+
{this.state.files[key].name}
+
+ ) + } +
+ +
+ ) + default: return } } diff --git a/styles/index.scss b/styles/index.scss index 296c914..3357bfd 100644 --- a/styles/index.scss +++ b/styles/index.scss @@ -87,7 +87,7 @@ p { animation: file3 0.25s forwards; } -.file__list { +.staging { z-index: 999; display: flex; flex-direction: column;