Profectus-Demo/src/components/Nav.vue

265 lines
6.9 KiB
Vue
Raw Normal View History

<template>
<div class="nav" v-if="useHeader" v-bind="$attrs">
<img v-if="banner" :src="banner" height="100%" :alt="title" />
<div v-else class="title">{{ title }}</div>
2022-01-14 04:25:47 +00:00
<div @click="changelog?.open()" class="version-container">
<Tooltip display="Changelog" bottom class="version"
2022-01-14 04:25:47 +00:00
><span>v{{ versionNumber }}</span></Tooltip
>
</div>
2022-01-25 04:23:30 +00:00
<div style="flex-grow: 1; cursor: unset"></div>
<div class="discord">
2022-01-14 04:25:47 +00:00
<span @click="openDiscord" class="material-icons">discord</span>
<ul class="discord-links">
<li v-if="discordLink !== 'https://discord.gg/WzejVAx'">
<a :href="discordLink" target="_blank">{{ discordName }}</a>
</li>
<li>
<a href="https://discord.gg/WzejVAx" target="_blank"
>The Paper Pilot Community</a
>
</li>
<li>
<a href="https://discord.gg/F3xveHV" target="_blank">The Modding Tree</a>
</li>
</ul>
</div>
2021-09-20 02:06:56 +00:00
<div>
<a href="https://forums.moddingtree.com/" target="_blank">
2022-01-14 04:25:47 +00:00
<Tooltip display="Forums" bottom yoffset="5px">
2021-09-20 02:06:56 +00:00
<span class="material-icons">forum</span>
2022-01-14 04:25:47 +00:00
</Tooltip>
2021-09-20 02:06:56 +00:00
</a>
</div>
2022-01-14 04:25:47 +00:00
<div @click="info?.open()">
<Tooltip display="Info" bottom class="info">
2021-09-19 21:59:43 +00:00
<span class="material-icons">info</span>
2022-01-14 04:25:47 +00:00
</Tooltip>
</div>
2022-01-14 04:25:47 +00:00
<div @click="savesManager?.open()">
<Tooltip display="Saves" bottom xoffset="-20px">
<span class="material-icons">library_books</span>
2022-01-14 04:25:47 +00:00
</Tooltip>
</div>
2022-01-14 04:25:47 +00:00
<div @click="options?.open()">
<Tooltip display="Options" bottom xoffset="-66px">
2021-09-19 21:59:43 +00:00
<span class="material-icons">settings</span>
2022-01-14 04:25:47 +00:00
</Tooltip>
</div>
</div>
<div v-else class="overlay-nav" v-bind="$attrs">
2022-01-14 04:25:47 +00:00
<div @click="changelog?.open()" class="version-container">
<Tooltip display="Changelog" right xoffset="25%" class="version">
<span>v{{ versionNumber }}</span>
2022-01-25 04:23:30 +00:00
</Tooltip>
</div>
2022-01-14 04:25:47 +00:00
<div @click="savesManager?.open()">
<Tooltip display="Saves" right>
2021-09-20 02:06:56 +00:00
<span class="material-icons">library_books</span>
2022-01-14 04:25:47 +00:00
</Tooltip>
</div>
2022-01-14 04:25:47 +00:00
<div @click="options?.open()">
<Tooltip display="Options" right>
2021-09-19 21:59:43 +00:00
<span class="material-icons">settings</span>
2022-01-14 04:25:47 +00:00
</Tooltip>
</div>
2022-01-14 04:25:47 +00:00
<div @click="info?.open()">
<Tooltip display="Info" right>
2021-09-19 21:59:43 +00:00
<span class="material-icons">info</span>
2022-01-14 04:25:47 +00:00
</Tooltip>
</div>
2021-09-20 02:06:56 +00:00
<div>
<a href="https://forums.moddingtree.com/" target="_blank">
2022-01-14 04:25:47 +00:00
<Tooltip display="Forums" right xoffset="7px">
2021-09-20 02:06:56 +00:00
<span class="material-icons">forum</span>
2022-01-14 04:25:47 +00:00
</Tooltip>
2021-09-20 02:06:56 +00:00
</a>
</div>
<div class="discord">
2022-01-14 04:25:47 +00:00
<span @click="openDiscord" class="material-icons">discord</span>
<ul class="discord-links">
<li v-if="discordLink !== 'https://discord.gg/WzejVAx'">
<a :href="discordLink" target="_blank">{{ discordName }}</a>
</li>
<li>
<a href="https://discord.gg/WzejVAx" target="_blank"
>The Paper Pilot Community</a
>
</li>
<li>
<a href="https://discord.gg/F3xveHV" target="_blank">The Modding Tree</a>
</li>
</ul>
</div>
</div>
2022-01-14 04:25:47 +00:00
<Info ref="info" :changelog="changelog" />
<SavesManager ref="savesManager" />
<Options ref="options" />
<Changelog ref="changelog" />
</template>
2022-01-14 04:25:47 +00:00
<script setup lang="ts">
import Changelog from "@/data/Changelog.vue";
import modInfo from "@/data/modInfo.json";
2022-01-14 04:25:47 +00:00
import { ComponentPublicInstance, ref } from "vue";
import Info from "./Info.vue";
import Options from "./Options.vue";
import SavesManager from "./SavesManager.vue";
import Tooltip from "./Tooltip.vue";
2022-01-25 04:25:34 +00:00
const info = ref<ComponentPublicInstance<typeof Info> | null>(null);
const savesManager = ref<ComponentPublicInstance<typeof SavesManager> | null>(null);
const options = ref<ComponentPublicInstance<typeof Options> | null>(null);
2022-01-14 04:25:47 +00:00
// For some reason Info won't accept the changelog unless I do this:
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const changelog = ref<ComponentPublicInstance<any> | null>(null);
2022-01-14 04:25:47 +00:00
const { useHeader, banner, title, discordName, discordLink, versionNumber } = modInfo;
2022-01-14 04:25:47 +00:00
function openDiscord() {
window.open(discordLink, "mywindow");
}
</script>
<style scoped>
2021-06-24 05:57:20 +00:00
.nav {
2021-09-04 21:51:41 +00:00
background-color: var(--raised-background);
display: flex;
left: 0;
right: 0;
top: 0;
height: 46px;
width: 100%;
2021-09-04 21:51:41 +00:00
border-bottom: 4px solid var(--outline);
2021-06-24 05:57:20 +00:00
}
.nav > * {
height: 46px;
width: 46px;
display: flex;
cursor: pointer;
2021-08-25 00:19:55 +00:00
flex-shrink: 0;
2021-06-24 05:57:20 +00:00
}
.overlay-nav {
position: absolute;
top: 10px;
left: 10px;
display: flex;
flex-direction: column;
z-index: 1;
2021-06-24 05:57:20 +00:00
}
.overlay-nav > * {
height: 50px;
width: 50px;
display: flex;
cursor: pointer;
margin: 0;
2021-06-24 05:57:20 +00:00
align-items: center;
justify-content: center;
}
.title {
font-size: 36px;
text-align: left;
margin-left: 12px;
cursor: unset;
2021-06-24 05:57:20 +00:00
}
.nav > .title {
width: unset;
2021-08-25 00:19:55 +00:00
flex-shrink: 1;
overflow: hidden;
white-space: nowrap;
2021-06-24 05:57:20 +00:00
}
.nav .saves,
.nav .info {
display: flex;
}
.tooltip-container {
width: 100%;
height: 100%;
2021-06-24 05:57:20 +00:00
display: flex;
}
.overlay-nav .discord {
position: relative;
2021-06-24 05:57:20 +00:00
}
.discord img {
width: 100%;
height: 100%;
2021-06-24 05:57:20 +00:00
}
.discord-links {
position: fixed;
top: 45px;
padding: 20px;
right: -280px;
width: 200px;
transition: right 0.25s ease;
2021-09-04 21:51:41 +00:00
background: var(--raised-background);
z-index: 10;
2021-06-24 05:57:20 +00:00
}
.overlay-nav .discord-links {
position: absolute;
2021-06-24 05:57:20 +00:00
left: -280px;
right: unset;
transition: left 0.25s ease;
2021-06-24 05:57:20 +00:00
}
.overlay-nav .discord:hover .discord-links {
left: -10px;
}
.discord-links li {
margin-bottom: 4px;
2021-06-24 05:57:20 +00:00
}
.discord-links li:first-child {
font-size: 1.2em;
}
*:not(.overlay-nav) .discord:hover .discord-links {
right: 0;
2021-06-24 05:57:20 +00:00
}
2021-09-19 21:59:43 +00:00
.material-icons {
font-size: 36px;
2021-06-24 05:57:20 +00:00
}
2021-09-19 21:59:43 +00:00
.material-icons:hover {
text-shadow: 5px 0 10px var(--link), -3px 0 12px var(--foreground);
2021-06-24 05:57:20 +00:00
}
.nav .version-container {
display: flex;
height: 25px;
margin-bottom: 0;
margin-left: 10px;
}
.overlay-nav .version-container {
width: unset;
height: 25px;
2021-06-24 05:57:20 +00:00
}
.version {
color: var(--points);
2021-06-24 05:57:20 +00:00
}
.version:hover span {
text-shadow: 5px 0 10px var(--points), -3px 0 12px var(--points);
2021-06-24 05:57:20 +00:00
}
2021-09-20 02:06:56 +00:00
2022-01-25 04:25:34 +00:00
.nav > div > a,
.overlay-nav > div > a {
2021-09-20 02:06:56 +00:00
color: var(--foreground);
text-shadow: none;
}
</style>