2023-12-30 05:29:53 +00:00
|
|
|
<template>
|
2024-01-03 01:52:41 +00:00
|
|
|
<div
|
|
|
|
class="container"
|
|
|
|
@click="blur"
|
|
|
|
>
|
2024-03-18 00:47:49 +00:00
|
|
|
<transition name="slide">
|
|
|
|
<Sidebar
|
|
|
|
v-if="showSidebar"
|
|
|
|
@sidebar="showSidebar = false"
|
|
|
|
/>
|
|
|
|
</transition>
|
|
|
|
|
2023-12-30 05:29:53 +00:00
|
|
|
<Header />
|
|
|
|
|
2024-01-05 23:30:30 +00:00
|
|
|
<div
|
|
|
|
ref="content"
|
|
|
|
class="content"
|
|
|
|
>
|
|
|
|
<slot @scroll="scroll" />
|
2023-12-30 05:29:53 +00:00
|
|
|
</div>
|
2024-03-18 00:47:49 +00:00
|
|
|
|
|
|
|
<BottomNavigation
|
|
|
|
class="nav"
|
|
|
|
@sidebar="showSidebar = true"
|
|
|
|
/>
|
2024-03-21 01:54:05 +00:00
|
|
|
|
|
|
|
<div
|
|
|
|
ref="feedbackContainer"
|
|
|
|
class="feedback-container"
|
|
|
|
>
|
|
|
|
<div
|
|
|
|
v-if="feedback"
|
|
|
|
ref="feedbackBubble"
|
|
|
|
class="feedback"
|
|
|
|
:class="{ [feedback.type]: true }"
|
|
|
|
>{{ feedback.message }}</div>
|
|
|
|
</div>
|
2023-12-30 05:29:53 +00:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script setup>
|
2024-03-21 01:54:05 +00:00
|
|
|
import { ref, onMounted, nextTick } from 'vue';
|
2024-01-05 23:30:30 +00:00
|
|
|
|
2024-01-03 01:52:41 +00:00
|
|
|
import events from '#/src/events.js';
|
|
|
|
|
2024-03-18 00:47:49 +00:00
|
|
|
import Header from '#/components/header/header.vue';
|
|
|
|
import Sidebar from '#/components/sidebar/sidebar.vue';
|
|
|
|
import BottomNavigation from '#/components/footer/navigation.vue';
|
2023-12-30 05:29:53 +00:00
|
|
|
|
2024-01-05 23:30:30 +00:00
|
|
|
const content = ref(null);
|
2024-03-21 01:54:05 +00:00
|
|
|
const feedback = ref(null);
|
|
|
|
const feedbackContainer = ref(null);
|
|
|
|
const feedbackBubble = ref(null);
|
2024-03-18 00:47:49 +00:00
|
|
|
const showSidebar = ref(false);
|
2024-01-05 23:30:30 +00:00
|
|
|
|
2024-01-03 01:52:41 +00:00
|
|
|
function blur() {
|
|
|
|
events.emit('blur');
|
|
|
|
}
|
2024-01-05 23:30:30 +00:00
|
|
|
|
|
|
|
onMounted(() => {
|
|
|
|
events.on('scrollUp', () => { content.value.scrollTop = 0; });
|
2024-03-21 01:54:05 +00:00
|
|
|
|
|
|
|
events.on('feedback', async (event) => {
|
|
|
|
feedback.value = event;
|
|
|
|
|
|
|
|
await nextTick();
|
|
|
|
|
|
|
|
feedbackBubble.value.animate([
|
|
|
|
{
|
|
|
|
visibility: 'visible',
|
|
|
|
transform: 'scaleY(0)',
|
|
|
|
opacity: 1,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
transform: 'scaleY(1)',
|
|
|
|
opacity: 1,
|
|
|
|
offset: 0.002,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
transform: 'scaleY(1)',
|
|
|
|
opacity: 1,
|
|
|
|
offset: 0.5,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
opacity: 0,
|
|
|
|
},
|
|
|
|
], {
|
2024-03-26 03:14:42 +00:00
|
|
|
duration: event.type === 'error' ? 5000 : 3000,
|
2024-03-21 01:54:05 +00:00
|
|
|
easing: 'ease-in-out',
|
|
|
|
});
|
|
|
|
});
|
2024-01-05 23:30:30 +00:00
|
|
|
});
|
2024-01-03 01:52:41 +00:00
|
|
|
</script>
|
2023-12-30 05:29:53 +00:00
|
|
|
|
2024-01-25 02:07:26 +00:00
|
|
|
<style>
|
2024-03-18 00:47:49 +00:00
|
|
|
.slide-enter-active,
|
|
|
|
.slide-leave-active {
|
|
|
|
&.sidebar-container {
|
|
|
|
transition: background .15s ease-in-out;
|
|
|
|
}
|
|
|
|
|
|
|
|
.sidebar {
|
|
|
|
transition: transform .15s ease-in-out;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
.slide-enter-from,
|
|
|
|
.slide-leave-to {
|
|
|
|
&.sidebar-container {
|
|
|
|
background: transparent;
|
|
|
|
}
|
|
|
|
|
|
|
|
.sidebar {
|
|
|
|
transform: translate(100%, 0);
|
|
|
|
}
|
|
|
|
}
|
2024-01-25 02:07:26 +00:00
|
|
|
</style>
|
|
|
|
|
2023-12-30 05:29:53 +00:00
|
|
|
<style scoped>
|
|
|
|
.container {
|
|
|
|
height: 100%;
|
|
|
|
display: flex;
|
|
|
|
flex-direction: column;
|
|
|
|
overflow: hidden;
|
|
|
|
}
|
|
|
|
|
|
|
|
.content {
|
2024-01-10 01:00:38 +00:00
|
|
|
display: flex;
|
|
|
|
flex-direction: column;
|
2023-12-30 05:29:53 +00:00
|
|
|
flex-grow: 1;
|
|
|
|
overflow-y: auto;
|
|
|
|
}
|
2024-03-18 00:47:49 +00:00
|
|
|
|
|
|
|
.nav {
|
|
|
|
display: none;
|
|
|
|
}
|
|
|
|
|
2024-03-21 01:54:05 +00:00
|
|
|
.feedback-container {
|
|
|
|
width: 100%;
|
|
|
|
display: flex;
|
|
|
|
justify-content: center;
|
|
|
|
position: fixed;
|
2024-03-25 01:08:09 +00:00
|
|
|
bottom: 2rem;
|
2024-03-21 01:54:05 +00:00
|
|
|
z-index: 1000;
|
|
|
|
pointer-events: none;
|
|
|
|
}
|
|
|
|
|
|
|
|
.feedback {
|
|
|
|
padding: .5rem 1rem;
|
|
|
|
margin: 0 .5rem;
|
|
|
|
border-radius: 1rem;
|
|
|
|
box-shadow: 0 0 3px var(--shadow-weak-10);
|
|
|
|
background: var(--grey-dark-40);
|
|
|
|
color: var(--text-light);
|
|
|
|
font-size: .9rem;
|
|
|
|
visibility: hidden;
|
|
|
|
line-height: 1.5;
|
|
|
|
|
|
|
|
&.success {
|
|
|
|
background: var(--success);
|
|
|
|
}
|
|
|
|
|
|
|
|
&.error {
|
|
|
|
background: var(--error);
|
|
|
|
}
|
|
|
|
|
2024-03-26 23:06:03 +00:00
|
|
|
&.remove,
|
|
|
|
&.undo {
|
2024-03-21 01:54:05 +00:00
|
|
|
background: var(--warn);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-03-18 00:47:49 +00:00
|
|
|
@media(--small-10) {
|
|
|
|
.nav {
|
|
|
|
display: flex;
|
|
|
|
}
|
2024-03-21 01:54:05 +00:00
|
|
|
|
|
|
|
.feedback-container {
|
2024-03-25 01:08:09 +00:00
|
|
|
bottom: 5rem;
|
2024-03-21 01:54:05 +00:00
|
|
|
}
|
2024-03-18 00:47:49 +00:00
|
|
|
}
|
2023-12-30 05:29:53 +00:00
|
|
|
</style>
|