From 6cec3f56dc323c279b4ff24ca243f1d37b205dc2 Mon Sep 17 00:00:00 2001 From: christinaroise Date: Tue, 3 Sep 2024 08:34:42 +0200 Subject: [PATCH] use costumer cases and add language field --- studioShared/deskStructure.ts | 49 +++---------------- .../schemas/documents/customerCases.ts | 5 ++ 2 files changed, 11 insertions(+), 43 deletions(-) diff --git a/studioShared/deskStructure.ts b/studioShared/deskStructure.ts index 234af76aa..bc691ceb6 100644 --- a/studioShared/deskStructure.ts +++ b/studioShared/deskStructure.ts @@ -1,54 +1,17 @@ import { i18n } from "languages"; -import { - StructureResolver, - DefaultDocumentNodeResolver, -} from "sanity/structure"; -import { blogPostsID } from "studioShared/schemas/documents/blogPosts"; +import { StructureResolver } from "sanity/structure"; +import { customerCasesID } from "./schemas/documents/customerCases"; export const deskStructure: StructureResolver = (S) => S.list() .title("Content") .items([ S.listItem() - .title("Blogposts sorted by base language") + .title("Costumer cases") .child( - S.documentTypeList(blogPostsID) - .title("List of Blogposts") + S.documentTypeList(customerCasesID) + .title("Costumer cases") .filter("_type == $type && language == $lang") - .params({ type: blogPostsID, lang: i18n.base }) + .params({ type: customerCasesID, lang: i18n.base }) ), - S.listItem() - .title("Blogposts sorted into language folders") - .child( - S.list() - .title("Blogposts") - .items([ - S.listItem() - .title("Blogposts (EN)") - .child( - S.documentTypeList(blogPostsID) - .title("List of Blogposts (EN)") - .filter("_type == $type && language == $lang") - .params({ type: blogPostsID, lang: "en" }) - ), - S.listItem() - .title("Blogposts (NO)") - .child( - S.documentTypeList(blogPostsID) - .title("List of Blogposts (NO)") - .filter("_type == $type && language == $lang") - .params({ type: blogPostsID, lang: "no" }) - ), - S.listItem() - .title("Blogposts (SE)") - .child( - S.documentTypeList(blogPostsID) - .title("List of Blogposts (SE)") - .filter("_type == $type && language == $lang") - .params({ type: blogPostsID, lang: "se" }) - ), - // Add more languages as needed - ]) - ), - // Other items can be added here if needed ]); diff --git a/studioShared/schemas/documents/customerCases.ts b/studioShared/schemas/documents/customerCases.ts index 5a84a6a7c..dba36fec1 100644 --- a/studioShared/schemas/documents/customerCases.ts +++ b/studioShared/schemas/documents/customerCases.ts @@ -10,6 +10,11 @@ const customerCases = defineType({ type: "document", title: "Costumer Cases", fields: [ + defineField({ + name: "language", + type: "string", + readOnly: true, + }), title, titleSlug, defineField({