From 68ad026acc821aef08a4babc983725d47789e07e Mon Sep 17 00:00:00 2001 From: Alexander Liu Date: Tue, 29 Aug 2023 20:11:32 -0700 Subject: [PATCH 1/5] feat: sanity faq schema --- apps/sanity/package.json | 1 + apps/sanity/sanity.config.ts | 23 ++++++++- apps/sanity/schemas/clipboard.ts | 42 --------------- apps/sanity/schemas/faqs.ts | 40 +++++++++++++++ apps/sanity/schemas/index.ts | 8 +-- apps/sanity/schemas/notes.ts | 36 ------------- apps/sanity/schemas/paper.ts | 36 ------------- apps/sanity/schemas/stickers.ts | 36 ------------- apps/sanity/schemas/tags.ts | 14 ----- pnpm-lock.yaml | 87 +++++++++++++++++--------------- 10 files changed, 111 insertions(+), 212 deletions(-) delete mode 100644 apps/sanity/schemas/clipboard.ts create mode 100644 apps/sanity/schemas/faqs.ts delete mode 100644 apps/sanity/schemas/notes.ts delete mode 100644 apps/sanity/schemas/paper.ts delete mode 100644 apps/sanity/schemas/stickers.ts delete mode 100644 apps/sanity/schemas/tags.ts diff --git a/apps/sanity/package.json b/apps/sanity/package.json index dc99d4b5..77904e0d 100644 --- a/apps/sanity/package.json +++ b/apps/sanity/package.json @@ -18,6 +18,7 @@ "dependencies": { "@sanity/icons": "^2.4.1", "@sanity/vision": "^3.15.1", + "lucide-react": "^0.271.0", "react": "^18.2.0", "react-dom": "^18.2.0", "react-is": "^18.2.0", diff --git a/apps/sanity/sanity.config.ts b/apps/sanity/sanity.config.ts index c59362ba..9ae0f7cf 100644 --- a/apps/sanity/sanity.config.ts +++ b/apps/sanity/sanity.config.ts @@ -3,6 +3,7 @@ import { deskTool } from "sanity/desk"; import { visionTool } from "@sanity/vision"; import { media } from "sanity-plugin-media"; import { schemaTypes } from "./schemas"; +import { HelpCircle } from "lucide-react"; export default defineConfig({ name: "default", @@ -11,7 +12,27 @@ export default defineConfig({ projectId: "1smqaeyk", dataset: "production", - plugins: [deskTool(), visionTool(), media()], + plugins: [ + deskTool({ + structure: (S) => + S.list() + .title("Content") + .items([ + S.listItem() + .title("FAQs") + .icon(HelpCircle) + .child( + S.document().schemaType("faqs").documentId("faqs").title("FAQs") + ), + S.divider(), + ...S.documentTypeListItems().filter( + (listItem) => !["faqs"].includes(listItem.getId()!) + ), + ]), + }), + visionTool(), + media(), + ], schema: { types: schemaTypes, diff --git a/apps/sanity/schemas/clipboard.ts b/apps/sanity/schemas/clipboard.ts deleted file mode 100644 index a3fba571..00000000 --- a/apps/sanity/schemas/clipboard.ts +++ /dev/null @@ -1,42 +0,0 @@ -// schemas/clipboard.ts -import { defineType, defineField, defineArrayMember } from "sanity"; -import { ClipboardIcon } from "@sanity/icons"; - -export default defineType({ - name: "clipboard", - type: "document", - title: "Clipboards", - icon: ClipboardIcon, - fields: [ - defineField({ - name: "label", - type: "string", - title: "Label", - validation: (Rule) => Rule.required(), - }), - defineField({ - name: "clipboardImage", - type: "image", - title: "Image", - validation: (Rule) => Rule.required(), - }), - defineField({ - name: "description", - type: "array", - title: "Description", - of: [defineArrayMember({ type: "block" })], - }), - defineField({ - name: "tags", - type: "array", - title: "Tags", - of: [ - defineArrayMember({ - type: "reference", - to: [{ type: "tag" }], - name: "tag", - }), - ], - }), - ], -}); diff --git a/apps/sanity/schemas/faqs.ts b/apps/sanity/schemas/faqs.ts new file mode 100644 index 00000000..5cd1b1a0 --- /dev/null +++ b/apps/sanity/schemas/faqs.ts @@ -0,0 +1,40 @@ +import { defineType, defineField, defineArrayMember } from "sanity"; + +export default defineType({ + name: "faqs", + title: "FAQs", + type: "document", + fields: [ + defineField({ + name: "faqs", + title: "FAQs", + type: "array", + of: [ + defineArrayMember({ + type: "object", + name: "faq", + fields: [ + defineField({ + name: "question", + title: "Question", + type: "text", + }), + + defineField({ + name: "answer", + title: "Answer", + type: "text", + }), + ], + + preview: { + select: { + title: "question", + subtitle: "answer", + }, + }, + }), + ], + }), + ], +}); diff --git a/apps/sanity/schemas/index.ts b/apps/sanity/schemas/index.ts index 9692eecf..65f60c24 100644 --- a/apps/sanity/schemas/index.ts +++ b/apps/sanity/schemas/index.ts @@ -1,7 +1,3 @@ -import stickers from "./stickers"; -import notes from "./notes"; -import clipboard from "./clipboard"; -import tags from "./tags"; -import paper from "./paper"; +import faqs from "./faqs"; -export const schemaTypes = [stickers, notes, clipboard, paper, tags]; +export const schemaTypes = [faqs]; diff --git a/apps/sanity/schemas/notes.ts b/apps/sanity/schemas/notes.ts deleted file mode 100644 index 262e1462..00000000 --- a/apps/sanity/schemas/notes.ts +++ /dev/null @@ -1,36 +0,0 @@ -// schemas/notes.ts -import { defineType, defineField, defineArrayMember } from "sanity"; -import { DocumentIcon } from "@sanity/icons"; - -export default defineType({ - name: "note", - type: "document", - title: "Notes", - icon: DocumentIcon, - fields: [ - defineField({ - name: "label", - type: "string", - title: "Label", - validation: (Rule) => Rule.required(), - }), - defineField({ - name: "noteImage", - type: "image", - title: "Image", - validation: (Rule) => Rule.required(), - }), - defineField({ - name: "description", - type: "array", - title: "Description", - of: [defineArrayMember({ type: "block" })], - }), - defineField({ - name: "tags", - type: "array", - title: "Tags", - of: [defineArrayMember({ type: "reference", to: [{ type: "tag" }] })], - }), - ], -}); diff --git a/apps/sanity/schemas/paper.ts b/apps/sanity/schemas/paper.ts deleted file mode 100644 index ccac59a7..00000000 --- a/apps/sanity/schemas/paper.ts +++ /dev/null @@ -1,36 +0,0 @@ -// schemas/paper.ts -import { defineType, defineField, defineArrayMember } from "sanity"; -import { DocumentSheetIcon } from "@sanity/icons"; - -export default defineType({ - name: "paper", - type: "document", - title: "Paper", - icon: DocumentSheetIcon, - fields: [ - defineField({ - name: "label", - type: "string", - title: "Label", - validation: (Rule) => Rule.required(), - }), - defineField({ - name: "paperImage", - type: "image", - title: "Image", - validation: (Rule) => Rule.required(), - }), - defineField({ - name: "description", - type: "array", - title: "Description", - of: [defineArrayMember({ type: "block" })], - }), - defineField({ - name: "tags", - type: "array", - title: "Tags", - of: [defineArrayMember({ type: "reference", to: [{ type: "tag" }] })], - }), - ], -}); diff --git a/apps/sanity/schemas/stickers.ts b/apps/sanity/schemas/stickers.ts deleted file mode 100644 index 8aa3a95c..00000000 --- a/apps/sanity/schemas/stickers.ts +++ /dev/null @@ -1,36 +0,0 @@ -// schemas/stickers.ts -import { defineType, defineField, defineArrayMember } from "sanity"; -import { ImageIcon } from "@sanity/icons"; - -export default defineType({ - name: "sticker", - type: "document", - title: "Stickers", - icon: ImageIcon, - fields: [ - defineField({ - name: "label", - type: "string", - title: "Label", - validation: (Rule) => Rule.required(), - }), - defineField({ - name: "stickerImage", - type: "image", - title: "Image", - validation: (Rule) => Rule.required(), - }), - defineField({ - title: "Description", - name: "description", - type: "array", - of: [defineArrayMember({ type: "block" })], - }), - defineField({ - name: "tags", - type: "array", - title: "Tags", - of: [defineArrayMember({ type: "reference", to: [{ type: "tag" }] })], - }), - ], -}); diff --git a/apps/sanity/schemas/tags.ts b/apps/sanity/schemas/tags.ts deleted file mode 100644 index b2398ac5..00000000 --- a/apps/sanity/schemas/tags.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { defineType, defineField } from "sanity"; - -export default defineType({ - name: "tag", - title: "Tag", - type: "document", - fields: [ - defineField({ - name: "tag_title", - type: "string", - title: "Tag", - }), - ], -}); diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 8ac42493..c6e4e775 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -10,7 +10,7 @@ importers: devDependencies: '@turbo/gen': specifier: ^1.10.13 - version: 1.10.13(@types/node@20.5.6)(typescript@5.2.2) + version: 1.10.13(@types/node@20.4.9)(typescript@4.9.5) eslint: specifier: ^7.32.0 version: 7.32.0 @@ -19,7 +19,7 @@ importers: version: 3.0.1 turbo: specifier: latest - version: 1.10.13 + version: 1.10.4 apps/sanity: dependencies: @@ -29,6 +29,9 @@ importers: '@sanity/vision': specifier: ^3.15.1 version: 3.15.1(@babel/runtime@7.22.11)(@codemirror/lint@6.4.0)(@codemirror/state@6.2.1)(@codemirror/theme-one-dark@6.1.2)(@lezer/common@1.0.4)(codemirror@6.0.1)(react-dom@18.2.0)(react-is@18.2.0)(react@18.2.0)(styled-components@5.3.9) + lucide-react: + specifier: ^0.271.0 + version: 0.271.0(react@18.2.0) react: specifier: ^18.2.0 version: 18.2.0 @@ -40,7 +43,7 @@ importers: version: 18.2.0 sanity: specifier: ^3.15.1 - version: 3.15.1(@types/node@20.5.6)(@types/react@18.2.20)(react-dom@18.2.0)(react@18.2.0)(styled-components@5.3.9) + version: 3.15.1(@types/node@20.4.9)(@types/react@18.2.20)(react-dom@18.2.0)(react@18.2.0)(styled-components@5.3.9) sanity-plugin-media: specifier: ^2.2.2 version: 2.2.2(@types/react@18.2.20)(react-dom@18.2.0)(react-is@18.2.0)(react@18.2.0)(sanity@3.15.1)(styled-components@5.3.9) @@ -2704,7 +2707,7 @@ packages: resolution: {integrity: sha512-vxhUy4J8lyeyinH7Azl1pdd43GJhZH/tP2weN8TntQblOY+A0XbT8DJk1/oCPuOOyg/Ja757rG0CgHcWC8OfMA==} dev: true - /@turbo/gen@1.10.13(@types/node@20.5.6)(typescript@5.2.2): + /@turbo/gen@1.10.13(@types/node@20.4.9)(typescript@4.9.5): resolution: {integrity: sha512-fwGVjeun2i0RIdq/20d2wpatPw9vE4Mbk60uB8rk8NENDXn2JLfbsh00mZ5KAEX5ZQUibh6tD+B7xROV8Eb7dQ==} hasBin: true dependencies: @@ -2716,7 +2719,7 @@ packages: minimatch: 9.0.3 node-plop: 0.26.3 proxy-agent: 6.3.0 - ts-node: 10.9.1(@types/node@20.5.6)(typescript@5.2.2) + ts-node: 10.9.1(@types/node@20.4.9)(typescript@4.9.5) update-check: 1.5.4 validate-npm-package-name: 5.0.0 transitivePeerDependencies: @@ -2803,7 +2806,6 @@ packages: /@types/node@20.4.9: resolution: {integrity: sha512-8e2HYcg7ohnTUbHk8focoklEQYvemQmu9M/f43DZVx43kHn0tE3BY/6gSDxS7k0SprtS0NHvj+L80cGLnoOUcQ==} - dev: false /@types/node@20.5.6: resolution: {integrity: sha512-Gi5wRGPbbyOTX+4Y2iULQ27oUPrefaB0PxGQJnfyWN3kvEDGM3mIB5M/gQLmitZf7A9FmLeaqxD3L1CXpm3VKQ==} @@ -3187,7 +3189,7 @@ packages: '@babel/plugin-transform-react-jsx-self': 7.22.5(@babel/core@7.22.10) '@babel/plugin-transform-react-jsx-source': 7.22.5(@babel/core@7.22.10) react-refresh: 0.14.0 - vite: 4.4.9(@types/node@20.5.6) + vite: 4.4.9(@types/node@20.4.9) transitivePeerDependencies: - supports-color dev: false @@ -6186,6 +6188,14 @@ packages: engines: {node: '>=12'} dev: true + /lucide-react@0.271.0(react@18.2.0): + resolution: {integrity: sha512-oc3/6m7gg/5E9FsX0F7t7DOuBiafsLTwg5/f0hJUJYePbmLmCXpZj1OESilmaUSwXGztawV7V12ZXBfAb8wRAA==} + peerDependencies: + react: ^16.5.1 || ^17.0.0 || ^18.0.0 + dependencies: + react: 18.2.0 + dev: false + /make-dir@3.1.0: resolution: {integrity: sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw==} engines: {node: '>=8'} @@ -7563,7 +7573,7 @@ packages: redux: 4.2.1 redux-observable: 2.0.0(redux@4.2.1) rxjs: 7.8.1 - sanity: 3.15.1(@types/node@20.5.6)(@types/react@18.2.20)(react-dom@18.2.0)(react@18.2.0)(styled-components@5.3.9) + sanity: 3.15.1(@types/node@20.4.9)(@types/react@18.2.20)(react-dom@18.2.0)(react@18.2.0)(styled-components@5.3.9) styled-components: 5.3.9(@babel/core@7.22.11)(react-dom@18.2.0)(react-is@18.2.0)(react@18.2.0) zod: 3.21.4 transitivePeerDependencies: @@ -7572,7 +7582,7 @@ packages: - react-native dev: false - /sanity@3.15.1(@types/node@20.5.6)(@types/react@18.2.20)(react-dom@18.2.0)(react@18.2.0)(styled-components@5.3.9): + /sanity@3.15.1(@types/node@20.4.9)(@types/react@18.2.20)(react-dom@18.2.0)(react@18.2.0)(styled-components@5.3.9): resolution: {integrity: sha512-Kf+qGmsQHv0uM/jn5hXmK+nE9gcBtAM08GDW2AyRQvnts/eXJkPZuYWYAGaZ98HFlZRIZbpHVTDq7L80FBxJTg==} engines: {node: '>=14.18.0'} hasBin: true @@ -7683,7 +7693,7 @@ packages: use-device-pixel-ratio: 1.1.2(react@18.2.0) use-hot-module-reload: 1.0.3(react@18.2.0) use-sync-external-store: 1.2.0(react@18.2.0) - vite: 4.4.9(@types/node@20.5.6) + vite: 4.4.9(@types/node@20.4.9) yargs: 17.7.2 transitivePeerDependencies: - '@types/node' @@ -8241,7 +8251,7 @@ packages: typescript: 4.9.5 dev: true - /ts-node@10.9.1(@types/node@20.5.6)(typescript@5.2.2): + /ts-node@10.9.1(@types/node@20.4.9)(typescript@4.9.5): resolution: {integrity: sha512-NtVysVPkxxrwFGUUxGYhfux8k78pQB3JqYBXlLRZgdGUqTO5wU/UyHop5p70iEbGhB7q5KmiZiU0Y3KlJrScEw==} hasBin: true peerDependencies: @@ -8260,14 +8270,14 @@ packages: '@tsconfig/node12': 1.0.11 '@tsconfig/node14': 1.0.3 '@tsconfig/node16': 1.0.4 - '@types/node': 20.5.6 + '@types/node': 20.4.9 acorn: 8.10.0 acorn-walk: 8.2.0 arg: 4.1.3 create-require: 1.1.1 diff: 4.0.2 make-error: 1.3.6 - typescript: 5.2.2 + typescript: 4.9.5 v8-compile-cache-lib: 3.0.1 yn: 3.1.1 dev: true @@ -8307,64 +8317,65 @@ packages: safe-buffer: 5.2.1 dev: false - /turbo-darwin-64@1.10.13: - resolution: {integrity: sha512-vmngGfa2dlYvX7UFVncsNDMuT4X2KPyPJ2Jj+xvf5nvQnZR/3IeDEGleGVuMi/hRzdinoxwXqgk9flEmAYp0Xw==} + /turbo-darwin-64@1.10.4: + resolution: {integrity: sha512-oAILq0QZUvOxYZU71SXRsL7DFpqZutPl9CX7+rD48tReHrmhcm3HMeuAFY0S5FD/9fKub04UfAQwVtJSlhvISg==} cpu: [x64] os: [darwin] requiresBuild: true dev: true optional: true - /turbo-darwin-arm64@1.10.13: - resolution: {integrity: sha512-eMoJC+k7gIS4i2qL6rKmrIQGP6Wr9nN4odzzgHFngLTMimok2cGLK3qbJs5O5F/XAtEeRAmuxeRnzQwTl/iuAw==} + /turbo-darwin-arm64@1.10.4: + resolution: {integrity: sha512-N0XPFLXsZRLE6gKDa5MREpPQp0drOz9PrADaaMXTlspxWS/tmmxyH+ZQ/uGqKC/0mqsNIhZuSFsEVZe1PGaqxw==} cpu: [arm64] os: [darwin] requiresBuild: true dev: true optional: true - /turbo-linux-64@1.10.13: - resolution: {integrity: sha512-0CyYmnKTs6kcx7+JRH3nPEqCnzWduM0hj8GP/aodhaIkLNSAGAa+RiYZz6C7IXN+xUVh5rrWTnU2f1SkIy7Gdg==} + /turbo-linux-64@1.10.4: + resolution: {integrity: sha512-S8ZVNCPnrBU+GMKKUWcgg4MaTOdL1reOU1XQtDiHfEPskXjLE+10vr65xJJQb6CqO8ARFXUlFSAUfxZRX6WVNA==} cpu: [x64] os: [linux] requiresBuild: true dev: true optional: true - /turbo-linux-arm64@1.10.13: - resolution: {integrity: sha512-0iBKviSGQQlh2OjZgBsGjkPXoxvRIxrrLLbLObwJo3sOjIH0loGmVIimGS5E323soMfi/o+sidjk2wU1kFfD7Q==} + /turbo-linux-arm64@1.10.4: + resolution: {integrity: sha512-/C6vpo7kd2ae6dR0iZyRuvfjijuixidhwLzV026A+/1gmAMRXYkslBfgOGfoOquHmvqjCeDVTsMWwCY2NRQqtw==} cpu: [arm64] os: [linux] requiresBuild: true dev: true optional: true - /turbo-windows-64@1.10.13: - resolution: {integrity: sha512-S5XySRfW2AmnTeY1IT+Jdr6Goq7mxWganVFfrmqU+qqq3Om/nr0GkcUX+KTIo9mPrN0D3p5QViBRzulwB5iuUQ==} + /turbo-windows-64@1.10.4: + resolution: {integrity: sha512-fh6X/fJl9gNTu3r7zMmwCychxMlpQMFn32bpioPNIBxrTHCbQYeGSQuw2XWa/RswgNzCY3Xo34emYAKu9btrsw==} cpu: [x64] os: [win32] requiresBuild: true dev: true optional: true - /turbo-windows-arm64@1.10.13: - resolution: {integrity: sha512-nKol6+CyiExJIuoIc3exUQPIBjP9nIq5SkMJgJuxsot2hkgGrafAg/izVDRDrRduQcXj2s8LdtxJHvvnbI8hEQ==} + /turbo-windows-arm64@1.10.4: + resolution: {integrity: sha512-KzcKGl+bjwaSkxMNTutuoIM+xPuTBA13zJiC2vFM7fQ6XYM0/ZmUekfoxpMnWgSav8vlTk5tRYaPniLcVzLnTQ==} cpu: [arm64] os: [win32] requiresBuild: true dev: true optional: true - /turbo@1.10.13: - resolution: {integrity: sha512-vOF5IPytgQPIsgGtT0n2uGZizR2N3kKuPIn4b5p5DdeLoI0BV7uNiydT7eSzdkPRpdXNnO8UwS658VaI4+YSzQ==} + /turbo@1.10.4: + resolution: {integrity: sha512-EVBt762wVGyZAXtp1UWQptRG2N/9TThUJ1tRawvt/pmB62VmdzgDuz80SQYXK5U5yKEID6OJdqAzq8HnIQVA6g==} hasBin: true + requiresBuild: true optionalDependencies: - turbo-darwin-64: 1.10.13 - turbo-darwin-arm64: 1.10.13 - turbo-linux-64: 1.10.13 - turbo-linux-arm64: 1.10.13 - turbo-windows-64: 1.10.13 - turbo-windows-arm64: 1.10.13 + turbo-darwin-64: 1.10.4 + turbo-darwin-arm64: 1.10.4 + turbo-linux-64: 1.10.4 + turbo-linux-arm64: 1.10.4 + turbo-windows-64: 1.10.4 + turbo-windows-arm64: 1.10.4 dev: true /type-check@0.4.0: @@ -8421,12 +8432,6 @@ packages: hasBin: true dev: false - /typescript@5.2.2: - resolution: {integrity: sha512-mI4WrpHsbCIcwT9cF4FZvr80QUeKvsUsUvKDoR+X/7XHQH98xYD8YHZg7ANtz2GtZt/CBq2QJ0thkGJMHfqc1w==} - engines: {node: '>=14.17'} - hasBin: true - dev: true - /uglify-js@3.17.4: resolution: {integrity: sha512-T9q82TJI9e/C1TAxYvfb16xO120tMVFZrGA3f9/P4424DNu6ypK103y0GPFVa17yotwSyZW5iYXgjYHkGrJW/g==} engines: {node: '>=0.8.0'} @@ -8647,7 +8652,7 @@ packages: builtins: 5.0.1 dev: true - /vite@4.4.9(@types/node@20.5.6): + /vite@4.4.9(@types/node@20.4.9): resolution: {integrity: sha512-2mbUn2LlUmNASWwSCNSJ/EG2HuSRTnVNaydp6vMCm5VIqJsjMfbIWtbH2kDuwUVW5mMUKKZvGPX/rqeqVvv1XA==} engines: {node: ^14.18.0 || >=16.0.0} hasBin: true @@ -8675,7 +8680,7 @@ packages: terser: optional: true dependencies: - '@types/node': 20.5.6 + '@types/node': 20.4.9 esbuild: 0.18.20 postcss: 8.4.27 rollup: 3.28.0 From 3df205416fe93d6df76280101272dde74cceebcd Mon Sep 17 00:00:00 2001 From: Alexander Liu Date: Wed, 30 Aug 2023 18:29:34 -0700 Subject: [PATCH 2/5] refactor: remove @sanity/icons --- apps/sanity/package.json | 3 +-- pnpm-lock.yaml | 3 --- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/apps/sanity/package.json b/apps/sanity/package.json index 77904e0d..42254f48 100644 --- a/apps/sanity/package.json +++ b/apps/sanity/package.json @@ -16,7 +16,6 @@ "sanity" ], "dependencies": { - "@sanity/icons": "^2.4.1", "@sanity/vision": "^3.15.1", "lucide-react": "^0.271.0", "react": "^18.2.0", @@ -34,4 +33,4 @@ "prettier": "^2.8.8", "typescript": "^4.9.5" } -} +} \ No newline at end of file diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index c6e4e775..579a72eb 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -23,9 +23,6 @@ importers: apps/sanity: dependencies: - '@sanity/icons': - specifier: ^2.4.1 - version: 2.4.1(react@18.2.0) '@sanity/vision': specifier: ^3.15.1 version: 3.15.1(@babel/runtime@7.22.11)(@codemirror/lint@6.4.0)(@codemirror/state@6.2.1)(@codemirror/theme-one-dark@6.1.2)(@lezer/common@1.0.4)(codemirror@6.0.1)(react-dom@18.2.0)(react-is@18.2.0)(react@18.2.0)(styled-components@5.3.9) From 9e85335ecbbd03e8fa5694fb033ce030a635a8dd Mon Sep 17 00:00:00 2001 From: Alexander Liu Date: Wed, 30 Aug 2023 18:35:58 -0700 Subject: [PATCH 3/5] feat: switch faq answer to portable text block --- apps/sanity/schemas/faqs.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/apps/sanity/schemas/faqs.ts b/apps/sanity/schemas/faqs.ts index 5cd1b1a0..e478afb7 100644 --- a/apps/sanity/schemas/faqs.ts +++ b/apps/sanity/schemas/faqs.ts @@ -19,11 +19,17 @@ export default defineType({ title: "Question", type: "text", }), - defineField({ name: "answer", title: "Answer", - type: "text", + type: "array", + of: [ + { + type: "block", + styles: [{ title: "Normal", value: "normal" }], + lists: [], + }, + ], }), ], From e3ba88afe019d4b7df15f1b142ae3ccd09721228 Mon Sep 17 00:00:00 2001 From: Alexander Liu Date: Wed, 30 Aug 2023 18:44:27 -0700 Subject: [PATCH 4/5] feat: update preview icons --- apps/sanity/package.json | 1 + apps/sanity/sanity.config.ts | 4 ++-- apps/sanity/schemas/faqs.ts | 9 +++++++++ pnpm-lock.yaml | 26 ++++++++++++++++++++++++++ 4 files changed, 38 insertions(+), 2 deletions(-) diff --git a/apps/sanity/package.json b/apps/sanity/package.json index 42254f48..e85417aa 100644 --- a/apps/sanity/package.json +++ b/apps/sanity/package.json @@ -16,6 +16,7 @@ "sanity" ], "dependencies": { + "@portabletext/react": "^3.0.7", "@sanity/vision": "^3.15.1", "lucide-react": "^0.271.0", "react": "^18.2.0", diff --git a/apps/sanity/sanity.config.ts b/apps/sanity/sanity.config.ts index 9ae0f7cf..c35f943d 100644 --- a/apps/sanity/sanity.config.ts +++ b/apps/sanity/sanity.config.ts @@ -3,7 +3,7 @@ import { deskTool } from "sanity/desk"; import { visionTool } from "@sanity/vision"; import { media } from "sanity-plugin-media"; import { schemaTypes } from "./schemas"; -import { HelpCircle } from "lucide-react"; +import { BadgeHelp } from "lucide-react"; export default defineConfig({ name: "default", @@ -20,7 +20,7 @@ export default defineConfig({ .items([ S.listItem() .title("FAQs") - .icon(HelpCircle) + .icon(BadgeHelp) .child( S.document().schemaType("faqs").documentId("faqs").title("FAQs") ), diff --git a/apps/sanity/schemas/faqs.ts b/apps/sanity/schemas/faqs.ts index e478afb7..8e12bedf 100644 --- a/apps/sanity/schemas/faqs.ts +++ b/apps/sanity/schemas/faqs.ts @@ -1,4 +1,6 @@ import { defineType, defineField, defineArrayMember } from "sanity"; +import { toPlainText } from "@portabletext/react"; +import { FileQuestion } from "lucide-react"; export default defineType({ name: "faqs", @@ -38,6 +40,13 @@ export default defineType({ title: "question", subtitle: "answer", }, + prepare({ title, subtitle }) { + return { + title, + subtitle: subtitle ? toPlainText(subtitle) : undefined, + media: FileQuestion, + }; + }, }, }), ], diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 579a72eb..bf899f87 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -23,6 +23,9 @@ importers: apps/sanity: dependencies: + '@portabletext/react': + specifier: ^3.0.7 + version: 3.0.7(react@18.2.0) '@sanity/vision': specifier: ^3.15.1 version: 3.15.1(@babel/runtime@7.22.11)(@codemirror/lint@6.4.0)(@codemirror/state@6.2.1)(@codemirror/theme-one-dark@6.1.2)(@lezer/common@1.0.4)(codemirror@6.0.1)(react-dom@18.2.0)(react-is@18.2.0)(react@18.2.0)(styled-components@5.3.9) @@ -2267,6 +2270,29 @@ packages: tslib: 2.6.2 dev: false + /@portabletext/react@3.0.7(react@18.2.0): + resolution: {integrity: sha512-Hx4rohr3rul/IQMDl07nRhdXLeey2fZPE/3Nbn0I+k8Zr5DsqKdkqMgkla3iBNS8h0a0LTSclS5GKVXoQlzrWg==} + engines: {node: ^14.13.1 || >=16.0.0} + peerDependencies: + react: ^17 || ^18 + dependencies: + '@portabletext/toolkit': 2.0.8 + '@portabletext/types': 2.0.6 + react: 18.2.0 + dev: false + + /@portabletext/toolkit@2.0.8: + resolution: {integrity: sha512-MI3FKYZiL+/dYsClkkTDRjSvNS7K4j+U2LNZ5XIEoq67qCY0l7CYjvT0fn+lFBEUxjegtEmbxLk6T9nV/iXA+Q==} + engines: {node: ^14.13.1 || >=16.0.0} + dependencies: + '@portabletext/types': 2.0.6 + dev: false + + /@portabletext/types@2.0.6: + resolution: {integrity: sha512-6iqorcsQ0Z1/4Y7PWLvoknyiUv0DngSPao+q5UIE0+0gT2cZwFdItUyLZRheG85AisSEvacHEEnvN+TT8mxXVg==} + engines: {node: ^14.13.1 || >=16.0.0 || >=18.0.0} + dev: false + /@reduxjs/toolkit@1.9.5(react-redux@7.2.9)(react@18.2.0): resolution: {integrity: sha512-Rt97jHmfTeaxL4swLRNPD/zV4OxTes4la07Xc4hetpUW/vc75t5m1ANyxG6ymnEQ2FsLQsoMlYB2vV1sO3m8tQ==} peerDependencies: From 34a4d4092e2f08d923a6310bd15ab7e030861de0 Mon Sep 17 00:00:00 2001 From: Alexander Liu Date: Thu, 31 Aug 2023 00:07:21 -0700 Subject: [PATCH 5/5] ci: deploy to vercel --- .github/workflows/deploy-preview.yml | 62 ++++++++++++++++++++++++++++ .github/workflows/deploy-prod.yml | 36 ++++++++++++++++ 2 files changed, 98 insertions(+) create mode 100644 .github/workflows/deploy-preview.yml create mode 100644 .github/workflows/deploy-prod.yml diff --git a/.github/workflows/deploy-preview.yml b/.github/workflows/deploy-preview.yml new file mode 100644 index 00000000..b3c9c20f --- /dev/null +++ b/.github/workflows/deploy-preview.yml @@ -0,0 +1,62 @@ +name: Deploy Preview + +on: + pull_request: + +permissions: + contents: read + pull-requests: write + +jobs: + Site: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: amondnet/vercel-action@v25 + with: + vercel-version: 30.2.2 + github-comment: | + + + + + + + + + + + + + +
NameHack at UCI Site
PreviewVisit Preview
Commit{{deploymentCommit}}
+ github-token: ${{ secrets.GITHUB_TOKEN }} + vercel-token: ${{ secrets.VERCEL_TOKEN }} + vercel-org-id: ${{ vars.VERCEL_ORG_ID}} + vercel-project-id: ${{ vars.VERCEL_PROJECT_ID_SITE}} + Studio: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: amondnet/vercel-action@v25 + with: + vercel-version: 30.2.2 + github-comment: | + + + + + + + + + + + + + +
NameSanity Studio
PreviewVisit Preview
Commit{{deploymentCommit}}
+ github-token: ${{ secrets.GITHUB_TOKEN }} + vercel-token: ${{ secrets.VERCEL_TOKEN }} + vercel-org-id: ${{ vars.VERCEL_ORG_ID}} + vercel-project-id: ${{ vars.VERCEL_PROJECT_ID_STUDIO}} diff --git a/.github/workflows/deploy-prod.yml b/.github/workflows/deploy-prod.yml new file mode 100644 index 00000000..af833b0d --- /dev/null +++ b/.github/workflows/deploy-prod.yml @@ -0,0 +1,36 @@ +name: Deploy Production + +on: + push: + branches: + - main + +permissions: + contents: read + pull-requests: write + +jobs: + Site: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: amondnet/vercel-action@v25 + with: + vercel-version: 30.2.2 + github-comment: false + vercel-args: "--prod" + vercel-token: ${{ secrets.VERCEL_TOKEN }} + vercel-org-id: ${{ vars.VERCEL_ORG_ID}} + vercel-project-id: ${{ vars.VERCEL_PROJECT_ID_SITE}} + Studio: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: amondnet/vercel-action@v25 + with: + vercel-version: 30.2.2 + github-comment: false + vercel-args: "--prod" + vercel-token: ${{ secrets.VERCEL_TOKEN }} + vercel-org-id: ${{ vars.VERCEL_ORG_ID}} + vercel-project-id: ${{ vars.VERCEL_PROJECT_ID_STUDIO}}