2019-02-15 15:50:58 -06:00
|
|
|
<template>
|
|
|
|
<ui-container :body-togglable="true">
|
2019-02-17 20:13:56 -06:00
|
|
|
<template #header><slot></slot></template>
|
2019-02-15 18:27:53 -06:00
|
|
|
|
2019-05-20 13:07:11 -05:00
|
|
|
<mk-error v-if="error" @retry="init()"/>
|
2019-02-15 18:27:53 -06:00
|
|
|
|
2019-02-18 12:38:34 -06:00
|
|
|
<div class="efvhhmdq" :class="{ iconOnly }" v-size="[{ lt: 500, class: 'narrow' }]">
|
2019-05-20 13:07:11 -05:00
|
|
|
<div class="no-users" v-if="empty">
|
2019-02-17 20:27:15 -06:00
|
|
|
<p>{{ $t('no-users') }}</p>
|
|
|
|
</div>
|
2019-05-20 13:07:11 -05:00
|
|
|
<div class="user" v-for="user in users" :key="user.id">
|
2019-02-15 17:51:35 -06:00
|
|
|
<mk-avatar class="avatar" :user="user"/>
|
2019-02-18 12:38:34 -06:00
|
|
|
<div class="body" v-if="!iconOnly">
|
2019-02-15 17:51:35 -06:00
|
|
|
<div class="name">
|
|
|
|
<router-link class="name" :to="user | userPage" v-user-preview="user.id"><mk-user-name :user="user"/></router-link>
|
|
|
|
<p class="username">@{{ user | acct }}</p>
|
|
|
|
</div>
|
2019-02-15 19:58:44 -06:00
|
|
|
<div class="description" v-if="user.description" :title="user.description">
|
2019-03-31 07:32:09 -05:00
|
|
|
<mfm :text="user.description" :is-note="false" :author="user" :i="$store.state.i" :custom-emojis="user.emojis" :should-break="false" :plain-text="true"/>
|
2019-02-15 17:51:35 -06:00
|
|
|
</div>
|
2019-04-08 03:20:16 -05:00
|
|
|
<mk-follow-button class="follow-button" v-if="$store.getters.isSignedIn && user.id != $store.state.i.id" :user="user" mini/>
|
2019-02-15 15:50:58 -06:00
|
|
|
</div>
|
|
|
|
</div>
|
2019-05-21 03:43:27 -05:00
|
|
|
<button class="more" :class="{ fetching: moreFetching }" v-if="more" @click="fetchMore()" :disabled="moreFetching">
|
2019-05-20 13:07:11 -05:00
|
|
|
<template v-if="moreFetching"><fa icon="spinner" pulse fixed-width/></template>{{ moreFetching ? $t('@.loading') : $t('@.load-more') }}
|
2019-02-15 18:27:53 -06:00
|
|
|
</button>
|
2019-02-15 15:50:58 -06:00
|
|
|
</div>
|
|
|
|
</ui-container>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
|
|
|
import Vue from 'vue';
|
2019-02-17 20:27:15 -06:00
|
|
|
import i18n from '../../../i18n';
|
2019-05-20 13:07:11 -05:00
|
|
|
import paging from '../../../common/scripts/paging';
|
2019-02-15 15:50:58 -06:00
|
|
|
|
|
|
|
export default Vue.extend({
|
2019-02-17 20:27:15 -06:00
|
|
|
i18n: i18n('common/views/components/user-list.vue'),
|
|
|
|
|
2019-05-20 13:07:11 -05:00
|
|
|
mixins: [
|
|
|
|
paging({}),
|
|
|
|
],
|
|
|
|
|
2019-02-15 15:50:58 -06:00
|
|
|
props: {
|
2019-05-20 13:07:11 -05:00
|
|
|
pagination: {
|
2019-02-15 15:50:58 -06:00
|
|
|
required: true
|
|
|
|
},
|
2019-05-20 13:07:11 -05:00
|
|
|
extract: {
|
|
|
|
required: false
|
|
|
|
},
|
2019-02-15 15:50:58 -06:00
|
|
|
iconOnly: {
|
|
|
|
type: Boolean,
|
|
|
|
default: false
|
|
|
|
}
|
2019-02-15 18:27:53 -06:00
|
|
|
},
|
|
|
|
|
2019-05-20 13:07:11 -05:00
|
|
|
computed: {
|
|
|
|
users() {
|
|
|
|
return this.extract ? this.extract(this.items) : this.items;
|
2019-02-15 18:27:53 -06:00
|
|
|
}
|
2019-02-15 15:50:58 -06:00
|
|
|
}
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="stylus" scoped>
|
|
|
|
.efvhhmdq
|
2019-02-15 17:51:35 -06:00
|
|
|
&.narrow
|
|
|
|
> .user > .body > .name
|
|
|
|
width 100%
|
|
|
|
|
|
|
|
> .user > .body > .description
|
|
|
|
display none
|
|
|
|
|
2019-02-18 12:38:34 -06:00
|
|
|
&.iconOnly
|
|
|
|
padding 12px
|
|
|
|
|
|
|
|
> .user
|
|
|
|
display inline-block
|
|
|
|
padding 0
|
|
|
|
border-bottom none
|
|
|
|
|
|
|
|
> .avatar
|
|
|
|
display inline-block
|
|
|
|
margin 4px
|
|
|
|
|
2019-02-17 20:27:15 -06:00
|
|
|
> .no-users
|
|
|
|
text-align center
|
|
|
|
color var(--text)
|
|
|
|
|
2019-02-15 15:50:58 -06:00
|
|
|
> .user
|
2019-02-15 17:51:35 -06:00
|
|
|
display flex
|
2019-02-15 15:50:58 -06:00
|
|
|
padding 16px
|
|
|
|
border-bottom solid 1px var(--faceDivider)
|
|
|
|
|
|
|
|
&:last-child
|
|
|
|
border-bottom none
|
|
|
|
|
|
|
|
> .avatar
|
|
|
|
display block
|
2019-02-15 17:51:35 -06:00
|
|
|
flex-shrink 0
|
2019-02-15 15:50:58 -06:00
|
|
|
margin 0 12px 0 0
|
|
|
|
width 42px
|
|
|
|
height 42px
|
|
|
|
border-radius 8px
|
|
|
|
|
|
|
|
> .body
|
2019-02-15 17:51:35 -06:00
|
|
|
display flex
|
2019-02-15 15:50:58 -06:00
|
|
|
width calc(100% - 54px)
|
|
|
|
|
|
|
|
> .name
|
2019-02-15 17:51:35 -06:00
|
|
|
width 45%
|
|
|
|
|
|
|
|
> .name
|
|
|
|
margin 0
|
|
|
|
font-size 16px
|
|
|
|
line-height 24px
|
|
|
|
color var(--text)
|
|
|
|
|
|
|
|
> .username
|
|
|
|
display block
|
|
|
|
margin 0
|
|
|
|
font-size 15px
|
|
|
|
line-height 16px
|
|
|
|
color var(--text)
|
|
|
|
opacity 0.7
|
2019-02-15 15:50:58 -06:00
|
|
|
|
2019-02-15 17:51:35 -06:00
|
|
|
> .description
|
|
|
|
width 55%
|
2019-02-15 15:50:58 -06:00
|
|
|
color var(--text)
|
2019-02-15 17:51:35 -06:00
|
|
|
line-height 42px
|
|
|
|
white-space nowrap
|
|
|
|
overflow hidden
|
|
|
|
text-overflow ellipsis
|
2019-02-15 15:50:58 -06:00
|
|
|
opacity 0.7
|
2019-02-15 19:58:44 -06:00
|
|
|
font-size 14px
|
2019-04-08 03:20:16 -05:00
|
|
|
padding-right 40px
|
|
|
|
|
|
|
|
> .follow-button
|
|
|
|
position absolute
|
|
|
|
top 8px
|
2019-05-04 19:27:55 -05:00
|
|
|
right 0
|
2019-02-15 15:50:58 -06:00
|
|
|
|
2019-02-16 01:39:34 -06:00
|
|
|
> .more
|
|
|
|
display block
|
|
|
|
width 100%
|
|
|
|
padding 16px
|
|
|
|
color var(--text)
|
|
|
|
border-top solid var(--lineWidth) rgba(#000, 0.05)
|
|
|
|
|
|
|
|
&:hover
|
|
|
|
background rgba(#000, 0.025)
|
|
|
|
|
|
|
|
&:active
|
|
|
|
background rgba(#000, 0.05)
|
|
|
|
|
|
|
|
&.fetching
|
|
|
|
cursor wait
|
|
|
|
|
|
|
|
> [data-icon]
|
|
|
|
margin-right 4px
|
|
|
|
|
2019-02-15 15:50:58 -06:00
|
|
|
</style>
|