ユーザーのページでノートを表示するかハイライトを表示するか決められるようにした

This commit is contained in:
mattyatea 2023-10-07 10:40:08 +09:00
parent 4357c75a44
commit abb79a0b36
5 changed files with 557 additions and 520 deletions

2
locales/index.d.ts vendored
View File

@ -543,6 +543,8 @@ export interface Locale {
"deleteAll": string; "deleteAll": string;
"showFixedPostForm": string; "showFixedPostForm": string;
"showFixedPostFormInChannel": string; "showFixedPostFormInChannel": string;
"FeaturedOrNote": string;
"FeaturedOrNoteInfo": string;
"newNoteRecived": string; "newNoteRecived": string;
"sounds": string; "sounds": string;
"sound": string; "sound": string;

View File

@ -540,6 +540,8 @@ serverLogs: "サーバーログ"
deleteAll: "全て削除" deleteAll: "全て削除"
showFixedPostForm: "タイムライン上部に投稿フォームを表示する" showFixedPostForm: "タイムライン上部に投稿フォームを表示する"
showFixedPostFormInChannel: "タイムライン上部に投稿フォームを表示する(チャンネル)" showFixedPostFormInChannel: "タイムライン上部に投稿フォームを表示する(チャンネル)"
FeaturedOrNote: "ユーザーのページで最新のノートを表示する"
FeaturedOrNoteInfo: "ユーザーのページに行ったときにハイライトか最新のノートを表示するかを選択することができます。 オフでハイライト オンで最新のノート です"
newNoteRecived: "新しいノートがあります" newNoteRecived: "新しいノートがあります"
sounds: "サウンド" sounds: "サウンド"
sound: "サウンド" sound: "サウンド"

View File

@ -30,6 +30,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<MkSwitch v-model="showFixedPostForm">{{ i18n.ts.showFixedPostForm }}</MkSwitch> <MkSwitch v-model="showFixedPostForm">{{ i18n.ts.showFixedPostForm }}</MkSwitch>
<MkSwitch v-model="showFixedPostFormInChannel">{{ i18n.ts.showFixedPostFormInChannel }}</MkSwitch> <MkSwitch v-model="showFixedPostFormInChannel">{{ i18n.ts.showFixedPostFormInChannel }}</MkSwitch>
<MkSwitch v-model="showMediaTimeline">{{ i18n.ts.showMediaTimeline}}<template #caption>{{ i18n.ts.showMediaTimelineInfo }} </template></MkSwitch> <MkSwitch v-model="showMediaTimeline">{{ i18n.ts.showMediaTimeline}}<template #caption>{{ i18n.ts.showMediaTimelineInfo }} </template></MkSwitch>
<MkSwitch v-model="FeaturedOrNote">{{ i18n.ts.FeaturedOrNote}}<template #caption>{{ i18n.ts.FeaturedOrNoteInfo }} </template></MkSwitch>
<MkFolder> <MkFolder>
<template #label>{{ i18n.ts.pinnedList }}</template> <template #label>{{ i18n.ts.pinnedList }}</template>
<!-- 複数ピン止め管理できるようにしたいけどめんどいので一旦ひとつのみ --> <!-- 複数ピン止め管理できるようにしたいけどめんどいので一旦ひとつのみ -->
@ -286,6 +287,7 @@ const enableGamingMode = computed(defaultStore.makeGetterSetter('gamingMode'));
const enableonlyAndWithSave = computed(defaultStore.makeGetterSetter('onlyAndWithSave')); const enableonlyAndWithSave = computed(defaultStore.makeGetterSetter('onlyAndWithSave'));
const showMediaTimeline = computed(defaultStore.makeGetterSetter('showMediaTimeline')); const showMediaTimeline = computed(defaultStore.makeGetterSetter('showMediaTimeline'));
const showVisibilityColor = computed(defaultStore.makeGetterSetter('showVisibilityColor')) const showVisibilityColor = computed(defaultStore.makeGetterSetter('showVisibilityColor'))
const FeaturedOrNote = computed(defaultStore.makeGetterSetter('FeaturedOrNote'))
watch(lang, () => { watch(lang, () => {
miLocalStorage.setItem('lang', lang.value as string); miLocalStorage.setItem('lang', lang.value as string);
miLocalStorage.removeItem('locale'); miLocalStorage.removeItem('locale');
@ -347,6 +349,7 @@ watch([
showMediaTimeline, showMediaTimeline,
showVisibilityColor, showVisibilityColor,
enableonlyAndWithSave, enableonlyAndWithSave,
FeaturedOrNote,
], async () => { ], async () => {
await reloadAsk(); await reloadAsk();
}); });

View File

@ -23,7 +23,8 @@ SPDX-License-Identifier: AGPL-3.0-only
<MkUserName class="name" :user="user" :nowrap="true"/> <MkUserName class="name" :user="user" :nowrap="true"/>
<div class="bottom"> <div class="bottom">
<span class="username"><MkAcct :user="user" :detail="true"/></span> <span class="username"><MkAcct :user="user" :detail="true"/></span>
<span v-if="user.isAdmin" :title="i18n.ts.isAdmin" style="color: var(--badge);"><i class="ti ti-shield"></i></span> <span v-if="user.isAdmin" :title="i18n.ts.isAdmin" style="color: var(--badge);"><i
class="ti ti-shield"></i></span>
<span v-if="user.isLocked" :title="i18n.ts.isLocked"><i class="ti ti-lock"></i></span> <span v-if="user.isLocked" :title="i18n.ts.isLocked"><i class="ti ti-lock"></i></span>
<span v-if="user.isBot" :title="i18n.ts.isBot"><i class="ti ti-robot"></i></span> <span v-if="user.isBot" :title="i18n.ts.isBot"><i class="ti ti-robot"></i></span>
<button v-if="!isEditingMemo && !memoDraft" class="_button add-note-button" @click="showMemoTextarea"> <button v-if="!isEditingMemo && !memoDraft" class="_button add-note-button" @click="showMemoTextarea">
@ -35,7 +36,8 @@ SPDX-License-Identifier: AGPL-3.0-only
<div v-if="$i" class="actions"> <div v-if="$i" class="actions">
<button class="menu _button" @click="menu"><i class="ti ti-dots"></i></button> <button class="menu _button" @click="menu"><i class="ti ti-dots"></i></button>
<MkNotifyButton v-if="$i.id != user.id " :user="user"></MkNotifyButton> <MkNotifyButton v-if="$i.id != user.id " :user="user"></MkNotifyButton>
<MkFollowButton v-if="$i.id != user.id" :user="user" :inline="true" :transparent="false" :full="true" class="koudoku"/> <MkFollowButton v-if="$i.id != user.id" :user="user" :inline="true" :transparent="false" :full="true"
class="koudoku"/>
</div> </div>
</div> </div>
<MkAvatar class="avatar" :user="user" indicator/> <MkAvatar class="avatar" :user="user" indicator/>
@ -43,13 +45,15 @@ SPDX-License-Identifier: AGPL-3.0-only
<MkUserName :user="user" :nowrap="false" class="name"/> <MkUserName :user="user" :nowrap="false" class="name"/>
<div class="bottom"> <div class="bottom">
<span class="username"><MkAcct :user="user" :detail="true"/></span> <span class="username"><MkAcct :user="user" :detail="true"/></span>
<span v-if="user.isAdmin" :title="i18n.ts.isAdmin" style="color: var(--badge);"><i class="ti ti-shield"></i></span> <span v-if="user.isAdmin" :title="i18n.ts.isAdmin" style="color: var(--badge);"><i
class="ti ti-shield"></i></span>
<span v-if="user.isLocked" :title="i18n.ts.isLocked"><i class="ti ti-lock"></i></span> <span v-if="user.isLocked" :title="i18n.ts.isLocked"><i class="ti ti-lock"></i></span>
<span v-if="user.isBot" :title="i18n.ts.isBot"><i class="ti ti-robot"></i></span> <span v-if="user.isBot" :title="i18n.ts.isBot"><i class="ti ti-robot"></i></span>
</div> </div>
</div> </div>
<div v-if="user.roles.length > 0" class="roles"> <div v-if="user.roles.length > 0" class="roles">
<span v-for="role in user.roles" :key="role.id" v-tooltip="role.description" class="role" :style="{ '--color': role.color }"> <span v-for="role in user.roles" :key="role.id" v-tooltip="role.description" class="role"
:style="{ '--color': role.color }">
<MkA v-adaptive-bg :to="`/roles/${role.id}`"> <MkA v-adaptive-bg :to="`/roles/${role.id}`">
<img v-if="role.iconUrl" style="height: 1.3em; vertical-align: -22%;" :src="role.iconUrl"/> <img v-if="role.iconUrl" style="height: 1.3em; vertical-align: -22%;" :src="role.iconUrl"/>
{{ role.name }} {{ role.name }}
@ -57,7 +61,8 @@ SPDX-License-Identifier: AGPL-3.0-only
</span> </span>
</div> </div>
<div v-if="iAmModerator" class="moderationNote"> <div v-if="iAmModerator" class="moderationNote">
<MkTextarea v-if="editModerationNote || (moderationNote != null && moderationNote !== '')" v-model="moderationNote" manualSave> <MkTextarea v-if="editModerationNote || (moderationNote != null && moderationNote !== '')"
v-model="moderationNote" manualSave>
<template #label>{{ i18n.ts.moderationNote }}</template> <template #label>{{ i18n.ts.moderationNote }}</template>
</MkTextarea> </MkTextarea>
<div v-else> <div v-else>
@ -88,11 +93,17 @@ SPDX-License-Identifier: AGPL-3.0-only
</dl> </dl>
<dl v-if="user.birthday" class="field"> <dl v-if="user.birthday" class="field">
<dt class="name"><i class="ti ti-cake ti-fw"></i> {{ i18n.ts.birthday }}</dt> <dt class="name"><i class="ti ti-cake ti-fw"></i> {{ i18n.ts.birthday }}</dt>
<dd class="value">{{ user.birthday.replace('-', '/').replace('-', '/') }} ({{ i18n.t('yearsOld', { age }) }})</dd> <dd class="value">{{ user.birthday.replace('-', '/').replace('-', '/') }} ({{
i18n.t('yearsOld', {age})
}})
</dd>
</dl> </dl>
<dl class="field"> <dl class="field">
<dt class="name"><i class="ti ti-calendar ti-fw"></i> {{ i18n.ts.registeredDate }}</dt> <dt class="name"><i class="ti ti-calendar ti-fw"></i> {{ i18n.ts.registeredDate }}</dt>
<dd class="value">{{ dateString(user.createdAt) }} (<MkTime :time="user.createdAt"/>)</dd> <dd class="value">{{ dateString(user.createdAt) }} (
<MkTime :time="user.createdAt"/>
)
</dd>
</dl> </dl>
</div> </div>
<div v-if="user.fields.length > 0" class="fields"> <div v-if="user.fields.length > 0" class="fields">
@ -102,7 +113,8 @@ SPDX-License-Identifier: AGPL-3.0-only
</dt> </dt>
<dd class="value"> <dd class="value">
<Mfm :text="field.value" :author="user" :i="$i" :colored="false"/> <Mfm :text="field.value" :author="user" :i="$i" :colored="false"/>
<i v-if="user.verifiedLinks.includes(field.value)" v-tooltip:dialog="i18n.ts.verifiedLink" class="ti ti-circle-check" :class="$style.verifiedLink"></i> <i v-if="user.verifiedLinks.includes(field.value)" v-tooltip:dialog="i18n.ts.verifiedLink"
class="ti ti-circle-check" :class="$style.verifiedLink"></i>
</dd> </dd>
</dl> </dl>
</div> </div>
@ -132,11 +144,17 @@ SPDX-License-Identifier: AGPL-3.0-only
<XFiles :key="user.id" :user="user"/> <XFiles :key="user.id" :user="user"/>
<XActivity :key="user.id" :user="user"/> <XActivity :key="user.id" :user="user"/>
</template> </template>
<div v-if="!defaultStore.state.FeaturedOrNote">
<div v-if="!disableNotes"> <div v-if="!disableNotes">
<div style="margin-bottom: 8px;">{{ i18n.ts.featured }}</div> <div style="margin-bottom: 8px;">{{ i18n.ts.featured }}</div>
<MkNotes :class="$style.tl" :noGap="true" :pagination="pagination"/> <MkNotes :class="$style.tl" :noGap="true" :pagination="pagination"/>
</div> </div>
</div> </div>
<div v-else>
<div style="margin-bottom: 8px;">{{ i18n.ts._sfx.note }}</div>
<MkNotes :class="$style.tl" :noGap="true" :pagination="Notes"/>
</div>
</div>
</div> </div>
<div v-if="!narrow" class="sub _gaps" style="container-type: inline-size;"> <div v-if="!narrow" class="sub _gaps" style="container-type: inline-size;">
<XFiles :key="user.id" :user="user"/> <XFiles :key="user.id" :user="user"/>
@ -172,6 +190,7 @@ import { api } from '@/os.js';
import {isFfVisibleForMe} from '@/scripts/isFfVisibleForMe.js'; import {isFfVisibleForMe} from '@/scripts/isFfVisibleForMe.js';
import MkNotifyButton from "@/components/MkNotifyButton.vue"; import MkNotifyButton from "@/components/MkNotifyButton.vue";
import MkRemoteInfoUpdate from "@/components/MkRemoteInfoUpdate.vue"; import MkRemoteInfoUpdate from "@/components/MkRemoteInfoUpdate.vue";
import {defaultStore} from '@/store.js';
function calcAge(birthdate: string): number { function calcAge(birthdate: string): number {
const date = new Date(birthdate); const date = new Date(birthdate);
@ -222,6 +241,13 @@ const pagination = {
userId: props.user.id, userId: props.user.id,
})), })),
}; };
const Notes ={
endpoint: 'users/notes' as const,
limit: 10,
params: computed(() => ({
userId: props.user.id,
})),
}
const style = $computed(() => { const style = $computed(() => {
if (props.user.bannerUrl == null) return {}; if (props.user.bannerUrl == null) return {};

View File

@ -432,6 +432,10 @@ export const defaultStore = markRaw(new Storage('base', {
where: 'device', where: 'device',
default: false, default: false,
}, },
FeaturedOrNote: {
where: 'device',
default: false
}
})); }));
// TODO: 他のタブと永続化されたstateを同期 // TODO: 他のタブと永続化されたstateを同期