From 8f68a356439b21657426f7ca2f1bc66c0b258777 Mon Sep 17 00:00:00 2001 From: 141099096 <141099096@smail.nju.edu.cn> Date: Mon, 17 Jul 2017 20:13:01 +0800 Subject: [PATCH] Fix error path --- app/components/Images/ImageList.js | 1 + app/components/MainLayout/ContentLayout.css | 39 +++++++++++ .../MainLayout/ContentLayout.css.map | 2 +- app/components/MainLayout/ContentLayout.js | 25 ++++++- app/components/MainLayout/ContentLayout.scss | 49 +++++++++++++ app/components/MainLayout/SideLayout.css | 52 +------------- app/components/MainLayout/SideLayout.css.map | 2 +- app/components/MainLayout/SideLayout.js | 68 ++++++------------- app/components/MainLayout/SideLayout.scss | 64 +---------------- app/components/Sidebar/DirectoryAddButton.css | 9 ++- .../Sidebar/DirectoryAddButton.css.map | 2 +- .../Sidebar/DirectoryAddButton.scss | 4 ++ app/components/Sidebar/Sidebar.css | 39 +++++++++++ app/components/Sidebar/Sidebar.css.map | 2 +- app/components/Sidebar/Sidebar.js | 29 +++++++- app/components/Sidebar/Sidebar.scss | 47 +++++++++++++ app/reducers/window.js | 10 ++- app/routes.js | 3 + app/routes/ImagePage.js | 4 +- app/routes/IndexPage.js | 16 ++++- app/routes/MainPage.js | 4 +- 21 files changed, 290 insertions(+), 181 deletions(-) diff --git a/app/components/Images/ImageList.js b/app/components/Images/ImageList.js index f2b89d1..269a73e 100644 --- a/app/components/Images/ImageList.js +++ b/app/components/Images/ImageList.js @@ -33,6 +33,7 @@ class ImageList extends Component { }, delay); } else { self.timeoutID = clearTimeout(self.timeoutID); + console.log('db') onDoubleClick(); } }; diff --git a/app/components/MainLayout/ContentLayout.css b/app/components/MainLayout/ContentLayout.css index 7dbd8ef..9effe92 100644 --- a/app/components/MainLayout/ContentLayout.css +++ b/app/components/MainLayout/ContentLayout.css @@ -40,4 +40,43 @@ .content_wrapper { height: 100%; } +.drop { + position: absolute; + width: 100%; + height: 100%; + top: 0; + padding: 10px; + pointer-events: none; + background-color: rgba(0, 0, 0, 0.03); } + .drop .drop_child { + width: 100%; + height: 100%; + border: dashed 1px #B3B3B3; + color: #808080; + font-size: 14px; + text-align: center; } + .drop .drop_child p { + top: 50%; + left: 50%; + display: table; + transform: translate(-50%, -50%); } + +.layout_drop .top, .layout_drop .main { + opacity: 0.3; } + +.hint { + position: absolute; + width: 100%; + height: 100%; + top: 0; + padding: 10px; + color: #DDDDDD; + font-size: 14px; + text-align: center; } + .hint p { + top: 50%; + left: 50%; + display: table; + transform: translate(-50%, -50%); } + /*# sourceMappingURL=ContentLayout.css.map */ diff --git a/app/components/MainLayout/ContentLayout.css.map b/app/components/MainLayout/ContentLayout.css.map index 70ffb35..8bfd7ff 100644 --- a/app/components/MainLayout/ContentLayout.css.map +++ b/app/components/MainLayout/ContentLayout.css.map @@ -1,6 +1,6 @@ { "version": 3, -"mappings": "AA+EA;;GAEG;ACjFH;;GAEG;AAoBH;;GAEG;ACrBH,OAAQ;EACN,KAAK,EAAE,IAAI;EACX,MAAM,EAAE,IAAI;;AAId,IAAK;EACH,OAAO,EAAE,CAAC;EACV,QAAQ,EAAE,QAAQ;EAClB,KAAK,EAAE,IAAI;EACX,MAAM,EAAE,IAAI;;AAGd,KAAM;EACJ,QAAQ,EAAE,QAAQ;EAClB,KAAK,EAAE,IAAI;EACX,UAAU,EAAE,IAAI;EAChB,WAAW,EAAE,GAAG;EAChB,GAAG,EAAE,CAAC;EACN,MAAM,EAAE,CAAC;EACT,QAAQ,EAAE,IAAI;EAEd,YAAS;IACV,UAAU,EAAE,MAAM;EAGjB,wBAAqB;IACtB,KAAK,EAAE,IAAI;IACX,MAAM,EAAE,IAAI;EAGX,8BAA2B;IAC5B,UAAU,EDLe,OAAO;ICMhC,aAAa,EAAE,IAAI;EAGlB,8BAA2B;IAC5B,UAAU,EAAE,WAAW;IACvB,aAAa,EAAE,IAAI;;AAKpB,gBAAiB;EACf,MAAM,EAAE,IAAI", +"mappings": "AA+EA;;GAEG;ACjFH;;GAEG;AAoBH;;GAEG;ACrBH,OAAQ;EACN,K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ED3DmB,OAAO;EC4D/B,SAAS,EAAE,IAAI;EACf,UAAU,EAAE,MAAM;EAClB,OAAE;IACH,GAAG,EAAE,GAAG;IACR,IAAI,EAAE,GAAG;IACT,OAAO,EAAE,KAAK;IACd,SAAS,EAAE,qBAAqB", "sources": ["../../assets/scss/_mixin.scss","../../assets/scss/_variables.scss","ContentLayout.scss"], "names": [], "file": "ContentLayout.css" diff --git a/app/components/MainLayout/ContentLayout.js b/app/components/MainLayout/ContentLayout.js index 82d0537..80aae71 100644 --- a/app/components/MainLayout/ContentLayout.js +++ b/app/components/MainLayout/ContentLayout.js @@ -38,12 +38,24 @@ class ContentLayout extends Component { render() { - const {top, children, hideX, isScroll} = this.props; + const {top, children, drop, hideX, isScroll, error} = this.props; + + let layoutClassName = styles.layout; + layoutClassName = drop ? layoutClassName + ' ' + styles.layout_drop : layoutClassName; let mainClassName = styles.main; mainClassName = hideX ? mainClassName + ' ' + styles.hide_x : mainClassName; + + return ( -
+
+ + {error && !drop ? +
+

This directory does not exist!

+
: null + } +
{top}
@@ -55,6 +67,15 @@ class ContentLayout extends Component { {children}
+ + {drop ? +
+
+

Drag images to copy

+
+
: null + } + ); } diff --git a/app/components/MainLayout/ContentLayout.scss b/app/components/MainLayout/ContentLayout.scss index 58f0812..c48e126 100644 --- a/app/components/MainLayout/ContentLayout.scss +++ b/app/components/MainLayout/ContentLayout.scss @@ -47,3 +47,52 @@ .content_wrapper { height: 100%; } + + +.drop { + position: absolute; + width: 100%; + height: 100%; + top: 0; + padding: 10px; + pointer-events: none; + background-color: rgba(0, 0, 0, 0.03); + + .drop_child { + width: 100%; + height: 100%; + border: dashed 1px $gray-color; + color: $gray-color-dark; + font-size: 14px; + text-align: center; + p { + top: 50%; + left: 50%; + display: table; + transform: translate(-50%, -50%); + } + } +} + +.layout_drop { + .top, .main { + opacity: 0.3; + } +} + +.hint { + position: absolute; + width: 100%; + height: 100%; + top: 0; + padding: 10px; + color: $gray-color-light; + font-size: 14px; + text-align: center; + p { + top: 50%; + left: 50%; + display: table; + transform: translate(-50%, -50%); + } +} diff --git a/app/components/MainLayout/SideLayout.css b/app/components/MainLayout/SideLayout.css index 8484c07..995decd 100644 --- a/app/components/MainLayout/SideLayout.css +++ b/app/components/MainLayout/SideLayout.css @@ -26,7 +26,7 @@ button { width: 100%; height: 100%; } -.sidebar_wrapper { +.sidebar { z-index: 9; position: absolute; width: 200px; @@ -38,7 +38,7 @@ button { -o-box-shadow: 0 0 0.3px 0 rgba(0, 0, 0, 0.5); box-shadow: 0 0 0.3px 0 rgba(0, 0, 0, 0.5); } -.main_wrapper { +.main { position: fixed; left: 0; right: 0; @@ -48,12 +48,6 @@ button { overflow: auto; background-color: #F9F9F9; } -.sidebar { - height: 100%; } - -.main { - height: 100%; } - .line { z-index: 10; position: fixed; @@ -64,46 +58,4 @@ button { height: 100%; cursor: col-resize; } -.drop { - position: absolute; - width: 100%; - height: 100%; - top: 0; - padding: 10px; - pointer-events: none; - background-color: rgba(0, 0, 0, 0.03); } - .drop .drop_child { - width: 100%; - height: 100%; - border: dashed 1px #B3B3B3; - color: #808080; - font-size: 14px; - text-align: center; } - .drop .drop_child p { - top: 50%; - left: 50%; - display: table; - transform: translate(-50%, -50%); } - -.siderbar_drop .sidebar { - opacity: 0.3; } - -.main_drop .main { - opacity: 0.3; } - -.hint { - position: absolute; - width: 100%; - height: 100%; - top: 0; - padding: 10px; - color: #DDDDDD; - font-size: 14px; - text-align: center; } - .hint p { - top: 50%; - left: 50%; - display: table; - transform: translate(-50%, -50%); } - /*# sourceMappingURL=SideLayout.css.map */ diff --git a/app/components/MainLayout/SideLayout.css.map b/app/components/MainLayout/SideLayout.css.map index 752fa5b..535e738 100644 --- a/app/components/MainLayout/SideLayout.css.map +++ b/app/components/MainLayout/SideLayout.css.map @@ -1,6 +1,6 @@ { "version": 3, -"mappings": "AA+EA;;GAEG;ACjFH;;GAEG;AAoBH;;GAEG;ACxBH,iEAAkE;EAChE,MAAM,EAAE,CAAC;EACT,OAAO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,cAAgB,EAAE,8BAAM;EAGxB,aAAe,EAAE,8BAAM;EAGvB,UAAY,EAAE,8BAAM;;AGN1B,KAAM;EACJ,QAAQ,EAAE,KAAK;EACf,IAAI,EAAE,CAAC;EACP,KAAK,EAAE,CAAC;EACR,GAAG,EAAE,IAAI;EACT,MAAM,EAAE,CAAC;EACT,WAAW,EAAE,KAAK;EAClB,QAAQ,EAAE,IAAI;EACd,gBAAgB,EFEQ,OAAO;;AECjC,KAAM;EACJ,OAAO,EAAE,EAAE;EACX,QAAQ,EAAE,KAAK;EACf,GAAG,EAAE,CAAC;EACN,IAAI,EAAE,CAAC;EACP,WAAW,EAAE,KAAK;EAClB,KAAK,EAAE,IAAI;EACX,MAAM,EAAE,IAAI;EACZ,MAAM,EAAE,UAAU", "sources": ["../../assets/scss/_mixin.scss","../../assets/scss/_variables.scss","../../assets/scss/_base.scss","SideLayout.scss"], "names": [], "file": "SideLayout.css" diff --git a/app/components/MainLayout/SideLayout.js b/app/components/MainLayout/SideLayout.js index 27a980a..fad8526 100644 --- a/app/components/MainLayout/SideLayout.js +++ b/app/components/MainLayout/SideLayout.js @@ -1,4 +1,4 @@ -import React, {Component} from 'react'; +import React, {Component, cloneElement} from 'react'; import {connect} from 'react-redux' import Draggable from 'react-draggable'; @@ -17,6 +17,7 @@ class SideLayout extends Component { componentWillMount() { const self = this; + const {handleChangeDrop} = this.props; window.ondragenter = function (e) { e.preventDefault(); @@ -30,10 +31,7 @@ class SideLayout extends Component { console.log('over'); e.dataTransfer.dropEffect = 'copy'; - - self.setState({ - drop: true, - }); + handleChangeDrop(true); return false; }; @@ -41,12 +39,9 @@ class SideLayout extends Component { e.preventDefault(); console.log('hover'); - self.setState({ - drop: false, - }); + handleChangeDrop(false); self.handleFileDrop(e); - return false; }; @@ -54,10 +49,8 @@ class SideLayout extends Component { e.preventDefault(); console.log('leave'); + handleChangeDrop(false); - self.setState({ - drop: false, - }); return false; }; } @@ -99,53 +92,23 @@ class SideLayout extends Component { }; render() { - const {sidebar, sidebarWidth, offsetX, bounds, children, empty} = this.props; - - const {drop} = this.state; + const {sidebar, sidebarWidth, offsetX, bounds, children} = this.props; - let sidebarClassName = styles.sidebar_wrapper; - sidebarClassName = drop ? sidebarClassName + ' ' + styles.siderbar_drop : sidebarClassName; - - let mainClassName = styles.main_wrapper; - mainClassName = drop ? mainClassName + ' ' + styles.main_drop : mainClassName; return (
- {empty && !drop ? -
-

Drag directories to add

-
: null} -
- {sidebar} -
- {drop ? -
-
-

Drag directories to add

-
-
: null - } - + {sidebar}
-
-
- {children} -
- {drop ? -
-
-

Drag images to copy

-
-
: null - } + {children}
{ + dispatch({ + type: 'window/saveDrop', + payload: drop + }) + }, } diff --git a/app/components/MainLayout/SideLayout.scss b/app/components/MainLayout/SideLayout.scss index 39cca7a..63dc41b 100644 --- a/app/components/MainLayout/SideLayout.scss +++ b/app/components/MainLayout/SideLayout.scss @@ -7,7 +7,7 @@ height: 100%; } -.sidebar_wrapper { +.sidebar { z-index: 9; position: absolute; width: 200px; @@ -15,7 +15,7 @@ background-color: $white-color; @include box-shadow(0 0 0.3px 0 $shadow-color) } -.main_wrapper { +.main { position: fixed; left: 0; right: 0; @@ -26,13 +26,6 @@ background-color: $gray-color-white; } -.sidebar { - height: 100%; -} -.main { - height: 100%; -} - .line { z-index: 10; position: fixed; @@ -44,56 +37,3 @@ cursor: col-resize; //background-color: rgba(0,0,0,0.5); } - -.drop { - position: absolute; - width: 100%; - height: 100%; - top: 0; - padding: 10px; - pointer-events: none; - background-color: rgba(0, 0, 0, 0.03); - - .drop_child { - width: 100%; - height: 100%; - border: dashed 1px $gray-color; - color: $gray-color-dark; - font-size: 14px; - text-align: center; - p { - top: 50%; - left: 50%; - display: table; - transform: translate(-50%, -50%); - } - } -} -.siderbar_drop { - .sidebar { - opacity: 0.3; - } -} - -.main_drop { - .main { - opacity: 0.3; - } -} - -.hint { - position: absolute; - width: 100%; - height: 100%; - top: 0; - padding: 10px; - color: $gray-color-light; - font-size: 14px; - text-align: center; - p { - top: 50%; - left: 50%; - display: table; - transform: translate(-50%, -50%); - } -} diff --git a/app/components/Sidebar/DirectoryAddButton.css b/app/components/Sidebar/DirectoryAddButton.css index b1f29c5..842ccce 100644 --- a/app/components/Sidebar/DirectoryAddButton.css +++ b/app/components/Sidebar/DirectoryAddButton.css @@ -11,6 +11,13 @@ background-color: transparent; color: #B3B3B3; outline: none; - cursor: pointer; } + cursor: pointer; + -webkit-transition: all 0.3s; + -moz-transition: all 0.3s; + -ms-transition: all 0.3s; + -o-transition: all 0.3s; + transition: all 0.3s; } + .add_button:hover { + opacity: 0.7; } /*# sourceMappingURL=DirectoryAddButton.css.map */ diff --git a/app/components/Sidebar/DirectoryAddButton.css.map b/app/components/Sidebar/DirectoryAddButton.css.map index 0cc1b51..c74cc9c 100644 --- a/app/components/Sidebar/DirectoryAddButton.css.map +++ b/app/components/Sidebar/DirectoryAddButton.css.map @@ -1,6 +1,6 @@ { "version": 3, -"mappings": "AA+EA;;GAEG;ACjFH;;GAEG;AAoBH;;GAEG;ACrBH,WAAY;EACV,gBAAgB,EAAE,WAAW;EAC7B,KAAK,EDyBmB,OAAO;ECxB/B,OAAO,EAAE,IAAI;EACb,MAAM,EAAE,OAAO", +"mappings": "AA+EA;;GAEG;ACjFH;;GAEG;AAoBH;;GAEG;ACrBH,WAAY;EACV,gBAAgB,EAAE,WAAW;EAC7B,KAAK,EDyBmB,OAAO;ECxB/B,OAAO,EAAE,IAAI;EACb,MAAM,EAAE,OAAO;EFIX,kBAAoB,EAAE,QAAM;EAG5B,eAAiB,EAAE,QAAM;EAGzB,cAAgB,EAAE,QAAM;EAGxB,aAAe,EAAE,QAAM;EAGvB,UAAY,EAAE,QAAM;EEdxB,iBAAQ;IACT,OAAO,EAAE,GAAG", "sources": ["../../assets/scss/_mixin.scss","../../assets/scss/_variables.scss","DirectoryAddButton.scss"], "names": [], "file": "DirectoryAddButton.css" diff --git a/app/components/Sidebar/DirectoryAddButton.scss b/app/components/Sidebar/DirectoryAddButton.scss index 50653a6..73495a4 100644 --- a/app/components/Sidebar/DirectoryAddButton.scss +++ b/app/components/Sidebar/DirectoryAddButton.scss @@ -6,4 +6,8 @@ color: $gray-color; outline: none; cursor: pointer; + @include transition(all .3s); + &:hover { + opacity: 0.7; + } } diff --git a/app/components/Sidebar/Sidebar.css b/app/components/Sidebar/Sidebar.css index dd2b126..2210e39 100644 --- a/app/components/Sidebar/Sidebar.css +++ b/app/components/Sidebar/Sidebar.css @@ -30,4 +30,43 @@ display: block; clear: both; } +.drop { + position: absolute; + width: 100%; + height: 100%; + top: 0; + padding: 10px; + pointer-events: none; + background-color: rgba(0, 0, 0, 0.03); } + .drop .drop_child { + width: 100%; + height: 100%; + border: dashed 1px #B3B3B3; + color: #808080; + font-size: 14px; + text-align: center; } + .drop .drop_child p { + top: 50%; + left: 50%; + display: table; + transform: translate(-50%, -50%); } + +.sidebar_drop .part { + opacity: 0.3; } + +.hint { + position: absolute; + width: 100%; + height: 100%; + top: 0; + padding: 10px; + color: #DDDDDD; + font-size: 14px; + text-align: center; } + .hint p { + top: 50%; + left: 50%; + display: table; + transform: translate(-50%, -50%); } + /*# sourceMappingURL=Sidebar.css.map */ diff --git a/app/components/Sidebar/Sidebar.css.map b/app/components/Sidebar/Sidebar.css.map index fd947df..4680aa2 100644 --- a/app/components/Sidebar/Sidebar.css.map +++ b/app/components/Sidebar/Sidebar.css.map @@ -1,6 +1,6 @@ { "version": 3, -"mappings": "AA+EA;;GAEG;ACjFH;;GAEG;AAoBH;;GAEG;ACrBH,QAAS;EACP,KAAK,EAAE,IAAI;EACX,MAAM,EAAE,IAAI;;AAId,KAAM;EACJ,OAAO,EAAE,MAAM;EACf,MAAM,EAAE,IAAI;EACZ,YAAO;IACR,MAAM,EAAE,WAAW;IACnB,MAAM,EAAE,OAAO;IACf,mBAAmB,EAAE,IAAI;IACzB,eAAG;MACD,OAAO,EAAE,YAAY;MACrB,KAAK,EDYkB,OAAO;MCX9B,SAAS,EAAE,IAA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;EACN,OAAO,EAAE,IAAI;EACb,KAAK,EDtCmB,OAAO;ECuC/B,SAAS,EAAE,IAAI;EACf,UAAU,EAAE,MAAM;EAClB,OAAE;IACH,GAAG,EAAE,GAAG;IACR,IAAI,EAAE,GAAG;IACT,OAAO,EAAE,KAAK;IACd,SAAS,EAAE,qBAAqB", "sources": ["../../assets/scss/_mixin.scss","../../assets/scss/_variables.scss","Sidebar.scss"], "names": [], "file": "Sidebar.css" diff --git a/app/components/Sidebar/Sidebar.js b/app/components/Sidebar/Sidebar.js index 339cfe1..bf817a1 100644 --- a/app/components/Sidebar/Sidebar.js +++ b/app/components/Sidebar/Sidebar.js @@ -47,13 +47,25 @@ class Sidebar extends Component { render() { const { - directories, currentDirIndex, editDirIndex, editItem, + drop, directories, currentDirIndex, editDirIndex, editItem, handleClickDirectory, handleEditDirectory, handleChangeEditDirectory, handleRemoveDirectory, handleSaveDirectory, handleCancelDirectory } = this.props; + const empty = !directories || directories.length === 0; + + let sidebarClassName = styles.sidebar; + sidebarClassName = drop ? sidebarClassName + ' ' + styles.sidebar_drop : sidebarClassName; + return ( -
+
+ + {empty && !drop ? +
+

Drag directories to add

+
: null + } +
Directory
@@ -79,18 +91,29 @@ class Sidebar extends Component { currentIndex={currentDirIndex} editIndex={editDirIndex} editItem={editItem} - /> :null + /> : null }
+ {drop ? +
+
+

Drag directories to add

+
+
: null + } +
); } } function mapStateToProps(state) { + const {drop} = state.window; const {directories, currentDirIndex, editDirIndex, editItem} = state.directories; + return { + drop, directories, currentDirIndex, editDirIndex, diff --git a/app/components/Sidebar/Sidebar.scss b/app/components/Sidebar/Sidebar.scss index 2e85ffb..97139e0 100644 --- a/app/components/Sidebar/Sidebar.scss +++ b/app/components/Sidebar/Sidebar.scss @@ -28,3 +28,50 @@ } +.drop { + position: absolute; + width: 100%; + height: 100%; + top: 0; + padding: 10px; + pointer-events: none; + background-color: rgba(0, 0, 0, 0.03); + + .drop_child { + width: 100%; + height: 100%; + border: dashed 1px $gray-color; + color: $gray-color-dark; + font-size: 14px; + text-align: center; + p { + top: 50%; + left: 50%; + display: table; + transform: translate(-50%, -50%); + } + } +} + +.sidebar_drop { + .part { + opacity: 0.3; + } +} + +.hint { + position: absolute; + width: 100%; + height: 100%; + top: 0; + padding: 10px; + color: $gray-color-light; + font-size: 14px; + text-align: center; + p { + top: 50%; + left: 50%; + display: table; + transform: translate(-50%, -50%); + } +} diff --git a/app/reducers/window.js b/app/reducers/window.js index 942e53f..d302222 100644 --- a/app/reducers/window.js +++ b/app/reducers/window.js @@ -13,7 +13,8 @@ const initialState = { scroll: { top: 0, left: 0, - } + }, + drop: false, }; function window(state = initialState, {type, payload}) { @@ -45,7 +46,12 @@ function window(state = initialState, {type, payload}) { ...state, scroll, }; - + case 'saveDrop': + const drop = payload; + return { + ...state, + drop, + }; default: return state; } diff --git a/app/routes.js b/app/routes.js index 855c15c..4547bee 100644 --- a/app/routes.js +++ b/app/routes.js @@ -22,6 +22,9 @@ export default () => ( + + {/**/} + {/**/} diff --git a/app/routes/ImagePage.js b/app/routes/ImagePage.js index 8a092e6..48c13c2 100644 --- a/app/routes/ImagePage.js +++ b/app/routes/ImagePage.js @@ -9,6 +9,8 @@ import ContentLayout from '../components/MainLayout/ContentLayout'; import ImageTop from '../components/Image/ImageTop'; import ImageWrapper from '../components/Image/ImageWrapper'; +import MainPage from './MainPage'; + import {TITLE_BAR_HEIGHT, CONTENT_TOP_HEIGHT} from '../constants' class ImagePage extends Component { @@ -21,7 +23,6 @@ class ImagePage extends Component { handleOpenMenu, handleCopyImages, handleConfirmDeleteImages } = this.props; return ( - } hideX={false} @@ -46,7 +47,6 @@ class ImagePage extends Component { /> : null } - ); } } diff --git a/app/routes/IndexPage.js b/app/routes/IndexPage.js index 4a1c836..50b9614 100644 --- a/app/routes/IndexPage.js +++ b/app/routes/IndexPage.js @@ -8,6 +8,8 @@ import ContentLayout from '../components/MainLayout/ContentLayout'; import ImagesTop from '../components/Images/ImagesTop'; import ImageList from '../components/Images/ImageList'; +import MainPage from './MainPage'; + class IndexPage extends Component { handleListScroll = (data) => { @@ -19,12 +21,17 @@ class IndexPage extends Component { render() { const { - path, imageWidth, isScroll, selectImages, showImages, menu, size, sidebarWidth, offsetX, scroll, directories, currentDirIndex, + path, exist, imageWidth, isScroll, selectImages, showImages, menu, size, sidebarWidth, offsetX, scroll, drop, directories, currentDirIndex, handlePinchContent, handleOpenMenu, handleClickBlank, handleClickImage, handleDoubleClickImage, handleRightClickImage, handleCopyImages, handlePasteImages, handleConfirmDeleteImages, handleSelectAllImages } = this.props; + + const error = directories && directories.length > 0 && !directories[currentDirIndex].exist; return ( + 0 ? : null } @@ -57,20 +64,23 @@ class IndexPage extends Component { /> : null } + ); } } function mapStateToProps(state) { - const {path, images, selectImages, column, imageWidth, isScroll, showImages, menu} = state.images; - const {size, sidebarWidth, offsetX, scroll} = state.window; + const {path, exist, images, selectImages, column, imageWidth, isScroll, showImages, menu} = state.images; + const {size, sidebarWidth, offsetX, scroll, drop} = state.window; const {directories, currentDirIndex} = state.directories; return { path, + exist, size, sidebarWidth, offsetX, scroll, + drop, images, selectImages, column, diff --git a/app/routes/MainPage.js b/app/routes/MainPage.js index 669d973..5ce3344 100644 --- a/app/routes/MainPage.js +++ b/app/routes/MainPage.js @@ -102,7 +102,7 @@ class MainPage extends Component { }; render() { - const {children, directories, existWarning, deleteConfirm, handleDeleteImages, handleCloseWarning, handleCloseConfirm} = this.props; + const {children, existWarning, deleteConfirm, handleDeleteImages, handleCloseWarning, handleCloseConfirm} = this.props; return (
@@ -111,7 +111,6 @@ class MainPage extends Component { sidebar={} handleDropDirectories={this.handleDropDirectories} handleDropImages={this.handleDropImages} - empty={!directories || directories.length === 0} > {children} @@ -155,7 +154,6 @@ function mapStateToProps(state) { location, existWarning, deleteConfirm, - directories }; }