diff options
Diffstat (limited to 'src/client/app/mobile/views')
| -rw-r--r-- | src/client/app/mobile/views/components/ui.nav.vue | 2 | ||||
| -rw-r--r-- | src/client/app/mobile/views/pages/explore.vue | 28 | ||||
| -rw-r--r-- | src/client/app/mobile/views/pages/messaging-room.vue | 23 | ||||
| -rw-r--r-- | src/client/app/mobile/views/pages/messaging.vue | 5 | ||||
| -rw-r--r-- | src/client/app/mobile/views/pages/pages.vue | 29 | ||||
| -rw-r--r-- | src/client/app/mobile/views/pages/received-follow-requests.vue | 69 | ||||
| -rw-r--r-- | src/client/app/mobile/views/pages/ui.vue | 38 | ||||
| -rw-r--r-- | src/client/app/mobile/views/pages/user-list.vue | 48 | ||||
| -rw-r--r-- | src/client/app/mobile/views/pages/user-lists.vue | 35 |
9 files changed, 60 insertions, 217 deletions
diff --git a/src/client/app/mobile/views/components/ui.nav.vue b/src/client/app/mobile/views/components/ui.nav.vue index da9bb518ef..29c744d898 100644 --- a/src/client/app/mobile/views/components/ui.nav.vue +++ b/src/client/app/mobile/views/components/ui.nav.vue @@ -19,7 +19,7 @@ <li><router-link to="/" :data-active="$route.name == 'index'"><i><fa icon="home" fixed-width/></i>{{ $t('timeline') }}<i><fa icon="angle-right"/></i></router-link></li> <li><p @click="showNotifications = true"><i><fa :icon="['far', 'bell']" fixed-width/></i>{{ $t('notifications') }}<i v-if="hasUnreadNotification" class="circle"><fa icon="circle"/></i><i><fa icon="angle-right"/></i></p></li> <li><router-link to="/i/messaging" :data-active="$route.name == 'messaging'"><i><fa :icon="['far', 'comments']" fixed-width/></i>{{ $t('@.messaging') }}<i v-if="hasUnreadMessagingMessage" class="circle"><fa icon="circle"/></i><i><fa icon="angle-right"/></i></router-link></li> - <li v-if="$store.getters.isSignedIn && ($store.state.i.isLocked || $store.state.i.carefulBot)"><router-link to="/i/received-follow-requests" :data-active="$route.name == 'received-follow-requests'"><i><fa :icon="['far', 'envelope']" fixed-width/></i>{{ $t('follow-requests') }}<i v-if="$store.getters.isSignedIn && $store.state.i.pendingReceivedFollowRequestsCount" class="circle"><fa icon="circle"/></i><i><fa icon="angle-right"/></i></router-link></li> + <li v-if="$store.getters.isSignedIn && ($store.state.i.isLocked || $store.state.i.carefulBot)"><router-link to="/i/follow-requests" :data-active="$route.name == 'follow-requests'"><i><fa :icon="['far', 'envelope']" fixed-width/></i>{{ $t('follow-requests') }}<i v-if="$store.getters.isSignedIn && $store.state.i.pendingReceivedFollowRequestsCount" class="circle"><fa icon="circle"/></i><i><fa icon="angle-right"/></i></router-link></li> <li><router-link to="/featured" :data-active="$route.name == 'featured'"><i><fa :icon="faNewspaper" fixed-width/></i>{{ $t('@.featured-notes') }}<i><fa icon="angle-right"/></i></router-link></li> <li><router-link to="/explore" :data-active="$route.name == 'explore' || $route.name == 'explore-tag'"><i><fa :icon="faHashtag" fixed-width/></i>{{ $t('@.explore') }}<i><fa icon="angle-right"/></i></router-link></li> <li><router-link to="/games/reversi" :data-active="$route.name == 'reversi'"><i><fa icon="gamepad" fixed-width/></i>{{ $t('game') }}<i v-if="hasGameInvitation" class="circle"><fa icon="circle"/></i><i><fa icon="angle-right"/></i></router-link></li> diff --git a/src/client/app/mobile/views/pages/explore.vue b/src/client/app/mobile/views/pages/explore.vue deleted file mode 100644 index 111721bc8a..0000000000 --- a/src/client/app/mobile/views/pages/explore.vue +++ /dev/null @@ -1,28 +0,0 @@ -<template> -<mk-ui> - <template #header><span style="margin-right:4px;"><fa :icon="faHashtag"/></span>{{ $t('@.explore') }}</template> - - <main> - <x-explore v-bind="$attrs"/> - </main> -</mk-ui> -</template> - -<script lang="ts"> -import Vue from 'vue'; -import i18n from '../../../i18n'; -import { faHashtag } from '@fortawesome/free-solid-svg-icons'; -import XExplore from '../../../common/views/pages/explore.vue'; - -export default Vue.extend({ - i18n: i18n(''), - components: { - XExplore - }, - data() { - return { - faHashtag - }; - }, -}); -</script> diff --git a/src/client/app/mobile/views/pages/messaging-room.vue b/src/client/app/mobile/views/pages/messaging-room.vue index aa00d48699..7872847127 100644 --- a/src/client/app/mobile/views/pages/messaging-room.vue +++ b/src/client/app/mobile/views/pages/messaging-room.vue @@ -2,9 +2,10 @@ <mk-ui> <template #header> <template v-if="user"><span style="margin-right:4px;"><fa :icon="['far', 'comments']"/></span><mk-user-name :user="user"/></template> + <template v-else-if="group"><span style="margin-right:4px;"><fa :icon="['far', 'comments']"/></span>{{ group.name }}</template> <template v-else><mk-ellipsis/></template> </template> - <x-messaging-room v-if="!fetching" :user="user" :is-naked="true"/> + <x-messaging-room v-if="!fetching" :user="user" :group="group" :is-naked="true"/> </mk-ui> </template> @@ -22,6 +23,7 @@ export default Vue.extend({ return { fetching: true, user: null, + group: null, unwatchDarkmode: null }; }, @@ -48,12 +50,21 @@ export default Vue.extend({ methods: { fetch() { this.fetching = true; - this.$root.api('users/show', parseAcct(this.$route.params.user)).then(user => { - this.user = user; - this.fetching = false; + if (this.$route.params.user) { + this.$root.api('users/show', parseAcct(this.$route.params.user)).then(user => { + this.user = user; + this.fetching = false; - document.title = `${this.$t('@.messaging')}: ${Vue.filter('userName')(this.user)} | ${this.$root.instanceName}`; - }); + document.title = `${this.$t('@.messaging')}: ${Vue.filter('userName')(this.user)} | ${this.$root.instanceName}`; + }); + } else { + this.$root.api('users/groups/show', { groupId: this.$route.params.group }).then(group => { + this.group = group; + this.fetching = false; + + document.title = this.$t('@.messaging') + ': ' + this.group.name; + }); + } } } }); diff --git a/src/client/app/mobile/views/pages/messaging.vue b/src/client/app/mobile/views/pages/messaging.vue index 5ce2f14bbd..ff66ae06e6 100644 --- a/src/client/app/mobile/views/pages/messaging.vue +++ b/src/client/app/mobile/views/pages/messaging.vue @@ -1,7 +1,7 @@ <template> <mk-ui> <template #header><span style="margin-right:4px;"><fa :icon="['far', 'comments']"/></span>{{ $t('@.messaging') }}</template> - <x-messaging @navigate="navigate" :header-top="48"/> + <x-messaging @navigate="navigate" @navigateGroup="navigateGroup" :header-top="48"/> </mk-ui> </template> @@ -21,6 +21,9 @@ export default Vue.extend({ methods: { navigate(user) { (this as any).$router.push(`/i/messaging/${getAcct(user)}`); + }, + navigateGroup(group) { + (this as any).$router.push(`/i/messaging/group/${group.id}`); } } }); diff --git a/src/client/app/mobile/views/pages/pages.vue b/src/client/app/mobile/views/pages/pages.vue deleted file mode 100644 index 2fd134fcd2..0000000000 --- a/src/client/app/mobile/views/pages/pages.vue +++ /dev/null @@ -1,29 +0,0 @@ -<template> -<mk-ui> - <template #header><span style="margin-right:4px;"><fa :icon="faStickyNote"/></span>{{ $t('@.pages') }}</template> - - <main> - <x-pages v-bind="$attrs"/> - </main> -</mk-ui> -</template> - - -<script lang="ts"> -import Vue from 'vue'; -import i18n from '../../../i18n'; -import { faHashtag } from '@fortawesome/free-solid-svg-icons'; -import XPages from '../../../common/views/pages/pages.vue'; - -export default Vue.extend({ - i18n: i18n(''), - components: { - XPages - }, - data() { - return { - faHashtag - }; - }, -}); -</script> diff --git a/src/client/app/mobile/views/pages/received-follow-requests.vue b/src/client/app/mobile/views/pages/received-follow-requests.vue deleted file mode 100644 index abf0c33830..0000000000 --- a/src/client/app/mobile/views/pages/received-follow-requests.vue +++ /dev/null @@ -1,69 +0,0 @@ -<template> -<mk-ui> - <template #header><fa :icon="['far', 'envelope']"/>{{ $t('title') }}</template> - - <main> - <div v-for="req in requests"> - <router-link :key="req.id" :to="req.follower | userPage"> - <mk-user-name :user="req.follower"/> - </router-link> - <span> - <a @click="accept(req.follower)">{{ $t('accept') }}</a>|<a @click="reject(req.follower)">{{ $t('reject') }}</a> - </span> - </div> - </main> -</mk-ui> -</template> - -<script lang="ts"> -import Vue from 'vue'; -import i18n from '../../../i18n'; -import Progress from '../../../common/scripts/loading'; - -export default Vue.extend({ - i18n: i18n('mobile/views/pages/received-follow-requests.vue'), - data() { - return { - fetching: true, - requests: [] - }; - }, - mounted() { - document.title = this.$t('title'); - - Progress.start(); - - this.$root.api('following/requests/list').then(requests => { - this.fetching = false; - this.requests = requests; - - Progress.done(); - }); - }, - methods: { - accept(user) { - this.$root.api('following/requests/accept', { userId: user.id }).then(() => { - this.requests = this.requests.filter(r => r.follower.id != user.id); - }); - }, - reject(user) { - this.$root.api('following/requests/reject', { userId: user.id }).then(() => { - this.requests = this.requests.filter(r => r.follower.id != user.id); - }); - } - } -}); -</script> - -<style lang="stylus" scoped> -main - > div - display flex - padding 16px - border solid 1px var(--faceDivider) - border-radius 4px - - > span - margin 0 0 0 auto - -</style> diff --git a/src/client/app/mobile/views/pages/ui.vue b/src/client/app/mobile/views/pages/ui.vue new file mode 100644 index 0000000000..397ba5df07 --- /dev/null +++ b/src/client/app/mobile/views/pages/ui.vue @@ -0,0 +1,38 @@ +<template> +<mk-ui> + <template #header><span style="margin-right:4px;" v-if="icon"><fa :icon="icon"/></span>{{ title }}</template> + + <main> + <component :is="component" @init="init" v-bind="$attrs"/> + </main> +</mk-ui> +</template> + +<script lang="ts"> +import Vue from 'vue'; + +export default Vue.extend({ + props: { + component: { + required: true + } + }, + + data() { + return { + title: null, + icon: null, + }; + }, + + mounted() { + }, + + methods: { + init(v) { + this.title = v.title; + this.icon = v.icon; + } + } +}); +</script> diff --git a/src/client/app/mobile/views/pages/user-list.vue b/src/client/app/mobile/views/pages/user-list.vue deleted file mode 100644 index 68fd0358c4..0000000000 --- a/src/client/app/mobile/views/pages/user-list.vue +++ /dev/null @@ -1,48 +0,0 @@ -<template> -<mk-ui> - <template #header v-if="!fetching"><fa icon="list"/>{{ list.name }}</template> - - <main v-if="!fetching"> - <x-editor :list="list"/> - </main> -</mk-ui> -</template> - -<script lang="ts"> -import Vue from 'vue'; -import Progress from '../../../common/scripts/loading'; -import XEditor from '../../../common/views/components/user-list-editor.vue'; - -export default Vue.extend({ - components: { - XEditor - }, - data() { - return { - fetching: true, - list: null - }; - }, - watch: { - $route: 'fetch' - }, - created() { - this.fetch(); - }, - methods: { - fetch() { - Progress.start(); - this.fetching = true; - - this.$root.api('users/lists/show', { - listId: this.$route.params.list - }).then(list => { - this.list = list; - this.fetching = false; - - Progress.done(); - }); - } - } -}); -</script> diff --git a/src/client/app/mobile/views/pages/user-lists.vue b/src/client/app/mobile/views/pages/user-lists.vue deleted file mode 100644 index a3e9bd78ba..0000000000 --- a/src/client/app/mobile/views/pages/user-lists.vue +++ /dev/null @@ -1,35 +0,0 @@ -<template> -<mk-ui> - <template #header><fa icon="list"/>{{ $t('title') }}</template> - <template #func><button @click="$refs.lists.add()"><fa icon="plus"/></button></template> - - <x-lists ref="lists" @choosen="choosen"/> -</mk-ui> -</template> - -<script lang="ts"> -import Vue from 'vue'; -import i18n from '../../../i18n'; - -export default Vue.extend({ - i18n: i18n('mobile/views/pages/user-lists.vue'), - data() { - return { - fetching: true, - lists: [] - }; - }, - components: { - XLists: () => import('../../../common/views/components/user-lists.vue').then(m => m.default) - }, - mounted() { - document.title = this.$t('title'); - }, - methods: { - choosen(list) { - if (!list) return; - this.$router.push(`/i/lists/${list.id}`); - } - } -}); -</script> |