summaryrefslogtreecommitdiff
path: root/src/web/app
diff options
context:
space:
mode:
authorsyuilo <syuilotan@yahoo.co.jp>2017-03-25 16:43:55 +0900
committersyuilo <syuilotan@yahoo.co.jp>2017-03-25 16:43:55 +0900
commitcaf945765335c81d4785b7a108c1944aa0f2af26 (patch)
treed241d785258b3ab24e22fde5e2f481b07cfc0388 /src/web/app
parentImprove readability (diff)
downloadmisskey-caf945765335c81d4785b7a108c1944aa0f2af26.tar.gz
misskey-caf945765335c81d4785b7a108c1944aa0f2af26.tar.bz2
misskey-caf945765335c81d4785b7a108c1944aa0f2af26.zip
#321
Diffstat (limited to 'src/web/app')
-rw-r--r--src/web/app/desktop/tags/home-widgets/recommended-polls.tag103
-rw-r--r--src/web/app/desktop/tags/home.tag1
-rw-r--r--src/web/app/desktop/tags/index.js1
3 files changed, 105 insertions, 0 deletions
diff --git a/src/web/app/desktop/tags/home-widgets/recommended-polls.tag b/src/web/app/desktop/tags/home-widgets/recommended-polls.tag
new file mode 100644
index 0000000000..4ef7701c45
--- /dev/null
+++ b/src/web/app/desktop/tags/home-widgets/recommended-polls.tag
@@ -0,0 +1,103 @@
+<mk-recommended-polls-home-widget>
+ <p class="title"><i class="fa fa-pie-chart"></i>投票</p>
+ <button onclick={ refresh } title="他を見る"><i class="fa fa-refresh"></i></button>
+ <div class="poll" if={ !loading && poll != null }>
+ <p class="text">{ poll.text }</p>
+ <mk-poll post={ poll }></mk-poll>
+ </div>
+ <p class="empty" if={ !loading && poll == null }>ありません!</p>
+ <p class="loading" if={ loading }><i class="fa fa-spinner fa-pulse fa-fw"></i>読み込んでいます<mk-ellipsis></mk-ellipsis></p>
+ <style>
+ :scope
+ display block
+ background #fff
+
+ > .title
+ margin 0
+ padding 0 16px
+ line-height 42px
+ font-size 0.9em
+ font-weight bold
+ color #888
+ border-bottom solid 1px #eee
+
+ > i
+ margin-right 4px
+
+ > button
+ position absolute
+ z-index 2
+ top 0
+ right 0
+ padding 0
+ width 42px
+ font-size 0.9em
+ line-height 42px
+ color #ccc
+
+ &:hover
+ color #aaa
+
+ &:active
+ color #999
+
+ > .poll
+ padding 16px
+ font-size 12px
+ color #555
+
+ > p
+ margin 0 0 8px 0
+
+ > .empty
+ margin 0
+ padding 16px
+ text-align center
+ color #aaa
+
+ > .loading
+ margin 0
+ padding 16px
+ text-align center
+ color #aaa
+
+ > i
+ margin-right 4px
+
+ </style>
+ <script>
+ this.mixin('api');
+
+ this.poll = null;
+ this.loading = true;
+
+ this.offset = 0;
+
+ this.on('mount', () => {
+ this.fetch();
+ });
+
+ this.fetch = () => {
+ this.update({
+ loading: true,
+ poll: null
+ });
+ this.api('posts/polls/recommendation', {
+ limit: 1,
+ offset: this.offset
+ }).then(posts => {
+ const poll = posts ? posts[0] : null;
+ if (poll == null) this.offset = 0;
+ this.update({
+ loading: false,
+ poll: poll
+ });
+ });
+ };
+
+ this.refresh = () => {
+ this.offset++;
+ this.fetch();
+ };
+ </script>
+</mk-recommended-polls-home-widget>
diff --git a/src/web/app/desktop/tags/home.tag b/src/web/app/desktop/tags/home.tag
index 6c218d93c3..93840bdf0e 100644
--- a/src/web/app/desktop/tags/home.tag
+++ b/src/web/app/desktop/tags/home.tag
@@ -76,6 +76,7 @@
'broadcast',
'notifications',
'user-recommendation',
+ 'recommended-polls',
'donation',
'nav',
'tips'
diff --git a/src/web/app/desktop/tags/index.js b/src/web/app/desktop/tags/index.js
index 1dd279430d..3032c9c544 100644
--- a/src/web/app/desktop/tags/index.js
+++ b/src/web/app/desktop/tags/index.js
@@ -42,6 +42,7 @@ require('./home-widgets/rss-reader.tag');
require('./home-widgets/photo-stream.tag');
require('./home-widgets/broadcast.tag');
require('./home-widgets/version.tag');
+require('./home-widgets/recommended-polls.tag');
require('./timeline.tag');
require('./messaging/window.tag');
require('./messaging/room-window.tag');