2023-07-07 19:22:30 +00:00
|
|
|
<template>
|
2023-07-23 13:31:28 +00:00
|
|
|
<div class="mk-app">
|
|
|
|
<div v-if="!narrow && !root" class="side">
|
|
|
|
<XKanban class="kanban" full />
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="main">
|
|
|
|
<XKanban v-if="narrow && !root" class="banner" :powered-by="root" />
|
|
|
|
|
|
|
|
<div class="contents">
|
|
|
|
<XHeader v-if="!root" class="header" :info="pageInfo" />
|
|
|
|
<main>
|
|
|
|
<RouterView />
|
|
|
|
</main>
|
|
|
|
<div v-if="!root" class="powered-by">
|
|
|
|
<b
|
|
|
|
><MkA to="/">{{ host }}</MkA></b
|
|
|
|
>
|
|
|
|
<small
|
|
|
|
>Powered by
|
2023-12-27 04:00:40 +00:00
|
|
|
<a href="https://git.astolfo.cool/natty/magnetar" target="_blank"
|
|
|
|
>Magnetar</a
|
2023-07-23 13:31:28 +00:00
|
|
|
></small
|
|
|
|
>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<transition :name="$store.state.animation ? 'tray-back' : ''">
|
|
|
|
<div
|
|
|
|
v-if="showMenu"
|
|
|
|
class="menu-back _modalBg"
|
|
|
|
@click="showMenu = false"
|
|
|
|
@touchstart.passive="showMenu = false"
|
|
|
|
></div>
|
|
|
|
</transition>
|
|
|
|
|
|
|
|
<transition :name="$store.state.animation ? 'tray' : ''">
|
|
|
|
<div v-if="showMenu" class="menu">
|
|
|
|
<MkA to="/" class="link" active-class="active"
|
|
|
|
><i class="ph-house ph-bold ph-lg icon"></i
|
|
|
|
>{{ i18n.ts.home }}</MkA
|
|
|
|
>
|
|
|
|
<MkA to="/explore" class="link" active-class="active"
|
|
|
|
><i class="ph-compass ph-bold ph-lg icon"></i
|
|
|
|
>{{ i18n.ts.explore }}</MkA
|
|
|
|
>
|
|
|
|
<MkA to="/pages" class="link" active-class="active"
|
|
|
|
><i class="ph-file-text ph-bold ph-lg icon"></i
|
|
|
|
>{{ i18n.ts.pages }}</MkA
|
|
|
|
>
|
|
|
|
<MkA to="/gallery" class="link" active-class="active"
|
|
|
|
><i class="ph-image-square ph-bold ph-lg icon"></i
|
|
|
|
>{{ i18n.ts.gallery }}</MkA
|
|
|
|
>
|
|
|
|
<div class="action">
|
|
|
|
<button class="_buttonPrimary" @click="signup()">
|
|
|
|
{{ i18n.ts.signup }}
|
|
|
|
</button>
|
|
|
|
<button class="_button" @click="signin()">
|
|
|
|
{{ i18n.ts.login }}
|
|
|
|
</button>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</transition>
|
|
|
|
</div>
|
2023-07-07 19:22:30 +00:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts" setup>
|
|
|
|
import { ComputedRef, onMounted, provide } from "vue";
|
|
|
|
import XHeader from "./header.vue";
|
|
|
|
import XKanban from "./kanban.vue";
|
|
|
|
import { host, instanceName } from "@/config";
|
|
|
|
import { search } from "@/scripts/search";
|
|
|
|
import * as os from "@/os";
|
|
|
|
import { instance } from "@/instance";
|
|
|
|
import MkPagination from "@/components/MkPagination.vue";
|
|
|
|
import XSigninDialog from "@/components/MkSigninDialog.vue";
|
|
|
|
import XSignupDialog from "@/components/MkSignupDialog.vue";
|
|
|
|
import MkButton from "@/components/MkButton.vue";
|
|
|
|
import { ColdDeviceStorage, defaultStore } from "@/store";
|
|
|
|
import { mainRouter } from "@/router";
|
|
|
|
import {
|
2023-07-23 13:31:28 +00:00
|
|
|
PageMetadata,
|
|
|
|
provideMetadataReceiver,
|
|
|
|
setPageMetadata,
|
2023-07-07 19:22:30 +00:00
|
|
|
} from "@/scripts/page-metadata";
|
|
|
|
import { i18n } from "@/i18n";
|
|
|
|
|
|
|
|
const DESKTOP_THRESHOLD = 1000;
|
|
|
|
|
|
|
|
let pageMetadata = $ref<null | ComputedRef<PageMetadata>>();
|
|
|
|
|
|
|
|
provide("router", mainRouter);
|
|
|
|
provideMetadataReceiver((info) => {
|
2023-07-23 13:31:28 +00:00
|
|
|
pageMetadata = info;
|
|
|
|
if (pageMetadata.value) {
|
|
|
|
document.title = `${pageMetadata.value.title} | ${instanceName}`;
|
|
|
|
}
|
2023-07-07 19:22:30 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
const announcements = {
|
2023-07-23 13:31:28 +00:00
|
|
|
endpoint: "announcements",
|
|
|
|
limit: 10,
|
2023-07-07 19:22:30 +00:00
|
|
|
};
|
|
|
|
const isTimelineAvailable =
|
2023-07-23 13:31:28 +00:00
|
|
|
!instance.disableLocalTimeline ||
|
|
|
|
!instance.disableRecommendedTimeline ||
|
|
|
|
!instance.disableGlobalTimeline;
|
2023-07-07 19:22:30 +00:00
|
|
|
let showMenu = $ref(false);
|
|
|
|
let isDesktop = $ref(window.innerWidth >= DESKTOP_THRESHOLD);
|
|
|
|
let narrow = $ref(window.innerWidth < 1280);
|
|
|
|
let meta = $ref();
|
|
|
|
|
|
|
|
const keymap = $computed(() => {
|
2023-07-23 13:31:28 +00:00
|
|
|
return {
|
|
|
|
d: () => {
|
|
|
|
if (ColdDeviceStorage.get("syncDeviceDarkMode")) return;
|
|
|
|
defaultStore.set("darkMode", !defaultStore.state.darkMode);
|
|
|
|
},
|
|
|
|
s: search,
|
|
|
|
};
|
2023-07-07 19:22:30 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
const root = $computed(() => mainRouter.currentRoute.value.name === "index");
|
|
|
|
|
|
|
|
os.api("meta", { detail: true }).then((res) => {
|
2023-07-23 13:31:28 +00:00
|
|
|
meta = res;
|
2023-07-07 19:22:30 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
function signin() {
|
2023-07-23 13:31:28 +00:00
|
|
|
os.popup(
|
|
|
|
XSigninDialog,
|
|
|
|
{
|
|
|
|
autoSet: true,
|
|
|
|
},
|
|
|
|
{},
|
|
|
|
"closed"
|
|
|
|
);
|
2023-07-07 19:22:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function signup() {
|
2023-07-23 13:31:28 +00:00
|
|
|
os.popup(
|
|
|
|
XSignupDialog,
|
|
|
|
{
|
|
|
|
autoSet: true,
|
|
|
|
},
|
|
|
|
{},
|
|
|
|
"closed"
|
|
|
|
);
|
2023-07-07 19:22:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
onMounted(() => {
|
2023-07-23 13:31:28 +00:00
|
|
|
if (!isDesktop) {
|
|
|
|
window.addEventListener(
|
|
|
|
"resize",
|
|
|
|
() => {
|
|
|
|
if (window.innerWidth >= DESKTOP_THRESHOLD) isDesktop = true;
|
|
|
|
},
|
|
|
|
{ passive: true }
|
|
|
|
);
|
|
|
|
}
|
2023-07-07 19:22:30 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
defineExpose({
|
2023-07-23 13:31:28 +00:00
|
|
|
showMenu: $$(showMenu),
|
2023-07-07 19:22:30 +00:00
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
.tray-enter-active,
|
|
|
|
.tray-leave-active {
|
2023-07-23 13:31:28 +00:00
|
|
|
opacity: 1;
|
|
|
|
transform: translateX(0);
|
|
|
|
transition: transform 300ms cubic-bezier(0.23, 1, 0.32, 1),
|
|
|
|
opacity 300ms cubic-bezier(0.23, 1, 0.32, 1);
|
2023-07-07 19:22:30 +00:00
|
|
|
}
|
|
|
|
.tray-enter-from,
|
|
|
|
.tray-leave-active {
|
2023-07-23 13:31:28 +00:00
|
|
|
opacity: 0;
|
|
|
|
transform: translateX(-240px);
|
2023-07-07 19:22:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.tray-back-enter-active,
|
|
|
|
.tray-back-leave-active {
|
2023-07-23 13:31:28 +00:00
|
|
|
opacity: 1;
|
|
|
|
transition: opacity 300ms cubic-bezier(0.23, 1, 0.32, 1);
|
2023-07-07 19:22:30 +00:00
|
|
|
}
|
|
|
|
.tray-back-enter-from,
|
|
|
|
.tray-back-leave-active {
|
2023-07-23 13:31:28 +00:00
|
|
|
opacity: 0;
|
2023-07-07 19:22:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.mk-app {
|
2023-07-23 13:31:28 +00:00
|
|
|
display: flex;
|
|
|
|
min-height: 100vh;
|
|
|
|
background-position: center;
|
|
|
|
background-size: cover;
|
|
|
|
background-attachment: fixed;
|
|
|
|
|
|
|
|
> .side {
|
|
|
|
width: 500px;
|
|
|
|
height: 100vh;
|
|
|
|
|
|
|
|
> .kanban {
|
|
|
|
position: fixed;
|
|
|
|
top: 0;
|
|
|
|
left: 0;
|
|
|
|
width: 500px;
|
|
|
|
height: 100vh;
|
|
|
|
overflow: auto;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
> .main {
|
|
|
|
flex: 1;
|
|
|
|
min-width: 0;
|
|
|
|
|
|
|
|
> .banner {
|
|
|
|
}
|
|
|
|
|
|
|
|
> .contents {
|
|
|
|
position: relative;
|
|
|
|
z-index: 1;
|
|
|
|
|
|
|
|
> .powered-by {
|
|
|
|
padding: 28px;
|
|
|
|
font-size: 14px;
|
|
|
|
text-align: center;
|
|
|
|
border-top: 1px solid var(--divider);
|
|
|
|
|
|
|
|
> small {
|
|
|
|
display: block;
|
|
|
|
margin-top: 8px;
|
|
|
|
opacity: 0.5;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
> .menu-back {
|
|
|
|
position: fixed;
|
|
|
|
z-index: 1001;
|
|
|
|
top: 0;
|
|
|
|
left: 0;
|
|
|
|
width: 100vw;
|
|
|
|
height: 100vh;
|
|
|
|
}
|
|
|
|
|
|
|
|
> .menu {
|
|
|
|
position: fixed;
|
|
|
|
z-index: 1001;
|
|
|
|
top: 0;
|
|
|
|
left: 0;
|
|
|
|
width: 240px;
|
|
|
|
height: 100vh;
|
|
|
|
background: var(--panel);
|
|
|
|
|
|
|
|
> .link {
|
|
|
|
display: block;
|
|
|
|
padding: 16px;
|
|
|
|
|
|
|
|
> .icon {
|
|
|
|
margin-right: 1em;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
> .action {
|
|
|
|
padding: 16px;
|
|
|
|
|
|
|
|
> button {
|
|
|
|
display: block;
|
|
|
|
width: 100%;
|
|
|
|
padding: 10px;
|
|
|
|
box-sizing: border-box;
|
|
|
|
text-align: center;
|
|
|
|
border-radius: 999px;
|
|
|
|
|
|
|
|
&._button {
|
|
|
|
background: var(--panel);
|
|
|
|
}
|
|
|
|
|
|
|
|
&:first-child {
|
|
|
|
margin-bottom: 16px;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2023-07-07 19:22:30 +00:00
|
|
|
}
|
|
|
|
</style>
|