406b4bdbe7
* refactor(frontend): 非推奨となったReactivity Transformを使わないように * refactor: 不要な括弧を除去 * fix: 不要なアノテーションを除去 * fix: Refの配列をrefしている部分の対応 * refactor: 不要な括弧を除去 * fix: lint * refactor: Ref、ShallowRef、ComputedRefの変数の宣言をletからconstに置換 * fix: type error * chore: drop reactivity transform from eslint configuration * refactor: remove unnecessary import * fix: 対応漏れ
62 lines
1.5 KiB
Vue
62 lines
1.5 KiB
Vue
<!--
|
|
SPDX-FileCopyrightText: syuilo and other misskey contributors
|
|
SPDX-License-Identifier: AGPL-3.0-only
|
|
-->
|
|
|
|
<template>
|
|
<div v-if="hasDisconnected && defaultStore.state.serverDisconnectedBehavior === 'quiet'" :class="$style.root" class="_panel _shadow" @click="resetDisconnected">
|
|
<div><i class="ti ti-alert-triangle"></i> {{ i18n.ts.disconnectedFromServer }}</div>
|
|
<div :class="$style.command" class="_buttons">
|
|
<MkButton small primary @click="reload">{{ i18n.ts.reload }}</MkButton>
|
|
<MkButton small>{{ i18n.ts.doNothing }}</MkButton>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
|
|
<script lang="ts" setup>
|
|
import { onUnmounted, ref } from 'vue';
|
|
import { useStream } from '@/stream.js';
|
|
import { i18n } from '@/i18n.js';
|
|
import MkButton from '@/components/MkButton.vue';
|
|
import * as os from '@/os.js';
|
|
import { defaultStore } from '@/store.js';
|
|
|
|
const zIndex = os.claimZIndex('high');
|
|
|
|
const hasDisconnected = ref(false);
|
|
|
|
function onDisconnected() {
|
|
hasDisconnected.value = true;
|
|
}
|
|
|
|
function resetDisconnected() {
|
|
hasDisconnected.value = false;
|
|
}
|
|
|
|
function reload() {
|
|
location.reload();
|
|
}
|
|
|
|
useStream().on('_disconnected_', onDisconnected);
|
|
|
|
onUnmounted(() => {
|
|
useStream().off('_disconnected_', onDisconnected);
|
|
});
|
|
</script>
|
|
|
|
<style lang="scss" module>
|
|
.root {
|
|
position: fixed;
|
|
z-index: v-bind(zIndex);
|
|
bottom: calc(var(--minBottomSpacing) + var(--margin));
|
|
right: var(--margin);
|
|
margin: 0;
|
|
padding: 12px;
|
|
font-size: 0.9em;
|
|
max-width: 320px;
|
|
}
|
|
|
|
.command {
|
|
margin-top: 8px;
|
|
}
|
|
</style>
|