mirror of
https://iceshrimp.dev/limepotato/jormungandr-bite.git
synced 2024-11-14 14:07:38 -07:00
wip: refactor(client): migrate components to composition api
This commit is contained in:
parent
52c13e9db5
commit
99278833e8
1 changed files with 41 additions and 48 deletions
|
@ -3,66 +3,59 @@
|
||||||
<transition :name="$store.state.animation ? 'zoom' : ''" appear>
|
<transition :name="$store.state.animation ? 'zoom' : ''" appear>
|
||||||
<div v-show="loaded" class="mjndxjch">
|
<div v-show="loaded" class="mjndxjch">
|
||||||
<img src="https://xn--931a.moe/assets/error.jpg" class="_ghost"/>
|
<img src="https://xn--931a.moe/assets/error.jpg" class="_ghost"/>
|
||||||
<p><b><i class="fas fa-exclamation-triangle"></i> {{ $ts.pageLoadError }}</b></p>
|
<p><b><i class="fas fa-exclamation-triangle"></i> {{ i18n.locale.pageLoadError }}</b></p>
|
||||||
<p v-if="version === meta.version">{{ $ts.pageLoadErrorDescription }}</p>
|
<p v-if="meta && (version === meta.version)">{{ i18n.locale.pageLoadErrorDescription }}</p>
|
||||||
<p v-else-if="serverIsDead">{{ $ts.serverIsDead }}</p>
|
<p v-else-if="serverIsDead">{{ i18n.locale.serverIsDead }}</p>
|
||||||
<template v-else>
|
<template v-else>
|
||||||
<p>{{ $ts.newVersionOfClientAvailable }}</p>
|
<p>{{ i18n.locale.newVersionOfClientAvailable }}</p>
|
||||||
<p>{{ $ts.youShouldUpgradeClient }}</p>
|
<p>{{ i18n.locale.youShouldUpgradeClient }}</p>
|
||||||
<MkButton class="button primary" @click="reload">{{ $ts.reload }}</MkButton>
|
<MkButton class="button primary" @click="reload">{{ i18n.locale.reload }}</MkButton>
|
||||||
</template>
|
</template>
|
||||||
<p><MkA to="/docs/general/troubleshooting" class="_link">{{ $ts.troubleshooting }}</MkA></p>
|
<p><MkA to="/docs/general/troubleshooting" class="_link">{{ i18n.locale.troubleshooting }}</MkA></p>
|
||||||
<p v-if="error" class="error">ERROR: {{ error }}</p>
|
<p v-if="error" class="error">ERROR: {{ error }}</p>
|
||||||
</div>
|
</div>
|
||||||
</transition>
|
</transition>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts" setup>
|
||||||
import { defineComponent } from 'vue';
|
import { } from 'vue';
|
||||||
|
import * as misskey from 'misskey-js';
|
||||||
import MkButton from '@/components/ui/button.vue';
|
import MkButton from '@/components/ui/button.vue';
|
||||||
import * as symbols from '@/symbols';
|
import * as symbols from '@/symbols';
|
||||||
import { version } from '@/config';
|
import { version } from '@/config';
|
||||||
import * as os from '@/os';
|
import * as os from '@/os';
|
||||||
import { unisonReload } from '@/scripts/unison-reload';
|
import { unisonReload } from '@/scripts/unison-reload';
|
||||||
|
import { i18n } from '@/i18n';
|
||||||
|
|
||||||
export default defineComponent({
|
const props = withDefaults(defineProps<{
|
||||||
components: {
|
error?: Error;
|
||||||
MkButton,
|
}>(), {
|
||||||
},
|
|
||||||
props: {
|
|
||||||
error: {
|
|
||||||
required: false,
|
|
||||||
}
|
|
||||||
},
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
[symbols.PAGE_INFO]: {
|
|
||||||
title: this.$ts.error,
|
|
||||||
icon: 'fas fa-exclamation-triangle'
|
|
||||||
},
|
|
||||||
loaded: false,
|
|
||||||
serverIsDead: false,
|
|
||||||
meta: {} as any,
|
|
||||||
version,
|
|
||||||
};
|
|
||||||
},
|
|
||||||
created() {
|
|
||||||
os.api('meta', {
|
|
||||||
detail: false
|
|
||||||
}).then(meta => {
|
|
||||||
this.loaded = true;
|
|
||||||
this.serverIsDead = false;
|
|
||||||
this.meta = meta;
|
|
||||||
localStorage.setItem('v', meta.version);
|
|
||||||
}, () => {
|
|
||||||
this.loaded = true;
|
|
||||||
this.serverIsDead = true;
|
|
||||||
});
|
});
|
||||||
},
|
|
||||||
methods: {
|
let loaded = $ref(false);
|
||||||
reload() {
|
let serverIsDead = $ref(false);
|
||||||
|
let meta = $ref<misskey.entities.LiteInstanceMetadata | null>(null);
|
||||||
|
|
||||||
|
os.api('meta', {
|
||||||
|
detail: false,
|
||||||
|
}).then(res => {
|
||||||
|
loaded = true;
|
||||||
|
serverIsDead = false;
|
||||||
|
meta = res;
|
||||||
|
localStorage.setItem('v', res.version);
|
||||||
|
}, () => {
|
||||||
|
loaded = true;
|
||||||
|
serverIsDead = true;
|
||||||
|
});
|
||||||
|
|
||||||
|
function reload() {
|
||||||
unisonReload();
|
unisonReload();
|
||||||
},
|
}
|
||||||
|
|
||||||
|
defineExpose({
|
||||||
|
[symbols.PAGE_INFO]: {
|
||||||
|
title: i18n.locale.error,
|
||||||
|
icon: 'fas fa-exclamation-triangle',
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
Loading…
Reference in a new issue