diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 3e3346c..376c622 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -6330,16 +6330,16 @@ snapshots: '@pkgjs/parseargs@0.11.0': optional: true - '@portabletext/block-tools@1.1.22(@sanity/types@3.87.1(@types/react@18.3.20))(@types/react@18.3.20)': + '@portabletext/block-tools@1.1.22(@sanity/types@3.87.1(@types/react@18.3.20)(debug@4.4.0))(@types/react@18.3.20)': dependencies: '@sanity/types': 3.87.1(@types/react@18.3.20)(debug@4.4.0) '@types/react': 18.3.20 get-random-values-esm: 1.0.2 lodash: 4.17.21 - '@portabletext/editor@1.48.11(@sanity/schema@3.87.1(@types/react@18.3.20)(debug@4.4.0))(@sanity/types@3.87.1(@types/react@18.3.20))(@types/react@18.3.20)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(rxjs@7.8.2)': + '@portabletext/editor@1.48.11(@sanity/schema@3.87.1(@types/react@18.3.20)(debug@4.4.0))(@sanity/types@3.87.1(@types/react@18.3.20)(debug@4.4.0))(@types/react@18.3.20)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(rxjs@7.8.2)': dependencies: - '@portabletext/block-tools': 1.1.22(@sanity/types@3.87.1(@types/react@18.3.20))(@types/react@18.3.20) + '@portabletext/block-tools': 1.1.22(@sanity/types@3.87.1(@types/react@18.3.20)(debug@4.4.0))(@types/react@18.3.20) '@portabletext/patches': 1.1.3 '@portabletext/to-html': 2.0.14 '@sanity/schema': 3.87.1(@types/react@18.3.20)(debug@4.4.0) @@ -6626,7 +6626,7 @@ snapshots: - '@types/react' - supports-color - '@sanity/insert-menu@1.1.11(@emotion/is-prop-valid@1.2.2)(@sanity/types@3.87.1(@types/react@18.3.20))(react-dom@18.3.1(react@18.3.1))(react-is@18.3.1)(react@18.3.1)(styled-components@6.1.17(react-dom@18.3.1(react@18.3.1))(react@18.3.1))': + '@sanity/insert-menu@1.1.11(@emotion/is-prop-valid@1.2.2)(@sanity/types@3.87.1(@types/react@18.3.20)(debug@4.4.0))(react-dom@18.3.1(react@18.3.1))(react-is@18.3.1)(react@18.3.1)(styled-components@6.1.17(react-dom@18.3.1(react@18.3.1))(react@18.3.1))': dependencies: '@sanity/icons': 3.7.0(react@18.3.1) '@sanity/types': 3.87.1(@types/react@18.3.20)(debug@4.4.0) @@ -6688,15 +6688,15 @@ snapshots: - '@types/react' - supports-color - '@sanity/presentation-comlink@1.0.18(@sanity/client@7.0.0)(@sanity/types@3.87.1(@types/react@18.3.20))': + '@sanity/presentation-comlink@1.0.18(@sanity/client@7.0.0(debug@4.4.0))(@sanity/types@3.87.1(@types/react@18.3.20)(debug@4.4.0))': dependencies: '@sanity/client': 7.0.0(debug@4.4.0) '@sanity/comlink': 3.0.2 - '@sanity/visual-editing-types': 1.0.17(@sanity/client@7.0.0)(@sanity/types@3.87.1(@types/react@18.3.20)) + '@sanity/visual-editing-types': 1.0.17(@sanity/client@7.0.0(debug@4.4.0))(@sanity/types@3.87.1(@types/react@18.3.20)(debug@4.4.0)) transitivePeerDependencies: - '@sanity/types' - '@sanity/preview-url-secret@2.1.10(@sanity/client@7.0.0)': + '@sanity/preview-url-secret@2.1.10(@sanity/client@7.0.0(debug@4.4.0))': dependencies: '@sanity/client': 7.0.0(debug@4.4.0) '@sanity/uuid': 3.0.2 @@ -6859,7 +6859,7 @@ snapshots: - react-dom - react-is - '@sanity/visual-editing-types@1.0.17(@sanity/client@7.0.0)(@sanity/types@3.87.1(@types/react@18.3.20))': + '@sanity/visual-editing-types@1.0.17(@sanity/client@7.0.0(debug@4.4.0))(@sanity/types@3.87.1(@types/react@18.3.20)(debug@4.4.0))': dependencies: '@sanity/client': 7.0.0(debug@4.4.0) optionalDependencies: @@ -9685,8 +9685,8 @@ snapshots: '@dnd-kit/sortable': 7.0.2(@dnd-kit/core@6.3.1(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(react@18.3.1) '@dnd-kit/utilities': 3.2.2(react@18.3.1) '@juggle/resize-observer': 3.4.0 - '@portabletext/block-tools': 1.1.22(@sanity/types@3.87.1(@types/react@18.3.20))(@types/react@18.3.20) - '@portabletext/editor': 1.48.11(@sanity/schema@3.87.1(@types/react@18.3.20)(debug@4.4.0))(@sanity/types@3.87.1(@types/react@18.3.20))(@types/react@18.3.20)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(rxjs@7.8.2) + '@portabletext/block-tools': 1.1.22(@sanity/types@3.87.1(@types/react@18.3.20)(debug@4.4.0))(@types/react@18.3.20) + '@portabletext/editor': 1.48.11(@sanity/schema@3.87.1(@types/react@18.3.20)(debug@4.4.0))(@sanity/types@3.87.1(@types/react@18.3.20)(debug@4.4.0))(@types/react@18.3.20)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(rxjs@7.8.2) '@portabletext/react': 3.2.1(react@18.3.1) '@portabletext/toolkit': 2.0.17 '@rexxars/react-json-inspector': 9.0.1(react@18.3.1) @@ -9705,13 +9705,13 @@ snapshots: '@sanity/id-utils': 1.0.0 '@sanity/image-url': 1.1.0 '@sanity/import': 3.38.2(@types/react@18.3.20) - '@sanity/insert-menu': 1.1.11(@emotion/is-prop-valid@1.2.2)(@sanity/types@3.87.1(@types/react@18.3.20))(react-dom@18.3.1(react@18.3.1))(react-is@18.3.1)(react@18.3.1)(styled-components@6.1.17(react-dom@18.3.1(react@18.3.1))(react@18.3.1)) + '@sanity/insert-menu': 1.1.11(@emotion/is-prop-valid@1.2.2)(@sanity/types@3.87.1(@types/react@18.3.20)(debug@4.4.0))(react-dom@18.3.1(react@18.3.1))(react-is@18.3.1)(react@18.3.1)(styled-components@6.1.17(react-dom@18.3.1(react@18.3.1))(react@18.3.1)) '@sanity/logos': 2.1.13(@sanity/color@3.0.6)(react@18.3.1) '@sanity/message-protocol': 0.9.0 '@sanity/migrate': 3.87.1(@types/react@18.3.20) '@sanity/mutator': 3.87.1(@types/react@18.3.20) - '@sanity/presentation-comlink': 1.0.18(@sanity/client@7.0.0)(@sanity/types@3.87.1(@types/react@18.3.20)) - '@sanity/preview-url-secret': 2.1.10(@sanity/client@7.0.0) + '@sanity/presentation-comlink': 1.0.18(@sanity/client@7.0.0(debug@4.4.0))(@sanity/types@3.87.1(@types/react@18.3.20)(debug@4.4.0)) + '@sanity/preview-url-secret': 2.1.10(@sanity/client@7.0.0(debug@4.4.0)) '@sanity/schema': 3.87.1(@types/react@18.3.20)(debug@4.4.0) '@sanity/sdk': 0.0.0-alpha.25(@types/react@18.3.20)(debug@4.4.0)(immer@10.1.1)(react@18.3.1)(use-sync-external-store@1.5.0(react@18.3.1)) '@sanity/telemetry': 0.8.1(react@18.3.1) diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml new file mode 100644 index 0000000..d0b7dbe --- /dev/null +++ b/pnpm-workspace.yaml @@ -0,0 +1,3 @@ +onlyBuiltDependencies: + - esbuild + - sharp diff --git a/schemaTypes/blockContent.ts b/schemaTypes/blockContent.ts new file mode 100644 index 0000000..98b22a1 --- /dev/null +++ b/schemaTypes/blockContent.ts @@ -0,0 +1,67 @@ +import {defineArrayMember, defineType} from 'sanity' + +/** + * This is the schema definition for the rich text fields used for + * for this blog studio. When you import it in schemas.js it can be + * reused in other parts of the studio with: + * { + * name: 'someName', + * title: 'Some title', + * type: 'blockContent' + * } + */ +export default defineType({ + title: 'Block Content', + name: 'blockContent', + type: 'array', + of: [ + defineArrayMember({ + title: 'Block', + type: 'block', + // Styles let you set what your user can mark up blocks with. These + // correspond with HTML tags, but you can set any title or value + // you want and decide how you want to deal with it where you want to + // use your content. + styles: [ + {title: 'Normal', value: 'normal'}, + {title: 'H1', value: 'h1'}, + {title: 'H2', value: 'h2'}, + {title: 'H3', value: 'h3'}, + {title: 'H4', value: 'h4'}, + {title: 'Quote', value: 'blockquote'}, + ], + lists: [{title: 'Bullet', value: 'bullet'}], + // Marks let you mark up inline text in the block editor. + marks: { + // Decorators usually describe a single property – e.g. a typographic + // preference or highlighting by editors. + decorators: [ + {title: 'Strong', value: 'strong'}, + {title: 'Emphasis', value: 'em'}, + ], + // Annotations can be any object structure – e.g. a link or a footnote. + annotations: [ + { + title: 'URL', + name: 'link', + type: 'object', + fields: [ + { + title: 'URL', + name: 'href', + type: 'url', + }, + ], + }, + ], + }, + }), + // You can add additional types here. Note that you can't use + // primitive types such as 'string' and 'number' in the same array + // as a block type. + defineArrayMember({ + type: 'image', + options: {hotspot: true}, + }), + ], +}) diff --git a/schemaTypes/developmentHistory.ts b/schemaTypes/developmentHistory.ts new file mode 100644 index 0000000..82d17e3 --- /dev/null +++ b/schemaTypes/developmentHistory.ts @@ -0,0 +1,15 @@ +import {defineField, defineType} from 'sanity' + +export default defineType({ + name: 'developmentHistory', + title: '发展历史', + type: 'document', + fields: [ + defineField({ + name: 'events', + title: 'Events', + type: 'array', + of: [{type: 'developmentHistoryEvent'}], + }), + ], +}) \ No newline at end of file diff --git a/schemaTypes/developmentHistoryEvent.ts b/schemaTypes/developmentHistoryEvent.ts new file mode 100644 index 0000000..c5086a8 --- /dev/null +++ b/schemaTypes/developmentHistoryEvent.ts @@ -0,0 +1,38 @@ +import {defineField, defineType} from 'sanity' + +export default defineType({ + name: 'developmentHistoryEvent', + title: 'Development History Event', + type: 'object', + fields: [ + defineField({ + name: 'timestamp', + title: 'Timestamp', + type: 'datetime', + }), + defineField({ + name: 'event', + title: 'Event', + type: 'string', + }), + defineField({ + name: 'description', + title: 'Description', + type: 'text', + }), + ], + preview: { + select: { + title: 'event', + subtitle: 'timestamp', + }, + prepare(selection) { + const {title, subtitle} = selection + const date = subtitle ? new Date(subtitle).toLocaleDateString() : '' + return { + title: title, + subtitle: date, + } + }, + }, +}) \ No newline at end of file diff --git a/schemaTypes/index.ts b/schemaTypes/index.ts index ba4681d..5a36323 100644 --- a/schemaTypes/index.ts +++ b/schemaTypes/index.ts @@ -1 +1,18 @@ -export const schemaTypes = [] +import blockContent from './blockContent' +import techStack from './techStack' +import project from './project' +import teamComposition from './teamComposition' +import developmentHistory from './developmentHistory' +import developmentHistoryEvent from './developmentHistoryEvent' + +export const schemaTypes = [ + // Document types + techStack, + project, + teamComposition, + developmentHistory, + + // Other types + blockContent, + developmentHistoryEvent, +] diff --git a/schemaTypes/project.ts b/schemaTypes/project.ts new file mode 100644 index 0000000..46f0b46 --- /dev/null +++ b/schemaTypes/project.ts @@ -0,0 +1,39 @@ +import {defineField, defineType} from 'sanity' + +export default defineType({ + name: 'project', + title: '项目', + type: 'document', + fields: [ + defineField({ + name: 'name', + title: 'Name', + type: 'string', + }), + defineField({ + name: 'screenshot', + title: 'Screenshot', + type: 'image', + options: { + hotspot: true, + }, + }), + defineField({ + name: 'techStack', + title: 'Tech Stack', + type: 'array', + of: [{type: 'string'}], + }), + defineField({ + name: 'deployUrl', + title: 'Deployment URL', + type: 'url', + }), + + defineField({ + name: 'description', + title: 'Description', + type: 'text', + }), + ], +}) \ No newline at end of file diff --git a/schemaTypes/teamComposition.ts b/schemaTypes/teamComposition.ts new file mode 100644 index 0000000..006385c --- /dev/null +++ b/schemaTypes/teamComposition.ts @@ -0,0 +1,19 @@ +import {defineField, defineType} from 'sanity' + +export default defineType({ + name: 'teamComposition', + title: '团队组成', + type: 'document', + fields: [ + defineField({ + name: 'department', + title: 'Department', + type: 'string', + }), + defineField({ + name: 'numberOfPeople', + title: 'Number of People', + type: 'number', + }), + ], +}) \ No newline at end of file diff --git a/schemaTypes/techStack.ts b/schemaTypes/techStack.ts new file mode 100644 index 0000000..9d8a6a1 --- /dev/null +++ b/schemaTypes/techStack.ts @@ -0,0 +1,20 @@ +import {defineField, defineType} from 'sanity' + +export default defineType({ + name: 'techStack', + title: '技术栈', + type: 'document', + fields: [ + defineField({ + name: 'domain', + title: 'Domain', + type: 'string', + }), + defineField({ + name: 'keywords', + title: 'Keywords', + type: 'array', + of: [{type: 'string'}], + }), + ], +}) \ No newline at end of file