chore(client): tweak ui
This commit is contained in:
parent
1bec974fe6
commit
4c2cd3c8d5
|
@ -112,9 +112,9 @@ function createDoughnut(chartEl, tooltip, data) {
|
||||||
labels: data.map(x => x.name),
|
labels: data.map(x => x.name),
|
||||||
datasets: [{
|
datasets: [{
|
||||||
backgroundColor: data.map(x => x.color),
|
backgroundColor: data.map(x => x.color),
|
||||||
borderWidth: 0,
|
borderColor: getComputedStyle(document.documentElement).getPropertyValue('--panel'),
|
||||||
spacing: 4,
|
borderWidth: 2,
|
||||||
hoverOffset: 4,
|
hoverOffset: 0,
|
||||||
data: data.map(x => x.value),
|
data: data.map(x => x.value),
|
||||||
}],
|
}],
|
||||||
},
|
},
|
||||||
|
|
|
@ -64,9 +64,9 @@ onMounted(() => {
|
||||||
labels: props.data.map(x => x.name),
|
labels: props.data.map(x => x.name),
|
||||||
datasets: [{
|
datasets: [{
|
||||||
backgroundColor: props.data.map(x => x.color),
|
backgroundColor: props.data.map(x => x.color),
|
||||||
borderWidth: 0,
|
borderColor: getComputedStyle(document.documentElement).getPropertyValue('--panel'),
|
||||||
spacing: 4,
|
borderWidth: 2,
|
||||||
hoverOffset: 4,
|
hoverOffset: 0,
|
||||||
data: props.data.map(x => x.value),
|
data: props.data.map(x => x.value),
|
||||||
}],
|
}],
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
<template>
|
<template>
|
||||||
<div>
|
<MkStickyContainer>
|
||||||
|
<template #header><MkPageHeader :actions="headerActions" :tabs="headerTabs"/></template>
|
||||||
|
<MkSpacer :content-max="800" :margin-min="16" :margin-max="32">
|
||||||
<FormSuspense :p="init">
|
<FormSuspense :p="init">
|
||||||
<FormInput v-model="title">
|
<FormInput v-model="title">
|
||||||
<template #label>{{ $ts.title }}</template>
|
<template #label>{{ $ts.title }}</template>
|
||||||
|
@ -24,7 +26,8 @@
|
||||||
|
|
||||||
<FormButton v-if="postId" danger @click="del"><i class="fas fa-trash-alt"></i> {{ $ts.delete }}</FormButton>
|
<FormButton v-if="postId" danger @click="del"><i class="fas fa-trash-alt"></i> {{ $ts.delete }}</FormButton>
|
||||||
</FormSuspense>
|
</FormSuspense>
|
||||||
</div>
|
</MkSpacer>
|
||||||
|
</MkStickyContainer>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
|
@ -71,7 +74,7 @@ async function save() {
|
||||||
fileIds: files.map(file => file.id),
|
fileIds: files.map(file => file.id),
|
||||||
isSensitive: isSensitive,
|
isSensitive: isSensitive,
|
||||||
});
|
});
|
||||||
mainRouter.push(`/gallery/${props.postId}`);
|
router.push(`/gallery/${props.postId}`);
|
||||||
} else {
|
} else {
|
||||||
const created = await os.apiWithDialog('gallery/posts/create', {
|
const created = await os.apiWithDialog('gallery/posts/create', {
|
||||||
title: title,
|
title: title,
|
||||||
|
@ -92,7 +95,7 @@ async function del() {
|
||||||
await os.apiWithDialog('gallery/posts/delete', {
|
await os.apiWithDialog('gallery/posts/delete', {
|
||||||
postId: props.postId,
|
postId: props.postId,
|
||||||
});
|
});
|
||||||
mainRouter.push('/gallery');
|
router.push('/gallery');
|
||||||
}
|
}
|
||||||
|
|
||||||
watch(() => props.postId, () => {
|
watch(() => props.postId, () => {
|
||||||
|
@ -113,9 +116,11 @@ const headerTabs = $computed(() => []);
|
||||||
definePageMetadata(computed(() => props.postId ? {
|
definePageMetadata(computed(() => props.postId ? {
|
||||||
title: i18n.ts.edit,
|
title: i18n.ts.edit,
|
||||||
icon: 'fas fa-pencil-alt',
|
icon: 'fas fa-pencil-alt',
|
||||||
|
bg: 'var(--bg)',
|
||||||
} : {
|
} : {
|
||||||
title: i18n.ts.postToGallery,
|
title: i18n.ts.postToGallery,
|
||||||
icon: 'fas fa-pencil-alt',
|
icon: 'fas fa-pencil-alt',
|
||||||
|
bg: 'var(--bg)',
|
||||||
}));
|
}));
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -1,14 +1,8 @@
|
||||||
<template>
|
<template>
|
||||||
<MkStickyContainer>
|
<MkStickyContainer>
|
||||||
<template #header><MkPageHeader :actions="headerActions" :tabs="headerTabs"/></template>
|
<template #header><MkPageHeader v-model:tab="tab" :actions="headerActions" :tabs="headerTabs"/></template>
|
||||||
<MkSpacer :content-max="1400">
|
<MkSpacer :content-max="1400">
|
||||||
<div class="_root">
|
<div class="_root">
|
||||||
<MkTab v-if="$i" v-model="tab">
|
|
||||||
<option value="explore"><i class="fas fa-icons"></i> {{ $ts.gallery }}</option>
|
|
||||||
<option value="liked"><i class="fas fa-heart"></i> {{ $ts._gallery.liked }}</option>
|
|
||||||
<option value="my"><i class="fas fa-edit"></i> {{ $ts._gallery.my }}</option>
|
|
||||||
</MkTab>
|
|
||||||
|
|
||||||
<div v-if="tab === 'explore'">
|
<div v-if="tab === 'explore'">
|
||||||
<MkFolder class="_gap">
|
<MkFolder class="_gap">
|
||||||
<template #header><i class="fas fa-clock"></i>{{ $ts.recentPosts }}</template>
|
<template #header><i class="fas fa-clock"></i>{{ $ts.recentPosts }}</template>
|
||||||
|
@ -60,6 +54,9 @@ import number from '@/filters/number';
|
||||||
import * as os from '@/os';
|
import * as os from '@/os';
|
||||||
import { definePageMetadata } from '@/scripts/page-metadata';
|
import { definePageMetadata } from '@/scripts/page-metadata';
|
||||||
import { i18n } from '@/i18n';
|
import { i18n } from '@/i18n';
|
||||||
|
import { useRouter } from '@/router';
|
||||||
|
|
||||||
|
const router = useRouter();
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
tag?: string;
|
tag?: string;
|
||||||
|
@ -100,9 +97,27 @@ watch(() => props.tag, () => {
|
||||||
if (tagsRef) tagsRef.tags.toggleContent(props.tag == null);
|
if (tagsRef) tagsRef.tags.toggleContent(props.tag == null);
|
||||||
});
|
});
|
||||||
|
|
||||||
const headerActions = $computed(() => []);
|
const headerActions = $computed(() => [{
|
||||||
|
icon: 'fas fa-plus',
|
||||||
|
text: i18n.ts.create,
|
||||||
|
handler: () => {
|
||||||
|
router.push('/gallery/new');
|
||||||
|
},
|
||||||
|
}]);
|
||||||
|
|
||||||
const headerTabs = $computed(() => []);
|
const headerTabs = $computed(() => [{
|
||||||
|
key: 'explore',
|
||||||
|
title: i18n.ts.gallery,
|
||||||
|
icon: 'fas fa-icons',
|
||||||
|
}, {
|
||||||
|
key: 'liked',
|
||||||
|
title: i18n.ts._gallery.liked,
|
||||||
|
icon: 'fas fa-heart',
|
||||||
|
}, {
|
||||||
|
key: 'my',
|
||||||
|
title: i18n.ts._gallery.my,
|
||||||
|
icon: 'fas fa-edit',
|
||||||
|
}]);
|
||||||
|
|
||||||
definePageMetadata({
|
definePageMetadata({
|
||||||
title: i18n.ts.gallery,
|
title: i18n.ts.gallery,
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="_root">
|
<MkStickyContainer>
|
||||||
|
<template #header><MkPageHeader :actions="headerActions" :tabs="headerTabs"/></template>
|
||||||
|
<MkSpacer :content-max="1000" :margin-min="16" :margin-max="32">
|
||||||
|
<div class="_root">
|
||||||
<transition :name="$store.state.animation ? 'fade' : ''" mode="out-in">
|
<transition :name="$store.state.animation ? 'fade' : ''" mode="out-in">
|
||||||
<div v-if="post" class="rkxwuolj">
|
<div v-if="post" class="rkxwuolj">
|
||||||
<div class="files">
|
<div class="files">
|
||||||
|
@ -46,7 +49,9 @@
|
||||||
<MkError v-else-if="error" @retry="fetch()"/>
|
<MkError v-else-if="error" @retry="fetch()"/>
|
||||||
<MkLoading v-else/>
|
<MkLoading v-else/>
|
||||||
</transition>
|
</transition>
|
||||||
</div>
|
</div>
|
||||||
|
</MkSpacer>
|
||||||
|
</MkStickyContainer>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
|
@ -133,23 +138,18 @@ function edit() {
|
||||||
|
|
||||||
watch(() => props.postId, fetchPost, { immediate: true });
|
watch(() => props.postId, fetchPost, { immediate: true });
|
||||||
|
|
||||||
const headerActions = $computed(() => []);
|
const headerActions = $computed(() => [{
|
||||||
|
icon: 'fas fa-pencil-alt',
|
||||||
|
text: i18n.ts.edit,
|
||||||
|
handler: edit,
|
||||||
|
}]);
|
||||||
|
|
||||||
const headerTabs = $computed(() => []);
|
const headerTabs = $computed(() => []);
|
||||||
|
|
||||||
definePageMetadata(computed(() => post ? {
|
definePageMetadata(computed(() => post ? {
|
||||||
title: post.title,
|
title: post.title,
|
||||||
avatar: post.user,
|
avatar: post.user,
|
||||||
path: `/gallery/${post.id}`,
|
bg: 'var(--bg)',
|
||||||
share: {
|
|
||||||
title: post.title,
|
|
||||||
text: post.description,
|
|
||||||
},
|
|
||||||
actions: [{
|
|
||||||
icon: 'fas fa-pencil-alt',
|
|
||||||
text: i18n.ts.edit,
|
|
||||||
handler: edit,
|
|
||||||
}],
|
|
||||||
} : null));
|
} : null));
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -8,36 +8,24 @@
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts" setup>
|
||||||
import { computed, defineComponent } from 'vue';
|
import { computed } from 'vue';
|
||||||
|
import * as misskey from 'misskey-js';
|
||||||
import MkGalleryPostPreview from '@/components/gallery-post-preview.vue';
|
import MkGalleryPostPreview from '@/components/gallery-post-preview.vue';
|
||||||
import MkPagination from '@/components/ui/pagination.vue';
|
import MkPagination from '@/components/ui/pagination.vue';
|
||||||
|
|
||||||
export default defineComponent({
|
const props = withDefaults(defineProps<{
|
||||||
components: {
|
user: misskey.entities.User;
|
||||||
MkPagination,
|
}>(), {
|
||||||
MkGalleryPostPreview,
|
});
|
||||||
},
|
|
||||||
|
|
||||||
props: {
|
const pagination = {
|
||||||
user: {
|
|
||||||
type: Object,
|
|
||||||
required: true
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
pagination: {
|
|
||||||
endpoint: 'users/gallery/posts' as const,
|
endpoint: 'users/gallery/posts' as const,
|
||||||
limit: 6,
|
limit: 6,
|
||||||
params: computed(() => ({
|
params: computed(() => ({
|
||||||
userId: this.user.id
|
userId: props.user.id,
|
||||||
})),
|
})),
|
||||||
},
|
};
|
||||||
};
|
|
||||||
},
|
|
||||||
});
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
|
Loading…
Reference in New Issue