forked from xuzuodong/personal-website
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: revert back to manually typing sanity queries
- Loading branch information
Showing
15 changed files
with
10,140 additions
and
8,173 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
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 |
---|---|---|
@@ -1,3 +1,17 @@ | ||
<script lang="ts"> | ||
import { imgProps } from '#image/components/nuxt-img' | ||
export default defineComponent({ | ||
props: { | ||
...imgProps, | ||
provider: { | ||
type: String, | ||
default: 'mySanity', | ||
}, | ||
}, | ||
}) | ||
</script> | ||
|
||
<template> | ||
<nuxt-img provider="mySanity" /> | ||
<nuxt-img v-bind="$props" /> | ||
</template> |
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
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 |
---|---|---|
@@ -1,14 +1,14 @@ | ||
import type { ResolvedSanityImage } from '@sanity/asset-utils' | ||
|
||
const query = groq` | ||
*[_id == "instantFilms"].instantFilms[-5..-1]{ | ||
const instantFilmsQuery = groq` | ||
*[_type == "instantFilm"][0].instantFilms[-5..-1]{ | ||
..., | ||
asset->, | ||
} | ||
` | ||
|
||
export default defineCachedEventHandler(async () => { | ||
return await useSanity().fetch<ResolvedSanityImage[]>(query) | ||
return await useSanity().fetch<ResolvedSanityImage[]>(instantFilmsQuery) | ||
}, { | ||
staleMaxAge: 60 * 60, | ||
}) |
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
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 |
---|---|---|
@@ -1,21 +1,15 @@ | ||
import type { StructureBuilder } from 'sanity/structure' | ||
import { | ||
filteredDocumentListItems, | ||
singletonDocumentListItems, | ||
} from 'sanity-plugin-singleton-tools' | ||
|
||
export function structure(S: StructureBuilder) { | ||
return S.list() | ||
.title('Content') | ||
.items([ | ||
S.listItem() | ||
.title('Instant Films') | ||
.child( | ||
S.document() | ||
.schemaType('instantFilms') | ||
.documentId('instantFilms') | ||
.title('Instant Films'), | ||
), | ||
import type { StructureResolver } from 'sanity/structure' | ||
|
||
...S.documentTypeListItems() | ||
.filter( | ||
listItem => !['instantFilms', 'media.tag'].includes(listItem.getId() as string), | ||
), | ||
]) | ||
} | ||
// eslint-disable-next-line func-style | ||
export const structure: StructureResolver = (S, context) => S.list() | ||
.title('Sanity Love Content') | ||
.items([ | ||
...singletonDocumentListItems({ S, context })!, | ||
S.divider(), | ||
...filteredDocumentListItems({ S, context }), | ||
]) |
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
2 changes: 1 addition & 1 deletion
2
packages/studio/schemas/galleries.ts → packages/studio/schemas/gallery.ts
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 |
---|---|---|
@@ -1,9 +1,9 @@ | ||
import galleries from './galleries' | ||
import instantFilms from './instantFilms' | ||
import projects from './projects' | ||
import gallery from './gallery' | ||
import instantFilm from './instantFilm' | ||
import project from './project' | ||
|
||
export const schemaTypes = [ | ||
galleries, | ||
instantFilms, | ||
projects, | ||
gallery, | ||
instantFilm, | ||
project, | ||
] |
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
2 changes: 1 addition & 1 deletion
2
packages/studio/schemas/projects.ts → packages/studio/schemas/project.ts
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.