feat(SW-66, SW-348): search functionality and ui
This commit is contained in:
@@ -1,25 +1,22 @@
|
||||
import { AccountPageRefsDataRaw } from "./output"
|
||||
import { AccountPageEnum } from "@/types/enums/accountPage"
|
||||
import type { System } from "@/types/requests/system"
|
||||
import type { AccountPageRefs } from "@/types/trpc/routers/contentstack/accountPage"
|
||||
|
||||
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({ account_page }: AccountPageRefs) {
|
||||
const connections: System["system"][] = [account_page.system]
|
||||
|
||||
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)
|
||||
}
|
||||
})
|
||||
if (account_page.content) {
|
||||
account_page.content.forEach((block) => {
|
||||
switch (block.__typename) {
|
||||
case AccountPageEnum.ContentStack.blocks.ShortCuts: {
|
||||
if (block.shortcuts.shortcuts.length) {
|
||||
connections.push(...block.shortcuts.shortcuts)
|
||||
}
|
||||
break
|
||||
}
|
||||
case ContentEntries.AccountPageContentDynamicContent: {
|
||||
if (item.dynamic_content.link.linkConnection.edges.length) {
|
||||
connections.push(item.dynamic_content.link.linkConnection)
|
||||
case AccountPageEnum.ContentStack.blocks.DynamicContent: {
|
||||
if (block.dynamic_content.link) {
|
||||
connections.push(block.dynamic_content.link)
|
||||
}
|
||||
break
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user