summaryrefslogtreecommitdiff
path: root/src/web/app/common
diff options
context:
space:
mode:
authorsyuilo <syuilotan@yahoo.co.jp>2017-08-30 11:38:35 +0900
committersyuilo <syuilotan@yahoo.co.jp>2017-08-30 11:38:35 +0900
commit4c0fbaedfa4cd1cac6c4980b078330566eafaed5 (patch)
treeb9415445820ca246e76bf4c14c319aa58ff3aa7d /src/web/app/common
parentv2503 (diff)
downloadmisskey-4c0fbaedfa4cd1cac6c4980b078330566eafaed5.tar.gz
misskey-4c0fbaedfa4cd1cac6c4980b078330566eafaed5.tar.bz2
misskey-4c0fbaedfa4cd1cac6c4980b078330566eafaed5.zip
モバイル版のアクティビティチャートを変更
Diffstat (limited to 'src/web/app/common')
-rw-r--r--src/web/app/common/tags/index.js1
-rw-r--r--src/web/app/common/tags/weekly-activity-chart.tag49
2 files changed, 50 insertions, 0 deletions
diff --git a/src/web/app/common/tags/index.js b/src/web/app/common/tags/index.js
index 1ee8dab42d..dd6ba75d7a 100644
--- a/src/web/app/common/tags/index.js
+++ b/src/web/app/common/tags/index.js
@@ -27,3 +27,4 @@ require('./activity-table.tag');
require('./reaction-picker.tag');
require('./reactions-viewer.tag');
require('./reaction-icon.tag');
+require('./weekly-activity-chart.tag');
diff --git a/src/web/app/common/tags/weekly-activity-chart.tag b/src/web/app/common/tags/weekly-activity-chart.tag
new file mode 100644
index 0000000000..ae9f7071c5
--- /dev/null
+++ b/src/web/app/common/tags/weekly-activity-chart.tag
@@ -0,0 +1,49 @@
+<mk-weekly-activity-chart>
+ <svg if={ data } ref="canvas" viewBox="0 0 7 1" preserveAspectRatio="none">
+ <g each={ d, i in data.reverse() }>
+ <rect width="0.8" riot-height={ d.postsH }
+ riot-x={ i + 0.1 } y={ 1 - d.postsH - d.repliesH - d.repostsH }
+ fill="#41ddde"/>
+ <rect width="0.8" riot-height={ d.repliesH }
+ riot-x={ i + 0.1 } y={ 1 - d.repliesH - d.repostsH }
+ fill="#f7796c"/>
+ <rect width="0.8" riot-height={ d.repostsH }
+ riot-x={ i + 0.1 } y={ 1 - d.repostsH }
+ fill="#a1de41"/>
+ </g>
+ </svg>
+ <style>
+ :scope
+ display block
+ max-width 600px
+ margin 0 auto
+
+ > svg
+ display block
+
+ > rect
+ transform-origin center
+
+ </style>
+ <script>
+ this.mixin('api');
+
+ this.user = this.opts.user;
+
+ this.on('mount', () => {
+ this.api('aggregation/users/activity', {
+ user_id: this.user.id,
+ limit: 7
+ }).then(data => {
+ data.forEach(d => d.total = d.posts + d.replies + d.reposts);
+ this.peak = Math.max.apply(null, data.map(d => d.total));
+ data.forEach(d => {
+ d.postsH = d.posts / this.peak;
+ d.repliesH = d.replies / this.peak;
+ d.repostsH = d.reposts / this.peak;
+ });
+ this.update({ data });
+ });
+ });
+ </script>
+</mk-weekly-activity-chart>