|
@@ -1,3 +1,5 @@
|
|
|
+const { h } = require('preact')
|
|
|
+const classNames = require('classnames')
|
|
|
const FileList = require('./FileList')
|
|
|
const AddFiles = require('./AddFiles')
|
|
|
const AddFilesPanel = require('./AddFilesPanel')
|
|
@@ -6,9 +8,7 @@ const EditorPanel = require('./EditorPanel')
|
|
|
const PanelTopBar = require('./PickerPanelTopBar')
|
|
|
const FileCard = require('./FileCard')
|
|
|
const Slide = require('./Slide')
|
|
|
-const classNames = require('classnames')
|
|
|
const isDragDropSupported = require('@uppy/utils/lib/isDragDropSupported')
|
|
|
-const { h } = require('preact')
|
|
|
|
|
|
// http://dev.edenspiekermann.com/2016/02/11/introducing-accessible-modal-dialog
|
|
|
// https://github.com/ghosh/micromodal
|
|
@@ -52,17 +52,18 @@ module.exports = function Dashboard (props) {
|
|
|
}
|
|
|
|
|
|
const showFileList = props.showSelectedFiles && !noFiles
|
|
|
+
|
|
|
const numberOfFilesForRecovery = props.recoveredState ? Object.keys(props.recoveredState.files).length : null
|
|
|
+ const numberOfGhosts = props.files ? Object.keys(props.files).filter((fileID) => props.files[fileID].isGhost).length : null
|
|
|
|
|
|
- const renderStartOverBtn = () => {
|
|
|
- return (
|
|
|
- <button
|
|
|
- className="uppy-u-reset uppy-c-btn uppy-Dashboard-serviceMsg-actionBtn"
|
|
|
- onClick={props.handleCancelRestore}
|
|
|
- >
|
|
|
- {props.i18n('startOver')}
|
|
|
- </button>
|
|
|
- )
|
|
|
+ const renderRestoredText = () => {
|
|
|
+ if (numberOfGhosts > 0) {
|
|
|
+ return props.i18n('recoveredXFiles', {
|
|
|
+ smart_count: numberOfGhosts,
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ return props.i18n('recoveredAllFiles')
|
|
|
}
|
|
|
|
|
|
const dashboard = (
|
|
@@ -114,21 +115,23 @@ module.exports = function Dashboard (props) {
|
|
|
|
|
|
{showFileList && <PanelTopBar {...props} />}
|
|
|
|
|
|
- {numberOfFilesForRecovery ? (
|
|
|
+ {numberOfFilesForRecovery && (
|
|
|
<div className="uppy-Dashboard-serviceMsg">
|
|
|
- <svg className="uppy-Dashboard-serviceMsg-icon" aria-hidden="true" focusable="false" width="24" height="19" viewBox="0 0 24 19">
|
|
|
+ <svg className="uppy-Dashboard-serviceMsg-icon" aria-hidden="true" focusable="false" width="21" height="16" viewBox="0 0 24 19">
|
|
|
<g transform="translate(0 -1)" fill="none" fillRule="evenodd">
|
|
|
<path d="M12.857 1.43l10.234 17.056A1 1 0 0122.234 20H1.766a1 1 0 01-.857-1.514L11.143 1.429a1 1 0 011.714 0z" fill="#FFD300" />
|
|
|
<path fill="#000" d="M11 6h2l-.3 8h-1.4z" />
|
|
|
<circle fill="#000" cx="12" cy="17" r="1" />
|
|
|
</g>
|
|
|
</svg>
|
|
|
- {props.i18nArray('recoveredXFiles', {
|
|
|
- smart_count: numberOfFilesForRecovery,
|
|
|
- startOver: renderStartOverBtn(),
|
|
|
- })}
|
|
|
+ <strong className="uppy-Dashboard-serviceMsg-title">
|
|
|
+ {props.i18n('sessionRestored')}
|
|
|
+ </strong>
|
|
|
+ <div class="uppy-Dashboard-serviceMsg-text">
|
|
|
+ {renderRestoredText()}
|
|
|
+ </div>
|
|
|
</div>
|
|
|
- ) : null}
|
|
|
+ )}
|
|
|
|
|
|
{showFileList ? (
|
|
|
<FileList
|