fix(frontend): 二段階認証の設定ダイアログはbotWarnよりも上に表示するように

This commit is contained in:
kakkokari-gtyih 2024-08-22 13:35:19 +09:00
parent 043ab1f69b
commit 74ecc4ec42
5 changed files with 17 additions and 5 deletions

View File

@ -68,7 +68,7 @@ const props = withDefaults(defineProps<{
anchor?: { x: string; y: string; }; anchor?: { x: string; y: string; };
src?: HTMLElement | null; src?: HTMLElement | null;
preferType?: ModalTypes | 'auto'; preferType?: ModalTypes | 'auto';
zPriority?: 'low' | 'middle' | 'high'; zPriority?: os.ZPriority;
noOverlap?: boolean; noOverlap?: boolean;
transparentBg?: boolean; transparentBg?: boolean;
hasInteractionWithOtherFocusTrappedEls?: boolean; hasInteractionWithOtherFocusTrappedEls?: boolean;

View File

@ -4,7 +4,7 @@ SPDX-License-Identifier: AGPL-3.0-only
--> -->
<template> <template>
<MkModal ref="modal" :preferType="'dialog'" @click="onBgClick" @closed="emit('closed')" @esc="emit('esc')"> <MkModal ref="modal" :preferType="'dialog'" :zPriority="zPriority" @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,6 +23,7 @@ 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<{
@ -31,12 +32,14 @@ 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,8 +144,14 @@ const zIndexes = {
low: 1000000, low: 1000000,
middle: 2000000, middle: 2000000,
high: 3000000, high: 3000000,
/** botアカウントインジケータよりも上に表示させる必要があるもの専用 */
veryHigh: 4000000,
}; };
export function claimZIndex(priority: keyof typeof zIndexes = 'low'): number {
export type ZPriority = keyof typeof zIndexes;
export function claimZIndex(priority: ZPriority = 'low'): number {
zIndexes[priority] += 100; zIndexes[priority] += 100;
return zIndexes[priority]; return zIndexes[priority];
} }

View File

@ -8,6 +8,7 @@ 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

@ -41,7 +41,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<div v-if="dev" id="devTicker"><span>DEV BUILD</span></div> <div v-if="dev" id="devTicker"><span>DEV BUILD</span></div>
<div v-if="$i && $i.isBot" id="botWarn"><span>{{ i18n.ts.loggedInAsBot }}</span></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,6 +53,7 @@ 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';
@ -64,6 +65,8 @@ 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) {
@ -251,7 +254,6 @@ if ($i) {
width: 100%; width: 100%;
height: max-content; height: max-content;
text-align: center; text-align: center;
z-index: 2147483647;
color: #ff0; color: #ff0;
background: rgba(0, 0, 0, 0.5); background: rgba(0, 0, 0, 0.5);
padding: 4px 7px; padding: 4px 7px;