From 68b1721ecf65484c1b679404246edc3627346c1b Mon Sep 17 00:00:00 2001 From: syuilo Date: Wed, 8 Nov 2017 23:43:47 +0900 Subject: なんかもうめっちゃやった MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/web/app/desktop/router.js | 5 + src/web/app/desktop/tags/donation.tag | 7 +- src/web/app/desktop/tags/home-widgets/activity.tag | 10 +- src/web/app/desktop/tags/home-widgets/server.tag | 11 +- src/web/app/desktop/tags/home.tag | 215 +++++++++++++++------ src/web/app/desktop/tags/index.js | 1 + src/web/app/desktop/tags/pages/home-customize.tag | 14 ++ src/web/app/desktop/tags/settings.tag | 1 + src/web/app/desktop/tags/ui.tag | 2 +- 9 files changed, 204 insertions(+), 62 deletions(-) create mode 100644 src/web/app/desktop/tags/pages/home-customize.tag (limited to 'src/web/app/desktop') diff --git a/src/web/app/desktop/router.js b/src/web/app/desktop/router.js index 104b9bbe5d..bbd68cf99a 100644 --- a/src/web/app/desktop/router.js +++ b/src/web/app/desktop/router.js @@ -9,6 +9,7 @@ let page = null; export default me => { route('/', index); route('/selectdrive', selectDrive); + route('/i/customize-home', customizeHome); route('/i/drive', drive); route('/i/drive/folder/:folder', drive); route('/i/mentions', mentions); @@ -27,6 +28,10 @@ export default me => { mount(document.createElement('mk-home-page')); } + function customizeHome() { + mount(document.createElement('mk-home-customize-page')); + } + function entrance() { mount(document.createElement('mk-entrance')); document.documentElement.setAttribute('data-page', 'entrance'); diff --git a/src/web/app/desktop/tags/donation.tag b/src/web/app/desktop/tags/donation.tag index 33f377a192..1c19fac1f5 100644 --- a/src/web/app/desktop/tags/donation.tag +++ b/src/web/app/desktop/tags/donation.tag @@ -54,11 +54,10 @@ e.preventDefault(); e.stopPropagation(); - this.I.data.no_donation = 'true'; + this.I.client_settings.show_donation = false; this.I.update(); - this.api('i/appdata/set', { - key: 'no_donation', - value: 'true' + this.api('i/update', { + show_donation: false }); this.unmount(); diff --git a/src/web/app/desktop/tags/home-widgets/activity.tag b/src/web/app/desktop/tags/home-widgets/activity.tag index 8bd8bfb2aa..7bdcd334c9 100644 --- a/src/web/app/desktop/tags/home-widgets/activity.tag +++ b/src/web/app/desktop/tags/home-widgets/activity.tag @@ -54,7 +54,7 @@ this.mixin('api'); this.initializing = true; - this.view = 0; + this.view = this.opts.data.hasOwnProperty('view') ? this.opts.data.view : 0; this.on('mount', () => { this.api('aggregation/users/activity', { @@ -71,6 +71,14 @@ this.toggle = () => { this.view++; if (this.view == 2) this.view = 0; + + // Save view state + this.I.client_settings.home.filter(w => w.id == this.opts.id)[0].data.view = this.view; + this.api('i/update_home', { + home: this.I.client_settings.home + }).then(() => { + this.I.update(); + }); }; diff --git a/src/web/app/desktop/tags/home-widgets/server.tag b/src/web/app/desktop/tags/home-widgets/server.tag index bc8f313d53..235867c38a 100644 --- a/src/web/app/desktop/tags/home-widgets/server.tag +++ b/src/web/app/desktop/tags/home-widgets/server.tag @@ -56,10 +56,11 @@ diff --git a/src/web/app/desktop/tags/home.tag b/src/web/app/desktop/tags/home.tag index 37b2d3cf7e..f0c71a7ea8 100644 --- a/src/web/app/desktop/tags/home.tag +++ b/src/web/app/desktop/tags/home.tag @@ -1,4 +1,30 @@ - + +
+
+

ウィジェットを追加:

+ + +
+
+

ゴミ箱 (ここにウィジェットをドロップすると削除できます)

+
+
@@ -11,25 +37,37 @@ :scope display block - > .main + &:not([data-customize]) + > .main > *:empty + display none + + > .customize + display flex margin 0 auto max-width 1200px + background #fff1c8 - &:after - content "" - display block - clear both + > div + width 50% - > * - float left + &.trash + background #ffc5c5 + + > .main + display flex + justify-content center + margin 0 auto + max-width 1200px - > * + > * + > *:not(.customize-container) + > .customize-container > * display block - //border solid 1px #eaeaea border solid 1px rgba(0, 0, 0, 0.075) border-radius 6px - //box-shadow 0px 2px 16px rgba(0, 0, 0, 0.2) + > *:not(.customize-container) + > .customize-container &:not(:last-child) margin-bottom 16px @@ -40,6 +78,12 @@ > *:not(main) width 275px + > .customize-container + cursor move + + > * + pointer-events none + > .left padding 16px 0 16px 16px @@ -58,66 +102,49 @@ diff --git a/src/web/app/desktop/tags/index.js b/src/web/app/desktop/tags/index.js index 7997bcc7f2..c36a06e499 100644 --- a/src/web/app/desktop/tags/index.js +++ b/src/web/app/desktop/tags/index.js @@ -57,6 +57,7 @@ require('./pages/entrance.tag'); require('./pages/entrance/signin.tag'); require('./pages/entrance/signup.tag'); require('./pages/home.tag'); +require('./pages/home-customize.tag'); require('./pages/user.tag'); require('./pages/post.tag'); require('./pages/search.tag'); diff --git a/src/web/app/desktop/tags/pages/home-customize.tag b/src/web/app/desktop/tags/pages/home-customize.tag new file mode 100644 index 0000000000..4434015615 --- /dev/null +++ b/src/web/app/desktop/tags/pages/home-customize.tag @@ -0,0 +1,14 @@ + + + + + + + diff --git a/src/web/app/desktop/tags/settings.tag b/src/web/app/desktop/tags/settings.tag index eabddfb432..4c16f9eaa8 100644 --- a/src/web/app/desktop/tags/settings.tag +++ b/src/web/app/desktop/tags/settings.tag @@ -38,6 +38,7 @@

デザイン

+ ホームをカスタマイズ
diff --git a/src/web/app/desktop/tags/ui.tag b/src/web/app/desktop/tags/ui.tag index 0a3e8d9c53..6a4982877f 100644 --- a/src/web/app/desktop/tags/ui.tag +++ b/src/web/app/desktop/tags/ui.tag @@ -37,7 +37,7 @@ - +
-- cgit v1.3.1-freya