botアカウントのメッセージを左上に

This commit is contained in:
kakkokari-gtyih 2024-08-22 13:44:13 +09:00
parent faefe39a4b
commit f9945d1abf
4 changed files with 8 additions and 37 deletions

View File

@ -4,7 +4,7 @@ SPDX-License-Identifier: AGPL-3.0-only
--> -->
<template> <template>
<MkModal ref="modal" :preferType="'dialog'" :zPriority="zPriority" @click="onBgClick" @closed="emit('closed')" @esc="emit('esc')"> <MkModal ref="modal" :preferType="'dialog'" @click="onBgClick" @closed="emit('closed')" @esc="emit('esc')">
<div ref="rootEl" :class="$style.root" :style="{ width: `${width}px`, height: `min(${height}px, 100%)` }"> <div ref="rootEl" :class="$style.root" :style="{ width: `${width}px`, height: `min(${height}px, 100%)` }">
<div ref="headerEl" :class="$style.header"> <div ref="headerEl" :class="$style.header">
<button v-if="withOkButton && withCloseButton" :class="$style.headerButton" class="_button" @click="emit('close')"><i class="ti ti-x"></i></button> <button v-if="withOkButton && withCloseButton" :class="$style.headerButton" class="_button" @click="emit('close')"><i class="ti ti-x"></i></button>
@ -23,7 +23,6 @@ SPDX-License-Identifier: AGPL-3.0-only
<script lang="ts" setup> <script lang="ts" setup>
import { onMounted, onUnmounted, shallowRef, ref } from 'vue'; import { onMounted, onUnmounted, shallowRef, ref } from 'vue';
import type { ZPriority } from '@/os.js';
import MkModal from './MkModal.vue'; import MkModal from './MkModal.vue';
const props = withDefaults(defineProps<{ const props = withDefaults(defineProps<{
@ -32,14 +31,12 @@ const props = withDefaults(defineProps<{
okButtonDisabled: boolean; okButtonDisabled: boolean;
width: number; width: number;
height: number; height: number;
zPriority: ZPriority;
}>(), { }>(), {
withOkButton: false, withOkButton: false,
withCloseButton: true, withCloseButton: true,
okButtonDisabled: false, okButtonDisabled: false,
width: 400, width: 400,
height: 500, height: 500,
zPriority: 'low',
}); });
const emit = defineEmits<{ const emit = defineEmits<{

View File

@ -144,9 +144,6 @@ const zIndexes = {
low: 1000000, low: 1000000,
middle: 2000000, middle: 2000000,
high: 3000000, high: 3000000,
/** botアカウントインジケータよりも上に表示させる必要があるもの専用 */
veryHigh: 4000000,
}; };
export type ZPriority = keyof typeof zIndexes; export type ZPriority = keyof typeof zIndexes;

View File

@ -8,7 +8,6 @@ SPDX-License-Identifier: AGPL-3.0-only
ref="dialog" ref="dialog"
:width="500" :width="500"
:height="550" :height="550"
:zPriority="'veryHigh'"
@close="cancel" @close="cancel"
@closed="emit('closed')" @closed="emit('closed')"
> >

View File

@ -39,9 +39,13 @@ SPDX-License-Identifier: AGPL-3.0-only
<div v-if="pendingApiRequestsCount > 0" id="wait"></div> <div v-if="pendingApiRequestsCount > 0" id="wait"></div>
<div v-if="dev" id="devTicker"><span>DEV BUILD</span></div> <div id="devTicker">
<div>
<div v-if="$i && $i.isBot">{{ i18n.ts.loggedInAsBot }}</div>
<div v-if="dev">DEV BUILD</div>
</div>
</div>
<div v-if="$i && $i.isBot" id="botWarn" :style="{ zIndex: botWarnZIndex }"><span>{{ i18n.ts.loggedInAsBot }}</span></div>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
@ -53,7 +57,6 @@ import { popups } from '@/os.js';
import { pendingApiRequestsCount } from '@/scripts/misskey-api.js'; import { pendingApiRequestsCount } from '@/scripts/misskey-api.js';
import { uploads } from '@/scripts/upload.js'; import { uploads } from '@/scripts/upload.js';
import * as sound from '@/scripts/sound.js'; import * as sound from '@/scripts/sound.js';
import * as os from '@/os.js';
import { $i } from '@/account.js'; import { $i } from '@/account.js';
import { useStream } from '@/stream.js'; import { useStream } from '@/stream.js';
import { i18n } from '@/i18n.js'; import { i18n } from '@/i18n.js';
@ -65,8 +68,6 @@ const XUpload = defineAsyncComponent(() => import('./upload.vue'));
const dev = _DEV_; const dev = _DEV_;
const botWarnZIndex = ref(os.claimZIndex('veryHigh'));
const notifications = ref<Misskey.entities.Notification[]>([]); const notifications = ref<Misskey.entities.Notification[]>([]);
function onNotification(notification: Misskey.entities.Notification, isClient = false) { function onNotification(notification: Misskey.entities.Notification, isClient = false) {
@ -244,28 +245,6 @@ if ($i) {
} }
} }
#botWarn {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
margin: auto;
width: 100%;
height: max-content;
text-align: center;
color: #ff0;
background: rgba(0, 0, 0, 0.5);
padding: 4px 7px;
font-size: 14px;
pointer-events: none;
user-select: none;
> span {
animation: dev-ticker-blink 2s infinite;
}
}
#devTicker { #devTicker {
position: fixed; position: fixed;
top: 0; top: 0;
@ -274,11 +253,10 @@ if ($i) {
color: #ff0; color: #ff0;
background: rgba(0, 0, 0, 0.5); background: rgba(0, 0, 0, 0.5);
padding: 4px 5px; padding: 4px 5px;
font-size: 14px;
pointer-events: none; pointer-events: none;
user-select: none; user-select: none;
> span { > div {
animation: dev-ticker-blink 2s infinite; animation: dev-ticker-blink 2s infinite;
} }
} }