2023-10-05 01:58:07 -04:00
|
|
|
<script setup lang="ts">
|
2023-12-29 20:11:07 -05:00
|
|
|
import type { MenuItemType, SubMenuType } from "ant-design-vue/es/menu/src/interface";
|
2023-10-05 01:58:07 -04:00
|
|
|
import { ItemType, theme } from "ant-design-vue";
|
|
|
|
import Icon from "../icon.vue";
|
2023-12-20 17:23:31 -05:00
|
|
|
import { ISidebarItem } from "@models/sidebarEntry";
|
2024-07-09 20:39:49 -04:00
|
|
|
import { NuxtLink } from "#components";
|
2023-10-05 01:58:07 -04:00
|
|
|
|
|
|
|
const { useToken } = theme;
|
|
|
|
const { token } = useToken();
|
|
|
|
|
|
|
|
const selState = ref<string>("");
|
|
|
|
|
|
|
|
const { data: injecto } = await useApiFetch<ISidebarItem[]>("/sidebar");
|
2024-07-09 20:39:49 -04:00
|
|
|
let custItems = computed(() => (injecto.value || ([] as ISidebarItem[])).sort((a, b) => a.index - b.index));
|
|
|
|
/*let items = ref<ItemType[]>([
|
2023-10-05 01:58:07 -04:00
|
|
|
{
|
|
|
|
key: "important",
|
|
|
|
label: h("span", { class: "smallcaps" }, ["Pinned"]),
|
|
|
|
icon: h(Icon, {
|
|
|
|
istyle: "regular",
|
|
|
|
name: "thumbtack",
|
|
|
|
size: 19,
|
|
|
|
}),
|
|
|
|
children: [
|
|
|
|
{
|
|
|
|
key: "/submission-rules",
|
|
|
|
label: h(
|
|
|
|
"b",
|
|
|
|
{
|
|
|
|
style: {
|
|
|
|
color: token.value.colorInfo,
|
|
|
|
},
|
|
|
|
},
|
2023-10-11 15:14:52 -04:00
|
|
|
["SUBMISSION RULES"],
|
2023-10-05 01:58:07 -04:00
|
|
|
),
|
|
|
|
icon: h(Icon, {
|
|
|
|
istyle: "regular",
|
|
|
|
name: "memo",
|
|
|
|
size: 15,
|
|
|
|
}),
|
|
|
|
} as MenuItemType,
|
|
|
|
{
|
|
|
|
key: "/terms",
|
|
|
|
label: "Terms of Service",
|
|
|
|
icon: h(Icon, {
|
|
|
|
istyle: "regular",
|
|
|
|
name: "globe",
|
|
|
|
size: 15,
|
|
|
|
}),
|
|
|
|
} as MenuItemType,
|
|
|
|
],
|
|
|
|
} as SubMenuType,
|
|
|
|
{
|
|
|
|
key: "fun-features",
|
2023-12-27 06:36:54 -05:00
|
|
|
label: h("span", { class: "smallcaps" }, ["Fun features"]),
|
2023-10-05 01:58:07 -04:00
|
|
|
icon: h(Icon, {
|
|
|
|
istyle: "regular",
|
|
|
|
name: "sparkles",
|
|
|
|
size: 19,
|
|
|
|
}),
|
2024-07-09 20:39:49 -04:00
|
|
|
children: custItems.value.map((b) => ({
|
|
|
|
key: b.url,
|
|
|
|
label: h(
|
|
|
|
"span",
|
|
|
|
{
|
|
|
|
"data-color": b.color,
|
|
|
|
class: "custom-side-item",
|
|
|
|
},
|
|
|
|
[h(NuxtLink, { to: b.url }, [b.linkTitle])],
|
|
|
|
),
|
|
|
|
})),
|
2023-10-05 01:58:07 -04:00
|
|
|
} as SubMenuType,
|
2024-07-09 20:39:49 -04:00
|
|
|
]);*/
|
2023-10-05 01:58:07 -04:00
|
|
|
</script>
|
|
|
|
<template>
|
2023-12-31 01:54:02 -05:00
|
|
|
<!-- <client-only>-->
|
|
|
|
<a-menu
|
2024-07-09 20:39:49 -04:00
|
|
|
id="sidebar-menu"
|
2023-12-31 01:54:02 -05:00
|
|
|
mode="inline"
|
|
|
|
@select="
|
|
|
|
({ item, key, selectedKeys }) => {
|
|
|
|
if ((key as string).startsWith('/')) {
|
|
|
|
selState = key as string;
|
|
|
|
navigateTo(key as string);
|
2023-10-05 01:58:07 -04:00
|
|
|
}
|
2023-12-31 01:54:02 -05:00
|
|
|
}
|
|
|
|
"
|
|
|
|
:trigger-sub-menu-action="'click'"
|
|
|
|
v-model:active-key="selState"
|
|
|
|
:inline-indent="16"
|
|
|
|
>
|
2024-07-09 20:39:49 -04:00
|
|
|
<a-sub-menu key="important">
|
|
|
|
<template #icon>
|
|
|
|
<icon istyle="regular" name="thumbtack" :size="19" />
|
|
|
|
</template>
|
|
|
|
<template #title>
|
|
|
|
<span class="smallcaps">Pinned</span>
|
|
|
|
</template>
|
|
|
|
<a-menu-item key="/submission-rules">
|
|
|
|
<template #icon>
|
|
|
|
<icon istyle="regular" name="memo" :size="15" />
|
2023-10-05 01:58:07 -04:00
|
|
|
</template>
|
2024-07-09 20:39:49 -04:00
|
|
|
<b :style="{ color: token.colorInfo }">SUBMISSION RULES</b>
|
|
|
|
</a-menu-item>
|
|
|
|
<a-menu-item key="/terms">
|
|
|
|
<template #icon>
|
|
|
|
<icon istyle="regular" name="globe" :size="15" />
|
|
|
|
</template>
|
|
|
|
<b>Terms of Service</b>
|
|
|
|
</a-menu-item>
|
|
|
|
</a-sub-menu>
|
|
|
|
<a-sub-menu key="fun-features">
|
|
|
|
<template #icon>
|
|
|
|
<Icon name="sparkles" istyle="regular" :size="19" />
|
|
|
|
</template>
|
|
|
|
<template #title>
|
|
|
|
<div class="smallcaps">fun features</div>
|
|
|
|
</template>
|
|
|
|
<a-menu-item v-for="item in custItems" :key="item.url">
|
|
|
|
<span :style="{ color: item.color }">
|
|
|
|
<nuxt-link :to="item.url">{{ item.linkTitle }}</nuxt-link>
|
|
|
|
</span>
|
|
|
|
</a-menu-item>
|
|
|
|
</a-sub-menu>
|
2023-12-31 01:54:02 -05:00
|
|
|
</a-menu>
|
|
|
|
<!-- </client-only>-->
|
2023-10-05 01:58:07 -04:00
|
|
|
</template>
|
|
|
|
<style>
|
|
|
|
.smallcaps {
|
|
|
|
font-variant: small-caps;
|
|
|
|
}
|
2024-07-09 20:39:49 -04:00
|
|
|
#sidebar-menu ul {
|
|
|
|
height: 100%;
|
|
|
|
}
|
2023-10-05 01:58:07 -04:00
|
|
|
</style>
|