summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorこぴなたみぽ <syuilotan@yahoo.co.jp>2018-02-16 12:59:19 +0900
committerこぴなたみぽ <syuilotan@yahoo.co.jp>2018-02-16 12:59:19 +0900
commit62bbc44cc1274dcc4d7f9dcbfcf15abadefff972 (patch)
treecbe302cfe104a443b73a7ea4d4de2e71301bfa40 /src
parentwip (diff)
downloadmisskey-62bbc44cc1274dcc4d7f9dcbfcf15abadefff972.tar.gz
misskey-62bbc44cc1274dcc4d7f9dcbfcf15abadefff972.tar.bz2
misskey-62bbc44cc1274dcc4d7f9dcbfcf15abadefff972.zip
wip
Diffstat (limited to 'src')
-rw-r--r--src/web/app/mobile/tags/user-followers.tag28
-rw-r--r--src/web/app/mobile/tags/user-following.tag28
-rw-r--r--src/web/app/mobile/tags/users-list.tag127
-rw-r--r--src/web/app/mobile/views/components/user-followers.vue26
-rw-r--r--src/web/app/mobile/views/components/user-following.vue26
-rw-r--r--src/web/app/mobile/views/components/users-list.vue126
6 files changed, 178 insertions, 183 deletions
diff --git a/src/web/app/mobile/tags/user-followers.tag b/src/web/app/mobile/tags/user-followers.tag
deleted file mode 100644
index f3f70b2a67..0000000000
--- a/src/web/app/mobile/tags/user-followers.tag
+++ /dev/null
@@ -1,28 +0,0 @@
-<mk-user-followers>
- <mk-users-list ref="list" fetch={ fetch } count={ user.followers_count } you-know-count={ user.followers_you_know_count } no-users={ '%i18n:mobile.tags.mk-user-followers.no-users%' }/>
- <style lang="stylus" scoped>
- :scope
- display block
-
- </style>
- <script lang="typescript">
- this.mixin('api');
-
- this.user = this.opts.user;
-
- this.fetch = (iknow, limit, cursor, cb) => {
- this.$root.$data.os.api('users/followers', {
- user_id: this.user.id,
- iknow: iknow,
- limit: limit,
- cursor: cursor ? cursor : undefined
- }).then(cb);
- };
-
- this.on('mount', () => {
- this.$refs.list.on('loaded', () => {
- this.$emit('loaded');
- });
- });
- </script>
-</mk-user-followers>
diff --git a/src/web/app/mobile/tags/user-following.tag b/src/web/app/mobile/tags/user-following.tag
deleted file mode 100644
index b767571432..0000000000
--- a/src/web/app/mobile/tags/user-following.tag
+++ /dev/null
@@ -1,28 +0,0 @@
-<mk-user-following>
- <mk-users-list ref="list" fetch={ fetch } count={ user.following_count } you-know-count={ user.following_you_know_count } no-users={ '%i18n:mobile.tags.mk-user-following.no-users%' }/>
- <style lang="stylus" scoped>
- :scope
- display block
-
- </style>
- <script lang="typescript">
- this.mixin('api');
-
- this.user = this.opts.user;
-
- this.fetch = (iknow, limit, cursor, cb) => {
- this.$root.$data.os.api('users/following', {
- user_id: this.user.id,
- iknow: iknow,
- limit: limit,
- cursor: cursor ? cursor : undefined
- }).then(cb);
- };
-
- this.on('mount', () => {
- this.$refs.list.on('loaded', () => {
- this.$emit('loaded');
- });
- });
- </script>
-</mk-user-following>
diff --git a/src/web/app/mobile/tags/users-list.tag b/src/web/app/mobile/tags/users-list.tag
deleted file mode 100644
index 84427a18e2..0000000000
--- a/src/web/app/mobile/tags/users-list.tag
+++ /dev/null
@@ -1,127 +0,0 @@
-<mk-users-list>
- <nav>
- <span data-is-active={ mode == 'all' } @click="setMode.bind(this, 'all')">%i18n:mobile.tags.mk-users-list.all%<span>{ opts.count }</span></span>
- <span v-if="$root.$data.os.isSignedIn && opts.youKnowCount" data-is-active={ mode == 'iknow' } @click="setMode.bind(this, 'iknow')">%i18n:mobile.tags.mk-users-list.known%<span>{ opts.youKnowCount }</span></span>
- </nav>
- <div class="users" v-if="!fetching && users.length != 0">
- <mk-user-preview each={ users } user={ this }/>
- </div>
- <button class="more" v-if="!fetching && next != null" @click="more" disabled={ moreFetching }>
- <span v-if="!moreFetching">%i18n:mobile.tags.mk-users-list.load-more%</span>
- <span v-if="moreFetching">%i18n:common.loading%<mk-ellipsis/></span></button>
- <p class="no" v-if="!fetching && users.length == 0">{ opts.noUsers }</p>
- <p class="fetching" v-if="fetching">%fa:spinner .pulse .fw%%i18n:common.loading%<mk-ellipsis/></p>
- <style lang="stylus" scoped>
- :scope
- display block
-
- > nav
- display flex
- justify-content center
- margin 0 auto
- max-width 600px
- border-bottom solid 1px rgba(0, 0, 0, 0.2)
-
- > span
- display block
- flex 1 1
- text-align center
- line-height 52px
- font-size 14px
- color #657786
- border-bottom solid 2px transparent
-
- &[data-is-active]
- font-weight bold
- color $theme-color
- border-color $theme-color
-
- > span
- display inline-block
- margin-left 4px
- padding 2px 5px
- font-size 12px
- line-height 1
- color #fff
- background rgba(0, 0, 0, 0.3)
- border-radius 20px
-
- > .users
- margin 8px auto
- max-width 500px
- width calc(100% - 16px)
- background #fff
- border-radius 8px
- box-shadow 0 0 0 1px rgba(0, 0, 0, 0.2)
-
- @media (min-width 500px)
- margin 16px auto
- width calc(100% - 32px)
-
- > *
- border-bottom solid 1px rgba(0, 0, 0, 0.05)
-
- > .no
- margin 0
- padding 16px
- text-align center
- color #aaa
-
- > .fetching
- margin 0
- padding 16px
- text-align center
- color #aaa
-
- > [data-fa]
- margin-right 4px
-
- </style>
- <script lang="typescript">
- this.mixin('i');
-
- this.limit = 30;
- this.mode = 'all';
-
- this.fetching = true;
- this.moreFetching = false;
-
- this.on('mount', () => {
- this.fetch(() => this.$emit('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();
- });
- };
-
- this.more = () => {
- this.update({
- moreFetching: true
- });
- this.opts.fetch(this.mode == 'iknow', this.limit, this.next, obj => {
- this.update({
- moreFetching: false,
- users: this.users.concat(obj.users),
- next: obj.next
- });
- });
- };
-
- this.setMode = mode => {
- this.update({
- mode: mode
- });
- this.fetch();
- };
- </script>
-</mk-users-list>
diff --git a/src/web/app/mobile/views/components/user-followers.vue b/src/web/app/mobile/views/components/user-followers.vue
new file mode 100644
index 0000000000..22629af9df
--- /dev/null
+++ b/src/web/app/mobile/views/components/user-followers.vue
@@ -0,0 +1,26 @@
+<template>
+<mk-users-list
+ :fetch="fetch"
+ :count="user.followers_count"
+ :you-know-count="user.followers_you_know_count"
+>
+ %i18n:mobile.tags.mk-user-followers.no-users%
+</mk-users-list>
+</template>
+
+<script lang="ts">
+import Vue from 'vue';
+export default Vue.extend({
+ props: ['user'],
+ methods: {
+ fetch(iknow, limit, cursor, cb) {
+ this.$root.$data.os.api('users/followers', {
+ user_id: this.user.id,
+ iknow: iknow,
+ limit: limit,
+ cursor: cursor ? cursor : undefined
+ }).then(cb);
+ }
+ }
+});
+</script>
diff --git a/src/web/app/mobile/views/components/user-following.vue b/src/web/app/mobile/views/components/user-following.vue
new file mode 100644
index 0000000000..bb739bc4ca
--- /dev/null
+++ b/src/web/app/mobile/views/components/user-following.vue
@@ -0,0 +1,26 @@
+<template>
+<mk-users-list
+ :fetch="fetch"
+ :count="user.following_count"
+ :you-know-count="user.following_you_know_count"
+>
+ %i18n:mobile.tags.mk-user-following.no-users%
+</mk-users-list>
+</template>
+
+<script lang="ts">
+import Vue from 'vue';
+export default Vue.extend({
+ props: ['user'],
+ methods: {
+ fetch(iknow, limit, cursor, cb) {
+ this.$root.$data.os.api('users/following', {
+ user_id: this.user.id,
+ iknow: iknow,
+ limit: limit,
+ cursor: cursor ? cursor : undefined
+ }).then(cb);
+ }
+ }
+});
+</script>
diff --git a/src/web/app/mobile/views/components/users-list.vue b/src/web/app/mobile/views/components/users-list.vue
new file mode 100644
index 0000000000..54af40ec48
--- /dev/null
+++ b/src/web/app/mobile/views/components/users-list.vue
@@ -0,0 +1,126 @@
+<template>
+<div class="mk-users-list">
+ <nav>
+ <span :data-is-active="mode == 'all'" @click="mode = 'all'">%i18n:mobile.tags.mk-users-list.all%<span>{{ count }}</span></span>
+ <span v-if="$root.$data.os.isSignedIn && youKnowCount" :data-is-active="mode == 'iknow'" @click="mode = 'iknow'">%i18n:mobile.tags.mk-users-list.known%<span>{{ youKnowCount }}</span></span>
+ </nav>
+ <div class="users" v-if="!fetching && users.length != 0">
+ <mk-user-preview v-for="u in users" :user="u" :key="u.id"/>
+ </div>
+ <button class="more" v-if="!fetching && next != null" @click="more" :disabled="moreFetching">
+ <span v-if="!moreFetching">%i18n:mobile.tags.mk-users-list.load-more%</span>
+ <span v-if="moreFetching">%i18n:common.loading%<mk-ellipsis/></span>
+ </button>
+ <p class="no" v-if="!fetching && users.length == 0">
+ <slot></slot>
+ </p>
+ <p class="fetching" v-if="fetching">%fa:spinner .pulse .fw%%i18n:common.loading%<mk-ellipsis/></p>
+</div>
+</template>
+
+<script lang="ts">
+import Vue from 'vue';
+export default Vue.extend({
+ props: ['fetch', 'count', 'youKnowCount'],
+ data() {
+ return {
+ limit: 30,
+ mode: 'all',
+ fetching: true,
+ moreFetching: false,
+ users: [],
+ next: null
+ };
+ },
+ mounted() {
+ this._fetch(() => {
+ this.$emit('loaded');
+ });
+ },
+ methods: {
+ _fetch(cb) {
+ this.fetching = true;
+ this.fetch(this.mode == 'iknow', this.limit, null, obj => {
+ this.fetching = false;
+ this.users = obj.users;
+ this.next = obj.next;
+ if (cb) cb();
+ });
+ },
+ more() {
+ this.moreFetching = true;
+ this.fetch(this.mode == 'iknow', this.limit, this.next, obj => {
+ this.moreFetching = false;
+ this.users = this.users.concat(obj.users);
+ this.next = obj.next;
+ });
+ }
+ }
+});
+</script>
+
+<style lang="stylus" scoped>
+.mk-users-list
+
+ > nav
+ display flex
+ justify-content center
+ margin 0 auto
+ max-width 600px
+ border-bottom solid 1px rgba(0, 0, 0, 0.2)
+
+ > span
+ display block
+ flex 1 1
+ text-align center
+ line-height 52px
+ font-size 14px
+ color #657786
+ border-bottom solid 2px transparent
+
+ &[data-is-active]
+ font-weight bold
+ color $theme-color
+ border-color $theme-color
+
+ > span
+ display inline-block
+ margin-left 4px
+ padding 2px 5px
+ font-size 12px
+ line-height 1
+ color #fff
+ background rgba(0, 0, 0, 0.3)
+ border-radius 20px
+
+ > .users
+ margin 8px auto
+ max-width 500px
+ width calc(100% - 16px)
+ background #fff
+ border-radius 8px
+ box-shadow 0 0 0 1px rgba(0, 0, 0, 0.2)
+
+ @media (min-width 500px)
+ margin 16px auto
+ width calc(100% - 32px)
+
+ > *
+ border-bottom solid 1px rgba(0, 0, 0, 0.05)
+
+ > .no
+ margin 0
+ padding 16px
+ text-align center
+ color #aaa
+
+ > .fetching
+ margin 0
+ padding 16px
+ text-align center
+ color #aaa
+
+ > [data-fa]
+ margin-right 4px
+
+</style>