2023-07-27 07:31:52 +02:00
|
|
|
<!--
|
2024-02-13 16:59:27 +01:00
|
|
|
SPDX-FileCopyrightText: syuilo and misskey-project
|
2023-07-27 07:31:52 +02:00
|
|
|
SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
-->
|
|
|
|
|
2023-05-15 12:08:46 +02:00
|
|
|
<template>
|
2023-07-07 13:18:06 +02:00
|
|
|
<div :class="$style.root">
|
|
|
|
<div style="container-type: inline-size;">
|
|
|
|
<RouterView/>
|
|
|
|
</div>
|
2023-05-15 12:08:46 +02:00
|
|
|
|
|
|
|
<XCommon/>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts" setup>
|
2024-02-16 08:17:09 +01:00
|
|
|
import { computed, provide, ref } from 'vue';
|
2023-05-15 12:08:46 +02:00
|
|
|
import XCommon from './_common_/common.vue';
|
2024-02-16 08:17:09 +01:00
|
|
|
import { PageMetadata, provideMetadataReceiver, provideReactiveMetadata } from '@/scripts/page-metadata.js';
|
2023-09-19 09:37:43 +02:00
|
|
|
import { instanceName } from '@/config.js';
|
2024-01-30 13:07:34 +01:00
|
|
|
import { mainRouter } from '@/router/main.js';
|
2023-05-15 12:08:46 +02:00
|
|
|
|
2024-02-16 08:17:09 +01:00
|
|
|
const isRoot = computed(() => mainRouter.currentRoute.value.name === 'index');
|
|
|
|
|
|
|
|
const pageMetadata = ref<null | PageMetadata>(null);
|
2023-05-15 12:08:46 +02:00
|
|
|
|
|
|
|
provide('router', mainRouter);
|
2024-02-16 08:17:09 +01:00
|
|
|
provideMetadataReceiver((metadataGetter) => {
|
|
|
|
const info = metadataGetter();
|
2023-12-07 06:42:09 +01:00
|
|
|
pageMetadata.value = info;
|
2024-02-16 08:17:09 +01:00
|
|
|
if (pageMetadata.value) {
|
|
|
|
if (isRoot.value && pageMetadata.value.title === instanceName) {
|
|
|
|
document.title = pageMetadata.value.title;
|
|
|
|
} else {
|
|
|
|
document.title = `${pageMetadata.value.title} | ${instanceName}`;
|
|
|
|
}
|
2023-05-15 12:08:46 +02:00
|
|
|
}
|
|
|
|
});
|
2024-02-16 08:17:09 +01:00
|
|
|
provideReactiveMetadata(pageMetadata);
|
2023-05-15 12:08:46 +02:00
|
|
|
|
|
|
|
document.documentElement.style.overflowY = 'scroll';
|
|
|
|
</script>
|
|
|
|
|
2023-05-19 09:30:39 +02:00
|
|
|
<style lang="scss" module>
|
|
|
|
.root {
|
2023-05-15 12:08:46 +02:00
|
|
|
min-height: 100dvh;
|
|
|
|
box-sizing: border-box;
|
|
|
|
}
|
|
|
|
</style>
|