From 7c526de4728f00f9be7dd11c73633d32cf25c424 Mon Sep 17 00:00:00 2001 From: syuilo Date: Wed, 6 Jun 2018 19:22:45 +0900 Subject: [PATCH] =?UTF-8?q?Deck=E3=81=AB=E3=82=A6=E3=82=A3=E3=82=B8?= =?UTF-8?q?=E3=82=A7=E3=83=83=E3=83=88=E3=82=92=E7=BD=AE=E3=81=91=E3=82=8B?= =?UTF-8?q?=E3=82=88=E3=81=86=E3=81=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/client/app/common/define-widget.ts | 21 +-- .../app/common/scripts/streaming/home.ts | 25 ++- .../app/common/views/components/menu.vue | 10 +- .../app/common/views/widgets/broadcast.vue | 2 +- .../app/common/views/widgets/calendar.vue | 4 +- .../app/common/views/widgets/donation.vue | 2 +- src/client/app/common/views/widgets/rss.vue | 2 +- .../app/common/views/widgets/slideshow.vue | 2 +- .../app/desktop/views/components/home.vue | 4 +- .../views/components/widget-container.vue | 2 +- .../desktop/views/pages/deck/deck.column.vue | 74 ++++++--- .../pages/deck/deck.notifications-column.vue | 2 +- .../app/desktop/views/pages/deck/deck.vue | 14 +- .../views/pages/deck/deck.widgets-column.vue | 152 ++++++++++++++++++ src/client/app/mobile/views/pages/widgets.vue | 4 +- src/client/app/store.ts | 89 ++++++---- src/server/api/endpoints.ts | 5 + src/server/api/endpoints/i/update_home.ts | 51 +----- .../api/endpoints/i/update_mobile_home.ts | 52 +----- src/server/api/endpoints/i/update_widget.ts | 79 +++++++++ 20 files changed, 417 insertions(+), 179 deletions(-) create mode 100644 src/client/app/desktop/views/pages/deck/deck.widgets-column.vue create mode 100644 src/server/api/endpoints/i/update_widget.ts diff --git a/src/client/app/common/define-widget.ts b/src/client/app/common/define-widget.ts index 0b2bc3656..2fae28be7 100644 --- a/src/client/app/common/define-widget.ts +++ b/src/client/app/common/define-widget.ts @@ -9,9 +9,9 @@ export default function(data: { widget: { type: Object }, - isMobile: { - type: Boolean, - default: false + platform: { + type: String, + required: true }, isCustomizeMode: { type: Boolean, @@ -66,17 +66,10 @@ export default function(data: { this.bakeProps(); - if (this.isMobile) { - (this as any).api('i/update_mobile_home', { - id: this.id, - data: this.props - }); - } else { - (this as any).api('i/update_home', { - id: this.id, - data: this.props - }); - } + (this as any).api('i/update_widget', { + id: this.id, + data: this.props + }); } } }); diff --git a/src/client/app/common/scripts/streaming/home.ts b/src/client/app/common/scripts/streaming/home.ts index a27c55a60..dd18c70d7 100644 --- a/src/client/app/common/scripts/streaming/home.ts +++ b/src/client/app/common/scripts/streaming/home.ts @@ -58,25 +58,18 @@ export class HomeStream extends Stream { }); this.on('home_updated', x => { - if (x.home) { - os.store.commit('settings/setHome', x.home); - } else { - os.store.commit('settings/setHomeWidget', { - id: x.id, - data: x.data - }); - } + os.store.commit('settings/setHome', x); }); this.on('mobile_home_updated', x => { - if (x.home) { - os.store.commit('settings/setMobileHome', x.home); - } else { - os.store.commit('settings/setMobileHomeWidget', { - id: x.id, - data: x.data - }); - } + os.store.commit('settings/setMobileHome', x); + }); + + this.on('widgetUpdated', x => { + os.store.commit('settings/setWidget', { + id: x.id, + data: x.data + }); }); // トークンが再生成されたとき diff --git a/src/client/app/common/views/components/menu.vue b/src/client/app/common/views/components/menu.vue index e5df8345b..73c8403ad 100644 --- a/src/client/app/common/views/components/menu.vue +++ b/src/client/app/common/views/components/menu.vue @@ -2,7 +2,10 @@
- +
@@ -150,4 +153,9 @@ $border-color = rgba(27, 31, 35, 0.15) color $theme-color-foreground background darken($theme-color, 10%) + > div + margin 8px 0 + height 1px + background #eee + diff --git a/src/client/app/common/views/widgets/broadcast.vue b/src/client/app/common/views/widgets/broadcast.vue index f337cec85..69b2a54fe 100644 --- a/src/client/app/common/views/widgets/broadcast.vue +++ b/src/client/app/common/views/widgets/broadcast.vue @@ -2,7 +2,7 @@
diff --git a/src/client/app/common/views/widgets/calendar.vue b/src/client/app/common/views/widgets/calendar.vue index 0e9714960..333b56f62 100644 --- a/src/client/app/common/views/widgets/calendar.vue +++ b/src/client/app/common/views/widgets/calendar.vue @@ -1,5 +1,5 @@
+
@@ -67,7 +67,7 @@ export default define({ }, methods: { func() { - if (this.isMobile) return; + if (this.platform == 'mobile') return; if (this.props.design == 2) { this.props.design = 0; } else { diff --git a/src/client/app/common/views/widgets/donation.vue b/src/client/app/common/views/widgets/donation.vue index 75f5db808..470576d5e 100644 --- a/src/client/app/common/views/widgets/donation.vue +++ b/src/client/app/common/views/widgets/donation.vue @@ -1,5 +1,5 @@