From 3f6a55aabdc87b13ea6ea28beb1ff49bf1d5552f Mon Sep 17 00:00:00 2001 From: syuilo Date: Sun, 25 Apr 2021 15:14:26 +0900 Subject: [PATCH] Tweak UI --- src/client/pages/gallery/post.vue | 14 +-- src/client/pages/page.vue | 199 +++++++++++++++++++++++------- 2 files changed, 163 insertions(+), 50 deletions(-) diff --git a/src/client/pages/gallery/post.vue b/src/client/pages/gallery/post.vue index 86fae99888..9bd102cee2 100644 --- a/src/client/pages/gallery/post.vue +++ b/src/client/pages/gallery/post.vue @@ -19,7 +19,7 @@ {{ post.likedCount }}
- +
@@ -125,6 +125,12 @@ export default defineComponent({ }); }, + shareWithNote() { + os.post({ + initialText: `${this.post.title} ${url}/gallery/${this.post.id}` + }); + }, + like() { os.apiWithDialog('gallery/posts/like', { postId: this.postId, @@ -148,12 +154,6 @@ export default defineComponent({ this.post.likedCount--; }); }, - - createNote() { - os.post({ - initialText: `${this.post.title} ${url}/gallery/${this.post.id}` - }); - } } }); diff --git a/src/client/pages/page.vue b/src/client/pages/page.vue index e43add7b0b..6ee3ee8d26 100644 --- a/src/client/pages/page.vue +++ b/src/client/pages/page.vue @@ -1,35 +1,60 @@ @@ -39,11 +64,20 @@ import XPage from '@client/components/page/page.vue'; import MkButton from '@client/components/ui/button.vue'; import * as os from '@client/os'; import * as symbols from '@client/symbols'; +import { url } from '@client/config'; +import MkFollowButton from '@client/components/follow-button.vue'; +import MkContainer from '@client/components/ui/container.vue'; +import MkPagination from '@client/components/ui/pagination.vue'; +import MkPagePreview from '@client/components/page-preview.vue'; export default defineComponent({ components: { XPage, MkButton, + MkFollowButton, + MkContainer, + MkPagination, + MkPagePreview, }, props: { @@ -69,6 +103,14 @@ export default defineComponent({ }, } : null), page: null, + error: null, + otherPostsPagination: { + endpoint: 'users/pages', + limit: 6, + params: () => ({ + userId: this.page.user.id + }) + }, }; }, @@ -90,11 +132,28 @@ export default defineComponent({ methods: { fetch() { + this.page = null; os.api('pages/show', { name: this.pageName, username: this.username, }).then(page => { this.page = page; + }).catch(e => { + this.error = e; + }); + }, + + share() { + navigator.share({ + title: this.page.title || this.page.name, + text: this.page.summary, + url: `${url}/@${this.page.user.username}/pages/${this.page.name}` + }); + }, + + shareWithNote() { + os.post({ + initialText: `${this.page.title || this.page.name} ${url}/@${this.page.user.username}/pages/${this.page.name}` }); }, @@ -132,6 +191,15 @@ export default defineComponent({