337dd97b49
* perf(#10923): unwind css module class name * perf(#10923): support multiple components * refactor: clean up * refactor(#10923): avoid `useCssModule()` * fix(#10923): allow direct literal class name * fix(#10923): avoid computed class name * fix(#10923): allow literal keys * fix(#10923): typo * fix(#10923): invalid class names * chore: test * revert: test This reverts commit 5c7ef366eceebe8ba260efa4d5d675f6c1775c45. * fix(#10923): hidden tale * perf(#10923): also unwind scoped css contained components * perf(#10923): `normalizeClass` AOT compilation --------- Co-authored-by: syuilo <Syuilotan@yahoo.co.jp>
58 lines
1.3 KiB
Vue
58 lines
1.3 KiB
Vue
<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 } from 'vue';
|
|
import { useStream } from '@/stream';
|
|
import { i18n } from '@/i18n';
|
|
import MkButton from '@/components/MkButton.vue';
|
|
import * as os from '@/os';
|
|
import { defaultStore } from '@/store';
|
|
|
|
const zIndex = os.claimZIndex('high');
|
|
|
|
let hasDisconnected = $ref(false);
|
|
|
|
function onDisconnected() {
|
|
hasDisconnected = true;
|
|
}
|
|
|
|
function resetDisconnected() {
|
|
hasDisconnected = 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>
|