fix(components): make navbar show up properly

This commit is contained in:
parent d5de2499ab
commit 14d9d12e5b
Signed by: tablet
GPG Key ID: 924A5F6AF051E87C

@ -3,9 +3,9 @@
import { MenuProps } from "ant-design-vue"; import { MenuProps } from "ant-design-vue";
const { data, status } = useAuth(); const { data, status } = useAuth();
const itemMap = { const itemMap = ref({
home: "/", home: "/",
bands: "bands", bands: "/bands",
authors: "/authors", authors: "/authors",
forum: "/forum", forum: "/forum",
account: "/my-stuff", account: "/my-stuff",
@ -17,18 +17,19 @@
profile: `/user/${data?.value?.user?._id || 0}`, profile: `/user/${data?.value?.user?._id || 0}`,
admin: "/admin", admin: "/admin",
logout: "/logout", logout: "/logout",
}; });
let cur = ref<string>( let cur = ref<string>(
Object.keys(itemMap).find((a) => itemMap[a] === useRoute().path) || Object.keys(itemMap.value).find(
useRoute().path, (a) => itemMap.value[a] === useRoute().path,
) || useRoute().path,
); );
let selected: string[] = [cur.value]; let selected: string[] = [cur.value];
const clickFn = (minfo) => { const clickFn = (minfo) => {
if (itemMap[minfo.key] === undefined) return; if (itemMap.value[minfo.key] === undefined) return;
cur.value = itemMap[minfo.key]; cur.value = itemMap.value[minfo.key];
selected = [cur.value]; selected = [cur.value];
navigateTo(itemMap[minfo.key]); navigateTo(itemMap.value[minfo.key]);
}; };
console.log({ label: "client", value: cur.value, stat: status.value }); console.log({ label: "client", value: cur.value, stat: status.value });
</script> </script>
@ -67,15 +68,14 @@
</a-menu> </a-menu>
<div> <div>
<a-button <a-button
v-if="!!data?.user" v-if="data?.user"
type="primary" type="primary"
:style="{}"
tooltip="Post a new Story" tooltip="Post a new Story"
@click="() => navigateTo('/new-story')" @click="() => navigateTo('/new-story')"
> >
<template #icon> <!-- <template #icon>
<icon istyle="regular" name="file-plus" /> </template> -->
</template> <icon istyle="regular" name="file-plus" />
<span style="margin-left: 0.5em"> Post a new Story </span> <span style="margin-left: 0.5em"> Post a new Story </span>
</a-button> </a-button>
</div> </div>