├── .editorconfig ├── .eslintignore ├── .eslintrc.js ├── .github ├── CODEOWNERS └── workflows │ └── main.yml ├── .gitignore ├── .husky ├── commit-msg └── pre-commit ├── .npmrc ├── .prettierignore ├── .prettierrc ├── .releaserc.json ├── CHANGELOG.md ├── LICENSE ├── README.md ├── assets └── dashboard.png ├── commitlint.config.js ├── lint-staged.config.js ├── package-lock.json ├── package.config.ts ├── package.json ├── renovate.json ├── sanity.config.ts ├── sanity.json ├── src ├── components │ ├── DashboardLayout.tsx │ ├── DashboardWidgetContainer.tsx │ ├── NotFoundWidget.tsx │ └── WidgetGroup.tsx ├── containers │ ├── Dashboard.tsx │ ├── DashboardContext.tsx │ └── WidgetContainer.tsx ├── index.ts ├── plugin.tsx ├── types.ts ├── versionedClient.ts └── widgets │ ├── projectInfo │ ├── ProjectInfo.tsx │ ├── index.ts │ └── types.ts │ ├── projectUsers │ ├── ProjectUser.tsx │ ├── ProjectUsers.tsx │ └── index.ts │ └── sanityTutorials │ ├── SanityTutorials.tsx │ ├── Tutorial.tsx │ ├── dataAdapter.ts │ └── index.ts ├── tsconfig.json ├── tsconfig.lib.json ├── tsconfig.settings.json └── v2-incompatible.js /.editorconfig: -------------------------------------------------------------------------------- 1 | ; editorconfig.org 2 | root = true 3 | charset= utf8 4 | 5 | [*] 6 | end_of_line = lf 7 | insert_final_newline = true 8 | trim_trailing_whitespace = true 9 | indent_style = space 10 | indent_size = 2 11 | 12 | [*.md] 13 | trim_trailing_whitespace = false 14 | -------------------------------------------------------------------------------- /.eslintignore: -------------------------------------------------------------------------------- 1 | *.js 2 | .eslintrc.js 3 | commitlint.config.js 4 | lib 5 | lint-staged.config.js 6 | package.config.ts 7 | sanity.config.ts 8 | -------------------------------------------------------------------------------- /.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | env: { 3 | browser: true, 4 | node: false, 5 | }, 6 | extends: [ 7 | 'sanity/react', // must come before sanity/typescript 8 | 'sanity/typescript', 9 | 'plugin:prettier/recommended', 10 | 'plugin:react-hooks/recommended', 11 | ], 12 | overrides: [ 13 | { 14 | files: ['*.{ts,tsx}'], 15 | }, 16 | ], 17 | parser: '@typescript-eslint/parser', 18 | parserOptions: { 19 | ecmaFeatures: { 20 | jsx: true, 21 | }, 22 | project: './tsconfig.json', 23 | }, 24 | plugins: ['prettier'], 25 | rules: { 26 | '@typescript-eslint/explicit-module-boundary-types': 'off', 27 | '@typescript-eslint/explicit-function-return-type': 'off', 28 | 'react/no-unused-prop-types': 'off', 29 | 'react/no-array-index-key': 'off', 30 | 'react/display-name': 0, 31 | camelcase: 'off', 32 | }, 33 | settings: { 34 | 'import/ignore': ['\\.css$', '.*node_modules.*', '.*:.*'], 35 | 'import/resolver': { 36 | node: { 37 | paths: ['src'], 38 | extensions: ['.js', '.jsx', '.ts', '.tsx'], 39 | }, 40 | }, 41 | }, 42 | } 43 | -------------------------------------------------------------------------------- /.github/CODEOWNERS: -------------------------------------------------------------------------------- 1 | * @sanity-io/ecosystem 2 | -------------------------------------------------------------------------------- /.github/workflows/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: CI & Release 3 | 4 | # Workflow name based on selected inputs. Fallback to default Github naming when expression evaluates to empty string 5 | run-name: >- 6 | ${{ 7 | inputs.release && inputs.test && 'Build ➤ Test ➤ Publish to NPM' || 8 | inputs.release && !inputs.test && 'Build ➤ Skip Tests ➤ Publish to NPM' || 9 | github.event_name == 'workflow_dispatch' && inputs.test && 'Build ➤ Test' || 10 | github.event_name == 'workflow_dispatch' && !inputs.test && 'Build ➤ Skip Tests' || 11 | '' 12 | }} 13 | 14 | on: 15 | # Build on pushes branches that have a PR (including drafts) 16 | pull_request: 17 | # Build on commits pushed to branches without a PR if it's in the allowlist 18 | push: 19 | branches: [main] 20 | # https://docs.github.com/en/actions/managing-workflow-runs/manually-running-a-workflow 21 | workflow_dispatch: 22 | inputs: 23 | test: 24 | description: Run tests 25 | required: true 26 | default: true 27 | type: boolean 28 | release: 29 | description: Release new version 30 | required: true 31 | default: false 32 | type: boolean 33 | 34 | concurrency: 35 | # On PRs builds will cancel if new pushes happen before the CI completes, as it defines `github.head_ref` and gives it the name of the branch the PR wants to merge into 36 | # Otherwise `github.run_id` ensures that you can quickly merge a queue of PRs without causing tests to auto cancel on any of the commits pushed to main. 37 | group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} 38 | cancel-in-progress: true 39 | 40 | jobs: 41 | log-the-inputs: 42 | name: Log inputs 43 | runs-on: ubuntu-latest 44 | steps: 45 | - run: | 46 | echo "Inputs: $INPUTS" 47 | env: 48 | INPUTS: ${{ toJSON(inputs) }} 49 | 50 | build: 51 | runs-on: ubuntu-latest 52 | name: Lint & Build 53 | steps: 54 | - uses: actions/checkout@v4 55 | - uses: actions/setup-node@v4 56 | with: 57 | cache: npm 58 | node-version: lts/* 59 | - run: npm ci 60 | # Linting can be skipped 61 | - run: npm run lint --if-present 62 | if: github.event.inputs.test != 'false' 63 | # But not the build script, as semantic-release will crash if this command fails so it makes sense to test it early 64 | - run: npm run prepublishOnly --if-present 65 | 66 | test: 67 | needs: build 68 | # The test matrix can be skipped, in case a new release needs to be fast-tracked and tests are already passing on main 69 | if: github.event.inputs.test != 'false' 70 | runs-on: ${{ matrix.os }} 71 | name: Node.js ${{ matrix.node }} / ${{ matrix.os }} 72 | strategy: 73 | # A test failing on windows doesn't mean it'll fail on macos. It's useful to let all tests run to its completion to get the full picture 74 | fail-fast: false 75 | matrix: 76 | # Run the testing suite on each major OS with the latest LTS release of Node.js 77 | os: [macos-latest, ubuntu-latest, windows-latest] 78 | node: [lts/*] 79 | # It makes sense to also test the oldest, and latest, versions of Node.js, on ubuntu-only since it's the fastest CI runner 80 | include: 81 | - os: ubuntu-latest 82 | # Test the oldest LTS release of Node that's still receiving bugfixes and security patches, versions older than that have reached End-of-Life 83 | node: lts/-2 84 | - os: ubuntu-latest 85 | # Test the actively developed version that will become the latest LTS release next October 86 | node: current 87 | steps: 88 | # It's only necessary to do this for windows, as mac and ubuntu are sane OS's that already use LF 89 | - name: Set git to use LF 90 | if: matrix.os == 'windows-latest' 91 | run: | 92 | git config --global core.autocrlf false 93 | git config --global core.eol lf 94 | - uses: actions/checkout@v4 95 | - uses: actions/setup-node@v4 96 | with: 97 | cache: npm 98 | node-version: ${{ matrix.node }} 99 | - run: npm i 100 | - run: npm test --if-present 101 | 102 | release: 103 | needs: [build, test] 104 | # only run if opt-in during workflow_dispatch 105 | if: always() && github.event.inputs.release == 'true' && needs.build.result != 'failure' && needs.test.result != 'failure' && needs.test.result != 'cancelled' 106 | runs-on: ubuntu-latest 107 | name: Semantic release 108 | steps: 109 | - uses: actions/create-github-app-token@v2 110 | id: app-token 111 | with: 112 | app-id: ${{ secrets.ECOSPARK_APP_ID }} 113 | private-key: ${{ secrets.ECOSPARK_APP_PRIVATE_KEY }} 114 | - uses: actions/checkout@v4 115 | with: 116 | # Need to fetch entire commit history to 117 | # analyze every commit since last release 118 | fetch-depth: 0 119 | # Uses generated token to allow pushing commits back 120 | token: ${{ steps.app-token.outputs.token }} 121 | # Make sure the value of GITHUB_TOKEN will not be persisted in repo's config 122 | persist-credentials: false 123 | - uses: actions/setup-node@v4 124 | with: 125 | cache: npm 126 | node-version: lts/* 127 | - run: npm ci 128 | # Branches that will release new versions are defined in .releaserc.json 129 | - run: npx semantic-release 130 | env: 131 | GITHUB_TOKEN: ${{ steps.app-token.outputs.token }} 132 | NPM_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }} 133 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | 6 | # Runtime data 7 | pids 8 | *.pid 9 | *.seed 10 | 11 | # Directory for instrumented libs generated by jscoverage/JSCover 12 | lib-cov 13 | 14 | # Coverage directory used by tools like istanbul 15 | coverage 16 | 17 | # nyc test coverage 18 | .nyc_output 19 | 20 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 21 | .grunt 22 | 23 | # node-waf configuration 24 | .lock-wscript 25 | 26 | # Compiled binary addons (http://nodejs.org/api/addons.html) 27 | build/Release 28 | 29 | # Dependency directories 30 | node_modules 31 | jspm_packages 32 | 33 | # Optional npm cache directory 34 | .npm 35 | 36 | # Optional REPL history 37 | .node_repl_history 38 | 39 | # macOS finder cache file 40 | .DS_Store 41 | 42 | # VS Code settings 43 | .vscode 44 | 45 | # IntelliJ 46 | .idea 47 | *.iml 48 | 49 | # Cache 50 | .cache 51 | 52 | # Yalc 53 | .yalc 54 | yalc.lock 55 | 56 | # npm package zips 57 | *.tgz 58 | 59 | # Compiled plugin 60 | lib 61 | 62 | # Sanity development 63 | .sanity 64 | -------------------------------------------------------------------------------- /.husky/commit-msg: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | . "$(dirname "$0")/_/husky.sh" 3 | 4 | npx --no -- commitlint --edit "" 5 | -------------------------------------------------------------------------------- /.husky/pre-commit: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | . "$(dirname "$0")/_/husky.sh" 3 | 4 | npx lint-staged 5 | -------------------------------------------------------------------------------- /.npmrc: -------------------------------------------------------------------------------- 1 | legacy-peer-deps=true -------------------------------------------------------------------------------- /.prettierignore: -------------------------------------------------------------------------------- 1 | lib 2 | pnpm-lock.yaml 3 | yarn.lock 4 | package-lock.json 5 | -------------------------------------------------------------------------------- /.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "semi": false, 3 | "printWidth": 100, 4 | "bracketSpacing": false, 5 | "singleQuote": true 6 | } 7 | -------------------------------------------------------------------------------- /.releaserc.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "@sanity/semantic-release-preset", 3 | "branches": ["main", {"name": "studio-v2", "channel": "studio-v2", "range": "2.x"}] 4 | } 5 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | # 📓 Changelog 4 | 5 | All notable changes to this project will be documented in this file. See 6 | [Conventional Commits](https://conventionalcommits.org) for commit guidelines. 7 | 8 | ## [5.0.0](https://github.com/sanity-io/dashboard/compare/v4.1.4...v5.0.0) (2025-09-15) 9 | 10 | ### ⚠ BREAKING CHANGES 11 | 12 | - **deps:** update @sanity/ui to 3.x (#70) 13 | 14 | ### Features 15 | 16 | - **deps:** update @sanity/ui to 3.x ([#70](https://github.com/sanity-io/dashboard/issues/70)) ([b3862d3](https://github.com/sanity-io/dashboard/commit/b3862d3dec1cdecb4273621d3c38c1a58bb88ce4)) 17 | 18 | ## [4.1.4](https://github.com/sanity-io/dashboard/compare/v4.1.3...v4.1.4) (2025-07-10) 19 | 20 | ### Bug Fixes 21 | 22 | - **deps:** allow studio v4 in peer dep ranges ([#67](https://github.com/sanity-io/dashboard/issues/67)) ([4472bf0](https://github.com/sanity-io/dashboard/commit/4472bf0833165b1e8e49f70d3e62d0b98be1e861)) 23 | 24 | ## [4.1.3](https://github.com/sanity-io/dashboard/compare/v4.1.2...v4.1.3) (2025-03-10) 25 | 26 | ### Bug Fixes 27 | 28 | - **deps:** bump dependencies for even better react 19 compatibility ([6ad8110](https://github.com/sanity-io/dashboard/commit/6ad811031d3b4bc786a1e62d5c82b01b916d8b38)) 29 | 30 | ## [4.1.2](https://github.com/sanity-io/dashboard/compare/v4.1.1...v4.1.2) (2024-12-11) 31 | 32 | ### Bug Fixes 33 | 34 | - **deps:** bump `[@sanity](https://github.com/sanity)` dependencies to react 19-compatible versions ([70442e9](https://github.com/sanity-io/dashboard/commit/70442e91c39ca14d8693f1715e84ea4a2286c0f5)) 35 | 36 | ## [4.1.1](https://github.com/sanity-io/dashboard/compare/v4.1.0...v4.1.1) (2024-12-11) 37 | 38 | ### Bug Fixes 39 | 40 | - **deps:** silence audit warnings ([957f4cf](https://github.com/sanity-io/dashboard/commit/957f4cf21f4e4b4534c87d37e3b19d4c2e619f00)) 41 | - **deps:** upgrade sanity dev dependency ([#64](https://github.com/sanity-io/dashboard/issues/64)) ([7b9ff32](https://github.com/sanity-io/dashboard/commit/7b9ff3290b40997539d50f7864a77fdedcbf8762)) 42 | - flag compatibility with React 19 ([f4ef8ed](https://github.com/sanity-io/dashboard/commit/f4ef8ed22dc230f97c050c2fb964f1999fe67816)) 43 | 44 | ## [4.1.0](https://github.com/sanity-io/dashboard/compare/v4.0.0...v4.1.0) (2024-10-01) 45 | 46 | ### Features 47 | 48 | - list all studios from user applications list ([#62](https://github.com/sanity-io/dashboard/issues/62)) ([f757d58](https://github.com/sanity-io/dashboard/commit/f757d58b7c7a6b5b61dd4c77de253102f22fda33)) 49 | 50 | ### Bug Fixes 51 | 52 | - **deps:** update non-major ([#60](https://github.com/sanity-io/dashboard/issues/60)) ([13b4b5a](https://github.com/sanity-io/dashboard/commit/13b4b5a499e22e54d3162b15757d54b3189f2170)) 53 | 54 | ## [4.0.0](https://github.com/sanity-io/dashboard/compare/v3.1.6...v4.0.0) (2024-07-15) 55 | 56 | ### ⚠ BREAKING CHANGES 57 | 58 | - This module now requires the peer dependency `styled-components` greater than or 59 | equal to version 6.1. This aligns with Sanity v3.37.0 and higher. 60 | - This module now requires Node.js 18 or higher. 61 | This shouldn't really impact anyone beyond developers of the module, since this really only applies 62 | to the build tooling. 63 | 64 | ### Bug Fixes 65 | 66 | - add request tags for all dashboard widget api requests ([528b92d](https://github.com/sanity-io/dashboard/commit/528b92dc2f1869d2d1fcff46000cb1b78aae675f)) 67 | - **projectInfo:** show external studio host if present ([36c6882](https://github.com/sanity-io/dashboard/commit/36c688211145e3dbed283b28f97898d13d6d77ef)) 68 | - **projectUsers:** show all of a users' roles, fix invite link + text ([4699add](https://github.com/sanity-io/dashboard/commit/4699add5706e3381d59c8d70353d30a7ce1b4123)) 69 | - require styled-components ^6.1, node >= 18 ([b0d9cb6](https://github.com/sanity-io/dashboard/commit/b0d9cb6726ec68d97550d1a465196835f463366d)) 70 | - upgrade build tooling, es/cjs export definitions ([21eaa29](https://github.com/sanity-io/dashboard/commit/21eaa29847b7157881d98c171fbaca74865cce17)) 71 | - use named import for styled-components ([5eec15a](https://github.com/sanity-io/dashboard/commit/5eec15ad6a9fdfae4d05b186576459bf302d3898)) 72 | 73 | ## [3.1.6](https://github.com/sanity-io/dashboard/compare/v3.1.5...v3.1.6) (2023-11-30) 74 | 75 | ### Bug Fixes 76 | 77 | - **deps:** Update dependency styled-components to v6 ([#41](https://github.com/sanity-io/dashboard/issues/41)) ([4db1ccb](https://github.com/sanity-io/dashboard/commit/4db1ccb64eff362e97c5c21d027f1fec9519f5db)) 78 | 79 | ## [3.1.5](https://github.com/sanity-io/dashboard/compare/v3.1.4...v3.1.5) (2023-08-02) 80 | 81 | ### Bug Fixes 82 | 83 | - **deps:** update dependencies (non-major) ([#18](https://github.com/sanity-io/dashboard/issues/18)) ([657bcfc](https://github.com/sanity-io/dashboard/commit/657bcfc631355b5f53727998e6d8ab75539ce577)) 84 | 85 | ## [3.1.4](https://github.com/sanity-io/dashboard/compare/v3.1.3...v3.1.4) (2023-05-03) 86 | 87 | ### Bug Fixes 88 | 89 | - **docs:** Update README.md ([#31](https://github.com/sanity-io/dashboard/issues/31)) ([c7450b9](https://github.com/sanity-io/dashboard/commit/c7450b98f417ed3f09e1f1a915ca59f082b0106a)) 90 | 91 | ## [3.1.3](https://github.com/sanity-io/dashboard/compare/v3.1.2...v3.1.3) (2023-01-31) 92 | 93 | ### Bug Fixes 94 | 95 | - **docs:** add instructions on customizing name, title, icon ([e7bb30b](https://github.com/sanity-io/dashboard/commit/e7bb30b34402d216d53a54fa65a37e098300fc6c)) 96 | 97 | ## [3.1.2](https://github.com/sanity-io/dashboard/compare/v3.1.1...v3.1.2) (2023-01-04) 98 | 99 | ### Bug Fixes 100 | 101 | - **deps:** applied npx @sanity/plugin-kit inject ([300067e](https://github.com/sanity-io/dashboard/commit/300067e12549d04817d1dae24a61992b57a426fa)) 102 | 103 | ## [3.1.1](https://github.com/sanity-io/dashboard/compare/v3.1.0...v3.1.1) (2022-12-22) 104 | 105 | ### Bug Fixes 106 | 107 | - **ui:** dashboard content overflowed layout ([0aa8cbe](https://github.com/sanity-io/dashboard/commit/0aa8cbed0d4775d667d51c86ea61e645c89c1b9a)) 108 | 109 | ## [3.1.0](https://github.com/sanity-io/dashboard/compare/v3.0.0...v3.1.0) (2022-12-22) 110 | 111 | ### Features 112 | 113 | - make name and icon configurable ([6db4c65](https://github.com/sanity-io/dashboard/commit/6db4c6573d558881621b764a4c124a431a1071d8)) 114 | - make title configurable ([36fcaf8](https://github.com/sanity-io/dashboard/commit/36fcaf8fa8274aa8724a2bd6ae33c0b50e5bfd6e)) 115 | 116 | ## [3.0.0](https://github.com/sanity-io/dashboard/compare/v2.35.2...v3.0.0) (2022-11-25) 117 | 118 | ### ⚠ BREAKING CHANGES 119 | 120 | - this version does not work in Sanity Studio v2 121 | - this version does not work in Sanity Studio v2 122 | - semantic-release is being difficult 123 | 124 | ### Features 125 | 126 | - dummy breaking to trick semantic-release ([53dd9dc](https://github.com/sanity-io/dashboard/commit/53dd9dcae19e2d6db97e11302867c3838ff155c6)) 127 | - initial release for Sanity Studio v3 ([4e3db99](https://github.com/sanity-io/dashboard/commit/4e3db99e83e49c5876db83c3fc3fe0ff5c3d3725)) 128 | - initial Sanity Studio v3 release ([9ea2f0a](https://github.com/sanity-io/dashboard/commit/9ea2f0a7146464f197598a63336f2500ff836aae)) 129 | 130 | ### Bug Fixes 131 | 132 | - compiled for dev-preview.22 ([3b97135](https://github.com/sanity-io/dashboard/commit/3b97135143ee29f2e1c2bae6f8e6ae051a943d4b)) 133 | - compiled for sanity 3.0.0-rc.0 ([74dfd9a](https://github.com/sanity-io/dashboard/commit/74dfd9a3db922649f32e52f990a80c5de7d1a752)) 134 | - **deps:** dev-preview.21 ([730cc2a](https://github.com/sanity-io/dashboard/commit/730cc2a25a36f57e5c3310079e262b39d8412774)) 135 | - **deps:** pin dependencies ([5fc3f9d](https://github.com/sanity-io/dashboard/commit/5fc3f9d276116dffcc957ed39b3a3e876a479fbf)) 136 | - **deps:** pkg-utils & @sanity/plugin-kit ([7d63c7c](https://github.com/sanity-io/dashboard/commit/7d63c7c05d274ab5d26fefd3da7807264f17b468)) 137 | - **deps:** sanity ^3.0.0 (works with rc.3) ([eeb0c7c](https://github.com/sanity-io/dashboard/commit/eeb0c7cdfd628ead3dcab39f7ce3cb2df2f1f784)) 138 | - **deps:** sanity 3.0.0-dev-preview.17 ([bed90ee](https://github.com/sanity-io/dashboard/commit/bed90eeaa3c6d2f9a8cda3a9c597e792d2816cff)) 139 | - **deps:** update dependency @sanity/icons to v1.3.9-beta.3 ([#12](https://github.com/sanity-io/dashboard/issues/12)) ([b547871](https://github.com/sanity-io/dashboard/commit/b5478710f11d58d898e1eaf638b702dece12edaa)) 140 | - **deps:** update dependency rxjs to ^6.6.7 ([#4](https://github.com/sanity-io/dashboard/issues/4)) ([b79f4be](https://github.com/sanity-io/dashboard/commit/b79f4bec0661c32f8b1a797f82ea22195ec583d9)) 141 | - **deps:** updated deps and added semver workflow ([68d714e](https://github.com/sanity-io/dashboard/commit/68d714e2b3457fbd4ab112a7cbc6194057b61e36)) 142 | 143 | ## [3.0.0-v3-studio.8](https://github.com/sanity-io/dashboard/compare/v3.0.0-v3-studio.7...v3.0.0-v3-studio.8) (2022-11-04) 144 | 145 | ### Bug Fixes 146 | 147 | - **deps:** pkg-utils & @sanity/plugin-kit ([7d63c7c](https://github.com/sanity-io/dashboard/commit/7d63c7c05d274ab5d26fefd3da7807264f17b468)) 148 | 149 | ## [3.0.0-v3-studio.7](https://github.com/sanity-io/dashboard/compare/v3.0.0-v3-studio.6...v3.0.0-v3-studio.7) (2022-11-04) 150 | 151 | ### Bug Fixes 152 | 153 | - **deps:** pin dependencies ([5fc3f9d](https://github.com/sanity-io/dashboard/commit/5fc3f9d276116dffcc957ed39b3a3e876a479fbf)) 154 | - **deps:** update dependency @sanity/icons to v1.3.9-beta.3 ([#12](https://github.com/sanity-io/dashboard/issues/12)) ([b547871](https://github.com/sanity-io/dashboard/commit/b5478710f11d58d898e1eaf638b702dece12edaa)) 155 | - **deps:** update dependency rxjs to ^6.6.7 ([#4](https://github.com/sanity-io/dashboard/issues/4)) ([b79f4be](https://github.com/sanity-io/dashboard/commit/b79f4bec0661c32f8b1a797f82ea22195ec583d9)) 156 | 157 | ## [3.0.0-v3-studio.6](https://github.com/sanity-io/dashboard/compare/v3.0.0-v3-studio.5...v3.0.0-v3-studio.6) (2022-11-02) 158 | 159 | ### Bug Fixes 160 | 161 | - compiled for sanity 3.0.0-rc.0 ([74dfd9a](https://github.com/sanity-io/dashboard/commit/74dfd9a3db922649f32e52f990a80c5de7d1a752)) 162 | 163 | ## [3.0.0-v3-studio.5](https://github.com/sanity-io/dashboard/compare/v3.0.0-v3-studio.4...v3.0.0-v3-studio.5) (2022-10-27) 164 | 165 | ### Bug Fixes 166 | 167 | - compiled for dev-preview.22 ([3b97135](https://github.com/sanity-io/dashboard/commit/3b97135143ee29f2e1c2bae6f8e6ae051a943d4b)) 168 | 169 | ## [3.0.0-v3-studio.4](https://github.com/sanity-io/dashboard/compare/v3.0.0-v3-studio.3...v3.0.0-v3-studio.4) (2022-10-07) 170 | 171 | ### Bug Fixes 172 | 173 | - **deps:** dev-preview.21 ([730cc2a](https://github.com/sanity-io/dashboard/commit/730cc2a25a36f57e5c3310079e262b39d8412774)) 174 | 175 | ## [3.0.0-v3-studio.3](https://github.com/sanity-io/dashboard/compare/v3.0.0-v3-studio.2...v3.0.0-v3-studio.3) (2022-09-15) 176 | 177 | ### Bug Fixes 178 | 179 | - **deps:** sanity 3.0.0-dev-preview.17 ([bed90ee](https://github.com/sanity-io/dashboard/commit/bed90eeaa3c6d2f9a8cda3a9c597e792d2816cff)) 180 | 181 | ## [3.0.0-v3-studio.2](https://github.com/sanity-io/dashboard/compare/v3.0.0-v3-studio.1...v3.0.0-v3-studio.2) (2022-09-14) 182 | 183 | ### ⚠ BREAKING CHANGES 184 | 185 | - semantic-release is being difficult 186 | 187 | ### Features 188 | 189 | - dummy breaking to trick semantic-release ([53dd9dc](https://github.com/sanity-io/dashboard/commit/53dd9dcae19e2d6db97e11302867c3838ff155c6)) 190 | 191 | ### Bug Fixes 192 | 193 | - **deps:** updated deps and added semver workflow ([68d714e](https://github.com/sanity-io/dashboard/commit/68d714e2b3457fbd4ab112a7cbc6194057b61e36)) 194 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2025 Sanity.io 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Sanity Dashboard 2 | 3 | > For the v2 version, please refer to the [v2-branch](https://github.com/sanity-io/dashboard/tree/studio-v2). 4 | 5 | ## What is it? 6 | 7 | Dashboard is a Sanity Content Studio Tool which renders any widgets configured for it. 8 | Install this plugin in your Studio to display stats about your project, recently edited documents, etc. 9 | 10 | The Dashboard tool has been designed to be as generic as possible, making few assumptions about its widgets. 11 | The Dashboard itself is mostly concerned about the layout of the configured widgets. 12 | 13 | ![Sanity dashboard](assets/dashboard.png) 14 | 15 | ## Install 16 | 17 | In your Sanity Content Studio run: 18 | 19 | `npm install --save @sanity/dashboard` 20 | 21 | or 22 | 23 | `yarn add @sanity/dashboard` 24 | 25 | ## Basic usage 26 | 27 | In `sanity.config.js` (or .ts), add the dashboard tool to the defineConfig plugins array: 28 | 29 | ```ts 30 | import {defineConfig} from 'sanity' 31 | import {dashboardTool} from '@sanity/dashboard' 32 | export default defineConfig({ 33 | /* ... */ 34 | plugins: [dashboardTool({widgets: []})], 35 | }) 36 | ``` 37 | 38 | To verify that all is well, fire up your Studio (`sanity start`) and point your browser to `http://localhost:3333/dashboard`. 39 | It should show an empty dashboard, with a message encouraging you to add some widgets to the dashboard. 40 | 41 | ## How to configure the Dashboard 42 | 43 | Now, add any widgets you might want. The dashboard plugin provides three widgets out-of-the-box: 44 | 45 | ```ts 46 | import {defineConfig} from 'sanity' 47 | import { 48 | dashboardTool, 49 | sanityTutorialsWidget, 50 | projectUsersWidget, 51 | projectInfoWidget, 52 | } from '@sanity/dashboard' 53 | 54 | // configure the dashboard tool with widgets 55 | dashboardTool({ 56 | widgets: [sanityTutorialsWidget(), projectInfoWidget(), projectUsersWidget()], 57 | }) 58 | ``` 59 | 60 | Widgets can be configured by passing widget-specific config: 61 | 62 | ```ts 63 | projectUsersWidget({layout: 'medium'}) 64 | ``` 65 | 66 | You can change the name, title and icon of the dashboard tool should you want to - which also allows you to configure multiple dashboards with different configurations: 67 | 68 | ```ts 69 | import {defineConfig} from 'sanity' 70 | import {dashboardTool} from '@sanity/dashboard' 71 | import {ActivityIcon} from '@sanity/icons' 72 | 73 | dashboardTool({ 74 | name: 'stats', 75 | title: 'Statistics', 76 | icon: ActivityIcon, 77 | widgets: [ 78 | /* ... */ 79 | ], 80 | }) 81 | ``` 82 | 83 | ## How to install a widget 84 | 85 | Install a Dashboard widget as you would any npm package. 86 | 87 | E.g. if you want to install the cats example widget mentioned below, proceed as follows: 88 | 89 | 1. Run `yarn install @sanity/sanity-plugin-dashboard-widget-cats` in the studio directory 90 | 2. Update your `sanity.config.js` by importing the widget and adding it to the widget array. 91 | 3. You've got 🐱 in your Studio 92 | 93 | Some widgets have widget-specific options to change aspects of their behavior. 94 | If you install the `@sanity/sanity-plugin-dashboard-widget-document-list` widget mentioned below, 95 | it can be configured with: 96 | 97 | ```ts 98 | documentListWidget({ 99 | showCreateButton: true, 100 | limit: 5, 101 | types: ['my-document-type'], 102 | }) 103 | ``` 104 | 105 | You can add multiple instances of a widget with different configuration. 106 | So, if you want your dashboard to display both newest documents across all document types and 107 | another widget showing the last edited books, dashboard config could look like this: 108 | 109 | ```js 110 | export default { 111 | widgets: [ 112 | documentListWidget({title: 'New', order: '_createdAt desc'}), 113 | documentListWidget({title: 'Last edited books', order: '_updatedAt desc', types: ['book']}), 114 | ], 115 | } 116 | ``` 117 | 118 | ## How to create a widget 119 | 120 | Widgets are simply objects that follow implement the [DashboardWidget](src/types.ts) interface. 121 | Let's have a look at some sample widgets: 122 | 123 | For example, [a document list](https://github.com/sanity-io/dashboard-widget-document-list/tree/master) or 124 | [maybe some cats](https://github.com/sanity-io/example-dashboard-widget-cats)? 125 | 126 | When writing your widget components, it's recommended to use the `DashboardWidgetContainer` component from 127 | this package by importing it like so: 128 | `import { DashboardWidgetContainer } from "@sanity/dashboard";`. 129 | 130 | This gives you a typical widget component structure with basic styles, 131 | and the option of presenting your content in the header, footer, or body of the widget. 132 | 133 | If you need something more flexible you can create your own component. 134 | 135 | Setting up the widget with the default setup will give you a basic widget that looks something like this: 136 | 137 | ```js 138 | 142 |