From 2dbd7983c62d232dc525ec2afbdf542230aefa91 Mon Sep 17 00:00:00 2001 From: Artur Paikin Date: Tue, 6 Sep 2016 09:55:08 -0400 Subject: [PATCH] refactor Dashboard, add inline option --- src/plugins/Dashboard/Dashboard.js | 70 +++++++++++++++++------------- src/plugins/Dashboard/FileCard.js | 4 +- src/plugins/Dashboard/FileItem.js | 7 ++- src/plugins/Dashboard/index.js | 24 ++++------ 4 files changed, 55 insertions(+), 50 deletions(-) diff --git a/src/plugins/Dashboard/Dashboard.js b/src/plugins/Dashboard/Dashboard.js index 9db9a9bf1..9542e4a87 100644 --- a/src/plugins/Dashboard/Dashboard.js +++ b/src/plugins/Dashboard/Dashboard.js @@ -4,20 +4,21 @@ import FileItem from './FileItem' import FileCard from './FileCard' import { closeIcon, localIcon, uploadIcon, dashboardBgIcon, iconPause, iconResume } from './icons' -export default function Dashboard (props, bus) { +export default function Dashboard (props) { // http://dev.edenspiekermann.com/2016/02/11/introducing-accessible-modal-dialog - const state = props.state + const { bus, + // log, + state, + container, + showProgressDetails, + hideModal, + hideAllPanels, + showPanel } = props + const files = state.files const modal = state.modal - const container = props.container const showFileCard = modal.showFileCard - const showProgressDetails = props.showProgressDetails - - const hideModal = props.hideModal - const hideAllPanels = props.hideAllPanels - const showPanel = props.showPanel - const log = props.log const acquirers = modal.targets.filter((target) => { return target.type === 'acquirer' @@ -38,16 +39,16 @@ export default function Dashboard (props, bus) { bus.emit('core:upload') } - function handleInputChange (ev) { + const handleInputChange = (ev) => { ev.preventDefault() - log('All right, something selected through input...') + // log('All right, something selected through input...') const files = Utils.toArray(ev.target.files) files.forEach((file) => { - log(file) + // log(file) bus.emit('file-add', { - source: this.id, + source: props.id, name: file.name, type: file.type, data: file @@ -79,31 +80,39 @@ export default function Dashboard (props, bus) { function renderPauseResume () { if (uploadStartedFilesCount > 0) { if (inProgressFilesCount > 0) { - return html`` } if (uploadStartedFilesCount !== completeFilesCount) { - return html`` } } } - return html`