summaryrefslogtreecommitdiff
path: root/src/web/app/common
diff options
context:
space:
mode:
authorsyuilo <syuilotan@yahoo.co.jp>2018-03-17 03:33:36 +0900
committersyuilo <syuilotan@yahoo.co.jp>2018-03-17 03:33:36 +0900
commit128b56da28f40d8d398ebb2f08dff47c51385063 (patch)
treea2d57a51280fb5b7d445463cfb498ff1920461db /src/web/app/common
parentv4182 (diff)
downloadsharkey-128b56da28f40d8d398ebb2f08dff47c51385063.tar.gz
sharkey-128b56da28f40d8d398ebb2f08dff47c51385063.tar.bz2
sharkey-128b56da28f40d8d398ebb2f08dff47c51385063.zip
:v:
Diffstat (limited to 'src/web/app/common')
-rw-r--r--src/web/app/common/views/components/index.ts2
-rw-r--r--src/web/app/common/views/components/welcome-timeline.vue115
2 files changed, 117 insertions, 0 deletions
diff --git a/src/web/app/common/views/components/index.ts b/src/web/app/common/views/components/index.ts
index 25f4e461df..fbf9d22a0b 100644
--- a/src/web/app/common/views/components/index.ts
+++ b/src/web/app/common/views/components/index.ts
@@ -23,6 +23,7 @@ import twitterSetting from './twitter-setting.vue';
import fileTypeIcon from './file-type-icon.vue';
import Switch from './switch.vue';
import Othello from './othello.vue';
+import welcomeTimeline from './welcome-timeline.vue';
Vue.component('mk-signin', signin);
Vue.component('mk-signup', signup);
@@ -47,3 +48,4 @@ Vue.component('mk-twitter-setting', twitterSetting);
Vue.component('mk-file-type-icon', fileTypeIcon);
Vue.component('mk-switch', Switch);
Vue.component('mk-othello', Othello);
+Vue.component('mk-welcome-timeline', welcomeTimeline);
diff --git a/src/web/app/common/views/components/welcome-timeline.vue b/src/web/app/common/views/components/welcome-timeline.vue
new file mode 100644
index 0000000000..ab402f126a
--- /dev/null
+++ b/src/web/app/common/views/components/welcome-timeline.vue
@@ -0,0 +1,115 @@
+<template>
+<div class="mk-welcome-timeline">
+ <div v-for="post in posts">
+ <router-link class="avatar-anchor" :to="`/${post.user.username}`">
+ <img class="avatar" :src="`${post.user.avatar_url}?thumbnail&size=96`" alt="avatar"/>
+ </router-link>
+ <div class="body">
+ <header>
+ <router-link class="name" :to="`/${post.user.username}`">{{ post.user.name }}</router-link>
+ <span class="username">@{{ post.user.username }}</span>
+ <div class="info">
+ <router-link class="created-at" :to="`/${post.user.username}/${post.id}`">
+ <mk-time :time="post.created_at"/>
+ </router-link>
+ </div>
+ </header>
+ <div class="text">
+ <mk-post-html :ast="post.ast"/>
+ </div>
+ </div>
+ </div>
+</div>
+</template>
+
+<script lang="ts">
+import Vue from 'vue';
+
+export default Vue.extend({
+ data() {
+ return {
+ fetching: true,
+ posts: []
+ };
+ },
+ mounted() {
+ this.fetch();
+ },
+ methods: {
+ fetch(cb?) {
+ this.fetching = true;
+ (this as any).api('posts', {
+ reply: false,
+ repost: false,
+ media: false,
+ poll: false,
+ bot: false
+ }).then(posts => {
+ this.posts = posts;
+ this.fetching = false;
+ });
+ }
+ }
+});
+</script>
+
+<style lang="stylus" scoped>
+.mk-welcome-timeline
+ background #fff
+
+ > div
+ padding 16px
+ overflow-wrap break-word
+ font-size .9em
+ color #4C4C4C
+ border-bottom 1px solid rgba(0, 0, 0, 0.05)
+
+ &:after
+ content ""
+ display block
+ clear both
+
+ > .avatar-anchor
+ display block
+ float left
+ position -webkit-sticky
+ position sticky
+ top 16px
+
+ > img
+ display block
+ width 36px
+ height 36px
+ border-radius 6px
+
+ > .body
+ float right
+ width calc(100% - 36px)
+ padding-left 8px
+
+ > header
+ display flex
+ align-items center
+ margin-bottom 4px
+ white-space nowrap
+
+ > .name
+ display block
+ margin 0 .5em 0 0
+ padding 0
+ overflow hidden
+ font-weight bold
+ text-overflow ellipsis
+
+ > .username
+ margin 0 .5em 0 0
+ color #ccc
+
+ > .info
+ margin-left auto
+ font-size 0.9em
+
+ > .created-at
+ color #c0c0c0
+
+</style>