@@ -40,7 +40,7 @@ import { popups, pendingApiRequestsCount } from '@/os';
|
||||
import { uploads } from '@/scripts/upload';
|
||||
import * as sound from '@/scripts/sound';
|
||||
import { $i } from '@/account';
|
||||
import { stream } from '@/stream';
|
||||
import { useStream } from '@/stream';
|
||||
import { i18n } from '@/i18n';
|
||||
import { defaultStore } from '@/store';
|
||||
|
||||
@@ -55,7 +55,7 @@ function onNotification(notification) {
|
||||
if ($i.mutingNotificationTypes.includes(notification.type)) return;
|
||||
|
||||
if (document.visibilityState === 'visible') {
|
||||
stream.send('readNotification');
|
||||
useStream().send('readNotification');
|
||||
|
||||
notifications.unshift(notification);
|
||||
window.setTimeout(() => {
|
||||
@@ -71,7 +71,7 @@ function onNotification(notification) {
|
||||
}
|
||||
|
||||
if ($i) {
|
||||
const connection = stream.useChannel('main', null, 'UI');
|
||||
const connection = useStream().useChannel('main', null, 'UI');
|
||||
connection.on('notification', onNotification);
|
||||
|
||||
//#region Listen message from SW
|
||||
|
@@ -10,7 +10,7 @@
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { onUnmounted } from 'vue';
|
||||
import { stream } from '@/stream';
|
||||
import { useStream } from '@/stream';
|
||||
import { i18n } from '@/i18n';
|
||||
import MkButton from '@/components/MkButton.vue';
|
||||
import * as os from '@/os';
|
||||
@@ -32,10 +32,10 @@ function reload() {
|
||||
location.reload();
|
||||
}
|
||||
|
||||
stream.on('_disconnected_', onDisconnected);
|
||||
useStream().on('_disconnected_', onDisconnected);
|
||||
|
||||
onUnmounted(() => {
|
||||
stream.off('_disconnected_', onDisconnected);
|
||||
useStream().off('_disconnected_', onDisconnected);
|
||||
});
|
||||
</script>
|
||||
|
||||
|
34
packages/frontend/src/ui/minimum.vue
Normal file
34
packages/frontend/src/ui/minimum.vue
Normal file
@@ -0,0 +1,34 @@
|
||||
<template>
|
||||
<div class="mk-app" style="container-type: inline-size;">
|
||||
<RouterView/>
|
||||
|
||||
<XCommon/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { provide, ComputedRef } from 'vue';
|
||||
import XCommon from './_common_/common.vue';
|
||||
import { mainRouter } from '@/router';
|
||||
import { PageMetadata, provideMetadataReceiver } from '@/scripts/page-metadata';
|
||||
import { instanceName } from '@/config';
|
||||
|
||||
let pageMetadata = $ref<null | ComputedRef<PageMetadata>>();
|
||||
|
||||
provide('router', mainRouter);
|
||||
provideMetadataReceiver((info) => {
|
||||
pageMetadata = info;
|
||||
if (pageMetadata.value) {
|
||||
document.title = `${pageMetadata.value.title} | ${instanceName}`;
|
||||
}
|
||||
});
|
||||
|
||||
document.documentElement.style.overflowY = 'scroll';
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.mk-app {
|
||||
min-height: 100dvh;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
</style>
|
Reference in New Issue
Block a user