mirror of
https://codeberg.org/yeentown/barkey.git
synced 2025-04-29 18:16:58 +00:00
copy changes from MkInstanceTicker to SkInstanceTicker
This commit is contained in:
parent
92a6757914
commit
105f8be9f5
3 changed files with 35 additions and 22 deletions
|
@ -4,40 +4,50 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div :class="$style.root" :style="bg">
|
<div :class="$style.root" :style="themeColorStyle">
|
||||||
<img v-if="faviconUrl" :class="$style.icon" :src="faviconUrl"/>
|
<img v-if="faviconUrl" :class="$style.icon" :src="faviconUrl"/>
|
||||||
<div :class="$style.name">{{ instance.name }}</div>
|
<div :class="$style.name">{{ instanceName }}</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { computed } from 'vue';
|
import { computed, type CSSProperties } from 'vue';
|
||||||
import { instanceName } from '@@/js/config.js';
|
import { instanceName as localInstanceName } from '@@/js/config.js';
|
||||||
import { instance as Instance } from '@/instance.js';
|
import { instance as localInstance } from '@/instance.js';
|
||||||
import { getProxiedImageUrlNullable } from '@/scripts/media-proxy.js';
|
import { getProxiedImageUrlNullable } from '@/scripts/media-proxy.js';
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
|
host: string | null;
|
||||||
instance?: {
|
instance?: {
|
||||||
faviconUrl?: string
|
faviconUrl?: string | null
|
||||||
name: string
|
name?: string | null
|
||||||
themeColor?: string
|
themeColor?: string | null
|
||||||
}
|
}
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
// if no instance data is given, this is for the local instance
|
// if no instance data is given, this is for the local instance
|
||||||
const instance = props.instance ?? {
|
const instanceName = computed(() => props.host == null ? localInstanceName : props.instance?.name ?? props.host);
|
||||||
name: instanceName,
|
|
||||||
themeColor: (document.querySelector('meta[name="theme-color-orig"]') as HTMLMetaElement).content,
|
|
||||||
};
|
|
||||||
|
|
||||||
const faviconUrl = computed(() => props.instance ? getProxiedImageUrlNullable(props.instance.faviconUrl, 'preview') : getProxiedImageUrlNullable(Instance.iconUrl, 'preview') ?? getProxiedImageUrlNullable(Instance.faviconUrl, 'preview') ?? '/favicon.ico');
|
const faviconUrl = computed(() => {
|
||||||
|
let imageSrc: string | null = null;
|
||||||
|
if (props.host == null) {
|
||||||
|
if (localInstance.iconUrl == null) {
|
||||||
|
return '/favicon.ico';
|
||||||
|
} else {
|
||||||
|
imageSrc = localInstance.iconUrl;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
imageSrc = props.instance?.faviconUrl ?? null;
|
||||||
|
}
|
||||||
|
return getProxiedImageUrlNullable(imageSrc);
|
||||||
|
});
|
||||||
|
|
||||||
const themeColor = instance.themeColor ?? '#777777';
|
const themeColorStyle = computed<CSSProperties>(() => {
|
||||||
|
const themeColor = (props.host == null ? localInstance.themeColor : props.instance?.themeColor) ?? '#777777';
|
||||||
const bg = {
|
return {
|
||||||
//background: `linear-gradient(90deg, ${themeColor}, ${themeColor}00)`,
|
|
||||||
background: `${themeColor}`,
|
background: `${themeColor}`,
|
||||||
};
|
};
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" module>
|
<style lang="scss" module>
|
||||||
|
|
|
@ -76,7 +76,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||||
<span v-if="appearNote.updatedAt" ref="menuVersionsButton" style="margin-left: 0.5em;" title="Edited" @mousedown="menuVersions()"><i class="ph-pencil-simple ph-bold ph-lg"></i></span>
|
<span v-if="appearNote.updatedAt" ref="menuVersionsButton" style="margin-left: 0.5em;" title="Edited" @mousedown="menuVersions()"><i class="ph-pencil-simple ph-bold ph-lg"></i></span>
|
||||||
<span v-if="appearNote.localOnly" style="margin-left: 0.5em;" :title="i18n.ts._visibility['disableFederation']"><i class="ti ti-rocket-off"></i></span>
|
<span v-if="appearNote.localOnly" style="margin-left: 0.5em;" :title="i18n.ts._visibility['disableFederation']"><i class="ti ti-rocket-off"></i></span>
|
||||||
</div>
|
</div>
|
||||||
<SkInstanceTicker v-if="showTicker" :instance="appearNote.user.instance"/>
|
<SkInstanceTicker v-if="showTicker" :host="appearNote.user.host" :instance="appearNote.user.instance"/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</header>
|
</header>
|
||||||
|
|
|
@ -37,7 +37,9 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||||
<span v-if="note.localOnly" style="margin-left: 0.5em;" :title="i18n.ts._visibility['disableFederation']"><i class="ph-rocket ph-bold ph-lg"></i></span>
|
<span v-if="note.localOnly" style="margin-left: 0.5em;" :title="i18n.ts._visibility['disableFederation']"><i class="ph-rocket ph-bold ph-lg"></i></span>
|
||||||
<span v-if="note.channel" style="margin-left: 0.5em;" :title="note.channel.name"><i class="ph-television ph-bold ph-lg"></i></span>
|
<span v-if="note.channel" style="margin-left: 0.5em;" :title="note.channel.name"><i class="ph-television ph-bold ph-lg"></i></span>
|
||||||
</div>
|
</div>
|
||||||
<div :class="$style.info"><SkInstanceTicker v-if="showTicker" style="cursor: pointer;" :instance="note.user.instance" @click.stop="showOnRemote()"/></div>
|
<div :class="$style.info">
|
||||||
|
<SkInstanceTicker v-if="showTicker" style="cursor: pointer;" :instance="note.user.instance" :host="note.user.host" @click.stop="showOnRemote()"/>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</header>
|
</header>
|
||||||
<header v-else :class="$style.classicRoot">
|
<header v-else :class="$style.classicRoot">
|
||||||
|
@ -52,7 +54,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||||
<div v-if="note.user.badgeRoles" :class="$style.badgeRoles">
|
<div v-if="note.user.badgeRoles" :class="$style.badgeRoles">
|
||||||
<img v-for="role in note.user.badgeRoles" :key="role.id" v-tooltip="role.name" :class="$style.badgeRole" :src="role.iconUrl"/>
|
<img v-for="role in note.user.badgeRoles" :key="role.id" v-tooltip="role.name" :class="$style.badgeRole" :src="role.iconUrl"/>
|
||||||
</div>
|
</div>
|
||||||
<SkInstanceTicker v-if="showTicker && !isMobile && defaultStore.state.showTickerOnReplies" style="cursor: pointer; max-height: 5px; top: 3px; position: relative; margin-top: 0px !important;" :instance="note.user.instance" @click.stop="showOnRemote()"/>
|
<SkInstanceTicker v-if="showTicker && !isMobile && defaultStore.state.showTickerOnReplies" style="cursor: pointer; max-height: 5px; top: 3px; position: relative; margin-top: 0px !important;" :instance="note.user.instance" :host="note.user.host" @click.stop="showOnRemote()"/>
|
||||||
<div :class="$style.classicInfo">
|
<div :class="$style.classicInfo">
|
||||||
<div v-if="mock">
|
<div v-if="mock">
|
||||||
<MkTime :time="note.createdAt" colored/>
|
<MkTime :time="note.createdAt" colored/>
|
||||||
|
@ -84,6 +86,7 @@ import { popupMenu } from '@/os.js';
|
||||||
import { defaultStore } from '@/store.js';
|
import { defaultStore } from '@/store.js';
|
||||||
import { useRouter } from '@/router/supplier.js';
|
import { useRouter } from '@/router/supplier.js';
|
||||||
import { deviceKind } from '@/scripts/device-kind.js';
|
import { deviceKind } from '@/scripts/device-kind.js';
|
||||||
|
import MkInstanceTicker from '@/components/MkInstanceTicker.vue';
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
note: Misskey.entities.Note;
|
note: Misskey.entities.Note;
|
||||||
|
|
Loading…
Add table
Reference in a new issue