2019-02-15 21:50:58 +00:00
|
|
|
<template>
|
|
|
|
<ui-container :body-togglable="true">
|
2019-02-18 02:13:56 +00:00
|
|
|
<template #header><slot></slot></template>
|
2019-02-16 00:27:53 +00:00
|
|
|
|
|
|
|
<mk-error v-if="!fetching && !inited" @retry="init()"/>
|
|
|
|
|
2019-02-15 23:51:35 +00:00
|
|
|
<div class="efvhhmdq" v-size="[{ lt: 500, class: 'narrow' }]">
|
2019-02-16 00:27:53 +00:00
|
|
|
<div class="user" v-for="user in us">
|
2019-02-15 23:51:35 +00:00
|
|
|
<mk-avatar class="avatar" :user="user"/>
|
2019-02-15 21:50:58 +00:00
|
|
|
<div class="body">
|
2019-02-15 23:51:35 +00: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-16 01:58:44 +00:00
|
|
|
<div class="description" v-if="user.description" :title="user.description">
|
2019-02-17 14:41:47 +00:00
|
|
|
<mfm :text="user.description" :is-note="false" :author="user" :i="$store.state.i" :custom-emojis="user.emojis" :should-break="false"/>
|
2019-02-15 23:51:35 +00:00
|
|
|
</div>
|
2019-02-15 21:50:58 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
2019-02-16 00:27:53 +00:00
|
|
|
<button class="more" :class="{ fetching: fetchingMoreUsers }" v-if="cursor != null" @click="fetchMoreUsers()" :disabled="fetchingMoreUsers">
|
|
|
|
<template v-if="fetchingMoreUsers"><fa icon="spinner" pulse fixed-width/></template>{{ fetchingMoreUsers ? $t('@.loading') : $t('@.load-more') }}
|
|
|
|
</button>
|
2019-02-15 21:50:58 +00:00
|
|
|
</div>
|
|
|
|
</ui-container>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
|
|
|
import Vue from 'vue';
|
|
|
|
|
|
|
|
export default Vue.extend({
|
|
|
|
props: {
|
2019-02-16 00:27:53 +00:00
|
|
|
makePromise: {
|
2019-02-15 21:50:58 +00:00
|
|
|
required: true
|
|
|
|
},
|
|
|
|
iconOnly: {
|
|
|
|
type: Boolean,
|
|
|
|
default: false
|
|
|
|
}
|
2019-02-16 00:27:53 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
fetching: true,
|
|
|
|
fetchingMoreUsers: false,
|
|
|
|
us: [],
|
|
|
|
inited: false,
|
|
|
|
cursor: null
|
|
|
|
};
|
|
|
|
},
|
|
|
|
|
|
|
|
created() {
|
|
|
|
this.init();
|
|
|
|
},
|
|
|
|
|
|
|
|
methods: {
|
|
|
|
init() {
|
|
|
|
this.fetching = true;
|
|
|
|
this.makePromise().then(x => {
|
|
|
|
if (Array.isArray(x)) {
|
|
|
|
this.us = x;
|
|
|
|
} else {
|
|
|
|
this.us = x.users;
|
|
|
|
this.cursor = x.cursor;
|
|
|
|
}
|
|
|
|
this.inited = true;
|
|
|
|
this.fetching = false;
|
|
|
|
}, e => {
|
|
|
|
this.fetching = false;
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
|
|
|
fetchMoreUsers() {
|
|
|
|
this.fetchingMoreUsers = true;
|
|
|
|
this.makePromise(this.cursor).then(x => {
|
2019-02-16 07:39:34 +00:00
|
|
|
this.us = this.us.concat(x.users);
|
2019-02-16 00:27:53 +00:00
|
|
|
this.cursor = x.cursor;
|
|
|
|
this.fetchingMoreUsers = false;
|
|
|
|
}, e => {
|
|
|
|
this.fetchingMoreUsers = false;
|
|
|
|
});
|
|
|
|
}
|
2019-02-15 21:50:58 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="stylus" scoped>
|
|
|
|
.efvhhmdq
|
2019-02-15 23:51:35 +00:00
|
|
|
&.narrow
|
|
|
|
> .user > .body > .name
|
|
|
|
width 100%
|
|
|
|
|
|
|
|
> .user > .body > .description
|
|
|
|
display none
|
|
|
|
|
2019-02-15 21:50:58 +00:00
|
|
|
> .user
|
2019-02-15 23:51:35 +00:00
|
|
|
display flex
|
2019-02-15 21:50:58 +00:00
|
|
|
padding 16px
|
|
|
|
border-bottom solid 1px var(--faceDivider)
|
|
|
|
|
|
|
|
&:last-child
|
|
|
|
border-bottom none
|
|
|
|
|
|
|
|
> .avatar
|
|
|
|
display block
|
2019-02-15 23:51:35 +00:00
|
|
|
flex-shrink 0
|
2019-02-15 21:50:58 +00:00
|
|
|
margin 0 12px 0 0
|
|
|
|
width 42px
|
|
|
|
height 42px
|
|
|
|
border-radius 8px
|
|
|
|
|
|
|
|
> .body
|
2019-02-15 23:51:35 +00:00
|
|
|
display flex
|
2019-02-15 21:50:58 +00:00
|
|
|
width calc(100% - 54px)
|
|
|
|
|
|
|
|
> .name
|
2019-02-15 23:51:35 +00: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 21:50:58 +00:00
|
|
|
|
2019-02-15 23:51:35 +00:00
|
|
|
> .description
|
|
|
|
width 55%
|
2019-02-15 21:50:58 +00:00
|
|
|
color var(--text)
|
2019-02-15 23:51:35 +00:00
|
|
|
line-height 42px
|
|
|
|
white-space nowrap
|
|
|
|
overflow hidden
|
|
|
|
text-overflow ellipsis
|
2019-02-15 21:50:58 +00:00
|
|
|
opacity 0.7
|
2019-02-16 01:58:44 +00:00
|
|
|
font-size 14px
|
2019-02-15 21:50:58 +00:00
|
|
|
|
2019-02-16 07:39:34 +00: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 21:50:58 +00:00
|
|
|
</style>
|