fix: sync current header with static-pages

This commit is contained in:
Christel Westerberg
2024-05-24 13:22:15 +02:00
parent 19d8b757cd
commit dd930688fc
22 changed files with 612 additions and 148 deletions

View File

@@ -0,0 +1,31 @@
import { AccountPageRefsDataRaw } from "./output"
import { ContentEntries } from "@/types/components/myPages/myPage/enums"
import type { Edges } from "@/types/requests/utils/edges"
import type { NodeRefs } from "@/types/requests/utils/refs"
export function getConnections(refs: AccountPageRefsDataRaw) {
const connections: Edges<NodeRefs>[] = []
if (refs.account_page.content) {
refs.account_page.content.forEach((item) => {
switch (item.__typename) {
case ContentEntries.AccountPageContentShortcuts: {
item.shortcuts.shortcuts.forEach((shortcut) => {
if (shortcut.linkConnection.edges.length) {
connections.push(shortcut.linkConnection)
}
})
break
}
case ContentEntries.AccountPageContentDynamicContent: {
if (item.dynamic_content.link.linkConnection.edges.length) {
connections.push(item.dynamic_content.link.linkConnection)
}
break
}
}
})
}
return connections
}