Create instance info component
This commit is contained in:
parent
96625d9c94
commit
c8fecfe14f
2 changed files with 55 additions and 38 deletions
51
src/components/InstanceInfo.vue
Normal file
51
src/components/InstanceInfo.vue
Normal file
|
@ -0,0 +1,51 @@
|
||||||
|
<template>
|
||||||
|
<div class="instance-info" v-if="instance">
|
||||||
|
<h1 class="instance-title">{{ instance.title }}</h1>
|
||||||
|
<div class="instance-description">{{ instance.short_description }}</div>
|
||||||
|
<router-link class="btn" :to="{ name: 'about-public' }">Learn more</router-link>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { $ } from "vue/macros"
|
||||||
|
|
||||||
|
import { useInstanceInfo } from "@/store/instance"
|
||||||
|
|
||||||
|
const { instance } = $(useInstanceInfo())
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped lang="scss">
|
||||||
|
@import "../styles/layout";
|
||||||
|
@import "../styles/mixins";
|
||||||
|
@import "../styles/theme";
|
||||||
|
|
||||||
|
.instance-info {
|
||||||
|
@include block-btn;
|
||||||
|
|
||||||
|
background-color: $block-background-color;
|
||||||
|
border-radius: $block-border-radius;
|
||||||
|
box-sizing: border-box;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
flex-shrink: 1;
|
||||||
|
gap: $block-inner-padding;
|
||||||
|
padding: $block-inner-padding;
|
||||||
|
width: $wide-sidebar-width;
|
||||||
|
|
||||||
|
h1 {
|
||||||
|
font-size: 32px;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn {
|
||||||
|
width: min-content;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@media screen and (max-width: $screen-breakpoint-small) {
|
||||||
|
.instance-info {
|
||||||
|
margin-bottom: $body-padding;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
|
@ -24,11 +24,7 @@
|
||||||
<span>Logout</span>
|
<span>Logout</span>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<div v-else-if="!isUserAuthenticated && instance" class="sidebar wide">
|
<instance-info v-else-if="!isUserAuthenticated"></instance-info>
|
||||||
<h1 class="instance-title">{{ instance.title }}</h1>
|
|
||||||
<div class="instance-description">{{ instance.short_description }}</div>
|
|
||||||
<router-link class="btn" :to="{name: 'about-public'}">Learn more</router-link>
|
|
||||||
</div>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
@ -36,12 +32,11 @@ import { onMounted } from "vue"
|
||||||
import { $, $computed } from "vue/macros"
|
import { $, $computed } from "vue/macros"
|
||||||
import { useRouter } from "vue-router"
|
import { useRouter } from "vue-router"
|
||||||
|
|
||||||
import { useInstanceInfo } from "@/store/instance"
|
import InstanceInfo from "@/components/InstanceInfo.vue"
|
||||||
import { useNotifications } from "@/store/notifications"
|
import { useNotifications } from "@/store/notifications"
|
||||||
import { useCurrentUser } from "@/store/user"
|
import { useCurrentUser } from "@/store/user"
|
||||||
|
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
const { instance } = $(useInstanceInfo())
|
|
||||||
const { loadNotifications, getUnreadNotificationCount } = $(useNotifications())
|
const { loadNotifications, getUnreadNotificationCount } = $(useNotifications())
|
||||||
const { currentUser, setCurrentUser, ensureAuthToken, setAuthToken } = $(useCurrentUser())
|
const { currentUser, setCurrentUser, ensureAuthToken, setAuthToken } = $(useCurrentUser())
|
||||||
|
|
||||||
|
@ -69,17 +64,13 @@ function logout() {
|
||||||
|
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
@import "../styles/layout";
|
@import "../styles/layout";
|
||||||
@import "../styles/mixins";
|
|
||||||
@import "../styles/theme";
|
@import "../styles/theme";
|
||||||
|
|
||||||
.sidebar {
|
.sidebar {
|
||||||
|
background-color: $background-color;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
}
|
|
||||||
|
|
||||||
.sidebar:not(.wide) {
|
|
||||||
background-color: $background-color;
|
|
||||||
flex-shrink: 0;
|
flex-shrink: 0;
|
||||||
gap: $block-outer-padding * 1.5;
|
gap: $block-outer-padding * 1.5;
|
||||||
position: sticky;
|
position: sticky;
|
||||||
|
@ -136,28 +127,8 @@ function logout() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.sidebar.wide {
|
|
||||||
@include block-btn;
|
|
||||||
|
|
||||||
background-color: $block-background-color;
|
|
||||||
border-radius: $block-border-radius;
|
|
||||||
flex-shrink: 1;
|
|
||||||
gap: $block-inner-padding;
|
|
||||||
padding: $block-inner-padding;
|
|
||||||
width: $wide-sidebar-width;
|
|
||||||
|
|
||||||
h1 {
|
|
||||||
font-size: 32px;
|
|
||||||
font-weight: bold;
|
|
||||||
}
|
|
||||||
|
|
||||||
.btn {
|
|
||||||
width: min-content;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@media screen and (max-width: $screen-breakpoint-small) {
|
@media screen and (max-width: $screen-breakpoint-small) {
|
||||||
.sidebar:not(.wide) {
|
.sidebar {
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
gap: 0;
|
gap: 0;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
|
@ -171,10 +142,5 @@ function logout() {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.sidebar.wide {
|
|
||||||
margin-bottom: $body-padding;
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
Loading…
Reference in a new issue