mirror of
https://github.com/misskey-dev/misskey.git
synced 2024-12-28 16:38:23 +01:00
feat(frontend): サーバーの表示をアイコンのみに切り替えられるように
This commit is contained in:
parent
70b2a8f72e
commit
2dcd9118e9
7 changed files with 99 additions and 3 deletions
4
locales/index.d.ts
vendored
4
locales/index.d.ts
vendored
|
@ -2922,6 +2922,10 @@ export interface Locale extends ILocale {
|
||||||
* ノートのサーバー情報
|
* ノートのサーバー情報
|
||||||
*/
|
*/
|
||||||
"instanceTicker": string;
|
"instanceTicker": string;
|
||||||
|
/**
|
||||||
|
* サーバー情報をアイコンのみにする
|
||||||
|
*/
|
||||||
|
"instanceIcon": string;
|
||||||
/**
|
/**
|
||||||
* {x}を待っています
|
* {x}を待っています
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -726,6 +726,7 @@ openInSideView: "サイドビューで開く"
|
||||||
defaultNavigationBehaviour: "デフォルトのナビゲーション"
|
defaultNavigationBehaviour: "デフォルトのナビゲーション"
|
||||||
editTheseSettingsMayBreakAccount: "これらの設定を編集するとアカウントが破損する可能性があります。"
|
editTheseSettingsMayBreakAccount: "これらの設定を編集するとアカウントが破損する可能性があります。"
|
||||||
instanceTicker: "ノートのサーバー情報"
|
instanceTicker: "ノートのサーバー情報"
|
||||||
|
instanceIcon: "サーバー情報をアイコンのみにする"
|
||||||
waitingFor: "{x}を待っています"
|
waitingFor: "{x}を待っています"
|
||||||
random: "ランダム"
|
random: "ランダム"
|
||||||
system: "システム"
|
system: "システム"
|
||||||
|
|
54
packages/frontend/src/components/MkInstanceIcon.vue
Normal file
54
packages/frontend/src/components/MkInstanceIcon.vue
Normal file
|
@ -0,0 +1,54 @@
|
||||||
|
<!--
|
||||||
|
SPDX-FileCopyrightText: syuilo and misskey-project
|
||||||
|
SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
-->
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<img v-if="faviconUrl" :class="$style.instanceIcon" :src="faviconUrl"/>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import { computed } from 'vue';
|
||||||
|
import { instance as Instance } from '@/instance.js';
|
||||||
|
import { getProxiedImageUrlNullable } from '@/scripts/media-proxy.js';
|
||||||
|
const props = defineProps<{
|
||||||
|
instance?: {
|
||||||
|
faviconUrl?: string | null
|
||||||
|
}
|
||||||
|
}>();
|
||||||
|
const faviconUrl = computed(() => props.instance ? getProxiedImageUrlNullable(props.instance.faviconUrl, 'preview') : getProxiedImageUrlNullable(Instance.iconUrl, 'preview') ?? '/favicon.ico');
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" module>
|
||||||
|
.instanceIcon {
|
||||||
|
width: 25px;
|
||||||
|
height: 25px;
|
||||||
|
border-radius: 50%;
|
||||||
|
opacity: 0.7;
|
||||||
|
background: var(--MI_THEME-panel);
|
||||||
|
box-shadow: 0 0 0 2px var(--MI_THEME-panel);
|
||||||
|
}
|
||||||
|
|
||||||
|
@container (max-width: 580px) {
|
||||||
|
.instanceIcon {
|
||||||
|
width: 21px;
|
||||||
|
height: 21px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@container (max-width: 450px) {
|
||||||
|
.instanceIcon {
|
||||||
|
width: 19px;
|
||||||
|
height: 19px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@container (max-width: 300px) {
|
||||||
|
.instanceIcon {
|
||||||
|
width: 17px;
|
||||||
|
height: 17px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
|
@ -47,10 +47,10 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||||
</div>
|
</div>
|
||||||
<article v-else :class="$style.article" @contextmenu.stop="onContextmenu">
|
<article v-else :class="$style.article" @contextmenu.stop="onContextmenu">
|
||||||
<div v-if="appearNote.channel" :class="$style.colorBar" :style="{ background: appearNote.channel.color }"></div>
|
<div v-if="appearNote.channel" :class="$style.colorBar" :style="{ background: appearNote.channel.color }"></div>
|
||||||
<MkAvatar :class="$style.avatar" :user="appearNote.user" :link="!mock" :preview="!mock"/>
|
<MkAvatar :class="$style.avatar" :user="appearNote.user" :link="!mock" :preview="!mock" :showInstance="!!showInstanceIcon && !!showTicker"/>
|
||||||
<div :class="$style.main">
|
<div :class="$style.main">
|
||||||
<MkNoteHeader :note="appearNote" :mini="true"/>
|
<MkNoteHeader :note="appearNote" :mini="true"/>
|
||||||
<MkInstanceTicker v-if="showTicker" :instance="appearNote.user.instance"/>
|
<MkInstanceTicker v-if="showTicker && !showInstanceIcon" :instance="appearNote.user.instance"/>
|
||||||
<div style="container-type: inline-size;">
|
<div style="container-type: inline-size;">
|
||||||
<p v-if="appearNote.cw != null" :class="$style.cw">
|
<p v-if="appearNote.cw != null" :class="$style.cw">
|
||||||
<Mfm
|
<Mfm
|
||||||
|
@ -274,6 +274,7 @@ const hardMuted = ref(props.withHardMute && checkMute(appearNote.value, $i?.hard
|
||||||
const translation = ref<Misskey.entities.NotesTranslateResponse | null>(null);
|
const translation = ref<Misskey.entities.NotesTranslateResponse | null>(null);
|
||||||
const translating = ref(false);
|
const translating = ref(false);
|
||||||
const showTicker = (defaultStore.state.instanceTicker === 'always') || (defaultStore.state.instanceTicker === 'remote' && appearNote.value.user.instance);
|
const showTicker = (defaultStore.state.instanceTicker === 'always') || (defaultStore.state.instanceTicker === 'remote' && appearNote.value.user.instance);
|
||||||
|
const showInstanceIcon = ref(defaultStore.state.instanceIcon);
|
||||||
const canRenote = computed(() => ['public', 'home'].includes(appearNote.value.visibility) || (appearNote.value.visibility === 'followers' && appearNote.value.userId === $i?.id));
|
const canRenote = computed(() => ['public', 'home'].includes(appearNote.value.visibility) || (appearNote.value.visibility === 'followers' && appearNote.value.userId === $i?.id));
|
||||||
const renoteCollapsed = ref(
|
const renoteCollapsed = ref(
|
||||||
defaultStore.state.collapseRenotes && isRenote && (
|
defaultStore.state.collapseRenotes && isRenote && (
|
||||||
|
|
|
@ -35,6 +35,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||||
}"
|
}"
|
||||||
alt=""
|
alt=""
|
||||||
>
|
>
|
||||||
|
<MkInstanceIcon v-if="showInstance" :class="$style.instanceicon" :instance="user.instance"/>
|
||||||
</template>
|
</template>
|
||||||
</component>
|
</component>
|
||||||
</template>
|
</template>
|
||||||
|
@ -49,6 +50,7 @@ import { getStaticImageUrl } from '@/scripts/media-proxy.js';
|
||||||
import { acct, userPage } from '@/filters/user.js';
|
import { acct, userPage } from '@/filters/user.js';
|
||||||
import MkUserOnlineIndicator from '@/components/MkUserOnlineIndicator.vue';
|
import MkUserOnlineIndicator from '@/components/MkUserOnlineIndicator.vue';
|
||||||
import { defaultStore } from '@/store.js';
|
import { defaultStore } from '@/store.js';
|
||||||
|
import MkInstanceIcon from '@/components/MkInstanceIcon.vue';
|
||||||
|
|
||||||
const animation = ref(defaultStore.state.animation);
|
const animation = ref(defaultStore.state.animation);
|
||||||
const squareAvatars = ref(defaultStore.state.squareAvatars);
|
const squareAvatars = ref(defaultStore.state.squareAvatars);
|
||||||
|
@ -62,6 +64,7 @@ const props = withDefaults(defineProps<{
|
||||||
indicator?: boolean;
|
indicator?: boolean;
|
||||||
decorations?: (Omit<Misskey.entities.UserDetailed['avatarDecorations'][number], 'id'> & { blink?: boolean; })[];
|
decorations?: (Omit<Misskey.entities.UserDetailed['avatarDecorations'][number], 'id'> & { blink?: boolean; })[];
|
||||||
forceShowDecoration?: boolean;
|
forceShowDecoration?: boolean;
|
||||||
|
showInstance?: boolean;
|
||||||
}>(), {
|
}>(), {
|
||||||
target: null,
|
target: null,
|
||||||
link: false,
|
link: false,
|
||||||
|
@ -69,6 +72,7 @@ const props = withDefaults(defineProps<{
|
||||||
indicator: false,
|
indicator: false,
|
||||||
decorations: undefined,
|
decorations: undefined,
|
||||||
forceShowDecoration: false,
|
forceShowDecoration: false,
|
||||||
|
showInstance: false,
|
||||||
});
|
});
|
||||||
|
|
||||||
const emit = defineEmits<{
|
const emit = defineEmits<{
|
||||||
|
@ -343,4 +347,30 @@ watch(() => props.user.avatarBlurhash, () => {
|
||||||
filter: brightness(1);
|
filter: brightness(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.instanceicon {
|
||||||
|
height: 25px;
|
||||||
|
z-index: 2;
|
||||||
|
position: absolute;
|
||||||
|
left: 0;
|
||||||
|
bottom: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@container (max-width: 580px) {
|
||||||
|
.instanceicon {
|
||||||
|
height: 21px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@container (max-width: 450px) {
|
||||||
|
.instanceicon {
|
||||||
|
height: 19px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@container (max-width: 300px) {
|
||||||
|
.instanceicon {
|
||||||
|
height: 17px;
|
||||||
|
}
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -70,7 +70,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||||
<option value="remote">{{ i18n.ts._instanceTicker.remote }}</option>
|
<option value="remote">{{ i18n.ts._instanceTicker.remote }}</option>
|
||||||
<option value="always">{{ i18n.ts._instanceTicker.always }}</option>
|
<option value="always">{{ i18n.ts._instanceTicker.always }}</option>
|
||||||
</MkSelect>
|
</MkSelect>
|
||||||
|
<MkSwitch v-if="instanceTicker !== 'none'" v-model="instanceIcon">{{ i18n.ts.instanceIcon }}</MkSwitch>
|
||||||
<MkSelect v-model="nsfw">
|
<MkSelect v-model="nsfw">
|
||||||
<template #label>{{ i18n.ts.displayOfSensitiveMedia }}</template>
|
<template #label>{{ i18n.ts.displayOfSensitiveMedia }}</template>
|
||||||
<option value="respect">{{ i18n.ts._displayOfSensitiveMedia.respect }}</option>
|
<option value="respect">{{ i18n.ts._displayOfSensitiveMedia.respect }}</option>
|
||||||
|
@ -304,6 +304,7 @@ const showFixedPostForm = computed(defaultStore.makeGetterSetter('showFixedPostF
|
||||||
const showFixedPostFormInChannel = computed(defaultStore.makeGetterSetter('showFixedPostFormInChannel'));
|
const showFixedPostFormInChannel = computed(defaultStore.makeGetterSetter('showFixedPostFormInChannel'));
|
||||||
const numberOfPageCache = computed(defaultStore.makeGetterSetter('numberOfPageCache'));
|
const numberOfPageCache = computed(defaultStore.makeGetterSetter('numberOfPageCache'));
|
||||||
const instanceTicker = computed(defaultStore.makeGetterSetter('instanceTicker'));
|
const instanceTicker = computed(defaultStore.makeGetterSetter('instanceTicker'));
|
||||||
|
const instanceIcon = computed(defaultStore.makeGetterSetter('instanceIcon'));
|
||||||
const enableInfiniteScroll = computed(defaultStore.makeGetterSetter('enableInfiniteScroll'));
|
const enableInfiniteScroll = computed(defaultStore.makeGetterSetter('enableInfiniteScroll'));
|
||||||
const useReactionPickerForContextMenu = computed(defaultStore.makeGetterSetter('useReactionPickerForContextMenu'));
|
const useReactionPickerForContextMenu = computed(defaultStore.makeGetterSetter('useReactionPickerForContextMenu'));
|
||||||
const squareAvatars = computed(defaultStore.makeGetterSetter('squareAvatars'));
|
const squareAvatars = computed(defaultStore.makeGetterSetter('squareAvatars'));
|
||||||
|
@ -353,6 +354,7 @@ watch([
|
||||||
showNoteActionsOnlyHover,
|
showNoteActionsOnlyHover,
|
||||||
showGapBetweenNotesInTimeline,
|
showGapBetweenNotesInTimeline,
|
||||||
instanceTicker,
|
instanceTicker,
|
||||||
|
instanceIcon,
|
||||||
overridedDeviceKind,
|
overridedDeviceKind,
|
||||||
mediaListWithOneImageAppearance,
|
mediaListWithOneImageAppearance,
|
||||||
reactionsDisplaySize,
|
reactionsDisplaySize,
|
||||||
|
|
|
@ -296,6 +296,10 @@ export const defaultStore = markRaw(new Storage('base', {
|
||||||
where: 'device',
|
where: 'device',
|
||||||
default: 'remote' as 'none' | 'remote' | 'always',
|
default: 'remote' as 'none' | 'remote' | 'always',
|
||||||
},
|
},
|
||||||
|
instanceIcon: {
|
||||||
|
where: 'device',
|
||||||
|
default: false,
|
||||||
|
},
|
||||||
emojiPickerScale: {
|
emojiPickerScale: {
|
||||||
where: 'device',
|
where: 'device',
|
||||||
default: 1,
|
default: 1,
|
||||||
|
|
Loading…
Reference in a new issue