summaryrefslogtreecommitdiff
path: root/src/client/app/common
diff options
context:
space:
mode:
authorsyuilo <syuilotan@yahoo.co.jp>2018-06-06 19:22:45 +0900
committersyuilo <syuilotan@yahoo.co.jp>2018-06-06 19:22:45 +0900
commitb0f989dbacbdbdd091b0d220496d22f47c795576 (patch)
treec4af330d8eb11c1d0d5dc0a991409060e9287c6b /src/client/app/common
parentUpdate README.md (diff)
downloadsharkey-b0f989dbacbdbdd091b0d220496d22f47c795576.tar.gz
sharkey-b0f989dbacbdbdd091b0d220496d22f47c795576.tar.bz2
sharkey-b0f989dbacbdbdd091b0d220496d22f47c795576.zip
Deckにウィジェットを置けるように
Diffstat (limited to 'src/client/app/common')
-rw-r--r--src/client/app/common/define-widget.ts21
-rw-r--r--src/client/app/common/scripts/streaming/home.ts25
-rw-r--r--src/client/app/common/views/components/menu.vue10
-rw-r--r--src/client/app/common/views/widgets/broadcast.vue2
-rw-r--r--src/client/app/common/views/widgets/calendar.vue4
-rw-r--r--src/client/app/common/views/widgets/donation.vue2
-rw-r--r--src/client/app/common/views/widgets/rss.vue2
-rw-r--r--src/client/app/common/views/widgets/slideshow.vue2
8 files changed, 31 insertions, 37 deletions
diff --git a/src/client/app/common/define-widget.ts b/src/client/app/common/define-widget.ts
index 0b2bc36566..2fae28be72 100644
--- a/src/client/app/common/define-widget.ts
+++ b/src/client/app/common/define-widget.ts
@@ -9,9 +9,9 @@ export default function<T extends object>(data: {
widget: {
type: Object
},
- isMobile: {
- type: Boolean,
- default: false
+ platform: {
+ type: String,
+ required: true
},
isCustomizeMode: {
type: Boolean,
@@ -66,17 +66,10 @@ export default function<T extends object>(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 a27c55a60d..dd18c70d70 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 e5df8345b9..73c8403ad3 100644
--- a/src/client/app/common/views/components/menu.vue
+++ b/src/client/app/common/views/components/menu.vue
@@ -2,7 +2,10 @@
<div class="mk-menu">
<div class="backdrop" ref="backdrop" @click="close"></div>
<div class="popover" :class="{ compact }" ref="popover">
- <button v-for="item in items" @click="clicked(item.onClick)" v-html="item.content"></button>
+ <template v-for="item in items">
+ <div v-if="item == null"></div>
+ <button v-else @click="clicked(item.onClick)" v-html="item.content"></button>
+ </template>
</div>
</div>
</template>
@@ -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
+
</style>
diff --git a/src/client/app/common/views/widgets/broadcast.vue b/src/client/app/common/views/widgets/broadcast.vue
index f337cec853..69b2a54fe9 100644
--- a/src/client/app/common/views/widgets/broadcast.vue
+++ b/src/client/app/common/views/widgets/broadcast.vue
@@ -2,7 +2,7 @@
<div class="mkw-broadcast"
:data-found="broadcasts.length != 0"
:data-melt="props.design == 1"
- :data-mobile="isMobile"
+ :data-mobile="platform == 'mobile'"
>
<div class="icon">
<svg height="32" version="1.1" viewBox="0 0 32 32" width="32">
diff --git a/src/client/app/common/views/widgets/calendar.vue b/src/client/app/common/views/widgets/calendar.vue
index 0e9714960a..333b56f629 100644
--- a/src/client/app/common/views/widgets/calendar.vue
+++ b/src/client/app/common/views/widgets/calendar.vue
@@ -1,5 +1,5 @@
<template>
-<div class="mkw-calendar" :data-special="special" :data-mobile="isMobile">
+<div class="mkw-calendar" :data-special="special" :data-mobile="platform == 'mobile'">
<mk-widget-container :naked="props.design == 1" :show-header="false">
<div class="mkw-calendar--body">
<div class="calendar" :data-is-holiday="isHoliday">
@@ -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 75f5db808a..470576d5e6 100644
--- a/src/client/app/common/views/widgets/donation.vue
+++ b/src/client/app/common/views/widgets/donation.vue
@@ -1,5 +1,5 @@
<template>
-<div class="mkw-donation" :data-mobile="isMobile">
+<div class="mkw-donation" :data-mobile="platform == 'mobile'">
<article>
<h1>%fa:heart%%i18n:@title%</h1>
<p>
diff --git a/src/client/app/common/views/widgets/rss.vue b/src/client/app/common/views/widgets/rss.vue
index 7ac453e450..a777388cdb 100644
--- a/src/client/app/common/views/widgets/rss.vue
+++ b/src/client/app/common/views/widgets/rss.vue
@@ -4,7 +4,7 @@
<template slot="header">%fa:rss-square%RSS</template>
<button slot="func" title="設定" @click="setting">%fa:cog%</button>
- <div class="mkw-rss--body" :data-mobile="isMobile">
+ <div class="mkw-rss--body" :data-mobile="platform == 'mobile'">
<p class="fetching" v-if="fetching">%fa:spinner .pulse .fw%%i18n:common.loading%<mk-ellipsis/></p>
<div class="feed" v-else>
<a v-for="item in items" :href="item.link" target="_blank">{{ item.title }}</a>
diff --git a/src/client/app/common/views/widgets/slideshow.vue b/src/client/app/common/views/widgets/slideshow.vue
index 459b24a32f..e1c28f5115 100644
--- a/src/client/app/common/views/widgets/slideshow.vue
+++ b/src/client/app/common/views/widgets/slideshow.vue
@@ -1,5 +1,5 @@
<template>
-<div class="mkw-slideshow" :data-mobile="isMobile">
+<div class="mkw-slideshow" :data-mobile="platform == 'mobile'">
<div @click="choose">
<p v-if="props.folder === undefined">
<template v-if="isCustomizeMode">フォルダを指定するには、カスタマイズモードを終了してください</template>