2020-02-20 03:42:36 +09:00
|
|
|
<template>
|
2021-11-19 19:36:12 +09:00
|
|
|
<div v-if="hasDisconnected && $store.state.serverDisconnectedBehavior === 'quiet'" class="nsbbhtug" @click="resetDisconnected">
|
2022-07-20 22:24:26 +09:00
|
|
|
<div>{{ i18n.ts.disconnectedFromServer }}</div>
|
2020-02-20 03:42:36 +09:00
|
|
|
<div class="command">
|
2022-07-20 22:24:26 +09:00
|
|
|
<button class="_textButton" @click="reload">{{ i18n.ts.reload }}</button>
|
|
|
|
<button class="_textButton">{{ i18n.ts.doNothing }}</button>
|
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';
|
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>
|
|
|
|
|
2022-12-27 18:29:39 +09:00
|
|
|
<style lang="scss" scoped>
|
2020-02-20 03:42:36 +09:00
|
|
|
.nsbbhtug {
|
|
|
|
position: fixed;
|
|
|
|
z-index: 16385;
|
|
|
|
bottom: 8px;
|
|
|
|
right: 8px;
|
|
|
|
margin: 0;
|
|
|
|
padding: 6px 12px;
|
|
|
|
font-size: 0.9em;
|
|
|
|
color: #fff;
|
|
|
|
background: #000;
|
|
|
|
opacity: 0.8;
|
|
|
|
border-radius: 4px;
|
|
|
|
max-width: 320px;
|
|
|
|
|
|
|
|
> .command {
|
|
|
|
display: flex;
|
|
|
|
justify-content: space-around;
|
|
|
|
|
|
|
|
> button {
|
|
|
|
padding: 0.7em;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|