iceshrimp-legacy/src/web/app/desktop/tags/users-list.tag

139 lines
2.8 KiB
HTML
Raw Normal View History

2017-01-11 21:55:38 +01:00
<mk-users-list>
<nav>
2017-02-21 03:44:53 +01:00
<div>
<span data-is-active={ mode == 'all' } onclick={ setMode.bind(this, 'all') }>すべて<span>{ opts.count }</span></span>
2017-04-01 20:54:16 +02:00
<span if={ SIGNIN && opts.youKnowCount } data-is-active={ mode == 'iknow' } onclick={ setMode.bind(this, 'iknow') }>知り合い<span>{ opts.youKnowCount }</span></span>
2017-01-11 21:55:38 +01:00
</div>
</nav>
2017-01-11 22:03:49 +01:00
<div class="users" if={ !fetching && users.length != 0 }>
<div each={ users }>
2017-06-07 08:43:29 +02:00
<mk-list-user user={ this }/>
2017-01-11 21:55:38 +01:00
</div>
</div>
2017-02-21 03:44:53 +01:00
<button class="more" if={ !fetching && next != null } onclick={ more } disabled={ moreFetching }>
<span if={ !moreFetching }>もっと</span>
2017-06-06 18:33:39 +02:00
<span if={ moreFetching }>読み込み中<mk-ellipsis/></span>
2017-02-21 03:44:53 +01:00
</button>
2017-01-11 22:03:49 +01:00
<p class="no" if={ !fetching && users.length == 0 }>{ opts.noUsers }</p>
2017-06-06 18:33:39 +02:00
<p class="fetching" if={ fetching }><i class="fa fa-spinner fa-pulse fa-fw"></i>読み込んでいます<mk-ellipsis/></p>
2017-02-19 04:31:53 +01:00
<style>
2017-01-11 21:55:38 +01:00
:scope
display block
height 100%
background #fff
> nav
z-index 1
box-shadow 0 1px 0 rgba(#000, 0.1)
> div
display flex
justify-content center
margin 0 auto
max-width 600px
> span
display block
flex 1 1
text-align center
line-height 52px
font-size 14px
color #657786
border-bottom solid 2px transparent
cursor pointer
*
pointer-events none
&[data-is-active]
font-weight bold
color $theme-color
border-color $theme-color
cursor default
> span
display inline-block
margin-left 4px
padding 2px 5px
font-size 12px
line-height 1
color #888
background #eee
border-radius 20px
> .users
height calc(100% - 54px)
overflow auto
> *
border-bottom solid 1px rgba(0, 0, 0, 0.05)
> *
max-width 600px
margin 0 auto
> .no
margin 0
padding 16px
2016-12-28 23:49:51 +01:00
text-align center
2017-01-11 21:55:38 +01:00
color #aaa
> .fetching
margin 0
padding 16px
text-align center
color #aaa
> i
margin-right 4px
</style>
<script>
2017-02-20 01:53:57 +01:00
this.mixin('i');
2017-01-11 21:55:38 +01:00
2017-02-21 03:44:53 +01:00
this.limit = 30;
this.mode = 'all';
2017-01-11 21:55:38 +01:00
2017-02-21 03:44:53 +01:00
this.fetching = true;
this.moreFetching = false;
2016-12-28 23:49:51 +01:00
2017-02-20 01:53:57 +01:00
this.on('mount', () => {
2017-02-21 03:44:53 +01:00
this.fetch(() => this.trigger('loaded'));
});
this.fetch = cb => {
this.update({
fetching: true
});
this.opts.fetch(this.mode == 'iknow', this.limit, null, obj => {
this.update({
fetching: false,
users: obj.users,
next: obj.next
});
if (cb) cb();
});
};
2017-01-11 21:55:38 +01:00
2017-02-20 02:34:57 +01:00
this.more = () => {
2017-02-21 03:44:53 +01:00
this.update({
moreFetching: true
});
this.opts.fetch(this.mode == 'iknow', this.limit, this.cursor, obj => {
this.update({
moreFetching: false,
users: this.users.concat(obj.users),
next: obj.next
});
});
};
this.setMode = mode => {
this.update({
2017-01-11 21:55:38 +01:00
mode: mode
2017-02-21 03:44:53 +01:00
});
this.fetch();
};
2017-01-11 21:55:38 +01:00
</script>
</mk-users-list>