mirror of
https://git.joinsharkey.org/Sharkey/Sharkey.git
synced 2024-12-23 22:13:07 +02:00
wip
This commit is contained in:
parent
463a38d606
commit
47efc83f16
10 changed files with 133 additions and 87 deletions
|
@ -8,6 +8,10 @@ import imagesImage from './images-image.vue';
|
|||
import drive from './drive.vue';
|
||||
import postPreview from './post-preview.vue';
|
||||
import subPostContent from './sub-post-content.vue';
|
||||
import postCard from './post-card.vue';
|
||||
import userCard from './user-card.vue';
|
||||
import postDetail from './post-detail.vue';
|
||||
import followButton from './follow-button.vue';
|
||||
|
||||
Vue.component('mk-ui', ui);
|
||||
Vue.component('mk-home', home);
|
||||
|
@ -17,3 +21,7 @@ Vue.component('mk-images-image', imagesImage);
|
|||
Vue.component('mk-drive', drive);
|
||||
Vue.component('mk-post-preview', postPreview);
|
||||
Vue.component('mk-sub-post-content', subPostContent);
|
||||
Vue.component('mk-post-card', postCard);
|
||||
Vue.component('mk-user-card', userCard);
|
||||
Vue.component('mk-post-detail', postDetail);
|
||||
Vue.component('mk-follow-button', followButton);
|
||||
|
|
|
@ -1,18 +1,18 @@
|
|||
<template>
|
||||
<div class="mk-post-detail-sub">
|
||||
<a class="avatar-anchor" href={ '/' + post.user.username }>
|
||||
<img class="avatar" src={ post.user.avatar_url + '?thumbnail&size=64' } alt="avatar"/>
|
||||
</a>
|
||||
<div class="root sub">
|
||||
<router-link class="avatar-anchor" :to="`/${post.user.username}`">
|
||||
<img class="avatar" :src="`${post.user.avatar_url}?thumbnail&size=64`" alt="avatar"/>
|
||||
</router-link>
|
||||
<div class="main">
|
||||
<header>
|
||||
<a class="name" href={ '/' + post.user.username }>{ post.user.name }</a>
|
||||
<span class="username">@{ post.user.username }</span>
|
||||
<a class="time" href={ '/' + post.user.username + '/' + post.id }>
|
||||
<mk-time time={ post.created_at }/>
|
||||
</a>
|
||||
<router-link class="name" :to="`/${post.user.username}`">{{ post.user.name }}</router-link>
|
||||
<span class="username">@{{ post.user.username }}</span>
|
||||
<router-link class="time" :to="`/${post.user.username}/${post.id}`">
|
||||
<mk-time :time="post.created_at"/>
|
||||
</router-link>
|
||||
</header>
|
||||
<div class="body">
|
||||
<mk-sub-post-content class="text" post={ post }/>
|
||||
<mk-sub-post-content class="text" :post="post"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -26,8 +26,7 @@ export default Vue.extend({
|
|||
</script>
|
||||
|
||||
<style lang="stylus" scoped>
|
||||
.mk-post-detail-sub
|
||||
margin 0
|
||||
.root.sub
|
||||
padding 8px
|
||||
font-size 0.9em
|
||||
background #fdfdfd
|
|
@ -1,58 +1,63 @@
|
|||
<template>
|
||||
<div class="mk-post-detail">
|
||||
<button class="read-more" v-if="p.reply && p.reply.reply_id && context == null" @click="loadContext" disabled={ loadingContext }>
|
||||
<button
|
||||
class="more"
|
||||
v-if="p.reply && p.reply.reply_id && context == null"
|
||||
@click="fetchContext"
|
||||
:disabled="fetchingContext"
|
||||
>
|
||||
<template v-if="!contextFetching">%fa:ellipsis-v%</template>
|
||||
<template v-if="contextFetching">%fa:spinner .pulse%</template>
|
||||
</button>
|
||||
<div class="context">
|
||||
<template each={ post in context }>
|
||||
<mk-post-detail-sub post={ post }/>
|
||||
</template>
|
||||
<x-sub v-for="post in context" :key="post.id" :post="post"/>
|
||||
</div>
|
||||
<div class="reply-to" v-if="p.reply">
|
||||
<mk-post-detail-sub post={ p.reply }/>
|
||||
<x-sub :post="p.reply"/>
|
||||
</div>
|
||||
<div class="repost" v-if="isRepost">
|
||||
<p>
|
||||
<a class="avatar-anchor" href={ '/' + post.user.username }>
|
||||
<img class="avatar" src={ post.user.avatar_url + '?thumbnail&size=32' } alt="avatar"/></a>
|
||||
%fa:retweet%<a class="name" href={ '/' + post.user.username }>
|
||||
{ post.user.name }
|
||||
</a>
|
||||
<router-link class="avatar-anchor" :to="`/${post.user.username}`">
|
||||
<img class="avatar" :src="`${post.user.avatar_url}?thumbnail&size=32`" alt="avatar"/>
|
||||
</router-link>
|
||||
%fa:retweet%
|
||||
<router-link class="name" :to="`/${post.user.username}`">
|
||||
{{ post.user.name }}
|
||||
</router-link>
|
||||
がRepost
|
||||
</p>
|
||||
</div>
|
||||
<article>
|
||||
<header>
|
||||
<a class="avatar-anchor" href={ '/' + p.user.username }>
|
||||
<img class="avatar" src={ p.user.avatar_url + '?thumbnail&size=64' } alt="avatar"/>
|
||||
</a>
|
||||
<router-link class="avatar-anchor" :to="`/${p.user.username}`">
|
||||
<img class="avatar" :src="`${p.user.avatar_url}?thumbnail&size=64`" alt="avatar"/>
|
||||
</router-link>
|
||||
<div>
|
||||
<a class="name" href={ '/' + p.user.username }>{ p.user.name }</a>
|
||||
<span class="username">@{ p.user.username }</span>
|
||||
<router-link class="name" :to="`/${p.user.username}`">{{ p.user.name }}</router-link>
|
||||
<span class="username">@{{ p.user.username }}</span>
|
||||
</div>
|
||||
</header>
|
||||
<div class="body">
|
||||
<mk-post-html v-if="p.ast" :ast="p.ast" :i="os.i"/>
|
||||
<mk-url-preview v-for="url in urls" :url="url" :key="url"/>
|
||||
<div class="media" v-if="p.media">
|
||||
<mk-images images={ p.media }/>
|
||||
<mk-images :images="p.media"/>
|
||||
</div>
|
||||
<mk-poll v-if="p.poll" post={ p }/>
|
||||
<mk-poll v-if="p.poll" :post="p"/>
|
||||
</div>
|
||||
<a class="time" href={ '/' + p.user.username + '/' + p.id }>
|
||||
<mk-time time={ p.created_at } mode="detail"/>
|
||||
</a>
|
||||
<router-link class="time" :to="`/${p.user.username}/${p.id}`">
|
||||
<mk-time :time="p.created_at" mode="detail"/>
|
||||
</router-link>
|
||||
<footer>
|
||||
<mk-reactions-viewer post={ p }/>
|
||||
<mk-reactions-viewer :post="p"/>
|
||||
<button @click="reply" title="%i18n:mobile.tags.mk-post-detail.reply%">
|
||||
%fa:reply%<p class="count" v-if="p.replies_count > 0">{ p.replies_count }</p>
|
||||
%fa:reply%<p class="count" v-if="p.replies_count > 0">{{ p.replies_count }}</p>
|
||||
</button>
|
||||
<button @click="repost" title="Repost">
|
||||
%fa:retweet%<p class="count" v-if="p.repost_count > 0">{ p.repost_count }</p>
|
||||
%fa:retweet%<p class="count" v-if="p.repost_count > 0">{{ p.repost_count }}</p>
|
||||
</button>
|
||||
<button :class="{ reacted: p.my_reaction != null }" @click="react" ref="reactButton" title="%i18n:mobile.tags.mk-post-detail.reaction%">
|
||||
%fa:plus%<p class="count" v-if="p.reactions_count > 0">{ p.reactions_count }</p>
|
||||
%fa:plus%<p class="count" v-if="p.reactions_count > 0">{{ p.reactions_count }}</p>
|
||||
</button>
|
||||
<button @click="menu" ref="menuButton">
|
||||
%fa:ellipsis-h%
|
||||
|
@ -60,19 +65,21 @@
|
|||
</footer>
|
||||
</article>
|
||||
<div class="replies" v-if="!compact">
|
||||
<template each={ post in replies }>
|
||||
<mk-post-detail-sub post={ post }/>
|
||||
</template>
|
||||
<x-sub v-for="post in replies" :key="post.id" :post="post"/>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import Vue from 'vue';
|
||||
import getPostSummary from '../../../../common/get-post-summary.ts';
|
||||
import openPostForm from '../scripts/open-post-form';
|
||||
import MkPostMenu from '../../../common/views/components/post-menu.vue';
|
||||
import MkReactionPicker from '../../../common/views/components/reaction-picker.vue';
|
||||
import XSub from './post-detail.sub.vue';
|
||||
|
||||
export default Vue.extend({
|
||||
components: {
|
||||
XSub
|
||||
},
|
||||
props: {
|
||||
post: {
|
||||
type: Object,
|
||||
|
@ -135,6 +142,34 @@ export default Vue.extend({
|
|||
this.contextFetching = false;
|
||||
this.context = context.reverse();
|
||||
});
|
||||
},
|
||||
reply() {
|
||||
(this as any).apis.post({
|
||||
reply: this.p
|
||||
});
|
||||
},
|
||||
repost() {
|
||||
(this as any).apis.post({
|
||||
repost: this.p
|
||||
});
|
||||
},
|
||||
react() {
|
||||
document.body.appendChild(new MkReactionPicker({
|
||||
propsData: {
|
||||
source: this.$refs.reactButton,
|
||||
post: this.p,
|
||||
compact: true
|
||||
}
|
||||
}).$mount().$el);
|
||||
},
|
||||
menu() {
|
||||
document.body.appendChild(new MkPostMenu({
|
||||
propsData: {
|
||||
source: this.$refs.menuButton,
|
||||
post: this.p,
|
||||
compact: true
|
||||
}
|
||||
}).$mount().$el);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -154,7 +189,7 @@ export default Vue.extend({
|
|||
> .fetching
|
||||
padding 64px 0
|
||||
|
||||
> .read-more
|
||||
> .more
|
||||
display block
|
||||
margin 0
|
||||
padding 10px 0
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
<template>
|
||||
<mk-ui :func="fn">
|
||||
<mk-ui>
|
||||
<span slot="header" v-if="!fetching">%fa:user% {{ user.name }}</span>
|
||||
<template slot="funcIcon">%fa:pencil-alt%</template>
|
||||
<div v-if="!fetching" :class="$style.user">
|
||||
<main v-if="!fetching">
|
||||
<header>
|
||||
<div class="banner" :style="user.banner_url ? `background-image: url(${user.banner_url}?thumbnail&size=1024)` : ''"></div>
|
||||
<div class="body">
|
||||
|
@ -48,11 +48,11 @@
|
|||
</nav>
|
||||
</header>
|
||||
<div class="body">
|
||||
<mk-user-home v-if="page == 'home'" :user="user"/>
|
||||
<x-home v-if="page == 'home'" :user="user"/>
|
||||
<mk-user-timeline v-if="page == 'posts'" :user="user"/>
|
||||
<mk-user-timeline v-if="page == 'media'" :user="user" with-media/>
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
</mk-ui>
|
||||
</template>
|
||||
|
||||
|
@ -60,8 +60,12 @@
|
|||
import Vue from 'vue';
|
||||
import age from 's-age';
|
||||
import Progress from '../../../common/scripts/loading';
|
||||
import XHome from './user/home.vue';
|
||||
|
||||
export default Vue.extend({
|
||||
components: {
|
||||
XHome
|
||||
},
|
||||
props: {
|
||||
page: {
|
||||
default: 'home'
|
||||
|
@ -86,7 +90,6 @@ export default Vue.extend({
|
|||
},
|
||||
mounted() {
|
||||
document.documentElement.style.background = '#313a42';
|
||||
(this as any).api('users/show', {
|
||||
},
|
||||
methods: {
|
||||
fetch() {
|
||||
|
@ -106,8 +109,8 @@ export default Vue.extend({
|
|||
});
|
||||
</script>
|
||||
|
||||
<style lang="stylus" module>
|
||||
.user
|
||||
<style lang="stylus" scoped>
|
||||
main
|
||||
> header
|
||||
box-shadow 0 4px 4px rgba(0, 0, 0, 0.3)
|
||||
|
||||
|
@ -140,7 +143,7 @@ export default Vue.extend({
|
|||
left -2px
|
||||
bottom -2px
|
||||
width 100%
|
||||
border 2px solid #313a42
|
||||
border 3px solid #313a42
|
||||
border-radius 6px
|
||||
|
||||
@media (min-width 500px)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<template>
|
||||
<div class="mk-user-home-activity">
|
||||
<div class="root activity">
|
||||
<svg v-if="data" ref="canvas" viewBox="0 0 30 1" preserveAspectRatio="none">
|
||||
<g v-for="(d, i) in data.reverse()">
|
||||
<g v-for="(d, i) in data">
|
||||
<rect width="0.8" :height="d.postsH"
|
||||
:x="i + 0.1" :y="1 - d.postsH - d.repliesH - d.repostsH"
|
||||
fill="#41ddde"/>
|
||||
|
@ -39,6 +39,7 @@ export default Vue.extend({
|
|||
d.repliesH = d.replies / this.peak;
|
||||
d.repostsH = d.reposts / this.peak;
|
||||
});
|
||||
data.reverse();
|
||||
this.data = data;
|
||||
});
|
||||
}
|
||||
|
@ -46,8 +47,7 @@ export default Vue.extend({
|
|||
</script>
|
||||
|
||||
<style lang="stylus" scoped>
|
||||
.mk-user-home-activity
|
||||
display block
|
||||
.root.activity
|
||||
max-width 600px
|
||||
margin 0 auto
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
<template>
|
||||
<div class="mk-user-home-followers-you-know">
|
||||
<div class="root followers-you-know">
|
||||
<p class="initializing" v-if="fetching">%fa:spinner .pulse .fw%%i18n:mobile.tags.mk-user-overview-followers-you-know.loading%<mk-ellipsis/></p>
|
||||
<div v-if="!fetching && users.length > 0">
|
||||
<a v-for="user in users" :key="user.id" :href="`/${user.username}`">
|
||||
|
@ -34,7 +34,7 @@ export default Vue.extend({
|
|||
</script>
|
||||
|
||||
<style lang="stylus" scoped>
|
||||
.mk-user-home-followers-you-know
|
||||
.root.followers-you-know
|
||||
|
||||
> div
|
||||
padding 4px
|
|
@ -1,6 +1,6 @@
|
|||
<template>
|
||||
<div class="mk-user-home-friends">
|
||||
<p class="initializing" v-if="fetching">%fa:spinner .pulse .fw%%i18n:mobile.tags.mk-user-overview-frequently-replied-users.loading%<mk-ellipsis/></p>
|
||||
<div class="root friends">
|
||||
<p class="fetching" v-if="fetching">%fa:spinner .pulse .fw%%i18n:mobile.tags.mk-user-overview-frequently-replied-users.loading%<mk-ellipsis/></p>
|
||||
<div v-if="!fetching && users.length > 0">
|
||||
<mk-user-card v-for="user in users" :key="user.id" :user="user"/>
|
||||
</div>
|
||||
|
@ -30,7 +30,7 @@ export default Vue.extend({
|
|||
</script>
|
||||
|
||||
<style lang="stylus" scoped>
|
||||
.mk-user-home-friends
|
||||
.root.friends
|
||||
> div
|
||||
overflow-x scroll
|
||||
-webkit-overflow-scrolling touch
|
||||
|
@ -41,7 +41,7 @@ export default Vue.extend({
|
|||
&:not(:last-child)
|
||||
margin-right 8px
|
||||
|
||||
> .initializing
|
||||
> .fetching
|
||||
> .empty
|
||||
margin 0
|
||||
padding 16px
|
|
@ -1,5 +1,5 @@
|
|||
<template>
|
||||
<div class="mk-user-home-photos">
|
||||
<div class="root photos">
|
||||
<p class="initializing" v-if="fetching">%fa:spinner .pulse .fw%%i18n:mobile.tags.mk-user-overview-photos.loading%<mk-ellipsis/></p>
|
||||
<div class="stream" v-if="!fetching && images.length > 0">
|
||||
<a v-for="image in images" :key="image.id"
|
||||
|
@ -43,7 +43,7 @@ export default Vue.extend({
|
|||
</script>
|
||||
|
||||
<style lang="stylus" scoped>
|
||||
.mk-user-home-photos
|
||||
.root.photos
|
||||
|
||||
> .stream
|
||||
display -webkit-flex
|
|
@ -1,10 +1,10 @@
|
|||
<template>
|
||||
<div class="mk-user-home-posts">
|
||||
<p class="initializing" v-if="initializing">%fa:spinner .pulse .fw%%i18n:mobile.tags.mk-user-overview-posts.loading%<mk-ellipsis/></p>
|
||||
<div v-if="!initializing && posts.length > 0">
|
||||
<div class="root posts">
|
||||
<p class="fetching" v-if="fetching">%fa:spinner .pulse .fw%%i18n:mobile.tags.mk-user-overview-posts.loading%<mk-ellipsis/></p>
|
||||
<div v-if="!fetching && posts.length > 0">
|
||||
<mk-post-card v-for="post in posts" :key="post.id" :post="post"/>
|
||||
</div>
|
||||
<p class="empty" v-if="!initializing && posts.length == 0">%i18n:mobile.tags.mk-user-overview-posts.no-posts%</p>
|
||||
<p class="empty" v-if="!fetching && posts.length == 0">%i18n:mobile.tags.mk-user-overview-posts.no-posts%</p>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
@ -30,7 +30,7 @@ export default Vue.extend({
|
|||
</script>
|
||||
|
||||
<style lang="stylus" scoped>
|
||||
.mk-user-home-posts
|
||||
.root.posts
|
||||
|
||||
> div
|
||||
overflow-x scroll
|
||||
|
@ -44,7 +44,7 @@ export default Vue.extend({
|
|||
&:not(:last-child)
|
||||
margin-right 8px
|
||||
|
||||
> .initializing
|
||||
> .fetching
|
||||
> .empty
|
||||
margin 0
|
||||
padding 16px
|
|
@ -1,46 +1,34 @@
|
|||
<template>
|
||||
<div class="mk-user-home">
|
||||
<div class="root home">
|
||||
<mk-post-detail v-if="user.pinned_post" :post="user.pinned_post" compact/>
|
||||
<section class="recent-posts">
|
||||
<h2>%fa:R comments%%i18n:mobile.tags.mk-user-overview.recent-posts%</h2>
|
||||
<div>
|
||||
<mk-user-home-posts :user="user"/>
|
||||
<x-posts :user="user"/>
|
||||
</div>
|
||||
</section>
|
||||
<section class="images">
|
||||
<h2>%fa:image%%i18n:mobile.tags.mk-user-overview.images%</h2>
|
||||
<div>
|
||||
<mk-user-home-photos :user="user"/>
|
||||
<x-photos :user="user"/>
|
||||
</div>
|
||||
</section>
|
||||
<section class="activity">
|
||||
<h2>%fa:chart-bar%%i18n:mobile.tags.mk-user-overview.activity%</h2>
|
||||
<div>
|
||||
<mk-user-home-activity-chart :user="user"/>
|
||||
</div>
|
||||
</section>
|
||||
<section class="keywords">
|
||||
<h2>%fa:R comment%%i18n:mobile.tags.mk-user-overview.keywords%</h2>
|
||||
<div>
|
||||
<mk-user-home-keywords :user="user"/>
|
||||
</div>
|
||||
</section>
|
||||
<section class="domains">
|
||||
<h2>%fa:globe%%i18n:mobile.tags.mk-user-overview.domains%</h2>
|
||||
<div>
|
||||
<mk-user-home-domains :user="user"/>
|
||||
<x-activity :user="user"/>
|
||||
</div>
|
||||
</section>
|
||||
<section class="frequently-replied-users">
|
||||
<h2>%fa:users%%i18n:mobile.tags.mk-user-overview.frequently-replied-users%</h2>
|
||||
<div>
|
||||
<mk-user-home-frequently-replied-users :user="user"/>
|
||||
<x-friends :user="user"/>
|
||||
</div>
|
||||
</section>
|
||||
<section class="followers-you-know" v-if="os.isSignedIn && os.i.id !== user.id">
|
||||
<h2>%fa:users%%i18n:mobile.tags.mk-user-overview.followers-you-know%</h2>
|
||||
<div>
|
||||
<mk-user-home-followers-you-know :user="user"/>
|
||||
<x-followers-you-know :user="user"/>
|
||||
</div>
|
||||
</section>
|
||||
<p>%i18n:mobile.tags.mk-user-overview.last-used-at%: <b><mk-time :time="user.last_used_at"/></b></p>
|
||||
|
@ -49,13 +37,26 @@
|
|||
|
||||
<script lang="ts">
|
||||
import Vue from 'vue';
|
||||
import XPosts from './home.posts.vue';
|
||||
import XPhotos from './home.photos.vue';
|
||||
import XFriends from './home.friends.vue';
|
||||
import XFollowersYouKnow from './home.followers-you-know.vue';
|
||||
import XActivity from './home.activity.vue';
|
||||
|
||||
export default Vue.extend({
|
||||
components: {
|
||||
XPosts,
|
||||
XPhotos,
|
||||
XFriends,
|
||||
XFollowersYouKnow,
|
||||
XActivity
|
||||
},
|
||||
props: ['user']
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="stylus" scoped>
|
||||
.mk-user-home
|
||||
.root.home
|
||||
max-width 600px
|
||||
margin 0 auto
|
||||
|
||||
|
|
Loading…
Reference in a new issue