Files
app-v2/src/App.vue
2025-10-27 15:12:00 +03:00

85 lines
2.5 KiB
Vue

<script setup>
import SpaceList from "@/components/space-list/SpaceList.vue";
import {useSpaceStore} from "@/stores/spaceStore";
import {computed, onMounted, ref} from "vue";
import Toolbar from "@/components/Toolbar.vue";
import {useToolbarStore} from "@/stores/toolbar-store";
import router from "@/router/index.js";
const spaceStore = useSpaceStore();
const toolbarStore = useToolbarStore()
const isSpaceSelectorVisible = ref(false);
const isSpaceSelected = computed(() => {
return spaceStore.selectedSpaceId === undefined || isSpaceSelectorVisible.value;
})
const menu = [
{
name: "Dashboard",
icon: "pi pi-chart-bar",
link: "/",
},
{
name: "Transactions",
icon: "pi pi-cog",
link: "/transactions",
},
{
name: "Settings",
icon: "pi pi-list",
link: "/settings",
}
]
const spaceSelected = () => {
router.push('/')
isSpaceSelectorVisible.value = false
}
onMounted(() => {
toolbarStore.registerHandler('openSpacePicker', () => {
isSpaceSelectorVisible.value = true
});
})
</script>
<template>
<body class="flex flex-col">
<SpaceList v-if="isSpaceSelected" @space-selected="spaceSelected()"
/>
<div v-else class="flex flex-col w-full gap-4">
<div class="w-full flex flex-row justify-items-end items-end justify-end pt-4 pe-4">
<Toolbar class=""/>
</div>
<div class="flex flex-col w-full h-full justify-items-end justify-end items-end px-4 gap-4 sticky">
<!-- <div class="w-fit flex flex-row items-center gap-2 p-2 bg-white rounded-full !text-xl sticky"-->
<!-- >-->
<!-- <span class=" px-1 " @click="isSpaceSelectorVisible=true">{{ spaceStore.selectedSpaceName }}</span>-->
<!-- <Divider layout="vertical" class="!h-full !m-0 !text-black !bg-black"/>-->
<!-- <i class="pi pi-plus !text-lg px-2"/>-->
<!-- </div>-->
<router-view class="w-full"/>
</div>
<div
class="w-full flex flex-row items-center justify-items-center justify-between fixed bottom-0 h-16 px-10 bg-white z-50 ">
<router-link v-for="itemKey in menu.keys()" :key="itemKey" :to="menu[itemKey].link" class="items-center">
<div class="w-fit flex flex-col justify-center items-center justify-items-center gap-0">
<i class="!text-lg" :class="menu[itemKey].icon"/>
<span class="text-lg font-medium text-gray-900">{{ menu[itemKey].name }}</span>
</div>
</router-link>
</div>
</div>
</body>
</template>
<style scoped>
</style>