2023-07-27 07:31:52 +02:00
|
|
|
<!--
|
2024-02-13 16:59:27 +01:00
|
|
|
SPDX-FileCopyrightText: syuilo and misskey-project
|
2023-07-27 07:31:52 +02:00
|
|
|
SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
-->
|
|
|
|
|
2020-02-19 19:42:36 +01:00
|
|
|
<template>
|
2023-04-01 06:42:40 +02:00
|
|
|
<div v-if="hasDisconnected && defaultStore.state.serverDisconnectedBehavior === 'quiet'" :class="$style.root" class="_panel _shadow" @click="resetDisconnected">
|
2023-09-30 21:53:52 +02:00
|
|
|
<div><i class="ph-warning ph-bold ph-lg"></i> {{ i18n.ts.disconnectedFromServer }}</div>
|
2023-01-15 03:30:40 +01:00
|
|
|
<div :class="$style.command" class="_buttons">
|
2023-06-01 10:19:46 +02:00
|
|
|
<MkButton small primary @click="reload">{{ i18n.ts.reload }}</MkButton>
|
|
|
|
<MkButton small>{{ i18n.ts.doNothing }}</MkButton>
|
2020-02-19 19:42:36 +01:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
2022-01-16 00:38:55 +01:00
|
|
|
<script lang="ts" setup>
|
2023-12-07 06:42:09 +01:00
|
|
|
import { onUnmounted, ref } from 'vue';
|
2023-11-10 09:52:50 +01:00
|
|
|
import { useStream } from '@/stream.js';
|
2023-09-19 09:37:43 +02:00
|
|
|
import { i18n } from '@/i18n.js';
|
2023-01-15 03:30:40 +01:00
|
|
|
import MkButton from '@/components/MkButton.vue';
|
2023-09-19 09:37:43 +02:00
|
|
|
import * as os from '@/os.js';
|
|
|
|
import { defaultStore } from '@/store.js';
|
2023-01-15 03:30:40 +01:00
|
|
|
|
|
|
|
const zIndex = os.claimZIndex('high');
|
2020-02-19 19:42:36 +01:00
|
|
|
|
2023-12-07 06:42:09 +01:00
|
|
|
const hasDisconnected = ref(false);
|
2022-01-16 00:38:55 +01:00
|
|
|
|
|
|
|
function onDisconnected() {
|
2023-12-07 06:42:09 +01:00
|
|
|
hasDisconnected.value = true;
|
2022-01-16 00:38:55 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
function resetDisconnected() {
|
2023-12-07 06:42:09 +01:00
|
|
|
hasDisconnected.value = false;
|
2022-01-16 00:38:55 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
function reload() {
|
|
|
|
location.reload();
|
|
|
|
}
|
|
|
|
|
2023-05-15 12:08:46 +02:00
|
|
|
useStream().on('_disconnected_', onDisconnected);
|
2022-01-16 00:38:55 +01:00
|
|
|
|
|
|
|
onUnmounted(() => {
|
2023-05-15 12:08:46 +02:00
|
|
|
useStream().off('_disconnected_', onDisconnected);
|
2020-02-19 19:42:36 +01:00
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
2023-01-15 03:30:40 +01:00
|
|
|
<style lang="scss" module>
|
|
|
|
.root {
|
2020-02-19 19:42:36 +01:00
|
|
|
position: fixed;
|
2023-01-15 03:30:40 +01:00
|
|
|
z-index: v-bind(zIndex);
|
2023-01-10 05:50:34 +01:00
|
|
|
bottom: calc(var(--minBottomSpacing) + var(--margin));
|
|
|
|
right: var(--margin);
|
2020-02-19 19:42:36 +01:00
|
|
|
margin: 0;
|
2023-01-15 03:30:40 +01:00
|
|
|
padding: 12px;
|
2020-02-19 19:42:36 +01:00
|
|
|
font-size: 0.9em;
|
|
|
|
max-width: 320px;
|
2023-01-15 03:30:40 +01:00
|
|
|
}
|
2020-02-19 19:42:36 +01:00
|
|
|
|
2023-01-15 03:30:40 +01:00
|
|
|
.command {
|
|
|
|
margin-top: 8px;
|
|
|
|
}
|
2020-02-19 19:42:36 +01:00
|
|
|
</style>
|