Improve Page
* ページをピン留めできるように * デッキでカラム内でページを見れるように
This commit is contained in:
@ -49,7 +49,7 @@ export default Vue.extend({
|
||||
<style lang="stylus" scoped>
|
||||
.kudkigyw
|
||||
display inline-block
|
||||
min-width 300px
|
||||
min-width 200px
|
||||
max-width 450px
|
||||
margin 8px 0
|
||||
</style>
|
@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<div v-if="page" class="iroscrza" :class="{ shadow: $store.state.device.useShadow, round: $store.state.device.roundedCorners, center: page.alignCenter }" :style="{ fontFamily: page.font }" :key="path">
|
||||
<header>
|
||||
<div class="iroscrza" :class="{ shadow: $store.state.device.useShadow, round: $store.state.device.roundedCorners, center: page.alignCenter }" :style="{ fontFamily: page.font }">
|
||||
<header v-if="showTitle">
|
||||
<div class="title">{{ page.title }}</div>
|
||||
</header>
|
||||
|
||||
@ -8,9 +8,13 @@
|
||||
<x-block v-for="child in page.content" :value="child" @input="v => updateBlock(v)" :page="page" :script="script" :key="child.id" :h="2"/>
|
||||
</div>
|
||||
|
||||
<footer>
|
||||
<footer v-if="showFooter">
|
||||
<small>@{{ page.user.username }}</small>
|
||||
<router-link v-if="$store.getters.isSignedIn && $store.state.i.id === page.userId" :to="`/i/pages/edit/${page.id}`">{{ $t('edit-this-page') }}</router-link>
|
||||
<template v-if="$store.getters.isSignedIn && $store.state.i.id === page.userId">
|
||||
<router-link :to="`/i/pages/edit/${page.id}`">{{ $t('edit-this-page') }}</router-link>
|
||||
<a v-if="$store.state.i.pinnedPageId === page.id" @click="pin(false)">{{ $t('unpin-this-page') }}</a>
|
||||
<a v-else @click="pin(true)">{{ $t('pin-this-page') }}</a>
|
||||
</template>
|
||||
<router-link :to="`./${page.name}/view-source`">{{ $t('view-source') }}</router-link>
|
||||
<div class="like">
|
||||
<button @click="unlike()" v-if="page.isLiked" :title="$t('unlike')"><fa :icon="faHeartS"/></button>
|
||||
@ -25,7 +29,7 @@
|
||||
import Vue from 'vue';
|
||||
import i18n from '../../../../i18n';
|
||||
import { faHeart as faHeartS } from '@fortawesome/free-solid-svg-icons';
|
||||
import { faHeart, faStickyNote } from '@fortawesome/free-regular-svg-icons';
|
||||
import { faHeart } from '@fortawesome/free-regular-svg-icons';
|
||||
import XBlock from './page.block.vue';
|
||||
import { ASEvaluator } from '../../../../../../misc/aiscript/evaluator';
|
||||
import { collectPageVars } from '../../../scripts/collect-page-vars';
|
||||
@ -69,64 +73,43 @@ export default Vue.extend({
|
||||
},
|
||||
|
||||
props: {
|
||||
pageName: {
|
||||
type: String,
|
||||
page: {
|
||||
type: Object,
|
||||
required: true
|
||||
},
|
||||
username: {
|
||||
type: String,
|
||||
required: true
|
||||
showTitle: {
|
||||
type: Boolean,
|
||||
required: false,
|
||||
default: true
|
||||
},
|
||||
showFooter: {
|
||||
type: Boolean,
|
||||
required: false,
|
||||
default: false
|
||||
},
|
||||
},
|
||||
|
||||
data() {
|
||||
return {
|
||||
page: null,
|
||||
script: null,
|
||||
faHeartS, faHeart
|
||||
};
|
||||
},
|
||||
|
||||
computed: {
|
||||
path(): string {
|
||||
return this.username + '/' + this.pageName;
|
||||
}
|
||||
},
|
||||
|
||||
watch: {
|
||||
path() {
|
||||
this.fetch();
|
||||
}
|
||||
},
|
||||
|
||||
created() {
|
||||
this.fetch();
|
||||
const pageVars = this.getPageVars();
|
||||
this.script = new Script(this.page, new ASEvaluator(this.page.variables, pageVars, {
|
||||
randomSeed: Math.random(),
|
||||
user: this.page.user,
|
||||
visitor: this.$store.state.i,
|
||||
page: this.page,
|
||||
url: url
|
||||
}), e => {
|
||||
console.dir(e);
|
||||
});
|
||||
},
|
||||
|
||||
methods: {
|
||||
fetch() {
|
||||
this.$root.api('pages/show', {
|
||||
name: this.pageName,
|
||||
username: this.username,
|
||||
}).then(page => {
|
||||
this.page = page;
|
||||
this.$emit('init', {
|
||||
title: this.page.title,
|
||||
icon: faStickyNote
|
||||
});
|
||||
const pageVars = this.getPageVars();
|
||||
this.script = new Script(this.page, new ASEvaluator(this.page.variables, pageVars, {
|
||||
randomSeed: Math.random(),
|
||||
user: page.user,
|
||||
visitor: this.$store.state.i,
|
||||
page: page,
|
||||
url: url
|
||||
}), e => {
|
||||
console.dir(e);
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
getPageVars() {
|
||||
return collectPageVars(this.page.content);
|
||||
},
|
||||
@ -147,6 +130,17 @@ export default Vue.extend({
|
||||
this.page.isLiked = false;
|
||||
this.page.likedCount--;
|
||||
});
|
||||
},
|
||||
|
||||
pin(pin) {
|
||||
this.$root.api('i/update', {
|
||||
pinnedPageId: pin ? this.page.id : null,
|
||||
}).then(() => {
|
||||
this.$root.dialog({
|
||||
type: 'success',
|
||||
splash: true
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
69
src/client/app/common/views/deck/deck.page-column.vue
Normal file
69
src/client/app/common/views/deck/deck.page-column.vue
Normal file
@ -0,0 +1,69 @@
|
||||
<template>
|
||||
<x-column>
|
||||
<template #header>
|
||||
<fa :icon="faStickyNote"/>{{ page ? page.name : '' }}
|
||||
</template>
|
||||
|
||||
<div v-if="page">
|
||||
<x-page :page="page" :key="page.id"/>
|
||||
</div>
|
||||
</x-column>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import Vue from 'vue';
|
||||
import { faStickyNote } from '@fortawesome/free-regular-svg-icons';
|
||||
import i18n from '../../../i18n';
|
||||
import XColumn from './deck.column.vue';
|
||||
import XPage from '../../../common/views/components/page/page.vue';
|
||||
|
||||
export default Vue.extend({
|
||||
i18n: i18n(),
|
||||
|
||||
components: {
|
||||
XColumn,
|
||||
XPage
|
||||
},
|
||||
|
||||
props: {
|
||||
pageName: {
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
username: {
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
},
|
||||
|
||||
data() {
|
||||
return {
|
||||
page: null,
|
||||
faStickyNote
|
||||
};
|
||||
},
|
||||
|
||||
watch: {
|
||||
$route: 'fetch'
|
||||
},
|
||||
|
||||
created() {
|
||||
this.fetch();
|
||||
},
|
||||
|
||||
methods: {
|
||||
fetch() {
|
||||
this.$root.api('pages/show', {
|
||||
name: this.pageName,
|
||||
username: this.username,
|
||||
}).then(page => {
|
||||
this.page = page;
|
||||
this.$emit('init', {
|
||||
title: this.page.title,
|
||||
icon: faStickyNote
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
@ -1,5 +1,11 @@
|
||||
<template>
|
||||
<div>
|
||||
<ui-container v-if="user.pinnedPage" :body-togglable="true">
|
||||
<template #header><fa icon="thumbtack"/> {{ $t('pinned-page') }}</template>
|
||||
<div>
|
||||
<x-page :page="user.pinnedPage" :key="user.pinnedPage.id" :show-title="!user.pinnedPage.hideTitleWhenPinned"/>
|
||||
</div>
|
||||
</ui-container>
|
||||
<ui-container v-if="user.pinnedNotes && user.pinnedNotes.length > 0" :body-togglable="true">
|
||||
<template #header><fa icon="thumbtack"/> {{ $t('pinned-notes') }}</template>
|
||||
<div>
|
||||
@ -48,6 +54,7 @@ export default Vue.extend({
|
||||
|
||||
components: {
|
||||
XNotes,
|
||||
XPage: () => import('../../../common/views/components/page/page.vue').then(m => m.default),
|
||||
},
|
||||
|
||||
props: {
|
||||
|
@ -35,6 +35,8 @@
|
||||
<option value="sans-serif">{{ $t('fontSansSerif') }}</option>
|
||||
</ui-select>
|
||||
|
||||
<ui-switch v-model="hideTitleWhenPinned">{{ $t('hide-title-when-pinned') }}</ui-switch>
|
||||
|
||||
<div class="eyeCatch">
|
||||
<ui-button v-if="eyeCatchingImageId == null && !readonly" @click="setEyeCatchingImage()"><fa :icon="faPlus"/> {{ $t('set-eye-catching-image') }}</ui-button>
|
||||
<div v-else-if="eyeCatchingImage">
|
||||
@ -140,6 +142,7 @@ export default Vue.extend({
|
||||
font: 'sans-serif',
|
||||
content: [],
|
||||
alignCenter: false,
|
||||
hideTitleWhenPinned: false,
|
||||
variables: [],
|
||||
aiScript: null,
|
||||
showOptions: false,
|
||||
@ -192,6 +195,7 @@ export default Vue.extend({
|
||||
this.currentName = this.page.name;
|
||||
this.summary = this.page.summary;
|
||||
this.font = this.page.font;
|
||||
this.hideTitleWhenPinned = this.page.hideTitleWhenPinned;
|
||||
this.alignCenter = this.page.alignCenter;
|
||||
this.content = this.page.content;
|
||||
this.variables = this.page.variables;
|
||||
@ -223,6 +227,7 @@ export default Vue.extend({
|
||||
name: this.name.trim(),
|
||||
summary: this.summary,
|
||||
font: this.font,
|
||||
hideTitleWhenPinned: this.hideTitleWhenPinned,
|
||||
alignCenter: this.alignCenter,
|
||||
content: this.content,
|
||||
variables: this.variables,
|
||||
@ -240,6 +245,7 @@ export default Vue.extend({
|
||||
name: this.name.trim(),
|
||||
summary: this.summary,
|
||||
font: this.font,
|
||||
hideTitleWhenPinned: this.hideTitleWhenPinned,
|
||||
alignCenter: this.alignCenter,
|
||||
content: this.content,
|
||||
variables: this.variables,
|
||||
|
63
src/client/app/common/views/pages/page.vue
Normal file
63
src/client/app/common/views/pages/page.vue
Normal file
@ -0,0 +1,63 @@
|
||||
<template>
|
||||
<x-page v-if="page" :page="page" :key="page.id" :show-footer="true"/>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import Vue from 'vue';
|
||||
import { faStickyNote } from '@fortawesome/free-regular-svg-icons';
|
||||
import XPage from '../components/page/page.vue';
|
||||
|
||||
export default Vue.extend({
|
||||
components: {
|
||||
XPage
|
||||
},
|
||||
|
||||
props: {
|
||||
pageName: {
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
username: {
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
},
|
||||
|
||||
data() {
|
||||
return {
|
||||
page: null,
|
||||
};
|
||||
},
|
||||
|
||||
computed: {
|
||||
path(): string {
|
||||
return this.username + '/' + this.pageName;
|
||||
}
|
||||
},
|
||||
|
||||
watch: {
|
||||
path() {
|
||||
this.fetch();
|
||||
}
|
||||
},
|
||||
|
||||
created() {
|
||||
this.fetch();
|
||||
},
|
||||
|
||||
methods: {
|
||||
fetch() {
|
||||
this.$root.api('pages/show', {
|
||||
name: this.pageName,
|
||||
username: this.username,
|
||||
}).then(page => {
|
||||
this.page = page;
|
||||
this.$emit('init', {
|
||||
title: this.page.title,
|
||||
icon: faStickyNote
|
||||
});
|
||||
});
|
||||
},
|
||||
}
|
||||
});
|
||||
</script>
|
@ -148,6 +148,7 @@ init(async (launch, os) => {
|
||||
{ path: '/i/groups', component: DeckColumn, props: route => ({ component: () => import('../common/views/pages/user-groups.vue').then(m => m.default) }) },
|
||||
{ path: '/i/groups/:groupId', component: DeckColumn, props: route => ({ component: () => import('../common/views/pages/user-group-editor.vue').then(m => m.default), groupId: route.params.groupId }) },
|
||||
{ path: '/i/follow-requests', component: DeckColumn, props: route => ({ component: () => import('../common/views/pages/follow-requests.vue').then(m => m.default) }) },
|
||||
{ path: '/@:username/pages/:pageName', name: 'page', props: true, component: () => import('../common/views/deck/deck.page-column.vue').then(m => m.default) },
|
||||
]}
|
||||
: { path: '/', component: MkHome, children: [
|
||||
{ path: '', name: 'index', component: MkHomeTimeline },
|
||||
@ -171,12 +172,11 @@ init(async (launch, os) => {
|
||||
{ path: '/i/follow-requests', component: () => import('../common/views/pages/follow-requests.vue').then(m => m.default) },
|
||||
{ path: '/i/pages/new', component: () => import('../common/views/pages/page-editor/page-editor.vue').then(m => m.default) },
|
||||
{ path: '/i/pages/edit/:pageId', component: () => import('../common/views/pages/page-editor/page-editor.vue').then(m => m.default), props: route => ({ initPageId: route.params.pageId }) },
|
||||
{ path: '/@:user/pages/:page', component: () => import('../common/views/pages/page/page.vue').then(m => m.default), props: route => ({ pageName: route.params.page, username: route.params.user }) },
|
||||
{ path: '/@:user/pages/:page', component: () => import('../common/views/pages/page.vue').then(m => m.default), props: route => ({ pageName: route.params.page, username: route.params.user }) },
|
||||
{ path: '/@:user/pages/:pageName/view-source', component: () => import('../common/views/pages/page-editor/page-editor.vue').then(m => m.default), props: route => ({ initUser: route.params.user, initPageName: route.params.pageName }) },
|
||||
]},
|
||||
{ path: '/i/pages/new', component: () => import('../common/views/pages/page-editor/page-editor.vue').then(m => m.default) },
|
||||
{ path: '/i/pages/edit/:pageId', component: () => import('../common/views/pages/page-editor/page-editor.vue').then(m => m.default), props: route => ({ initPageId: route.params.pageId }) },
|
||||
{ path: '/@:user/pages/:page', component: () => import('../common/views/pages/page/page.vue').then(m => m.default), props: route => ({ pageName: route.params.page, username: route.params.user }) },
|
||||
{ path: '/@:user/pages/:pageName/view-source', component: () => import('../common/views/pages/page-editor/page-editor.vue').then(m => m.default), props: route => ({ initUser: route.params.user, initPageName: route.params.pageName }) },
|
||||
{ path: '/i/messaging/group/:group', component: MkMessagingRoom },
|
||||
{ path: '/i/messaging/:user', component: MkMessagingRoom },
|
||||
|
@ -1,5 +1,6 @@
|
||||
<template>
|
||||
<div class="lnctpgve">
|
||||
<x-page v-if="user.pinnedPage" :page="user.pinnedPage" :key="user.pinnedPage.id" :show-title="!user.pinnedPage.hideTitleWhenPinned"/>
|
||||
<mk-note-detail v-for="n in user.pinnedNotes" :key="n.id" :note="n" :compact="true"/>
|
||||
<!--<mk-calendar @chosen="warp" :start="new Date(user.createdAt)"/>-->
|
||||
<div class="activity">
|
||||
@ -21,13 +22,15 @@ import i18n from '../../../../i18n';
|
||||
import XTimeline from './user.timeline.vue';
|
||||
import XPhotos from './user.photos.vue';
|
||||
import XActivity from '../../../../common/views/components/activity.vue';
|
||||
import XPage from '../../../../common/views/components/page/page.vue';
|
||||
|
||||
export default Vue.extend({
|
||||
i18n: i18n(),
|
||||
components: {
|
||||
XTimeline,
|
||||
XPhotos,
|
||||
XActivity
|
||||
XActivity,
|
||||
XPage,
|
||||
},
|
||||
props: {
|
||||
user: {
|
||||
|
@ -129,6 +129,7 @@ init((launch, os) => {
|
||||
{ path: '/i/groups', component: DeckColumn, props: route => ({ component: () => import('../common/views/pages/user-groups.vue').then(m => m.default) }) },
|
||||
{ path: '/i/groups/:groupId', component: DeckColumn, props: route => ({ component: () => import('../common/views/pages/user-group-editor.vue').then(m => m.default), groupId: route.params.groupId }) },
|
||||
{ path: '/i/follow-requests', component: DeckColumn, props: route => ({ component: () => import('../common/views/pages/follow-requests.vue').then(m => m.default) }) },
|
||||
{ path: '/@:username/pages/:pageName', name: 'page', props: true, component: () => import('../common/views/deck/deck.page-column.vue').then(m => m.default) },
|
||||
]}]
|
||||
: [
|
||||
{ path: '/', name: 'index', component: MkIndex },
|
||||
@ -163,7 +164,7 @@ init((launch, os) => {
|
||||
{ path: 'following', component: () => import('../common/views/pages/following.vue').then(m => m.default) },
|
||||
{ path: 'followers', component: () => import('../common/views/pages/followers.vue').then(m => m.default) },
|
||||
]},
|
||||
{ path: '/@:user/pages/:page', component: UI, props: route => ({ component: () => import('../common/views/pages/page/page.vue').then(m => m.default), pageName: route.params.page, username: route.params.user }) },
|
||||
{ path: '/@:user/pages/:page', component: UI, props: route => ({ component: () => import('../common/views/pages/page.vue').then(m => m.default), pageName: route.params.page, username: route.params.user }) },
|
||||
{ path: '/@:user/pages/:pageName/view-source', component: UI, props: route => ({ component: () => import('../common/views/pages/page-editor/page-editor.vue').then(m => m.default), initUser: route.params.user, initPageName: route.params.pageName }) },
|
||||
{ path: '/notes/:note', component: MkNote },
|
||||
{ path: '/authorize-follow', component: MkFollow },
|
||||
|
@ -1,5 +1,6 @@
|
||||
<template>
|
||||
<div class="wojmldye">
|
||||
<x-page class="page" v-if="user.pinnedPage" :page="user.pinnedPage" :key="user.pinnedPage.id" :show-title="!user.pinnedPage.hideTitleWhenPinned"/>
|
||||
<mk-note-detail class="note" v-for="n in user.pinnedNotes" :key="n.id" :note="n" :compact="true"/>
|
||||
<ui-container :body-togglable="true">
|
||||
<template #header><fa :icon="['far', 'comments']"/>{{ $t('recent-notes') }}</template>
|
||||
@ -33,6 +34,7 @@ export default Vue.extend({
|
||||
components: {
|
||||
XNotes,
|
||||
XPhotos,
|
||||
XPage: () => import('../../../../common/views/components/page/page.vue').then(m => m.default),
|
||||
XActivity: () => import('../../../../common/views/components/activity.vue').then(m => m.default)
|
||||
},
|
||||
props: ['user'],
|
||||
@ -53,6 +55,12 @@ export default Vue.extend({
|
||||
|
||||
<style lang="stylus" scoped>
|
||||
.wojmldye
|
||||
> .page
|
||||
margin 0 0 8px 0
|
||||
|
||||
@media (min-width 500px)
|
||||
margin 0 0 16px 0
|
||||
|
||||
> .note
|
||||
margin 0 0 8px 0
|
||||
|
||||
|
Reference in New Issue
Block a user