Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cleanup of deskstructure #633

Merged
merged 2 commits into from
Sep 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
191 changes: 110 additions & 81 deletions studio/schemas/deskStructure.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
import { StructureBuilder } from "sanity/structure";
import { pageBuilderID } from "./builders/pageBuilder";
import { blogId } from "./documents/blog";
//import { blogId } from "./documents/blog";
import {
TransferIcon,
UsersIcon,
CogIcon,
ControlsIcon,
ProjectsIcon,
StackCompactIcon,
InfoOutlineIcon,
HeartIcon,
SparkleIcon,
CaseIcon,
DoubleChevronRightIcon,
PinIcon,
Expand All @@ -21,86 +20,116 @@ import { compensationsId } from "./documents/compensations";
import { redirectId } from "./documents/redirect";
import { companyLocationID } from "./documents/companyLocation";

// Admin Section
const adminSection = (S: StructureBuilder) =>
S.listItem()
.title("Admin")
.icon(CaseIcon)
.child(
S.list()
.title("Company Details")
.items([
S.listItem()
.title("Company Information")
.icon(InfoOutlineIcon)
.child(
S.document()
.schemaType(companyInfoID)
.documentId(companyInfoID)
.title("Company Information"),
),
S.listItem()
.title("Company Locations")
.icon(PinIcon)
.child(
S.documentTypeList(companyLocationID).title("Company Locations"),
),
S.listItem()
.title("Legal Documents")
.icon(CogIcon)
.child(
S.documentTypeList(legalDocumentID).title("Legal Documents"),
),
]),
);

// Site Settings Section
const siteSettingSection = (S: StructureBuilder) =>
S.listItem()
.title("Site Settings")
.icon(CogIcon)
.child(
S.list()
.title("Site Settings")
.items([
S.listItem()
.title("Navigation Manager")
.icon(TransferIcon)
.child(
S.document()
.schemaType("navigationManager")
.documentId("navigationManager")
.title("Navigation Manager"),
),
S.listItem()
.title("Social Media Profiles")
.icon(UsersIcon)
.child(
S.document().schemaType(soMeLinksID).documentId(soMeLinksID),
),
S.listItem()
.title("Broken Links")
.icon(DoubleChevronRightIcon)
.child(S.documentTypeList(redirectId).title("Redirects")),
//TODO: Add SEO Settings
//TODO: Add Language selector
]),
);

// Section for dynamic and customizable Pages
const pagesSection = (S: StructureBuilder) =>
S.listItem()
.title("Pages")
.icon(ProjectsIcon)
.child(S.documentTypeList(pageBuilderID).title("Pages"));

//Section for set pages
const SpecialPagesSection = (S: StructureBuilder) =>
S.listItem()
.title("Special Pages")
.icon(SparkleIcon)
.child(
S.list()
.title("Special Pages")
.items([
// S.listItem()
// .title("Blog Overview & Settings")
// .icon(ControlsIcon)
// .child(
// S.document()
// .schemaType(blogId)
// .documentId(blogId)
// .title("Blog Overview & Settings"),
// ),
S.listItem()
.title("Compensations")
.icon(HeartIcon)
.child(
S.document()
.schemaType(compensationsId)
.documentId(compensationsId)
.title("Compensations"),
),
]),
);

// Main export
export default (S: StructureBuilder) =>
S.list()
.title("Content")
.items([
S.listItem()
.title("Company Details")
.icon(CaseIcon)
.child(
S.list()
.title("Company Details")
.items([
S.listItem()
.title("Company Information")
.icon(InfoOutlineIcon)
.child(
S.document()
.schemaType(companyInfoID)
.documentId(companyInfoID)
.title("Company Information"),
),
S.listItem()
.title("Company Locations")
.icon(PinIcon)
.child(
S.documentTypeList(companyLocationID).title(
"Company Locations",
),
),
]),
),
S.listItem()
.title("Legal Documents")
.icon(CogIcon)
.child(S.documentTypeList(legalDocumentID).title("Legal Documents")),
S.listItem()
.title("Social Media Profiles")
.icon(UsersIcon)
.child(S.document().schemaType(soMeLinksID).documentId(soMeLinksID)),
S.listItem()
.title("Navigation Manager")
.icon(TransferIcon)
.child(
S.document()
.schemaType("navigationManager")
.documentId("navigationManager")
.title("Navigation Manager"),
),
S.listItem()
.title("Dynamic Pages")
.icon(ProjectsIcon)
.child(S.documentTypeList(pageBuilderID).title("Dynamic Pages")),
S.listItem()
.title("Static Pages")
.icon(StackCompactIcon)
.child(
S.list()
.title("Static Pages")
.items([
S.listItem()
.title("Blog Overview & Settings")
.icon(ControlsIcon)
.child(
S.document()
.schemaType(blogId)
.documentId(blogId)
.title("Blog Overview & Settings"),
),
S.listItem()
.title("Compensations")
.icon(HeartIcon)
.child(
S.document()
.schemaType(compensationsId)
.documentId(compensationsId)
.title("Compensations"),
),
]),
),
S.listItem()
.title("Redirects")
.icon(DoubleChevronRightIcon)
.child(S.documentTypeList(redirectId).title("Redirects")),
adminSection(S),
siteSettingSection(S),
pagesSection(S),
SpecialPagesSection(S),
]);