Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

chore: add eslint-config-next

Alaister Young281b02b70359
diff --git a/package-lock.json b/package-lock.json
index 42935afdd16..f9f0505e8e9 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -5952,6 +5952,25 @@
"resolved": "https://registry.npmjs.org/@octokit/webhooks-types/-/webhooks-types-6.10.0.tgz",
"integrity": "sha512-lDNv83BeEyxxukdQ0UttiUXawk9+6DkdjjFtm2GFED+24IQhTVaoSbwV9vWWKONyGLzRmCQqZmoEWkDhkEmPlw=="
},
+ "node_modules/@pkgr/utils": {
+ "version": "2.3.1",
+ "resolved": "https://registry.npmjs.org/@pkgr/utils/-/utils-2.3.1.tgz",
+ "integrity": "sha512-wfzX8kc1PMyUILA+1Z/EqoE4UCXGy0iRGMhPwdfae1+f0OXlLqCk+By+aMzgJBzR9AzS4CDizioG6Ss1gvAFJw==",
+ "dependencies": {
+ "cross-spawn": "^7.0.3",
+ "is-glob": "^4.0.3",
+ "open": "^8.4.0",
+ "picocolors": "^1.0.0",
+ "tiny-glob": "^0.2.9",
+ "tslib": "^2.4.0"
+ },
+ "engines": {
+ "node": "^12.20.0 || ^14.18.0 || >=16.0.0"
+ },
+ "funding": {
+ "url": "https://opencollective.com/unts"
+ }
+ },
"node_modules/@pmmmwh/react-refresh-webpack-plugin": {
"version": "0.5.10",
"resolved": "https://registry.npmjs.org/@pmmmwh/react-refresh-webpack-plugin/-/react-refresh-webpack-plugin-0.5.10.tgz",
@@ -15821,7 +15840,6 @@
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/define-lazy-prop/-/define-lazy-prop-2.0.0.tgz",
"integrity": "sha512-Ds09qNh8yw3khSjiJjiUInaGX9xlqZDY7JVryGxdxV7NPeuqQfplOpQ66yJFZut3jLa5zOwkXw1g9EI2uKh4Og==",
- "dev": true,
"engines": {
"node": ">=8"
}
@@ -19014,7 +19032,6 @@
"version": "4.5.0",
"resolved": "https://registry.npmjs.org/get-tsconfig/-/get-tsconfig-4.5.0.tgz",
"integrity": "sha512-MjhiaIWCJ1sAU4pIQ5i5OfOuHHxVo1oYeNsWTON7jxYkod8pHocXeh+SSbmu5OZZZK73B6cbJ2XADzXehLyovQ==",
- "dev": true,
"funding": {
"url": "https://github.com/privatenumber/get-tsconfig?sponsor=1"
}
@@ -19121,6 +19138,11 @@
"url": "https://github.com/sponsors/ljharb"
}
},
+ "node_modules/globalyzer": {
+ "version": "0.1.0",
+ "resolved": "https://registry.npmjs.org/globalyzer/-/globalyzer-0.1.0.tgz",
+ "integrity": "sha512-40oNTM9UfG6aBmuKxk/giHn5nQ8RVz/SS4Ir6zgzOv9/qC3kKZ9v4etGTcJbEl/NyVQH7FGU7d+X1egr57Md2Q=="
+ },
"node_modules/globby": {
"version": "12.2.0",
"resolved": "https://registry.npmjs.org/globby/-/globby-12.2.0.tgz",
@@ -19151,6 +19173,11 @@
"url": "https://github.com/sponsors/sindresorhus"
}
},
+ "node_modules/globrex": {
+ "version": "0.1.2",
+ "resolved": "https://registry.npmjs.org/globrex/-/globrex-0.1.2.tgz",
+ "integrity": "sha512-uHJgbwAMwNFf5mLst7IWLNg14x1CkeqglJb/K3doi4dw6q2IvAAmM/Y81kevy83wP+Sst+nutFTYOGg3d1lsxg=="
+ },
"node_modules/goober": {
"version": "2.1.12",
"resolved": "https://registry.npmjs.org/goober/-/goober-2.1.12.tgz",
@@ -20879,7 +20906,6 @@
"version": "2.2.1",
"resolved": "https://registry.npmjs.org/is-docker/-/is-docker-2.2.1.tgz",
"integrity": "sha512-F+i2BKsFrH66iaUFc0woD8sLy8getkwTwtOBjvs56Cx4CgJDeKQeqfz8wAYiSb8JOprWhHH5p77PbmYCvvUuXQ==",
- "dev": true,
"bin": {
"is-docker": "cli.js"
},
@@ -21295,7 +21321,6 @@
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-2.2.0.tgz",
"integrity": "sha512-fKzAra0rGJUUBwGBgNkHZuToZcn+TtXHpeCgmkMJMMYx1sQDYaCSyjJBSCa2nH1DGm7s3n1oBnohoVTBaN7Lww==",
- "dev": true,
"dependencies": {
"is-docker": "^2.0.0"
},
@@ -28214,7 +28239,6 @@
"version": "8.4.2",
"resolved": "https://registry.npmjs.org/open/-/open-8.4.2.tgz",
"integrity": "sha512-7x81NCL719oNbsq/3mh+hVrAWmFuEYUqrq/Iw3kUzH8ReypT9QQ0BLoJS7/G9k6N81XjW4qHWtjWwe/9eLy1EQ==",
- "dev": true,
"dependencies": {
"define-lazy-prop": "^2.0.0",
"is-docker": "^2.1.1",
@@ -35336,6 +35360,21 @@
"integrity": "sha512-AsS729u2RHUfEra9xJrE39peJcc2stq2+poBXX8bcM08Y6g9j/i/PUzwNQqkaJde7Ntg1TO7bSREbR5sdosQ+g==",
"dev": true
},
+ "node_modules/synckit": {
+ "version": "0.8.5",
+ "resolved": "https://registry.npmjs.org/synckit/-/synckit-0.8.5.tgz",
+ "integrity": "sha512-L1dapNV6vu2s/4Sputv8xGsCdAVlb5nRDMFU/E27D44l5U6cw1g0dGd45uLc+OXjNMmF4ntiMdCimzcjFKQI8Q==",
+ "dependencies": {
+ "@pkgr/utils": "^2.3.1",
+ "tslib": "^2.5.0"
+ },
+ "engines": {
+ "node": "^14.18.0 || >=16.0.0"
+ },
+ "funding": {
+ "url": "https://opencollective.com/unts"
+ }
+ },
"node_modules/tabbable": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/tabbable/-/tabbable-4.0.0.tgz",
@@ -35792,6 +35831,15 @@
"resolved": "https://registry.npmjs.org/tiny-emitter/-/tiny-emitter-2.1.0.tgz",
"integrity": "sha512-NB6Dk1A9xgQPMoGqC5CVXn123gWyte215ONT5Pp5a0yt4nlEoO1ZWeCwpncaekPHXO60i47ihFnZPiRPjRMq4Q=="
},
+ "node_modules/tiny-glob": {
+ "version": "0.2.9",
+ "resolved": "https://registry.npmjs.org/tiny-glob/-/tiny-glob-0.2.9.tgz",
+ "integrity": "sha512-g/55ssRPUjShh+xkfx9UPDXqhckHEsHr4Vd9zX55oSdGZc/MD0m3sferOkwWtp98bv+kcVfEHtRJgBVJzelrzg==",
+ "dependencies": {
+ "globalyzer": "0.1.0",
+ "globrex": "^0.1.2"
+ }
+ },
"node_modules/tiny-invariant": {
"version": "1.3.1",
"resolved": "https://registry.npmjs.org/tiny-invariant/-/tiny-invariant-1.3.1.tgz",
@@ -39071,6 +39119,7 @@
"config": "*",
"configcat-js": "^7.0.0",
"dayjs": "^1.11.0",
+ "eslint-config-next": "^13.3.0",
"file-saver": "^2.0.5",
"generate-password": "^1.7.0",
"graphql": "^16.6.0",
@@ -39085,7 +39134,6 @@
"mobx": "^6.3.2",
"mobx-react-lite": "^3.2.0",
"next": "12.3.2",
- "next-compose-plugins": "^2.2.1",
"next-transpile-modules": "^9.0.0",
"openapi-types": "^9.1.0",
"p-queue": "^6.6.2",
@@ -39184,6 +39232,14 @@
"webpack-bundle-analyzer": "4.3.0"
}
},
+ "studio/node_modules/@next/eslint-plugin-next": {
+ "version": "13.3.0",
+ "resolved": "https://registry.npmjs.org/@next/eslint-plugin-next/-/eslint-plugin-next-13.3.0.tgz",
+ "integrity": "sha512-wuGN5qSEjSgcq9fVkH0Y/qIPFjnZtW3ZPwfjJOn7l/rrf6y8J24h/lo61kwqunTyzZJm/ETGfGVU9PUs8cnzEA==",
+ "dependencies": {
+ "glob": "7.1.7"
+ }
+ },
"studio/node_modules/@tailwindcss/typography": {
"version": "0.5.8",
"dev": true,
@@ -39438,6 +39494,132 @@
"d3-time": "1 - 2"
}
},
+ "studio/node_modules/doctrine": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-2.1.0.tgz",
+ "integrity": "sha512-35mSku4ZXK0vfCuHEDAwt55dg2jNajHZ1odvF+8SSr82EsZY4QmXfuWso8oEd8zRhVObSN18aM0CjSdoBX7zIw==",
+ "dependencies": {
+ "esutils": "^2.0.2"
+ },
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "studio/node_modules/eslint-config-next": {
+ "version": "13.3.0",
+ "resolved": "https://registry.npmjs.org/eslint-config-next/-/eslint-config-next-13.3.0.tgz",
+ "integrity": "sha512-6YEwmFBX0VjBd3ODGW9df0Is0FLaRFdMN8eAahQG9CN6LjQ28J8AFr19ngxqMSg7Qv6Uca/3VeeBosJh1bzu0w==",
+ "dependencies": {
+ "@next/eslint-plugin-next": "13.3.0",
+ "@rushstack/eslint-patch": "^1.1.3",
+ "@typescript-eslint/parser": "^5.42.0",
+ "eslint-import-resolver-node": "^0.3.6",
+ "eslint-import-resolver-typescript": "^3.5.2",
+ "eslint-plugin-import": "^2.26.0",
+ "eslint-plugin-jsx-a11y": "^6.5.1",
+ "eslint-plugin-react": "^7.31.7",
+ "eslint-plugin-react-hooks": "^4.5.0"
+ },
+ "peerDependencies": {
+ "eslint": "^7.23.0 || ^8.0.0",
+ "typescript": ">=3.3.1"
+ },
+ "peerDependenciesMeta": {
+ "typescript": {
+ "optional": true
+ }
+ }
+ },
+ "studio/node_modules/eslint-import-resolver-typescript": {
+ "version": "3.5.5",
+ "resolved": "https://registry.npmjs.org/eslint-import-resolver-typescript/-/eslint-import-resolver-typescript-3.5.5.tgz",
+ "integrity": "sha512-TdJqPHs2lW5J9Zpe17DZNQuDnox4xo2o+0tE7Pggain9Rbc19ik8kFtXdxZ250FVx2kF4vlt2RSf4qlUpG7bhw==",
+ "dependencies": {
+ "debug": "^4.3.4",
+ "enhanced-resolve": "^5.12.0",
+ "eslint-module-utils": "^2.7.4",
+ "get-tsconfig": "^4.5.0",
+ "globby": "^13.1.3",
+ "is-core-module": "^2.11.0",
+ "is-glob": "^4.0.3",
+ "synckit": "^0.8.5"
+ },
+ "engines": {
+ "node": "^14.18.0 || >=16.0.0"
+ },
+ "funding": {
+ "url": "https://opencollective.com/unts/projects/eslint-import-resolver-ts"
+ },
+ "peerDependencies": {
+ "eslint": "*",
+ "eslint-plugin-import": "*"
+ }
+ },
+ "studio/node_modules/eslint-plugin-react": {
+ "version": "7.32.2",
+ "resolved": "https://registry.npmjs.org/eslint-plugin-react/-/eslint-plugin-react-7.32.2.tgz",
+ "integrity": "sha512-t2fBMa+XzonrrNkyVirzKlvn5RXzzPwRHtMvLAtVZrt8oxgnTQaYbU6SXTOO1mwQgp1y5+toMSKInnzGr0Knqg==",
+ "dependencies": {
+ "array-includes": "^3.1.6",
+ "array.prototype.flatmap": "^1.3.1",
+ "array.prototype.tosorted": "^1.1.1",
+ "doctrine": "^2.1.0",
+ "estraverse": "^5.3.0",
+ "jsx-ast-utils": "^2.4.1 || ^3.0.0",
+ "minimatch": "^3.1.2",
+ "object.entries": "^1.1.6",
+ "object.fromentries": "^2.0.6",
+ "object.hasown": "^1.1.2",
+ "object.values": "^1.1.6",
+ "prop-types": "^15.8.1",
+ "resolve": "^2.0.0-next.4",
+ "semver": "^6.3.0",
+ "string.prototype.matchall": "^4.0.8"
+ },
+ "engines": {
+ "node": ">=4"
+ },
+ "peerDependencies": {
+ "eslint": "^3 || ^4 || ^5 || ^6 || ^7 || ^8"
+ }
+ },
+ "studio/node_modules/glob": {
+ "version": "7.1.7",
+ "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.7.tgz",
+ "integrity": "sha512-OvD9ENzPLbegENnYP5UUfJIirTg4+XwMWGaQfQTY0JenxNvvIKP3U3/tAQSPIu/lHxXYSZmpXlUHeqAIdKzBLQ==",
+ "dependencies": {
+ "fs.realpath": "^1.0.0",
+ "inflight": "^1.0.4",
+ "inherits": "2",
+ "minimatch": "^3.0.4",
+ "once": "^1.3.0",
+ "path-is-absolute": "^1.0.0"
+ },
+ "engines": {
+ "node": "*"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/isaacs"
+ }
+ },
+ "studio/node_modules/globby": {
+ "version": "13.1.4",
+ "resolved": "https://registry.npmjs.org/globby/-/globby-13.1.4.tgz",
+ "integrity": "sha512-iui/IiiW+QrJ1X1hKH5qwlMQyv34wJAYwH1vrf8b9kBA4sNiif3gKsMHa+BrdnOpEudWjpotfa7LrTzB1ERS/g==",
+ "dependencies": {
+ "dir-glob": "^3.0.1",
+ "fast-glob": "^3.2.11",
+ "ignore": "^5.2.0",
+ "merge2": "^1.4.1",
+ "slash": "^4.0.0"
+ },
+ "engines": {
+ "node": "^12.20.0 || ^14.13.1 || >=16.0.0"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
"studio/node_modules/internmap": {
"version": "1.0.1",
"license": "ISC"
@@ -39505,6 +39687,33 @@
"react-dom": "^16.0.0 || ^17.0.0"
}
},
+ "studio/node_modules/resolve": {
+ "version": "2.0.0-next.4",
+ "resolved": "https://registry.npmjs.org/resolve/-/resolve-2.0.0-next.4.tgz",
+ "integrity": "sha512-iMDbmAWtfU+MHpxt/I5iWI7cY6YVEZUQ3MBgPQ++XD1PELuJHIl82xBmObyP2KyQmkNB2dsqF7seoQQiAn5yDQ==",
+ "dependencies": {
+ "is-core-module": "^2.9.0",
+ "path-parse": "^1.0.7",
+ "supports-preserve-symlinks-flag": "^1.0.0"
+ },
+ "bin": {
+ "resolve": "bin/resolve"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "studio/node_modules/slash": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/slash/-/slash-4.0.0.tgz",
+ "integrity": "sha512-3dOsAHXXUkQTpOYcoAxLIorMTp4gIQr5IW3iVb7A7lFIp0VHhnynm9izx6TssdrIcVIESAlVjtnO2K8bg+Coew==",
+ "engines": {
+ "node": ">=12"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
"studio/node_modules/sql-formatter": {
"version": "12.2.0",
"resolved": "https://registry.npmjs.org/sql-formatter/-/sql-formatter-12.2.0.tgz",
@@ -39519,7 +39728,7 @@
},
"studio/node_modules/typescript": {
"version": "4.8.4",
- "dev": true,
+ "devOptional": true,
"license": "Apache-2.0",
"bin": {
"tsc": "bin/tsc",
@@ -43371,6 +43580,19 @@
"resolved": "https://registry.npmjs.org/@octokit/webhooks-types/-/webhooks-types-6.10.0.tgz",
"integrity": "sha512-lDNv83BeEyxxukdQ0UttiUXawk9+6DkdjjFtm2GFED+24IQhTVaoSbwV9vWWKONyGLzRmCQqZmoEWkDhkEmPlw=="
},
+ "@pkgr/utils": {
+ "version": "2.3.1",
+ "resolved": "https://registry.npmjs.org/@pkgr/utils/-/utils-2.3.1.tgz",
+ "integrity": "sha512-wfzX8kc1PMyUILA+1Z/EqoE4UCXGy0iRGMhPwdfae1+f0OXlLqCk+By+aMzgJBzR9AzS4CDizioG6Ss1gvAFJw==",
+ "requires": {
+ "cross-spawn": "^7.0.3",
+ "is-glob": "^4.0.3",
+ "open": "^8.4.0",
+ "picocolors": "^1.0.0",
+ "tiny-glob": "^0.2.9",
+ "tslib": "^2.4.0"
+ }
+ },
"@pmmmwh/react-refresh-webpack-plugin": {
"version": "0.5.10",
"resolved": "https://registry.npmjs.org/@pmmmwh/react-refresh-webpack-plugin/-/react-refresh-webpack-plugin-0.5.10.tgz",
@@ -51020,8 +51242,7 @@
"define-lazy-prop": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/define-lazy-prop/-/define-lazy-prop-2.0.0.tgz",
- "integrity": "sha512-Ds09qNh8yw3khSjiJjiUInaGX9xlqZDY7JVryGxdxV7NPeuqQfplOpQ66yJFZut3jLa5zOwkXw1g9EI2uKh4Og==",
- "dev": true
+ "integrity": "sha512-Ds09qNh8yw3khSjiJjiUInaGX9xlqZDY7JVryGxdxV7NPeuqQfplOpQ66yJFZut3jLa5zOwkXw1g9EI2uKh4Og=="
},
"define-properties": {
"version": "1.2.0",
@@ -53927,8 +54148,7 @@
"get-tsconfig": {
"version": "4.5.0",
"resolved": "https://registry.npmjs.org/get-tsconfig/-/get-tsconfig-4.5.0.tgz",
- "integrity": "sha512-MjhiaIWCJ1sAU4pIQ5i5OfOuHHxVo1oYeNsWTON7jxYkod8pHocXeh+SSbmu5OZZZK73B6cbJ2XADzXehLyovQ==",
- "dev": true
+ "integrity": "sha512-MjhiaIWCJ1sAU4pIQ5i5OfOuHHxVo1oYeNsWTON7jxYkod8pHocXeh+SSbmu5OZZZK73B6cbJ2XADzXehLyovQ=="
},
"get-value": {
"version": "2.0.6",
@@ -54002,6 +54222,11 @@
"define-properties": "^1.1.3"
}
},
+ "globalyzer": {
+ "version": "0.1.0",
+ "resolved": "https://registry.npmjs.org/globalyzer/-/globalyzer-0.1.0.tgz",
+ "integrity": "sha512-40oNTM9UfG6aBmuKxk/giHn5nQ8RVz/SS4Ir6zgzOv9/qC3kKZ9v4etGTcJbEl/NyVQH7FGU7d+X1egr57Md2Q=="
+ },
"globby": {
"version": "12.2.0",
"resolved": "https://registry.npmjs.org/globby/-/globby-12.2.0.tgz",
@@ -54022,6 +54247,11 @@
}
}
},
+ "globrex": {
+ "version": "0.1.2",
+ "resolved": "https://registry.npmjs.org/globrex/-/globrex-0.1.2.tgz",
+ "integrity": "sha512-uHJgbwAMwNFf5mLst7IWLNg14x1CkeqglJb/K3doi4dw6q2IvAAmM/Y81kevy83wP+Sst+nutFTYOGg3d1lsxg=="
+ },
"goober": {
"version": "2.1.12",
"resolved": "https://registry.npmjs.org/goober/-/goober-2.1.12.tgz",
@@ -55308,8 +55538,7 @@
"is-docker": {
"version": "2.2.1",
"resolved": "https://registry.npmjs.org/is-docker/-/is-docker-2.2.1.tgz",
- "integrity": "sha512-F+i2BKsFrH66iaUFc0woD8sLy8getkwTwtOBjvs56Cx4CgJDeKQeqfz8wAYiSb8JOprWhHH5p77PbmYCvvUuXQ==",
- "dev": true
+ "integrity": "sha512-F+i2BKsFrH66iaUFc0woD8sLy8getkwTwtOBjvs56Cx4CgJDeKQeqfz8wAYiSb8JOprWhHH5p77PbmYCvvUuXQ=="
},
"is-dom": {
"version": "1.1.0",
@@ -55586,7 +55815,6 @@
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-2.2.0.tgz",
"integrity": "sha512-fKzAra0rGJUUBwGBgNkHZuToZcn+TtXHpeCgmkMJMMYx1sQDYaCSyjJBSCa2nH1DGm7s3n1oBnohoVTBaN7Lww==",
- "dev": true,
"requires": {
"is-docker": "^2.0.0"
}
@@ -60867,7 +61095,6 @@
"version": "8.4.2",
"resolved": "https://registry.npmjs.org/open/-/open-8.4.2.tgz",
"integrity": "sha512-7x81NCL719oNbsq/3mh+hVrAWmFuEYUqrq/Iw3kUzH8ReypT9QQ0BLoJS7/G9k6N81XjW4qHWtjWwe/9eLy1EQ==",
- "dev": true,
"requires": {
"define-lazy-prop": "^2.0.0",
"is-docker": "^2.1.1",
@@ -66102,6 +66329,7 @@
"config": "*",
"configcat-js": "^7.0.0",
"dayjs": "^1.11.0",
+ "eslint-config-next": "*",
"file-saver": "^2.0.5",
"generate-password": "^1.7.0",
"graphql": "^16.6.0",
@@ -66118,7 +66346,6 @@
"mobx": "^6.3.2",
"mobx-react-lite": "^3.2.0",
"next": "12.3.2",
- "next-compose-plugins": "^2.2.1",
"next-transpile-modules": "^9.0.0",
"openapi-types": "^9.1.0",
"p-queue": "^6.6.2",
@@ -66173,6 +66400,14 @@
"webpack-bundle-analyzer": "4.3.0"
}
},
+ "@next/eslint-plugin-next": {
+ "version": "13.3.0",
+ "resolved": "https://registry.npmjs.org/@next/eslint-plugin-next/-/eslint-plugin-next-13.3.0.tgz",
+ "integrity": "sha512-wuGN5qSEjSgcq9fVkH0Y/qIPFjnZtW3ZPwfjJOn7l/rrf6y8J24h/lo61kwqunTyzZJm/ETGfGVU9PUs8cnzEA==",
+ "requires": {
+ "glob": "7.1.7"
+ }
+ },
"@tailwindcss/typography": {
"version": "0.5.8",
"dev": true,
@@ -66334,6 +66569,92 @@
"d3-time": "1 - 2"
}
},
+ "doctrine": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-2.1.0.tgz",
+ "integrity": "sha512-35mSku4ZXK0vfCuHEDAwt55dg2jNajHZ1odvF+8SSr82EsZY4QmXfuWso8oEd8zRhVObSN18aM0CjSdoBX7zIw==",
+ "requires": {
+ "esutils": "^2.0.2"
+ }
+ },
+ "eslint-config-next": {
+ "version": "13.3.0",
+ "resolved": "https://registry.npmjs.org/eslint-config-next/-/eslint-config-next-13.3.0.tgz",
+ "integrity": "sha512-6YEwmFBX0VjBd3ODGW9df0Is0FLaRFdMN8eAahQG9CN6LjQ28J8AFr19ngxqMSg7Qv6Uca/3VeeBosJh1bzu0w==",
+ "requires": {
+ "@next/eslint-plugin-next": "13.3.0",
+ "@rushstack/eslint-patch": "^1.1.3",
+ "@typescript-eslint/parser": "^5.42.0",
+ "eslint-import-resolver-node": "^0.3.6",
+ "eslint-import-resolver-typescript": "^3.5.2",
+ "eslint-plugin-import": "^2.26.0",
+ "eslint-plugin-jsx-a11y": "^6.5.1",
+ "eslint-plugin-react": "^7.31.7",
+ "eslint-plugin-react-hooks": "^4.5.0"
+ }
+ },
+ "eslint-import-resolver-typescript": {
+ "version": "3.5.5",
+ "resolved": "https://registry.npmjs.org/eslint-import-resolver-typescript/-/eslint-import-resolver-typescript-3.5.5.tgz",
+ "integrity": "sha512-TdJqPHs2lW5J9Zpe17DZNQuDnox4xo2o+0tE7Pggain9Rbc19ik8kFtXdxZ250FVx2kF4vlt2RSf4qlUpG7bhw==",
+ "requires": {
+ "debug": "^4.3.4",
+ "enhanced-resolve": "^5.12.0",
+ "eslint-module-utils": "^2.7.4",
+ "get-tsconfig": "^4.5.0",
+ "globby": "^13.1.3",
+ "is-core-module": "^2.11.0",
+ "is-glob": "^4.0.3",
+ "synckit": "^0.8.5"
+ }
+ },
+ "eslint-plugin-react": {
+ "version": "7.32.2",
+ "resolved": "https://registry.npmjs.org/eslint-plugin-react/-/eslint-plugin-react-7.32.2.tgz",
+ "integrity": "sha512-t2fBMa+XzonrrNkyVirzKlvn5RXzzPwRHtMvLAtVZrt8oxgnTQaYbU6SXTOO1mwQgp1y5+toMSKInnzGr0Knqg==",
+ "requires": {
+ "array-includes": "^3.1.6",
+ "array.prototype.flatmap": "^1.3.1",
+ "array.prototype.tosorted": "^1.1.1",
+ "doctrine": "^2.1.0",
+ "estraverse": "^5.3.0",
+ "jsx-ast-utils": "^2.4.1 || ^3.0.0",
+ "minimatch": "^3.1.2",
+ "object.entries": "^1.1.6",
+ "object.fromentries": "^2.0.6",
+ "object.hasown": "^1.1.2",
+ "object.values": "^1.1.6",
+ "prop-types": "^15.8.1",
+ "resolve": "^2.0.0-next.4",
+ "semver": "^6.3.0",
+ "string.prototype.matchall": "^4.0.8"
+ }
+ },
+ "glob": {
+ "version": "7.1.7",
+ "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.7.tgz",
+ "integrity": "sha512-OvD9ENzPLbegENnYP5UUfJIirTg4+XwMWGaQfQTY0JenxNvvIKP3U3/tAQSPIu/lHxXYSZmpXlUHeqAIdKzBLQ==",
+ "requires": {
+ "fs.realpath": "^1.0.0",
+ "inflight": "^1.0.4",
+ "inherits": "2",
+ "minimatch": "^3.0.4",
+ "once": "^1.3.0",
+ "path-is-absolute": "^1.0.0"
+ }
+ },
+ "globby": {
+ "version": "13.1.4",
+ "resolved": "https://registry.npmjs.org/globby/-/globby-13.1.4.tgz",
+ "integrity": "sha512-iui/IiiW+QrJ1X1hKH5qwlMQyv34wJAYwH1vrf8b9kBA4sNiif3gKsMHa+BrdnOpEudWjpotfa7LrTzB1ERS/g==",
+ "requires": {
+ "dir-glob": "^3.0.1",
+ "fast-glob": "^3.2.11",
+ "ignore": "^5.2.0",
+ "merge2": "^1.4.1",
+ "slash": "^4.0.0"
+ }
+ },
"internmap": {
"version": "1.0.1"
},
@@ -66385,6 +66706,21 @@
"reduce-css-calc": "^2.1.8"
}
},
+ "resolve": {
+ "version": "2.0.0-next.4",
+ "resolved": "https://registry.npmjs.org/resolve/-/resolve-2.0.0-next.4.tgz",
+ "integrity": "sha512-iMDbmAWtfU+MHpxt/I5iWI7cY6YVEZUQ3MBgPQ++XD1PELuJHIl82xBmObyP2KyQmkNB2dsqF7seoQQiAn5yDQ==",
+ "requires": {
+ "is-core-module": "^2.9.0",
+ "path-parse": "^1.0.7",
+ "supports-preserve-symlinks-flag": "^1.0.0"
+ }
+ },
+ "slash": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/slash/-/slash-4.0.0.tgz",
+ "integrity": "sha512-3dOsAHXXUkQTpOYcoAxLIorMTp4gIQr5IW3iVb7A7lFIp0VHhnynm9izx6TssdrIcVIESAlVjtnO2K8bg+Coew=="
+ },
"sql-formatter": {
"version": "12.2.0",
"resolved": "https://registry.npmjs.org/sql-formatter/-/sql-formatter-12.2.0.tgz",
@@ -66396,7 +66732,7 @@
},
"typescript": {
"version": "4.8.4",
- "dev": true
+ "devOptional": true
},
"uuid": {
"version": "8.3.2",
@@ -66765,6 +67101,15 @@
"integrity": "sha512-AsS729u2RHUfEra9xJrE39peJcc2stq2+poBXX8bcM08Y6g9j/i/PUzwNQqkaJde7Ntg1TO7bSREbR5sdosQ+g==",
"dev": true
},
+ "synckit": {
+ "version": "0.8.5",
+ "resolved": "https://registry.npmjs.org/synckit/-/synckit-0.8.5.tgz",
+ "integrity": "sha512-L1dapNV6vu2s/4Sputv8xGsCdAVlb5nRDMFU/E27D44l5U6cw1g0dGd45uLc+OXjNMmF4ntiMdCimzcjFKQI8Q==",
+ "requires": {
+ "@pkgr/utils": "^2.3.1",
+ "tslib": "^2.5.0"
+ }
+ },
"tabbable": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/tabbable/-/tabbable-4.0.0.tgz",
@@ -67111,6 +67456,15 @@
"resolved": "https://registry.npmjs.org/tiny-emitter/-/tiny-emitter-2.1.0.tgz",
"integrity": "sha512-NB6Dk1A9xgQPMoGqC5CVXn123gWyte215ONT5Pp5a0yt4nlEoO1ZWeCwpncaekPHXO60i47ihFnZPiRPjRMq4Q=="
},
+ "tiny-glob": {
+ "version": "0.2.9",
+ "resolved": "https://registry.npmjs.org/tiny-glob/-/tiny-glob-0.2.9.tgz",
+ "integrity": "sha512-g/55ssRPUjShh+xkfx9UPDXqhckHEsHr4Vd9zX55oSdGZc/MD0m3sferOkwWtp98bv+kcVfEHtRJgBVJzelrzg==",
+ "requires": {
+ "globalyzer": "0.1.0",
+ "globrex": "^0.1.2"
+ }
+ },
"tiny-invariant": {
"version": "1.3.1",
"resolved": "https://registry.npmjs.org/tiny-invariant/-/tiny-invariant-1.3.1.tgz",
diff --git a/packages/ui/src/components/Form/Form.tsx b/packages/ui/src/components/Form/Form.tsx
index 791ceeaaaa6..3be7eb4a3a2 100644
--- a/packages/ui/src/components/Form/Form.tsx
+++ b/packages/ui/src/components/Form/Form.tsx
@@ -3,8 +3,7 @@ import { useFormik, FormikConfig } from 'formik'
import { FormContextProvider } from './FormContext'
// interface Props extends FormikProps<any>, Partial FormikConfig<any> {
-interface Props
- extends Omit<FormikConfig<any>, 'validateOnMount' | 'validateOnChange'> {
+interface Props extends Omit<FormikConfig<any>, 'validateOnMount' | 'validateOnChange'> {
children: any
handleIsSubmitting?: any
handleIsValidating?: any
@@ -69,8 +68,8 @@ export default function Form({ validate, ...props }: Props) {
handleBlur={formik.handleBlur}
touched={formik.touched}
fieldLevelValidation={handleFieldLevelValidation}
- // children={rest.children}
- children={props.children({
+ >
+ {props.children({
/** map of field names to specific error for that field */
errors: formik.errors, // errors,
// /** map of field names to whether the field has been touched */
@@ -90,7 +89,7 @@ export default function Form({ validate, ...props }: Props) {
/** Resets the form with custom values */
resetForm: formik.resetForm,
})}
- />
+ </FormContextProvider>
</form>
)
}
diff --git a/studio/.eslintrc.json b/studio/.eslintrc.json
new file mode 100644
index 00000000000..88df946c854
--- /dev/null
+++ b/studio/.eslintrc.json
@@ -0,0 +1,8 @@
+{
+ "extends": "next/core-web-vitals",
+ "rules": {
+ "@next/next/no-img-element": "off",
+ "react/no-unescaped-entities": "off",
+ "react/display-name": "warn"
+ }
+}
diff --git a/studio/components/grid/components/header/RLSBannerWarning.tsx b/studio/components/grid/components/header/RLSBannerWarning.tsx
index 2d013d25760..2c40d373712 100644
--- a/studio/components/grid/components/header/RLSBannerWarning.tsx
+++ b/studio/components/grid/components/header/RLSBannerWarning.tsx
@@ -58,12 +58,11 @@ export default function RLSBannerWarning() {
size="medium"
onSelectCancel={() => setIsOpen(false)}
onSelectConfirm={handleDismissWarning}
- children={
- <Modal.Content>
- <RLSDisableModalContent />
- </Modal.Content>
- }
- />
+ >
+ <Modal.Content>
+ <RLSDisableModalContent />
+ </Modal.Content>
+ </ConfirmationModal>
</div>
) : (
<></>
diff --git a/studio/components/grid/components/header/sort/SortRow.tsx b/studio/components/grid/components/header/sort/SortRow.tsx
index 69191da0592..cde4967167b 100644
--- a/studio/components/grid/components/header/sort/SortRow.tsx
+++ b/studio/components/grid/components/header/sort/SortRow.tsx
@@ -17,7 +17,6 @@ export interface SortRowProps {
const SortRow = ({ table, index, columnName, sort, onDelete, onToggle, onDrag }: SortRowProps) => {
const column = table.columns.find((x) => x.name === columnName)
- if (!column) return null
const ref = useRef<HTMLDivElement>(null)
@@ -95,6 +94,8 @@ const SortRow = ({ table, index, columnName, sort, onDelete, onToggle, onDrag }:
const opacity = isDragging ? 0 : 1
drag(drop(ref))
+ if (!column) return null
+
return (
<div
className="flex items-center gap-3 px-3"
diff --git a/studio/components/grid/services/row/SqlRowService.ts b/studio/components/grid/services/row/SqlRowService.ts
index 5014d78df00..3dc0860073c 100644
--- a/studio/components/grid/services/row/SqlRowService.ts
+++ b/studio/components/grid/services/row/SqlRowService.ts
@@ -7,6 +7,9 @@ import { useDispatch } from 'components/grid/store'
export class SqlRowService implements IRowService {
protected query = new Query()
+ // [Alaister]: This store is going to be removed in the near future
+ // and I really don't want to fix this "hook inside class" craziness 🤯
+ // eslint-disable-next-line react-hooks/rules-of-hooks
protected dispatch = useDispatch()
constructor(
diff --git a/studio/components/interfaces/Account/AccessTokenList.tsx b/studio/components/interfaces/Account/AccessTokenList.tsx
index 09fc5bfdd18..487376eea35 100644
--- a/studio/components/interfaces/Account/AccessTokenList.tsx
+++ b/studio/components/interfaces/Account/AccessTokenList.tsx
@@ -89,14 +89,13 @@ const AccessTokenList = observer(() => {
onSelectConfirm={() => {
if (token) onDeleteToken(token.id)
}}
- children={
- <Modal.Content>
- <p className="py-4 text-sm text-scale-1100">
- {`This action cannot be undone. Are you sure you want to delete "${token?.name}" token?`}
- </p>
- </Modal.Content>
- }
- />
+ >
+ <Modal.Content>
+ <p className="py-4 text-sm text-scale-1100">
+ {`This action cannot be undone. Are you sure you want to delete "${token?.name}" token?`}
+ </p>
+ </Modal.Content>
+ </ConfirmationModal>
</>
)
})
diff --git a/studio/components/interfaces/Auth/AuthProvidersForm/FormField.tsx b/studio/components/interfaces/Auth/AuthProvidersForm/FormField.tsx
index f9437860cc7..ddb160631fb 100644
--- a/studio/components/interfaces/Auth/AuthProvidersForm/FormField.tsx
+++ b/studio/components/interfaces/Auth/AuthProvidersForm/FormField.tsx
@@ -12,10 +12,10 @@ interface Props {
}
const FormField: FC<Props> = ({ name, properties, formValues, disabled = false }) => {
- if (properties.show && formValues[properties.show.key] !== properties.show.matches) return <></>
-
const [hidden, setHidden] = useState(!!properties.isSecret)
+ if (properties.show && formValues[properties.show.key] !== properties.show.matches) return null
+
switch (properties.type) {
case 'string':
return (
diff --git a/studio/components/interfaces/Auth/EmailTemplates/TemplateEditor.tsx b/studio/components/interfaces/Auth/EmailTemplates/TemplateEditor.tsx
index 1cedb5dbc67..d2e80f1aed6 100644
--- a/studio/components/interfaces/Auth/EmailTemplates/TemplateEditor.tsx
+++ b/studio/components/interfaces/Auth/EmailTemplates/TemplateEditor.tsx
@@ -85,7 +85,7 @@ const TemplateEditor: FC<Props> = ({ template }) => {
const property = properties[x]
if (property.type === 'string') {
return (
- <div className="space-y-3">
+ <div key={x} className="space-y-3">
<label className="col-span-12 text-sm text-scale-1200 lg:col-span-5">
{property.title}
</label>
diff --git a/studio/components/interfaces/Billing/PlanSelection/Plans/PlanCard.tsx b/studio/components/interfaces/Billing/PlanSelection/Plans/PlanCard.tsx
index 44637d482b9..8804f44446b 100644
--- a/studio/components/interfaces/Billing/PlanSelection/Plans/PlanCard.tsx
+++ b/studio/components/interfaces/Billing/PlanSelection/Plans/PlanCard.tsx
@@ -15,7 +15,7 @@ interface Props {
const PlanCard: FC<Props> = ({ plan, currentPlan, onSelectPlan }) => {
// Team tier is enabled when the flag is turned on OR the user is already on the team tier (manually assigned by us)
const teamTierEnabled =
- currentPlan?.supabase_prod_id === PRICING_TIER_PRODUCT_IDS.TEAM || useFlag('teamTier')
+ useFlag('teamTier') || currentPlan?.supabase_prod_id === PRICING_TIER_PRODUCT_IDS.TEAM
const planMeta = PRICING_META[plan.id]
const isEnterprise = plan.id === 'Enterprise'
@@ -134,9 +134,7 @@ const PlanCard: FC<Props> = ({ plan, currentPlan, onSelectPlan }) => {
{planMeta.name === 'Pro' && currentPlan?.prod_id === STRIPE_PRODUCT_IDS.PAYG && (
<div>
- <p className="text-sm text-scale-1100">
- Spend cap is currently disabled
- </p>
+ <p className="text-sm text-scale-1100">Spend cap is currently disabled</p>
<p className="text-xs text-scale-1000">
You will be charged for usage beyond the plan limits
</p>{' '}
diff --git a/studio/components/interfaces/Billing/TeamUpgrade.tsx b/studio/components/interfaces/Billing/TeamUpgrade.tsx
index e067a403a06..c437c65df25 100644
--- a/studio/components/interfaces/Billing/TeamUpgrade.tsx
+++ b/studio/components/interfaces/Billing/TeamUpgrade.tsx
@@ -52,7 +52,7 @@ const TeamUpgrade: FC<Props> = ({
// Team tier is enabled when the flag is turned on OR the user is already on the team tier (manually assigned by us)
const userIsOnTeamTier =
currentSubscription?.tier?.supabase_prod_id === PRICING_TIER_PRODUCT_IDS.TEAM
- const teamTierEnabled = userIsOnTeamTier || useFlag('teamTier')
+ const teamTierEnabled = useFlag('teamTier') || userIsOnTeamTier
const [captchaToken, setCaptchaToken] = useState<string | null>(null)
const captchaRef = useRef<HCaptcha>(null)
diff --git a/studio/components/interfaces/Database/Functions/CreateFunction.tsx b/studio/components/interfaces/Database/Functions/CreateFunction.tsx
index 80e780b289a..5848e0e14b6 100644
--- a/studio/components/interfaces/Database/Functions/CreateFunction.tsx
+++ b/studio/components/interfaces/Database/Functions/CreateFunction.tsx
@@ -450,15 +450,14 @@ const CreateFunction: FC<CreateFunctionProps> = ({ func, visible, setVisible })
setIsClosingPanel(false)
setVisible(!visible)
}}
- children={
- <Modal.Content>
- <p className="py-4 text-sm text-scale-1100">
- There are unsaved changes. Are you sure you want to close the panel? Your changes
- will be lost.
- </p>
- </Modal.Content>
- }
- />
+ >
+ <Modal.Content>
+ <p className="py-4 text-sm text-scale-1100">
+ There are unsaved changes. Are you sure you want to close the panel? Your changes will
+ be lost.
+ </p>
+ </Modal.Content>
+ </ConfirmationModal>
</SidePanel>
</>
)
diff --git a/studio/components/interfaces/Database/Hooks/EditHookPanel.tsx b/studio/components/interfaces/Database/Hooks/EditHookPanel.tsx
index 1af30acba47..9fe7aaf4977 100644
--- a/studio/components/interfaces/Database/Hooks/EditHookPanel.tsx
+++ b/studio/components/interfaces/Database/Hooks/EditHookPanel.tsx
@@ -1,6 +1,6 @@
import Image from 'next/image'
-import { useState, useRef, useEffect } from 'react'
-import { PostgresTrigger } from '@supabase/postgres-meta'
+import { useState, useRef, useEffect, MutableRefObject } from 'react'
+import { PostgresTable, PostgresTrigger } from '@supabase/postgres-meta'
import { Button, SidePanel, Form, Input, Listbox, Checkbox, Radio, Badge, Modal } from 'ui'
import { useStore } from 'hooks'
@@ -13,7 +13,10 @@ import ConfirmationModal from 'components/ui/ConfirmationModal'
import { FormSection, FormSectionLabel, FormSectionContent } from 'components/ui/Forms'
import { useProjectContext } from 'components/layouts/ProjectLayout/ProjectContext'
-import { useEdgeFunctionsQuery } from 'data/edge-functions/edge-functions-query'
+import {
+ EdgeFunctionsResponse,
+ useEdgeFunctionsQuery,
+} from 'data/edge-functions/edge-functions-query'
import { useDatabaseTriggerCreateMutation } from 'data/database-triggers/database-trigger-create-mutation'
import { useDatabaseTriggerUpdateMutation } from 'data/database-triggers/database-trigger-update-transaction-mutation'
@@ -29,7 +32,7 @@ const EditHookPanel = ({ visible, selectedHook, onClose }: EditHookPanelProps) =
// [Joshen] Need to change to use RQ once Alaister's PR goes in
const { ref } = useParams()
const { meta, ui } = useStore()
- const submitRef: any = useRef()
+ const submitRef = useRef<any>(null)
const [isEdited, setIsEdited] = useState(false)
const [isSubmitting, setIsSubmitting] = useState(false)
const [isClosingPanel, setIsClosingPanel] = useState(false)
@@ -277,184 +280,26 @@ const EditHookPanel = ({ visible, selectedHook, onClose }: EditHookPanelProps) =
}
>
<Form validateOnBlur initialValues={initialValues} onSubmit={onSubmit} validate={validate}>
- {({ values, resetForm, errors }: any) => {
- useEffect(() => {
- if (values.function_type === 'http_request') {
- if (selectedHook !== undefined) {
- const [url, method] = selectedHook.function_args
- const updatedValues = { ...values, http_url: url, http_method: method }
- resetForm({ values: updatedValues, initialValues: updatedValues })
- } else {
- const updatedValues = { ...values, http_url: '' }
- resetForm({ values: updatedValues, initialValues: updatedValues })
- }
- } else if (values.function_type === 'supabase_function') {
- const fnSlug = (functions ?? [])[0]?.slug
- const defaultFunctionUrl = `https://${ref}.functions.supabase.${restUrlTld}/${fnSlug}`
- const updatedValues = {
- ...values,
- http_url: isEdgeFunction(values.http_url) ? values.http_url : defaultFunctionUrl,
- }
- resetForm({ values: updatedValues, initialValues: updatedValues })
- }
- }, [values.function_type])
-
- return (
- <div>
- <FormSection
- header={<FormSectionLabel className="lg:!col-span-4">General</FormSectionLabel>}
- >
- <FormSectionContent loading={false} className="lg:!col-span-8">
- <Input
- id="name"
- name="name"
- label="Name"
- descriptionText="Do not use spaces/whitespaces"
- />
- </FormSectionContent>
- </FormSection>
- <SidePanel.Separator />
- <FormSection
- header={
- <FormSectionLabel
- className="lg:!col-span-4"
- description={
- <p className="text-sm text-scale-1000">
- Select which table and events will trigger your webhook
- </p>
- }
- >
- Conditions to fire webhook
- </FormSectionLabel>
- }
- >
- <FormSectionContent loading={false} className="lg:!col-span-8">
- <Listbox
- size="medium"
- id="table_id"
- name="table_id"
- label="Table"
- descriptionText="This is the table the trigger will watch for changes. You can only select 1 table for a trigger."
- >
- <Listbox.Option
- key={'table-no-selection'}
- id={'table-no-selection'}
- label={'---'}
- value={'no-selection'}
- >
- ---
- </Listbox.Option>
- {tables.map((table) => (
- <Listbox.Option
- key={table.id}
- id={table.id.toString()}
- value={table.id}
- label={table.name}
- >
- <div className="flex items-center space-x-2">
- <p className="text-scale-1000">{table.schema}</p>
- <p className="text-scale-1200">{table.name}</p>
- </div>
- </Listbox.Option>
- ))}
- </Listbox>
- <Checkbox.Group
- id="events"
- name="events"
- label="Events"
- error={eventsError}
- descriptionText="These are the events that are watched by the webhook, only the events selected above will fire the webhook on the table you've selected."
- >
- {HOOK_EVENTS.map((event) => (
- <Checkbox
- key={event.value}
- value={event.value}
- label={event.label}
- description={event.description}
- checked={events.includes(event.value)}
- onChange={() => onUpdateSelectedEvents(event.value)}
- />
- ))}
- </Checkbox.Group>
- </FormSectionContent>
- </FormSection>
- <SidePanel.Separator />
- <FormSection
- header={
- <FormSectionLabel className="lg:!col-span-4">
- Webhook configuration
- </FormSectionLabel>
- }
- >
- <FormSectionContent loading={false} className="lg:!col-span-8">
- <Radio.Group
- id="function_type"
- name="function_type"
- label="Type of webhook"
- type="cards"
- >
- {AVAILABLE_WEBHOOK_TYPES.map((webhook) => (
- <Radio
- key={webhook.value}
- id={webhook.value}
- value={webhook.value}
- label=""
- beforeLabel={
- <div className="flex items-center space-x-5">
- <Image src={webhook.icon} layout="fixed" width="32" height="32" />
- <div className="flex-col space-y-0">
- <div className="flex space-x-2">
- <p className="text-scale-1200">{webhook.label}</p>
- </div>
- <p className="text-scale-1000">{webhook.description}</p>
- </div>
- </div>
- }
- />
- ))}
- </Radio.Group>
- </FormSectionContent>
- </FormSection>
- <SidePanel.Separator />
-
- <HTTPRequestFields
- type={values.function_type}
- errors={errors}
- httpHeaders={httpHeaders}
- httpParameters={httpParameters}
- onAddHeader={(header?: any) => {
- if (header) setHttpHeaders(httpHeaders.concat(header))
- else setHttpHeaders(httpHeaders.concat({ id: uuidv4(), name: '', value: '' }))
- }}
- onUpdateHeader={(idx, property, value) =>
- setHttpHeaders(
- httpHeaders.map((header, i) => {
- if (idx === i) return { ...header, [property]: value }
- else return header
- })
- )
- }
- onRemoveHeader={(idx) => setHttpHeaders(httpHeaders.filter((_, i) => idx !== i))}
- onAddParameter={() =>
- setHttpParameters(httpParameters.concat({ id: uuidv4(), name: '', value: '' }))
- }
- onUpdateParameter={(idx, property, value) =>
- setHttpParameters(
- httpParameters.map((param, i) => {
- if (idx === i) return { ...param, [property]: value }
- else return param
- })
- )
- }
- onRemoveParameter={(idx) =>
- setHttpParameters(httpParameters.filter((_, i) => idx !== i))
- }
- />
-
- <button ref={submitRef} type="submit" className="hidden" />
- </div>
- )
- }}
+ {({ values, resetForm, errors }: any) => (
+ <FormContents
+ values={values}
+ resetForm={resetForm}
+ errors={errors}
+ projectRef={ref}
+ restUrlTld={restUrlTld}
+ functions={functions}
+ isEdgeFunction={isEdgeFunction}
+ tables={tables}
+ events={events}
+ eventsError={eventsError}
+ onUpdateSelectedEvents={onUpdateSelectedEvents}
+ httpHeaders={httpHeaders}
+ httpParameters={httpParameters}
+ setHttpHeaders={setHttpHeaders}
+ setHttpParameters={setHttpParameters}
+ submitRef={submitRef}
+ />
+ )}
</Form>
</SidePanel>
<ConfirmationModal
@@ -467,17 +312,222 @@ const EditHookPanel = ({ visible, selectedHook, onClose }: EditHookPanelProps) =
setIsEdited(false)
onClose()
}}
- children={
- <Modal.Content>
- <p className="py-4 text-sm text-scale-1100">
- There are unsaved changes. Are you sure you want to close the panel? Your changes will
- be lost.
- </p>
- </Modal.Content>
- }
- />
+ >
+ <Modal.Content>
+ <p className="py-4 text-sm text-scale-1100">
+ There are unsaved changes. Are you sure you want to close the panel? Your changes will
+ be lost.
+ </p>
+ </Modal.Content>
+ </ConfirmationModal>
</>
)
}
export default EditHookPanel
+
+interface FormContentsProps {
+ values: any
+ resetForm: any
+ errors: any
+ projectRef?: string
+ restUrlTld?: string
+ selectedHook?: PostgresTrigger
+ functions: EdgeFunctionsResponse[] | undefined
+ isEdgeFunction: (url: string) => boolean
+ tables: PostgresTable[]
+ events: string[]
+ eventsError?: string
+ onUpdateSelectedEvents: (event: string) => void
+ httpHeaders: HTTPArgument[]
+ httpParameters: HTTPArgument[]
+ setHttpHeaders: (arr: HTTPArgument[]) => void
+ setHttpParameters: (arr: HTTPArgument[]) => void
+ submitRef: MutableRefObject<any>
+}
+
+const FormContents = ({
+ values,
+ resetForm,
+ errors,
+ projectRef,
+ restUrlTld,
+ selectedHook,
+ functions,
+ isEdgeFunction,
+ tables,
+ events,
+ eventsError,
+ onUpdateSelectedEvents,
+ httpHeaders,
+ httpParameters,
+ setHttpHeaders,
+ setHttpParameters,
+ submitRef,
+}: FormContentsProps) => {
+ useEffect(() => {
+ if (values.function_type === 'http_request') {
+ if (selectedHook !== undefined) {
+ const [url, method] = selectedHook.function_args
+ const updatedValues = { ...values, http_url: url, http_method: method }
+ resetForm({ values: updatedValues, initialValues: updatedValues })
+ } else {
+ const updatedValues = { ...values, http_url: '' }
+ resetForm({ values: updatedValues, initialValues: updatedValues })
+ }
+ } else if (values.function_type === 'supabase_function') {
+ const fnSlug = (functions ?? [])[0]?.slug
+ const defaultFunctionUrl = `https://${projectRef}.functions.supabase.${restUrlTld}/${fnSlug}`
+ const updatedValues = {
+ ...values,
+ http_url: isEdgeFunction(values.http_url) ? values.http_url : defaultFunctionUrl,
+ }
+ resetForm({ values: updatedValues, initialValues: updatedValues })
+ }
+ }, [values.function_type])
+
+ return (
+ <div>
+ <FormSection header={<FormSectionLabel className="lg:!col-span-4">General</FormSectionLabel>}>
+ <FormSectionContent loading={false} className="lg:!col-span-8">
+ <Input
+ id="name"
+ name="name"
+ label="Name"
+ descriptionText="Do not use spaces/whitespaces"
+ />
+ </FormSectionContent>
+ </FormSection>
+ <SidePanel.Separator />
+ <FormSection
+ header={
+ <FormSectionLabel
+ className="lg:!col-span-4"
+ description={
+ <p className="text-sm text-scale-1000">
+ Select which table and events will trigger your webhook
+ </p>
+ }
+ >
+ Conditions to fire webhook
+ </FormSectionLabel>
+ }
+ >
+ <FormSectionContent loading={false} className="lg:!col-span-8">
+ <Listbox
+ size="medium"
+ id="table_id"
+ name="table_id"
+ label="Table"
+ descriptionText="This is the table the trigger will watch for changes. You can only select 1 table for a trigger."
+ >
+ <Listbox.Option
+ key={'table-no-selection'}
+ id={'table-no-selection'}
+ label={'---'}
+ value={'no-selection'}
+ >
+ ---
+ </Listbox.Option>
+ {tables.map((table) => (
+ <Listbox.Option
+ key={table.id}
+ id={table.id.toString()}
+ value={table.id}
+ label={table.name}
+ >
+ <div className="flex items-center space-x-2">
+ <p className="text-scale-1000">{table.schema}</p>
+ <p className="text-scale-1200">{table.name}</p>
+ </div>
+ </Listbox.Option>
+ ))}
+ </Listbox>
+ <Checkbox.Group
+ id="events"
+ name="events"
+ label="Events"
+ error={eventsError}
+ descriptionText="These are the events that are watched by the webhook, only the events selected above will fire the webhook on the table you've selected."
+ >
+ {HOOK_EVENTS.map((event) => (
+ <Checkbox
+ key={event.value}
+ value={event.value}
+ label={event.label}
+ description={event.description}
+ checked={events.includes(event.value)}
+ onChange={() => onUpdateSelectedEvents(event.value)}
+ />
+ ))}
+ </Checkbox.Group>
+ </FormSectionContent>
+ </FormSection>
+ <SidePanel.Separator />
+ <FormSection
+ header={
+ <FormSectionLabel className="lg:!col-span-4">Webhook configuration</FormSectionLabel>
+ }
+ >
+ <FormSectionContent loading={false} className="lg:!col-span-8">
+ <Radio.Group id="function_type" name="function_type" label="Type of webhook" type="cards">
+ {AVAILABLE_WEBHOOK_TYPES.map((webhook) => (
+ <Radio
+ key={webhook.value}
+ id={webhook.value}
+ value={webhook.value}
+ label=""
+ beforeLabel={
+ <div className="flex items-center space-x-5">
+ <Image src={webhook.icon} layout="fixed" width="32" height="32" />
+ <div className="flex-col space-y-0">
+ <div className="flex space-x-2">
+ <p className="text-scale-1200">{webhook.label}</p>
+ </div>
+ <p className="text-scale-1000">{webhook.description}</p>
+ </div>
+ </div>
+ }
+ />
+ ))}
+ </Radio.Group>
+ </FormSectionContent>
+ </FormSection>
+ <SidePanel.Separator />
+
+ <HTTPRequestFields
+ type={values.function_type}
+ errors={errors}
+ httpHeaders={httpHeaders}
+ httpParameters={httpParameters}
+ onAddHeader={(header?: any) => {
+ if (header) setHttpHeaders(httpHeaders.concat(header))
+ else setHttpHeaders(httpHeaders.concat({ id: uuidv4(), name: '', value: '' }))
+ }}
+ onUpdateHeader={(idx, property, value) =>
+ setHttpHeaders(
+ httpHeaders.map((header, i) => {
+ if (idx === i) return { ...header, [property]: value }
+ else return header
+ })
+ )
+ }
+ onRemoveHeader={(idx) => setHttpHeaders(httpHeaders.filter((_, i) => idx !== i))}
+ onAddParameter={() =>
+ setHttpParameters(httpParameters.concat({ id: uuidv4(), name: '', value: '' }))
+ }
+ onUpdateParameter={(idx, property, value) =>
+ setHttpParameters(
+ httpParameters.map((param, i) => {
+ if (idx === i) return { ...param, [property]: value }
+ else return param
+ })
+ )
+ }
+ onRemoveParameter={(idx) => setHttpParameters(httpParameters.filter((_, i) => idx !== i))}
+ />
+
+ <button ref={submitRef} type="submit" className="hidden" />
+ </div>
+ )
+}
diff --git a/studio/components/interfaces/Database/Wrappers/CreateWrapper.tsx b/studio/components/interfaces/Database/Wrappers/CreateWrapper.tsx
index 558873bb1e3..cc2b6379ed7 100644
--- a/studio/components/interfaces/Database/Wrappers/CreateWrapper.tsx
+++ b/studio/components/interfaces/Database/Wrappers/CreateWrapper.tsx
@@ -229,7 +229,10 @@ const CreateWrapper = () => {
) : (
<div className="space-y-2">
{newTables.map((table, i) => (
- <div className="flex items-center justify-between px-4 py-2 border rounded-md border-scale-600">
+ <div
+ key={`${table.schema_name}.${table.table_name}`}
+ className="flex items-center justify-between px-4 py-2 border rounded-md border-scale-600"
+ >
<div>
<p className="text-sm">
{table.schema_name}.{table.table_name}
diff --git a/studio/components/interfaces/Database/Wrappers/EditWrapper.tsx b/studio/components/interfaces/Database/Wrappers/EditWrapper.tsx
index a8661b6f3bf..9c20cf9680d 100644
--- a/studio/components/interfaces/Database/Wrappers/EditWrapper.tsx
+++ b/studio/components/interfaces/Database/Wrappers/EditWrapper.tsx
@@ -327,7 +327,10 @@ const EditWrapper = () => {
) : (
<div className="space-y-2">
{wrapperTables.map((table, i) => (
- <div className="flex items-center justify-between px-4 py-2 border rounded-md border-scale-600">
+ <div
+ key={`${table.schema_name}.${table.table_name}`}
+ className="flex items-center justify-between px-4 py-2 border rounded-md border-scale-600"
+ >
<div>
<p className="text-sm">
{table.schema_name}.{table.table_name}
diff --git a/studio/components/interfaces/Database/Wrappers/WrapperRow.tsx b/studio/components/interfaces/Database/Wrappers/WrapperRow.tsx
index 13798aa8747..d22d91b727f 100644
--- a/studio/components/interfaces/Database/Wrappers/WrapperRow.tsx
+++ b/studio/components/interfaces/Database/Wrappers/WrapperRow.tsx
@@ -146,7 +146,7 @@ const WrapperRow: FC<Props> = ({ wrappers = [], wrapperMeta, isOpen, onOpen }) =
</p>
<div className="flex flex-wrap gap-2">
{wrapper.tables.map((table: any) => (
- <Link href={`/project/${ref}/editor/${table.id}`}>
+ <Link key={table.id} href={`/project/${ref}/editor/${table.id}`}>
<a>
<div
key={table.id}
diff --git a/studio/components/interfaces/Functions/CommandRender.tsx b/studio/components/interfaces/Functions/CommandRender.tsx
index 450cc90ffb4..6a3b83b2a86 100644
--- a/studio/components/interfaces/Functions/CommandRender.tsx
+++ b/studio/components/interfaces/Functions/CommandRender.tsx
@@ -5,49 +5,53 @@ const CommandRender = ({ commands }: any) => {
return (
<div className="space-y-4">
{commands.map((item: any, idx: number) => {
- const [isCopied, setIsCopied] = useState(false)
- return (
- <div key={`command-${idx}`} className="space-y-1">
- <span className="font-mono text-sm text-scale-900">{`> ${item.comment}`}</span>
- <div className="flex items-center gap-2">
- <div className="flex gap-2 font-mono text-sm font-normal text-scale-1200">
- <span className="text-scale-900">$</span>
- <span>
- <span className="">{item.jsx ? item.jsx() : null} </span>
- <button
- type="button"
- className="text-scale-900 hover:text-scale-1200"
- onClick={() => {
- function onCopy(value: any) {
- setIsCopied(true)
- navigator.clipboard.writeText(value).then()
- setTimeout(function () {
- setIsCopied(false)
- }, 3000)
- }
- onCopy(item.command)
- }}
- >
- {isCopied ? (
- <div className="text-brand-900">
- <IconCheck size={14} strokeWidth={3} />
- </div>
- ) : (
- <div className="relative">
- <div className="block">
- <IconClipboard size={14} />
- </div>
- </div>
- )}
- </button>
- </span>
- </div>
- </div>
- </div>
- )
+ return <Command key={`command-${idx}`} item={item} />
})}
</div>
)
}
export default CommandRender
+
+const Command = ({ item }: any) => {
+ const [isCopied, setIsCopied] = useState(false)
+ return (
+ <div className="space-y-1">
+ <span className="font-mono text-sm text-scale-900">{`> ${item.comment}`}</span>
+ <div className="flex items-center gap-2">
+ <div className="flex gap-2 font-mono text-sm font-normal text-scale-1200">
+ <span className="text-scale-900">$</span>
+ <span>
+ <span className="">{item.jsx ? item.jsx() : null} </span>
+ <button
+ type="button"
+ className="text-scale-900 hover:text-scale-1200"
+ onClick={() => {
+ function onCopy(value: any) {
+ setIsCopied(true)
+ navigator.clipboard.writeText(value).then()
+ setTimeout(function () {
+ setIsCopied(false)
+ }, 3000)
+ }
+ onCopy(item.command)
+ }}
+ >
+ {isCopied ? (
+ <div className="text-brand-900">
+ <IconCheck size={14} strokeWidth={3} />
+ </div>
+ ) : (
+ <div className="relative">
+ <div className="block">
+ <IconClipboard size={14} />
+ </div>
+ </div>
+ )}
+ </button>
+ </span>
+ </div>
+ </div>
+ </div>
+ )
+}
diff --git a/studio/components/interfaces/Functions/EdgeFunctionDetails/EdgeFunctionDetails.tsx b/studio/components/interfaces/Functions/EdgeFunctionDetails/EdgeFunctionDetails.tsx
index 1095bf70ed0..5be829db53d 100644
--- a/studio/components/interfaces/Functions/EdgeFunctionDetails/EdgeFunctionDetails.tsx
+++ b/studio/components/interfaces/Functions/EdgeFunctionDetails/EdgeFunctionDetails.tsx
@@ -132,6 +132,7 @@ const EdgeFunctionDetails: FC<Props> = () => {
resetForm({ values: formValues, initialValues: formValues })
}
}, [selectedFunction])
+
return (
<>
<FormPanel
diff --git a/studio/components/interfaces/Reports/GridResize.tsx b/studio/components/interfaces/Reports/GridResize.tsx
index 3efbd5b9f53..5f5abac8f9e 100644
--- a/studio/components/interfaces/Reports/GridResize.tsx
+++ b/studio/components/interfaces/Reports/GridResize.tsx
@@ -1,4 +1,3 @@
-import { useEffect } from 'react'
import RGL, { WidthProvider } from 'react-grid-layout'
import { LAYOUT_COLUMN_COUNT } from './Reports.constants'
@@ -7,40 +6,7 @@ import ChartHandler from 'components/to-be-cleaned/Charts/ChartHandler'
const ReactGridLayout = WidthProvider(RGL)
const GridResize = ({ startDate, endDate, interval, editableReport, setEditableReport }: any) => {
- if (!editableReport) return
-
- useEffect(() => {
- generateDOM()
- }, [editableReport])
-
- function generateDOM() {
- return editableReport.layout.map((x: any, i: number) => {
- return (
- <div
- key={x.id}
- data-grid={{ ...x, minH: 4, maxH: 4, minW: 8 }}
- className="react-grid-layout__report-item bg-panel-body-light dark:bg-panel-body-dark border-panel-border-light dark:border-panel-border-dark group relative rounded border px-6 py-4 shadow-sm hover:border-green-900 dark:hover:border-green-900"
- >
- <ChartHandler
- startDate={startDate}
- endDate={endDate}
- interval={interval}
- attribute={x.attribute}
- provider={x.provider}
- label={x.label}
- customDateFormat={'MMM D, YYYY'}
- />
- <div className="absolute inset-x-0 top-3 ">
- <div className="flex justify-around">
- <div className="flex h-3 w-24 cursor-move flex-col space-y-2">
- <div className="hidden h-3 w-full border-4 border-dotted border-green-900 opacity-50 transition-all hover:opacity-100 group-hover:block"></div>
- </div>
- </div>
- </div>
- </div>
- )
- })
- }
+ if (!editableReport) return null
function onLayoutChange(layout: any) {
let updatedLayout = editableReport.layout
@@ -69,7 +35,32 @@ const GridResize = ({ startDate, endDate, interval, editableReport, setEditableR
containerPadding={[0, 0]}
compactType="horizontal"
>
- {generateDOM()}
+ {editableReport.layout.map((x: any, i: number) => {
+ return (
+ <div
+ key={x.id}
+ data-grid={{ ...x, minH: 4, maxH: 4, minW: 8 }}
+ className="react-grid-layout__report-item bg-panel-body-light dark:bg-panel-body-dark border-panel-border-light dark:border-panel-border-dark group relative rounded border px-6 py-4 shadow-sm hover:border-green-900 dark:hover:border-green-900"
+ >
+ <ChartHandler
+ startDate={startDate}
+ endDate={endDate}
+ interval={interval}
+ attribute={x.attribute}
+ provider={x.provider}
+ label={x.label}
+ customDateFormat={'MMM D, YYYY'}
+ />
+ <div className="absolute inset-x-0 top-3 ">
+ <div className="flex justify-around">
+ <div className="flex h-3 w-24 cursor-move flex-col space-y-2">
+ <div className="hidden h-3 w-full border-4 border-dotted border-green-900 opacity-50 transition-all hover:opacity-100 group-hover:block"></div>
+ </div>
+ </div>
+ </div>
+ </div>
+ )
+ })}
</ReactGridLayout>
</>
)
diff --git a/studio/components/ui/CardButton.tsx b/studio/components/ui/CardButton.tsx
index c5bf21833bf..ab4e0a954a4 100644
--- a/studio/components/ui/CardButton.tsx
+++ b/studio/components/ui/CardButton.tsx
@@ -113,13 +113,13 @@ const CardButton: FC<Props> = ({
)
if (onClick) {
- return <ButtonContainer children={contents} />
+ return <ButtonContainer>{contents}</ButtonContainer>
} else if (linkHref) {
- return <LinkContainer children={contents} />
+ return <LinkContainer>{contents}</LinkContainer>
} else if (url) {
- return <UrlContainer children={contents} />
+ return <UrlContainer>{contents}</UrlContainer>
} else {
- return <NonLinkContainer children={contents} />
+ return <NonLinkContainer>{contents}</NonLinkContainer>
}
}
diff --git a/studio/components/ui/Charts/Sparkline.stories.tsx b/studio/components/ui/Charts/Sparkline.stories.tsx
index e341ff7b86a..5cb2e257683 100644
--- a/studio/components/ui/Charts/Sparkline.stories.tsx
+++ b/studio/components/ui/Charts/Sparkline.stories.tsx
@@ -32,8 +32,8 @@ export const Sparkline = () => (
{ title: 'Normal', props: {} },
{ title: 'Large', props: { size: 'large' as const } },
{ title: 'No data', props: { data: [] } },
- ].map(({ title, props }) => (
- <div className="w-32 h-72">
+ ].map(({ title, props }, i) => (
+ <div key={i} className="w-32 h-72">
<ExampleName>{title}</ExampleName>
<div className="w-full h-full mt-4">
<Chart {...PROPS} {...props} />
diff --git a/studio/components/ui/Charts/StackedAreaChart.tsx b/studio/components/ui/Charts/StackedAreaChart.tsx
index 3bd49593e0d..f67fac87aed 100644
--- a/studio/components/ui/Charts/StackedAreaChart.tsx
+++ b/studio/components/ui/Charts/StackedAreaChart.tsx
@@ -42,7 +42,6 @@ const StackedAreaChart: React.FC<Props> = ({
styleMap = {},
xAxisFormatAsDate = false,
}) => {
- if (!isLoading && (data === undefined || data === null)) return <EmptyState />
const transformed = useMemo(() => {
if (!data) return []
const mapping = data.reduce((acc, datum) => {
@@ -62,6 +61,9 @@ const StackedAreaChart: React.FC<Props> = ({
}))
return flattened
}, [JSON.stringify(data)])
+
+ if (!isLoading && (data === undefined || data === null)) return <EmptyState />
+
const dataKeys = Object.keys(transformed[0] || {}).filter((k) => k !== xAxisKey && k !== yAxisKey)
const formatToDate = (value: string | number | any) => {
diff --git a/studio/components/ui/Charts/StackedBarChart.stories.tsx b/studio/components/ui/Charts/StackedBarChart.stories.tsx
index 2e0289aa158..9eb71d42736 100644
--- a/studio/components/ui/Charts/StackedBarChart.stories.tsx
+++ b/studio/components/ui/Charts/StackedBarChart.stories.tsx
@@ -65,8 +65,8 @@ export const StackedBarChart = () => (
{ title: 'Value format (c suffix)', props: { format: 'c' } },
{ title: 'Minimal Value format', props: { minimalHeader: true, format: 'c' } },
{ title: 'No data', props: { data: [] } },
- ].map(({ title, props }) => (
- <div className="w-72 h-72">
+ ].map(({ title, props }, i) => (
+ <div key={i} className="w-72 h-72">
<ExampleName>{title}</ExampleName>
<div className="w-full h-full mt-4">
<Chart {...PROPS} {...props} />
diff --git a/studio/components/ui/ConfirmationModal.tsx b/studio/components/ui/ConfirmationModal.tsx
index 116cf9b0965..1465a529c8e 100644
--- a/studio/components/ui/ConfirmationModal.tsx
+++ b/studio/components/ui/ConfirmationModal.tsx
@@ -1,8 +1,7 @@
-import { Modal, Button, Space } from 'ui'
-import { MouseEventHandler } from 'react'
-import { FC, useState, useEffect } from 'react'
+import { MouseEventHandler, PropsWithChildren, useEffect, useState } from 'react'
+import { Button, Modal } from 'ui'
-interface Props {
+export interface ConfirmationModalProps {
visible: boolean
danger?: boolean
header: string | JSX.Element
@@ -12,10 +11,9 @@ interface Props {
buttonLoadingLabel?: string
onSelectCancel: () => void
onSelectConfirm: () => void
- children?: React.ReactNode
}
-const ConfirmationModal: FC<Props> = ({
+const ConfirmationModal = ({
visible = false,
danger = false,
header = '',
@@ -26,7 +24,7 @@ const ConfirmationModal: FC<Props> = ({
onSelectCancel = () => {},
onSelectConfirm = () => {},
children,
-}) => {
+}: PropsWithChildren<ConfirmationModalProps>) => {
useEffect(() => {
if (visible) {
setLoading(false)
@@ -65,8 +63,9 @@ const ConfirmationModal: FC<Props> = ({
</Button>
</div>
}
- children={children}
- />
+ >
+ {children}
+ </Modal>
)
}
diff --git a/studio/components/ui/Logs/LogsExplorerHeader.tsx b/studio/components/ui/Logs/LogsExplorerHeader.tsx
index aa4ca18c83a..5c28819357a 100644
--- a/studio/components/ui/Logs/LogsExplorerHeader.tsx
+++ b/studio/components/ui/Logs/LogsExplorerHeader.tsx
@@ -1,10 +1,9 @@
import * as Tooltip from '@radix-ui/react-tooltip'
import { LOGS_EXPLORER_DOCS_URL } from 'components/interfaces/Settings/Logs'
import Table from 'components/to-be-cleaned/Table'
-import { useStore } from 'hooks'
import { copyToClipboard } from 'lib/helpers'
import Link from 'next/link'
-import { FC, useState } from 'react'
+import { useState } from 'react'
import { logConstants } from 'shared-data'
import {
Button,
@@ -18,12 +17,11 @@ import {
Tabs,
} from 'ui'
-interface Props {
+export interface LogsExplorerHeaderProps {
subtitle?: string
}
-const LogsExplorerHeader: FC<Props> = ({ subtitle }) => {
- const { ui } = useStore()
+const LogsExplorerHeader = ({ subtitle }: LogsExplorerHeaderProps) => {
const [showReference, setShowReference] = useState(false)
return (
@@ -104,7 +102,12 @@ const LogsExplorerHeader: FC<Props> = ({ subtitle }) => {
listClassNames="px-2"
>
{logConstants.schemas.map((schema) => (
- <Tabs.Panel id={schema.reference} label={schema.name} className="px-4 pb-4">
+ <Tabs.Panel
+ key={schema.reference}
+ id={schema.reference}
+ label={schema.name}
+ className="px-4 pb-4"
+ >
<Table
head={[
<Table.th className="text-xs !p-2" key="path">
@@ -116,64 +119,9 @@ const LogsExplorerHeader: FC<Props> = ({ subtitle }) => {
]}
body={schema.fields
.sort((a: any, b: any) => a.path - b.path)
- .map((field) => {
- const [isCopied, setIsCopied] = useState(false)
- return (
- <Table.tr key={field.path}>
- <Table.td
- className="font-mono text-xs !p-2 cursor-pointer hover:text-scale-1200 transition flex items-center space-x-2"
- onClick={() =>
- copyToClipboard(field.path, () => {
- setIsCopied(true)
- setTimeout(() => setIsCopied(false), 3000)
- })
- }
- >
- <span>{field.path}</span>
- {isCopied ? (
- <Tooltip.Root delayDuration={0}>
- <Tooltip.Trigger>
- <IconCheck size={14} strokeWidth={3} className="text-brand-900" />
- </Tooltip.Trigger>
- <Tooltip.Portal>
- <Tooltip.Content side="bottom">
- <Tooltip.Arrow className="radix-tooltip-arrow" />
- <div
- className={[
- 'rounded bg-scale-100 py-1 px-2 leading-none shadow',
- 'border border-scale-200',
- ].join(' ')}
- >
- <span className="text-xs text-scale-1200">Copied</span>
- </div>
- </Tooltip.Content>
- </Tooltip.Portal>
- </Tooltip.Root>
- ) : (
- <Tooltip.Root delayDuration={0}>
- <Tooltip.Trigger>
- <IconClipboard size="tiny" strokeWidth={1.5} />
- </Tooltip.Trigger>
- <Tooltip.Portal>
- <Tooltip.Content side="bottom">
- <Tooltip.Arrow className="radix-tooltip-arrow" />
- <div
- className={[
- 'rounded bg-scale-100 py-1 px-2 leading-none shadow',
- 'border border-scale-200',
- ].join(' ')}
- >
- <span className="text-xs text-scale-1200">Copy value</span>
- </div>
- </Tooltip.Content>
- </Tooltip.Portal>
- </Tooltip.Root>
- )}
- </Table.td>
- <Table.td className="font-mono text-xs !p-2">{field.type}</Table.td>
- </Table.tr>
- )
- })}
+ .map((field) => (
+ <Field key={field.path} field={field} />
+ ))}
/>
</Tabs.Panel>
))}
@@ -183,4 +131,72 @@ const LogsExplorerHeader: FC<Props> = ({ subtitle }) => {
</div>
)
}
+
export default LogsExplorerHeader
+
+const Field = ({
+ field,
+}: {
+ field: {
+ path: string
+ type: string
+ }
+}) => {
+ const [isCopied, setIsCopied] = useState(false)
+
+ return (
+ <Table.tr>
+ <Table.td
+ className="font-mono text-xs !p-2 cursor-pointer hover:text-scale-1200 transition flex items-center space-x-2"
+ onClick={() =>
+ copyToClipboard(field.path, () => {
+ setIsCopied(true)
+ setTimeout(() => setIsCopied(false), 3000)
+ })
+ }
+ >
+ <span>{field.path}</span>
+ {isCopied ? (
+ <Tooltip.Root delayDuration={0}>
+ <Tooltip.Trigger>
+ <IconCheck size={14} strokeWidth={3} className="text-brand-900" />
+ </Tooltip.Trigger>
+ <Tooltip.Portal>
+ <Tooltip.Content side="bottom">
+ <Tooltip.Arrow className="radix-tooltip-arrow" />
+ <div
+ className={[
+ 'rounded bg-scale-100 py-1 px-2 leading-none shadow',
+ 'border border-scale-200',
+ ].join(' ')}
+ >
+ <span className="text-xs text-scale-1200">Copied</span>
+ </div>
+ </Tooltip.Content>
+ </Tooltip.Portal>
+ </Tooltip.Root>
+ ) : (
+ <Tooltip.Root delayDuration={0}>
+ <Tooltip.Trigger>
+ <IconClipboard size="tiny" strokeWidth={1.5} />
+ </Tooltip.Trigger>
+ <Tooltip.Portal>
+ <Tooltip.Content side="bottom">
+ <Tooltip.Arrow className="radix-tooltip-arrow" />
+ <div
+ className={[
+ 'rounded bg-scale-100 py-1 px-2 leading-none shadow',
+ 'border border-scale-200',
+ ].join(' ')}
+ >
+ <span className="text-xs text-scale-1200">Copy value</span>
+ </div>
+ </Tooltip.Content>
+ </Tooltip.Portal>
+ </Tooltip.Root>
+ )}
+ </Table.td>
+ <Table.td className="font-mono text-xs !p-2">{field.type}</Table.td>
+ </Table.tr>
+ )
+}
diff --git a/studio/next.config.js b/studio/next.config.js
index 4a757bbed91..517f1b8e1cf 100644
--- a/studio/next.config.js
+++ b/studio/next.config.js
@@ -1,5 +1,4 @@
const { withSentryConfig } = require('@sentry/nextjs')
-const withPlugins = require('next-compose-plugins')
const withBundleAnalyzer = require('@next/bundle-analyzer')({
enabled: process.env.ANALYZE === 'true',
})
@@ -23,8 +22,12 @@ const csp = [
.filter(Boolean)
.join(' ')
+/**
+ * @type {import('next').NextConfig}
+ */
const nextConfig = {
basePath: process.env.NEXT_PUBLIC_BASE_PATH,
+ output: 'standalone',
async redirects() {
return [
{
@@ -177,15 +180,12 @@ const nextConfig = {
},
// Ref: https://nextjs.org/docs/advanced-features/output-file-tracing#caveats
experimental: {
- outputStandalone: true,
outputFileTracingRoot: path.join(__dirname, '../../'),
},
}
// Export all config
-const plugins = [[withBundleAnalyzer({})], withTM()]
-
-const moduleExports = withPlugins(plugins, nextConfig)
+const moduleExports = withTM(withBundleAnalyzer(nextConfig))
const sentryWebpackPluginOptions = {
// Additional config options for the Sentry Webpack plugin. Keep in mind that
@@ -205,4 +205,4 @@ const sentryWebpackPluginOptions = {
module.exports =
process.env.NEXT_PUBLIC_IS_PLATFORM === 'true'
? withSentryConfig(moduleExports, sentryWebpackPluginOptions)
- : withPlugins([withTM()], nextConfig)
+ : withTM(nextConfig)
diff --git a/studio/package.json b/studio/package.json
index 373f8b124f2..2f845d6011e 100644
--- a/studio/package.json
+++ b/studio/package.json
@@ -8,6 +8,7 @@
"build": "next build",
"start": "next start",
"test": "jest",
+ "lint": "next lint",
"deploy:staging": "VERCEL_ORG_ID=team_E6KJ1W561hMTjon1QSwOh0WO VERCEL_PROJECT_ID=QmcmhbiAtCMFTAHCuGgQscNbke4TzgWULECctNcKmxWCoT vercel --prod -A .vercel/staging.json",
"storybook": "start-storybook -p 6006",
"build-storybook": "build-storybook",
@@ -47,6 +48,7 @@
"config": "*",
"configcat-js": "^7.0.0",
"dayjs": "^1.11.0",
+ "eslint-config-next": "^13.3.0",
"file-saver": "^2.0.5",
"generate-password": "^1.7.0",
"graphql": "^16.6.0",
@@ -61,7 +63,6 @@
"mobx": "^6.3.2",
"mobx-react-lite": "^3.2.0",
"next": "12.3.2",
- "next-compose-plugins": "^2.2.1",
"next-transpile-modules": "^9.0.0",
"openapi-types": "^9.1.0",
"p-queue": "^6.6.2",
diff --git a/studio/pages/404.tsx b/studio/pages/404.tsx
index d616cc2d0ad..acf5db37979 100644
--- a/studio/pages/404.tsx
+++ b/studio/pages/404.tsx
@@ -4,7 +4,6 @@ import Link from 'next/link'
import { useEffect, useState } from 'react'
import { Button } from 'ui'
-import { useStore } from 'hooks'
import { BASE_PATH } from 'lib/constants'
import { useTheme } from 'common'
@@ -24,18 +23,20 @@ const Error404: NextPage = ({}) => {
<nav className="relative flex items-center justify-between sm:h-10">
<div className="flex flex-shrink-0 flex-grow items-center lg:flex-grow-0">
<div className="flex w-full items-center justify-between md:w-auto">
- <a href="/projects">
- <Image
- src={
- isDarkMode
- ? `${BASE_PATH}/img/supabase-dark.svg`
- : `${BASE_PATH}/img/supabase-light.svg`
- }
- alt="supabase"
- height={24}
- width={120}
- />
- </a>
+ <Link href="/projects">
+ <a>
+ <Image
+ src={
+ isDarkMode
+ ? `${BASE_PATH}/img/supabase-dark.svg`
+ : `${BASE_PATH}/img/supabase-light.svg`
+ }
+ alt="supabase"
+ height={24}
+ width={120}
+ />
+ </a>
+ </Link>
</div>
</div>
</nav>
diff --git a/studio/pages/500.tsx b/studio/pages/500.tsx
index 5790b7dda1e..b49bc05df1e 100644
--- a/studio/pages/500.tsx
+++ b/studio/pages/500.tsx
@@ -5,13 +5,11 @@ import Image from 'next/image'
import { Button } from 'ui'
import { observer } from 'mobx-react-lite'
-import { useStore } from 'hooks'
import { auth, STORAGE_KEY } from 'lib/gotrue'
import { useTheme } from 'common'
const Error500: NextPage = () => {
const router = useRouter()
- const { ui } = useStore()
const { isDarkMode } = useTheme()
const onClickLogout = async () => {
@@ -27,18 +25,20 @@ const Error500: NextPage = () => {
<nav className="relative flex items-center justify-between sm:h-10">
<div className="flex flex-shrink-0 flex-grow items-center lg:flex-grow-0">
<div className="flex w-full items-center justify-between md:w-auto">
- <a href="/projects">
- <Image
- src={
- isDarkMode
- ? `${router.basePath}/img/supabase-dark.svg`
- : `${router.basePath}/img/supabase-light.svg`
- }
- alt=""
- height={24}
- width={120}
- />
- </a>
+ <Link href="/projects">
+ <a>
+ <Image
+ src={
+ isDarkMode
+ ? `${router.basePath}/img/supabase-dark.svg`
+ : `${router.basePath}/img/supabase-light.svg`
+ }
+ alt=""
+ height={24}
+ width={120}
+ />
+ </a>
+ </Link>
</div>
</div>
</nav>
diff --git a/studio/pages/project/[ref]/database/tables.tsx b/studio/pages/project/[ref]/database/tables.tsx
index 5ce9684374e..74bfaa45637 100644
--- a/studio/pages/project/[ref]/database/tables.tsx
+++ b/studio/pages/project/[ref]/database/tables.tsx
@@ -170,34 +170,32 @@ const DatabaseTables: NextPageWithLayout = () => {
header={
<span className="break-words">{`Confirm deletion of table "${selectedTableToDelete?.name}"`}</span>
}
- children={
- <Modal.Content>
- <p className="py-4 text-sm text-scale-1100">
- Are you sure you want to delete the selected table? This action cannot be undone.
- </p>
- </Modal.Content>
- }
buttonLabel="Delete"
buttonLoadingLabel="Deleting"
onSelectCancel={() => setIsDeleting(false)}
onSelectConfirm={onConfirmDeleteTable}
- />
+ >
+ <Modal.Content>
+ <p className="py-4 text-sm text-scale-1100">
+ Are you sure you want to delete the selected table? This action cannot be undone.
+ </p>
+ </Modal.Content>
+ </ConfirmationModal>
<ConfirmationModal
danger
visible={isDeleting && !isUndefined(selectedColumnToDelete)}
header={`Confirm deletion of column "${selectedColumnToDelete?.name}"`}
- children={
- <Modal.Content>
- <p className="py-4 text-sm text-scale-1100">
- Are you sure you want to delete the selected column? This action cannot be undone.
- </p>
- </Modal.Content>
- }
buttonLabel="Delete"
buttonLoadingLabel="Deleting"
onSelectCancel={() => setIsDeleting(false)}
onSelectConfirm={onConfirmDeleteColumn}
- />
+ >
+ <Modal.Content>
+ <p className="py-4 text-sm text-scale-1100">
+ Are you sure you want to delete the selected column? This action cannot be undone.
+ </p>
+ </Modal.Content>
+ </ConfirmationModal>
<SidePanelEditor
sidePanelKey={sidePanelKey}
selectedSchema={selectedSchema}
diff --git a/studio/pages/project/[ref]/editor/[id].tsx b/studio/pages/project/[ref]/editor/[id].tsx
index 4fa02f8b868..6250cdb8a9a 100644
--- a/studio/pages/project/[ref]/editor/[id].tsx
+++ b/studio/pages/project/[ref]/editor/[id].tsx
@@ -302,40 +302,6 @@ const TableEditorPage: NextPageWithLayout = () => {
size="small"
visible={isDeleting && !isUndefined(selectedColumnToDelete)}
header={`Confirm deletion of column "${selectedColumnToDelete?.name}"`}
- children={
- <Modal.Content>
- <div className="py-4 space-y-4">
- <p className="text-sm text-scale-1100">
- Are you sure you want to delete the selected column? This action cannot be undone.
- </p>
- <Checkbox
- label="Drop column with cascade?"
- description="Deletes the column and its dependent objects"
- checked={isDeleteWithCascade}
- onChange={() => setIsDeleteWithCascade(!isDeleteWithCascade)}
- />
- {isDeleteWithCascade && (
- <Alert
- withIcon
- variant="warning"
- title="Warning: Dropping with cascade may result in unintended consequences"
- >
- <p className="mb-4">
- All dependent objects will be removed, as will any objects that depend on them,
- recursively.
- </p>
- <Link href="https://www.postgresql.org/docs/current/ddl-depend.html">
- <a target="_blank">
- <Button size="tiny" type="default" icon={<IconExternalLink />}>
- About dependency tracking
- </Button>
- </a>
- </Link>
- </Alert>
- )}
- </div>
- </Modal.Content>
- }
buttonLabel="Delete"
buttonLoadingLabel="Deleting"
onSelectCancel={() => {
@@ -343,7 +309,40 @@ const TableEditorPage: NextPageWithLayout = () => {
setSelectedColumnToDelete(undefined)
}}
onSelectConfirm={onConfirmDeleteColumn}
- />
+ >
+ <Modal.Content>
+ <div className="py-4 space-y-4">
+ <p className="text-sm text-scale-1100">
+ Are you sure you want to delete the selected column? This action cannot be undone.
+ </p>
+ <Checkbox
+ label="Drop column with cascade?"
+ description="Deletes the column and its dependent objects"
+ checked={isDeleteWithCascade}
+ onChange={() => setIsDeleteWithCascade(!isDeleteWithCascade)}
+ />
+ {isDeleteWithCascade && (
+ <Alert
+ withIcon
+ variant="warning"
+ title="Warning: Dropping with cascade may result in unintended consequences"
+ >
+ <p className="mb-4">
+ All dependent objects will be removed, as will any objects that depend on them,
+ recursively.
+ </p>
+ <Link href="https://www.postgresql.org/docs/current/ddl-depend.html">
+ <a target="_blank">
+ <Button size="tiny" type="default" icon={<IconExternalLink />}>
+ About dependency tracking
+ </Button>
+ </a>
+ </Link>
+ </Alert>
+ )}
+ </div>
+ </Modal.Content>
+ </ConfirmationModal>
<ConfirmationModal
danger
size="small"
@@ -351,40 +350,6 @@ const TableEditorPage: NextPageWithLayout = () => {
header={
<span className="break-words">{`Confirm deletion of table "${selectedTableToDelete?.name}"`}</span>
}
- children={
- <Modal.Content>
- <div className="py-4 space-y-4">
- <p className="text-sm text-scale-1100">
- Are you sure you want to delete the selected table? This action cannot be undone.
- </p>
- <Checkbox
- label="Drop table with cascade?"
- description="Deletes the table and its dependent objects"
- checked={isDeleteWithCascade}
- onChange={() => setIsDeleteWithCascade(!isDeleteWithCascade)}
- />
- {isDeleteWithCascade && (
- <Alert
- withIcon
- variant="warning"
- title="Warning: Dropping with cascade may result in unintended consequences"
- >
- <p className="mb-4">
- All dependent objects will be removed, as will any objects that depend on them,
- recursively.
- </p>
- <Link href="https://www.postgresql.org/docs/current/ddl-depend.html">
- <a target="_blank">
- <Button size="tiny" type="default" icon={<IconExternalLink />}>
- About dependency tracking
- </Button>
- </a>
- </Link>
- </Alert>
- )}
- </div>
- </Modal.Content>
- }
buttonLabel="Delete"
buttonLoadingLabel="Deleting"
onSelectCancel={() => {
@@ -392,7 +357,40 @@ const TableEditorPage: NextPageWithLayout = () => {
setSelectedTableToDelete(undefined)
}}
onSelectConfirm={onConfirmDeleteTable}
- />
+ >
+ <Modal.Content>
+ <div className="py-4 space-y-4">
+ <p className="text-sm text-scale-1100">
+ Are you sure you want to delete the selected table? This action cannot be undone.
+ </p>
+ <Checkbox
+ label="Drop table with cascade?"
+ description="Deletes the table and its dependent objects"
+ checked={isDeleteWithCascade}
+ onChange={() => setIsDeleteWithCascade(!isDeleteWithCascade)}
+ />
+ {isDeleteWithCascade && (
+ <Alert
+ withIcon
+ variant="warning"
+ title="Warning: Dropping with cascade may result in unintended consequences"
+ >
+ <p className="mb-4">
+ All dependent objects will be removed, as will any objects that depend on them,
+ recursively.
+ </p>
+ <Link href="https://www.postgresql.org/docs/current/ddl-depend.html">
+ <a target="_blank">
+ <Button size="tiny" type="default" icon={<IconExternalLink />}>
+ About dependency tracking
+ </Button>
+ </a>
+ </Link>
+ </Alert>
+ )}
+ </div>
+ </Modal.Content>
+ </ConfirmationModal>
</TableEditorLayout>
)
}
diff --git a/studio/pages/project/[ref]/reports/query-performance.tsx b/studio/pages/project/[ref]/reports/query-performance.tsx
index f475188813c..1bcbd7cfb15 100644
--- a/studio/pages/project/[ref]/reports/query-performance.tsx
+++ b/studio/pages/project/[ref]/reports/query-performance.tsx
@@ -199,7 +199,9 @@ const QueryPerformanceReport: NextPageWithLayout = () => {
<Tabs type="underlined" size="medium">
<Tabs.Panel key={1} id="1" label="Most time consuming">
<div className={panelClassNames}>
- <ReactMarkdown className={helperTextClassNames} children={TimeConsumingHelperText} />
+ <ReactMarkdown className={helperTextClassNames}>
+ {TimeConsumingHelperText}
+ </ReactMarkdown>
<div className="thin-scrollbars max-w-full overflow-scroll">
<Table
head={
@@ -248,7 +250,9 @@ const QueryPerformanceReport: NextPageWithLayout = () => {
</Tabs.Panel>
<Tabs.Panel key={2} id="2" label="Most frequent">
<div className={panelClassNames}>
- <ReactMarkdown className={helperTextClassNames} children={MostFrequentHelperText} />
+ <ReactMarkdown className={helperTextClassNames}>
+ {MostFrequentHelperText}
+ </ReactMarkdown>
<div className="thin-scrollbars max-w-full overflow-scroll">
<Table
head={
@@ -310,10 +314,9 @@ const QueryPerformanceReport: NextPageWithLayout = () => {
</Tabs.Panel>
<Tabs.Panel key={3} id="3" label="Slowest execution time">
<div className={panelClassNames}>
- <ReactMarkdown
- className={helperTextClassNames}
- children={SlowestExecutionHelperText}
- />
+ <ReactMarkdown className={helperTextClassNames}>
+ {SlowestExecutionHelperText}
+ </ReactMarkdown>
<div className="thin-scrollbars max-w-full overflow-scroll">
<Table
head={
diff --git a/studio/pages/project/[ref]/settings/billing/update/index.tsx b/studio/pages/project/[ref]/settings/billing/update/index.tsx
index 7ad5f7410b1..7a9b49601b7 100644
--- a/studio/pages/project/[ref]/settings/billing/update/index.tsx
+++ b/studio/pages/project/[ref]/settings/billing/update/index.tsx
@@ -104,6 +104,10 @@ const BillingUpdate: NextPageWithLayout = () => {
}
}
+ // Team tier is enabled when the flag is turned on OR the user is already on the team tier (manually assigned by us)
+ const userIsOnTeamTier = subscription?.tier?.supabase_prod_id === PRICING_TIER_PRODUCT_IDS.TEAM
+ const teamTierEnabled = useFlag('teamTier') || userIsOnTeamTier
+
if (isLoadingProducts || isEnterprise) {
return (
<div className="flex items-center justify-center w-full h-full">
@@ -112,10 +116,6 @@ const BillingUpdate: NextPageWithLayout = () => {
)
}
- // Team tier is enabled when the flag is turned on OR the user is already on the team tier (manually assigned by us)
- const userIsOnTeamTier = subscription?.tier?.supabase_prod_id === PRICING_TIER_PRODUCT_IDS.TEAM
- const teamTierEnabled = userIsOnTeamTier || useFlag('teamTier')
-
const productTiers = (products?.tiers ?? []).filter(
(tier) => teamTierEnabled || tier.id !== STRIPE_PRODUCT_IDS.TEAM
)