salix-front/src/components/NavBar.vue

86 lines
3.2 KiB
Vue
Raw Normal View History

2022-03-24 15:49:33 +00:00
<script setup>
2022-11-15 13:59:04 +00:00
import { onMounted } from 'vue';
import { useI18n } from 'vue-i18n';
2022-03-24 15:49:33 +00:00
import { useSession } from 'src/composables/useSession';
2022-11-17 07:04:12 +00:00
import UserPanel from 'components/UserPanel.vue';
2023-02-09 14:07:27 +00:00
import { useState } from 'src/composables/useState';
import { useStateStore } from 'stores/useStateStore';
2022-11-29 13:45:48 +00:00
import PinnedModules from './PinnedModules.vue';
2022-03-24 15:49:33 +00:00
const { t } = useI18n();
2022-03-24 15:49:33 +00:00
const session = useSession();
2023-02-09 14:07:27 +00:00
const stateStore = useStateStore();
2022-03-24 15:49:33 +00:00
const state = useState();
const user = state.getUser();
const token = session.getToken();
2023-01-05 13:57:47 +00:00
const appName = 'Lilium';
2022-03-24 15:49:33 +00:00
2023-02-09 14:07:27 +00:00
onMounted(() => stateStore.setMounted());
2022-03-24 15:49:33 +00:00
</script>
<template>
2022-11-09 07:29:04 +00:00
<q-header class="bg-dark" color="white" elevated>
2022-03-24 15:49:33 +00:00
<q-toolbar class="q-py-sm q-px-md">
2023-02-09 14:07:27 +00:00
<q-btn flat @click="stateStore.toggleLeftDrawer()" round dense icon="menu">
<q-tooltip bottom anchor="bottom right">
{{ t('globals.collapseMenu') }}
</q-tooltip>
</q-btn>
2022-03-24 15:49:33 +00:00
<router-link to="/">
2023-02-09 06:26:08 +00:00
<q-btn class="q-ml-xs" color="primary" v-if="$q.screen.gt.xs" flat round>
2022-03-24 15:49:33 +00:00
<q-avatar square size="md">
2023-02-09 06:26:08 +00:00
<q-img
src="~/assets/logo_icon.svg"
2023-02-09 14:07:27 +00:00
:alt="appName"
2023-02-09 06:26:08 +00:00
spinner-color="primary"
/>
2022-03-24 15:49:33 +00:00
</q-avatar>
<q-tooltip bottom>
{{ t('globals.backToDashboard') }}
</q-tooltip>
2022-03-24 15:49:33 +00:00
</q-btn>
</router-link>
2023-01-17 13:57:12 +00:00
<q-toolbar-title shrink class="text-weight-bold" v-if="$q.screen.gt.xs">
{{ appName }}
2023-02-09 14:07:27 +00:00
<q-badge label="Beta" align="top" />
2023-01-17 13:57:12 +00:00
</q-toolbar-title>
2022-03-24 15:49:33 +00:00
<q-space></q-space>
2022-11-15 13:59:04 +00:00
<div id="searchbar"></div>
<q-space></q-space>
2022-03-24 15:49:33 +00:00
<div class="q-pl-sm q-gutter-sm row items-center no-wrap">
2022-11-15 13:59:04 +00:00
<div id="header-actions"></div>
2022-11-29 13:45:48 +00:00
<q-btn id="pinnedModules" icon="apps" flat dense rounded>
<q-tooltip bottom>
2022-11-29 13:45:48 +00:00
{{ t('globals.pinnedModules') }}
</q-tooltip>
2022-11-29 13:45:48 +00:00
<PinnedModules />
</q-btn>
2023-02-28 14:00:51 +00:00
<q-btn
flat
@click="stateStore.toggleRightDrawer()"
round
dense
icon="menu"
>
2023-02-09 06:26:08 +00:00
<q-tooltip bottom anchor="bottom right">
{{ t('globals.collapseMenu') }}
</q-tooltip>
</q-btn>
2022-11-17 14:12:48 +00:00
<q-btn rounded dense flat no-wrap id="user">
2022-03-24 15:49:33 +00:00
<q-avatar size="lg">
<q-img
:src="`/api/Images/user/160x160/${user.id}/download?access_token=${token}`"
2023-02-09 06:26:08 +00:00
spinner-color="primary"
>
</q-img>
2022-03-24 15:49:33 +00:00
</q-avatar>
<q-tooltip bottom>
{{ t('globals.userPanel') }}
</q-tooltip>
2022-03-24 15:49:33 +00:00
<UserPanel />
</q-btn>
</div>
</q-toolbar>
</q-header>
</template>