fix: refine url logic based on typename

This commit is contained in:
Arvid Norlin
2024-04-09 12:50:02 +02:00
parent 56ccce346d
commit 631a82ee04
3 changed files with 66 additions and 35 deletions

View File

@@ -1,5 +1,11 @@
import type { AllRequestResponse } from "../utils/all"
import { Edges } from "../utils/edges"
import { Typename } from "../utils/typename"
export enum PageLinkEnum {
CodeDefinedPage = "CodeDefinedPage",
ContentPage = "ContentPage",
}
export type MenuItem = {
uid: string
@@ -11,12 +17,27 @@ export type MenuItem = {
export type SidebarProps = { menuItems: MenuItem[] }
export type PageLink = {
uid: string
title: string
url: string
system: { uid: string }
}
export type CodeDefinedPageLink = Typename<
{
uid: string
title: string
url: string
system: { uid: string }
},
PageLinkEnum.CodeDefinedPage
>
export type ContentPageLink = Typename<
{
uid: string
title: string
web: { url: string }
system: { uid: string }
},
PageLinkEnum.ContentPage
>
export type PageLink = CodeDefinedPageLink | ContentPageLink
export type NavigationItem = {
item: {