2020-02-20 03:42:36 +09:00
|
|
|
<template>
|
2023-01-15 11:30:40 +09:00
|
|
|
<div v-if="true || hasDisconnected && $store.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 :class="$style.commandButton" small primary @click="reload">{{ i18n.ts.reload }}</MkButton>
|
|
|
|
<MkButton :class="$style.commandButton" small>{{ i18n.ts.doNothing }}</MkButton>
|
2020-02-20 03:42:36 +09:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
2022-01-16 08:38:55 +09:00
|
|
|
<script lang="ts" setup>
|
|
|
|
import { onUnmounted } from 'vue';
|
2021-12-29 22:13:09 +09:00
|
|
|
import { stream } from '@/stream';
|
2022-07-20 22:24:26 +09:00
|
|
|
import { i18n } from '@/i18n';
|
2023-01-15 11:30:40 +09:00
|
|
|
import MkButton from '@/components/MkButton.vue';
|
|
|
|
import * as os from '@/os';
|
|
|
|
|
|
|
|
const zIndex = os.claimZIndex('high');
|
2020-02-20 03:42:36 +09:00
|
|
|
|
2022-01-16 08:38:55 +09:00
|
|
|
let hasDisconnected = $ref(false);
|
|
|
|
|
|
|
|
function onDisconnected() {
|
|
|
|
hasDisconnected = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
function resetDisconnected() {
|
|
|
|
hasDisconnected = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
function reload() {
|
|
|
|
location.reload();
|
|
|
|
}
|
|
|
|
|
|
|
|
stream.on('_disconnected_', onDisconnected);
|
|
|
|
|
|
|
|
onUnmounted(() => {
|
|
|
|
stream.off('_disconnected_', onDisconnected);
|
2020-02-20 03:42:36 +09:00
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
2023-01-15 11:30:40 +09:00
|
|
|
<style lang="scss" module>
|
|
|
|
.root {
|
2020-02-20 03:42:36 +09:00
|
|
|
position: fixed;
|
2023-01-15 11:30:40 +09:00
|
|
|
z-index: v-bind(zIndex);
|
2023-01-10 13:50:34 +09:00
|
|
|
bottom: calc(var(--minBottomSpacing) + var(--margin));
|
|
|
|
right: var(--margin);
|
2020-02-20 03:42:36 +09:00
|
|
|
margin: 0;
|
2023-01-15 11:30:40 +09:00
|
|
|
padding: 12px;
|
2020-02-20 03:42:36 +09:00
|
|
|
font-size: 0.9em;
|
|
|
|
max-width: 320px;
|
2023-01-15 11:30:40 +09:00
|
|
|
}
|
2020-02-20 03:42:36 +09:00
|
|
|
|
2023-01-15 11:30:40 +09:00
|
|
|
.command {
|
|
|
|
margin-top: 8px;
|
|
|
|
}
|
2020-02-20 03:42:36 +09:00
|
|
|
|
2023-01-15 11:30:40 +09:00
|
|
|
.commandButton {
|
2020-02-20 03:42:36 +09:00
|
|
|
}
|
|
|
|
</style>
|