-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
faf4a79
commit 7de0c12
Showing
6 changed files
with
304 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
const languages = [ | ||
{ id: "en", title: "English", isDefault: true }, | ||
{ id: "se", title: "Swedish" }, | ||
{ id: "no", title: "Norwegian" }, | ||
]; | ||
|
||
const i18n = { | ||
languages, | ||
base: "en", | ||
}; | ||
|
||
export { i18n }; |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
import { i18n } from "languages"; | ||
import { | ||
StructureResolver, | ||
DefaultDocumentNodeResolver, | ||
} from "sanity/structure"; | ||
import { blogPostsID } from "studioShared/schemas/documents/blogPosts"; | ||
|
||
export const deskStructure: StructureResolver = (S) => | ||
S.list() | ||
.title("Content") | ||
.items([ | ||
S.listItem() | ||
.title("Blogposts sorted by base language") | ||
.child( | ||
S.documentTypeList(blogPostsID) | ||
.title("List of Blogposts") | ||
.filter("_type == $type && language == $lang") | ||
.params({ type: blogPostsID, 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 | ||
]); | ||
|
||
export const defaultDocumentNode: DefaultDocumentNodeResolver = ( | ||
S, | ||
{ schemaType } | ||
) => { | ||
switch (schemaType) { | ||
case blogPostsID: | ||
return S.document().views([S.view.form()]); | ||
default: | ||
return S.document(); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.