mirror of
https://github.com/misskey-dev/misskey.git
synced 2024-12-27 08:10:24 +01:00
fix(frontend): MkAvatar内にMkInstanceIconの内容を含めるように
This commit is contained in:
parent
8c1dfab195
commit
1368f58b96
4 changed files with 32 additions and 69 deletions
|
@ -1,54 +0,0 @@
|
||||||
<!--
|
|
||||||
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,7 +47,7 @@ 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" :showInstance="showInstanceIcon"/>
|
<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" :instance="appearNote.user.instance"/>
|
||||||
|
|
|
@ -63,7 +63,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div :class="$style.noteHeaderUsername"><MkAcct :user="appearNote.user"/></div>
|
<div :class="$style.noteHeaderUsername"><MkAcct :user="appearNote.user"/></div>
|
||||||
<MkInstanceTicker v-if="showTicker" :instance="appearNote.user.instance"/>
|
<MkInstanceTicker v-if="showTicker || showInstanceIcon" :instance="appearNote.user.instance"/>
|
||||||
</div>
|
</div>
|
||||||
</header>
|
</header>
|
||||||
<div :class="$style.noteContent">
|
<div :class="$style.noteContent">
|
||||||
|
@ -295,6 +295,7 @@ const translating = ref(false);
|
||||||
const parsed = appearNote.value.text ? mfm.parse(appearNote.value.text) : null;
|
const parsed = appearNote.value.text ? mfm.parse(appearNote.value.text) : null;
|
||||||
const urls = parsed ? extractUrlFromMfm(parsed).filter((url) => appearNote.value.renote?.url !== url && appearNote.value.renote?.uri !== url) : null;
|
const urls = parsed ? extractUrlFromMfm(parsed).filter((url) => appearNote.value.renote?.url !== url && appearNote.value.renote?.uri !== url) : null;
|
||||||
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 = (defaultStore.state.instanceTicker === 'alwaysIcon') || (defaultStore.state.instanceTicker === 'remoteIcon' && appearNote.value.user.instance);
|
||||||
const conversation = ref<Misskey.entities.Note[]>([]);
|
const conversation = ref<Misskey.entities.Note[]>([]);
|
||||||
const replies = ref<Misskey.entities.Note[]>([]);
|
const replies = ref<Misskey.entities.Note[]>([]);
|
||||||
const canRenote = computed(() => ['public', 'home'].includes(appearNote.value.visibility) || appearNote.value.userId === $i?.id);
|
const canRenote = computed(() => ['public', 'home'].includes(appearNote.value.visibility) || appearNote.value.userId === $i?.id);
|
||||||
|
|
|
@ -23,6 +23,9 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div v-if="showInstance">
|
||||||
|
<img v-if="faviconUrl" :class="$style.instanceIcon" :src="faviconUrl" :title="instance.name ?? undefined"/>
|
||||||
|
</div>
|
||||||
<template v-if="showDecoration">
|
<template v-if="showDecoration">
|
||||||
<img
|
<img
|
||||||
v-for="decoration in decorations ?? user.avatarDecorations"
|
v-for="decoration in decorations ?? user.avatarDecorations"
|
||||||
|
@ -36,21 +39,21 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||||
alt=""
|
alt=""
|
||||||
>
|
>
|
||||||
</template>
|
</template>
|
||||||
<MkInstanceIcon v-if="showInstance" :class="$style.instanceicon" :instance="user.instance"/>
|
|
||||||
</component>
|
</component>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { watch, ref, computed } from 'vue';
|
import { watch, ref, computed } from 'vue';
|
||||||
import * as Misskey from 'misskey-js';
|
import * as Misskey from 'misskey-js';
|
||||||
|
import { instanceName } from '@@/js/config.js';
|
||||||
import { extractAvgColorFromBlurhash } from '@@/js/extract-avg-color-from-blurhash.js';
|
import { extractAvgColorFromBlurhash } from '@@/js/extract-avg-color-from-blurhash.js';
|
||||||
import MkImgWithBlurhash from '../MkImgWithBlurhash.vue';
|
import MkImgWithBlurhash from '../MkImgWithBlurhash.vue';
|
||||||
import MkA from './MkA.vue';
|
import MkA from './MkA.vue';
|
||||||
import { getStaticImageUrl } from '@/scripts/media-proxy.js';
|
import { instance as Instance } from '@/instance.js';
|
||||||
|
import { getStaticImageUrl, getProxiedImageUrlNullable } 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);
|
||||||
|
@ -65,6 +68,10 @@ const props = withDefaults(defineProps<{
|
||||||
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;
|
showInstance?: boolean;
|
||||||
|
instance?: {
|
||||||
|
faviconUrl?: string | null,
|
||||||
|
name?: string | null,
|
||||||
|
};
|
||||||
}>(), {
|
}>(), {
|
||||||
target: null,
|
target: null,
|
||||||
link: false,
|
link: false,
|
||||||
|
@ -73,6 +80,7 @@ const props = withDefaults(defineProps<{
|
||||||
decorations: undefined,
|
decorations: undefined,
|
||||||
forceShowDecoration: false,
|
forceShowDecoration: false,
|
||||||
showInstance: false,
|
showInstance: false,
|
||||||
|
instance: undefined,
|
||||||
});
|
});
|
||||||
|
|
||||||
const emit = defineEmits<{
|
const emit = defineEmits<{
|
||||||
|
@ -81,6 +89,12 @@ const emit = defineEmits<{
|
||||||
|
|
||||||
const showDecoration = props.forceShowDecoration || defaultStore.state.showAvatarDecorations;
|
const showDecoration = props.forceShowDecoration || defaultStore.state.showAvatarDecorations;
|
||||||
|
|
||||||
|
const instance = props.instance ?? {
|
||||||
|
name: instanceName,
|
||||||
|
};
|
||||||
|
|
||||||
|
const faviconUrl = computed(() => props.instance ? getProxiedImageUrlNullable(props.instance.faviconUrl, 'preview') : getProxiedImageUrlNullable(Instance.iconUrl, 'preview') ?? '/favicon.ico');
|
||||||
|
|
||||||
const bound = computed(() => props.link
|
const bound = computed(() => props.link
|
||||||
? { to: userPage(props.user), target: props.target }
|
? { to: userPage(props.user), target: props.target }
|
||||||
: {});
|
: {});
|
||||||
|
@ -348,28 +362,30 @@ watch(() => props.user.avatarBlurhash, () => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.instanceicon {
|
.instanceIcon {
|
||||||
|
width: 25px;
|
||||||
height: 25px;
|
height: 25px;
|
||||||
|
border-radius: 50%;
|
||||||
|
opacity: 0.65;
|
||||||
z-index: 2;
|
z-index: 2;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
left: 0;
|
left: 0;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
}
|
background: var(--MI_THEME-panel);
|
||||||
|
box-shadow: 0 0 0 2px var(--MI_THEME-panel);
|
||||||
|
|
||||||
@container (max-width: 580px) {
|
@container (max-width: 580px) {
|
||||||
.instanceicon {
|
width: 21px;
|
||||||
height: 21px;
|
height: 21px;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@container (max-width: 450px) {
|
@container (max-width: 450px) {
|
||||||
.instanceicon {
|
width: 19px;
|
||||||
height: 19px;
|
height: 19px;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@container (max-width: 300px) {
|
@container (max-width: 300px) {
|
||||||
.instanceicon {
|
width: 17px;
|
||||||
height: 17px;
|
height: 17px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue