From e9ce3b1bd395fee092d09128e8d3dc032b26c578 Mon Sep 17 00:00:00 2001 From: Nick Grosenbacher Date: Wed, 30 Aug 2023 15:18:27 -0400 Subject: [PATCH 1/6] Add import order rule to eslint, add eslint to lint-staged --- .eslintrc.cjs | 7 ++ package.json | 3 + pnpm-lock.yaml | 296 ++++++++++++++++++++++++++++++++++++++++++++++++- 3 files changed, 302 insertions(+), 4 deletions(-) diff --git a/.eslintrc.cjs b/.eslintrc.cjs index 189f7dbc9c..c218497188 100644 --- a/.eslintrc.cjs +++ b/.eslintrc.cjs @@ -17,6 +17,8 @@ module.exports = { "plugin:@typescript-eslint/recommended", "plugin:@typescript-eslint/recommended-requiring-type-checking", "plugin:storybook/recommended", + "plugin:import/recommended", + "plugin:import/typescript", ], parserOptions: { tsconfigRootDir: __dirname, @@ -59,11 +61,16 @@ module.exports = { "@typescript-eslint/explicit-module-boundary-types": "off", "@typescript-eslint/no-empty-function": "off", "@typescript-eslint/no-extra-semi": "warn", + "import/order": ["error", { "groups": ["builtin", "external", "internal", "parent", "sibling", "index", "object", "type"]}] }, settings: { react: { version: "detect", }, + "import/resolver": { + typescript: true, + node: true, + } }, globals: { JSX: true, diff --git a/package.json b/package.json index d7e0c523c6..c2c76f2f51 100644 --- a/package.json +++ b/package.json @@ -18,6 +18,8 @@ "@typescript-eslint/eslint-plugin": "^5.61.0", "@typescript-eslint/parser": "^5.61.0", "eslint": "^8.44.0", + "eslint-import-resolver-typescript": "^3.6.0", + "eslint-plugin-import": "^2.28.1", "eslint-plugin-jest": "^27.2.2", "eslint-plugin-jest-dom": "^5.0.1", "eslint-plugin-react": "^7.32.2", @@ -32,6 +34,7 @@ }, "npmClient": "pnpm", "lint-staged": { + "*.{js,jsx,ts,tsx}": "eslint --fix", "*.{js,jsx,ts,tsx,json,yml,scss,css,md}": "prettier --write" }, "pnpm": { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 2101451e25..0ffe17c621 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -29,6 +29,12 @@ importers: eslint: specifier: ^8.44.0 version: 8.44.0 + eslint-import-resolver-typescript: + specifier: ^3.6.0 + version: 3.6.0(@typescript-eslint/parser@5.61.0)(eslint-plugin-import@2.28.1)(eslint@8.44.0) + eslint-plugin-import: + specifier: ^2.28.1 + version: 2.28.1(@typescript-eslint/parser@5.61.0)(eslint-import-resolver-typescript@3.6.0)(eslint@8.44.0) eslint-plugin-jest: specifier: ^27.2.2 version: 27.2.2(@typescript-eslint/eslint-plugin@5.61.0)(eslint@8.44.0)(typescript@5.1.6) @@ -8099,6 +8105,10 @@ packages: /@types/json-schema@7.0.12: resolution: {integrity: sha512-Hr5Jfhc9eYOQNPYO5WLDq/n4jqijdHNlDXjuAQkkt+mWdQR+XJToOHrsD4cPaMXpn6KO7y2+wM8AZEs8VpBLVA==} + /@types/json5@0.0.29: + resolution: {integrity: sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ==} + dev: true + /@types/katex@0.10.2: resolution: {integrity: sha512-QYTNuhuDU22gouVoL5kLmBTguu2rPvtp7wL5U5fTFsQkM1ojfUgxFPMFrqOSUofrdWwnZEmblcobdlLXj1lVOw==} dev: true @@ -9131,6 +9141,17 @@ packages: engines: {node: '>=8'} dev: true + /array.prototype.findlastindex@1.2.3: + resolution: {integrity: sha512-LzLoiOMAxvy+Gd3BAq3B7VeIgPdo+Q8hthvKtXybMvRV0jrXfJM/t8mw7nNlpEcVlVUnCnM2KSX4XU5HmpodOA==} + engines: {node: '>= 0.4'} + dependencies: + call-bind: 1.0.2 + define-properties: 1.2.0 + es-abstract: 1.22.1 + es-shim-unscopables: 1.0.0 + get-intrinsic: 1.2.1 + dev: true + /array.prototype.flat@1.3.1: resolution: {integrity: sha512-roTU0KWIOmJ4DRLmwKd19Otg0/mT3qPNt0Qb3GWW8iObuZXxrjB/pzn0R3hqpRSWg4HCwqx+0vwOnWnvlOyeIA==} engines: {node: '>= 0.4'} @@ -9161,6 +9182,18 @@ packages: get-intrinsic: 1.2.1 dev: true + /arraybuffer.prototype.slice@1.0.1: + resolution: {integrity: sha512-09x0ZWFEjj4WD8PDbykUwo3t9arLn8NIzmmYEJFpYekOAQjpkGSyrQhNoRTcwwcFRu+ycWF78QZ63oWTqSjBcw==} + engines: {node: '>= 0.4'} + dependencies: + array-buffer-byte-length: 1.0.0 + call-bind: 1.0.2 + define-properties: 1.2.0 + get-intrinsic: 1.2.1 + is-array-buffer: 3.0.2 + is-shared-array-buffer: 1.0.2 + dev: true + /asap@2.0.6: resolution: {integrity: sha512-BSHWgDSAiKs50o2Re8ppvp3seVHXSRM44cdSsT9FfNEUUZLOGWVCsiWaRPWM1Znn+mqZ1OfVZ3z3DWEzSp7hRA==} dev: false @@ -10532,7 +10565,7 @@ packages: commander: 2.20.3 d3-array: 1.2.4 d3-geo: 1.12.1 - resolve: 1.22.2 + resolve: 1.22.4 dev: false /d3-geo@1.12.1: @@ -11193,6 +11226,51 @@ packages: which-typed-array: 1.1.9 dev: true + /es-abstract@1.22.1: + resolution: {integrity: sha512-ioRRcXMO6OFyRpyzV3kE1IIBd4WG5/kltnzdxSCqoP8CMGs/Li+M1uF5o7lOkZVFjDs+NLesthnF66Pg/0q0Lw==} + engines: {node: '>= 0.4'} + dependencies: + array-buffer-byte-length: 1.0.0 + arraybuffer.prototype.slice: 1.0.1 + available-typed-arrays: 1.0.5 + call-bind: 1.0.2 + es-set-tostringtag: 2.0.1 + es-to-primitive: 1.2.1 + function.prototype.name: 1.1.5 + get-intrinsic: 1.2.1 + get-symbol-description: 1.0.0 + globalthis: 1.0.3 + gopd: 1.0.1 + has: 1.0.3 + has-property-descriptors: 1.0.0 + has-proto: 1.0.1 + has-symbols: 1.0.3 + internal-slot: 1.0.5 + is-array-buffer: 3.0.2 + is-callable: 1.2.7 + is-negative-zero: 2.0.2 + is-regex: 1.1.4 + is-shared-array-buffer: 1.0.2 + is-string: 1.0.7 + is-typed-array: 1.1.10 + is-weakref: 1.0.2 + object-inspect: 1.12.3 + object-keys: 1.1.1 + object.assign: 4.1.4 + regexp.prototype.flags: 1.5.0 + safe-array-concat: 1.0.0 + safe-regex-test: 1.0.0 + string.prototype.trim: 1.2.7 + string.prototype.trimend: 1.0.6 + string.prototype.trimstart: 1.0.6 + typed-array-buffer: 1.0.0 + typed-array-byte-length: 1.0.0 + typed-array-byte-offset: 1.0.0 + typed-array-length: 1.0.4 + unbox-primitive: 1.0.2 + which-typed-array: 1.1.11 + dev: true + /es-get-iterator@1.1.3: resolution: {integrity: sha512-sPZmqHBe6JIiTfN5q2pEi//TwxmAFHwj/XEuYjTuse78i8KxaqMTTzxPoFKuzRpDpTJ+0NAbpfenkmH2rePtuw==} dependencies: @@ -11462,6 +11540,104 @@ packages: optionalDependencies: source-map: 0.6.1 + /eslint-import-resolver-node@0.3.9: + resolution: {integrity: sha512-WFj2isz22JahUv+B788TlO3N6zL3nNJGU8CcZbPZvVEkBPaJdCV4vy5wyghty5ROFbCRnm132v8BScu5/1BQ8g==} + dependencies: + debug: 3.2.7 + is-core-module: 2.13.0 + resolve: 1.22.4 + transitivePeerDependencies: + - supports-color + dev: true + + /eslint-import-resolver-typescript@3.6.0(@typescript-eslint/parser@5.61.0)(eslint-plugin-import@2.28.1)(eslint@8.44.0): + resolution: {integrity: sha512-QTHR9ddNnn35RTxlaEnx2gCxqFlF2SEN0SE2d17SqwyM7YOSI2GHWRYp5BiRkObTUNYPupC/3Fq2a0PpT+EKpg==} + engines: {node: ^14.18.0 || >=16.0.0} + peerDependencies: + eslint: '*' + eslint-plugin-import: '*' + dependencies: + debug: 4.3.4 + enhanced-resolve: 5.15.0 + eslint: 8.44.0 + eslint-module-utils: 2.8.0(@typescript-eslint/parser@5.61.0)(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.0)(eslint@8.44.0) + eslint-plugin-import: 2.28.1(@typescript-eslint/parser@5.61.0)(eslint-import-resolver-typescript@3.6.0)(eslint@8.44.0) + fast-glob: 3.3.1 + get-tsconfig: 4.7.0 + is-core-module: 2.13.0 + is-glob: 4.0.3 + transitivePeerDependencies: + - '@typescript-eslint/parser' + - eslint-import-resolver-node + - eslint-import-resolver-webpack + - supports-color + dev: true + + /eslint-module-utils@2.8.0(@typescript-eslint/parser@5.61.0)(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.0)(eslint@8.44.0): + resolution: {integrity: sha512-aWajIYfsqCKRDgUfjEXNN/JlrzauMuSEy5sbd7WXbtW3EH6A6MpwEh42c7qD+MqQo9QMJ6fWLAeIJynx0g6OAw==} + engines: {node: '>=4'} + peerDependencies: + '@typescript-eslint/parser': '*' + eslint: '*' + eslint-import-resolver-node: '*' + eslint-import-resolver-typescript: '*' + eslint-import-resolver-webpack: '*' + peerDependenciesMeta: + '@typescript-eslint/parser': + optional: true + eslint: + optional: true + eslint-import-resolver-node: + optional: true + eslint-import-resolver-typescript: + optional: true + eslint-import-resolver-webpack: + optional: true + dependencies: + '@typescript-eslint/parser': 5.61.0(eslint@8.44.0)(typescript@5.1.6) + debug: 3.2.7 + eslint: 8.44.0 + eslint-import-resolver-node: 0.3.9 + eslint-import-resolver-typescript: 3.6.0(@typescript-eslint/parser@5.61.0)(eslint-plugin-import@2.28.1)(eslint@8.44.0) + transitivePeerDependencies: + - supports-color + dev: true + + /eslint-plugin-import@2.28.1(@typescript-eslint/parser@5.61.0)(eslint-import-resolver-typescript@3.6.0)(eslint@8.44.0): + resolution: {integrity: sha512-9I9hFlITvOV55alzoKBI+K9q74kv0iKMeY6av5+umsNwayt59fz692daGyjR+oStBQgx6nwR9rXldDev3Clw+A==} + engines: {node: '>=4'} + peerDependencies: + '@typescript-eslint/parser': '*' + eslint: ^2 || ^3 || ^4 || ^5 || ^6 || ^7.2.0 || ^8 + peerDependenciesMeta: + '@typescript-eslint/parser': + optional: true + dependencies: + '@typescript-eslint/parser': 5.61.0(eslint@8.44.0)(typescript@5.1.6) + array-includes: 3.1.6 + array.prototype.findlastindex: 1.2.3 + array.prototype.flat: 1.3.1 + array.prototype.flatmap: 1.3.1 + debug: 3.2.7 + doctrine: 2.1.0 + eslint: 8.44.0 + eslint-import-resolver-node: 0.3.9 + eslint-module-utils: 2.8.0(@typescript-eslint/parser@5.61.0)(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.0)(eslint@8.44.0) + has: 1.0.3 + is-core-module: 2.13.0 + is-glob: 4.0.3 + minimatch: 3.1.2 + object.fromentries: 2.0.6 + object.groupby: 1.0.1 + object.values: 1.1.6 + semver: 7.5.4 + tsconfig-paths: 3.14.2 + transitivePeerDependencies: + - eslint-import-resolver-typescript + - eslint-import-resolver-webpack + - supports-color + dev: true + /eslint-plugin-jest-dom@5.0.1(@testing-library/dom@8.20.1)(eslint@8.44.0): resolution: {integrity: sha512-zD/BjNk12R5R9cxIu8oa2HfNeDSknI3ewtN8nygIUMQuieWDnTY9Np//6a1Z3G7Y3dx3l45hCUR4EphsgRmUtA==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0, npm: '>=6', yarn: '>=1'} @@ -11859,6 +12035,17 @@ packages: merge2: 1.4.1 micromatch: 4.0.5 + /fast-glob@3.3.1: + resolution: {integrity: sha512-kNFPyjhh5cKjrUltxs+wFx+ZkbRaxxmZ+X0ZU31SOsxCEtP9VPgtq2teZw1DebupL5GmDaNQ6yKMMVcM41iqDg==} + engines: {node: '>=8.6.0'} + dependencies: + '@nodelib/fs.stat': 2.0.5 + '@nodelib/fs.walk': 1.2.8 + glob-parent: 5.1.2 + merge2: 1.4.1 + micromatch: 4.0.5 + dev: true + /fast-isnumeric@1.1.4: resolution: {integrity: sha512-1mM8qOr2LYz8zGaUdmiqRDiuue00Dxjgcb1NQR7TnhLVh6sQyngP9xvLo7Sl7LZpP/sk5eb+bcyWXw530NTBZw==} dependencies: @@ -12229,6 +12416,12 @@ packages: resolution: {integrity: sha512-syloC6fsCt62ELLrr1VKBM1ggOpMdetX9hTrdW77UQdcApPHLmf7CI7OKcN1c9kYuNxKcDe4iJ4FY9sX3aw2xw==} dev: true + /get-tsconfig@4.7.0: + resolution: {integrity: sha512-pmjiZ7xtB8URYm74PlGJozDNyhvsVLUcpBa8DZBG3bWHwaHa9bPiRpiSfovw+fjhwONSCWKRyk+JQHEGZmMrzw==} + dependencies: + resolve-pkg-maps: 1.0.0 + dev: true + /get-uv-event-loop-napi-h@1.0.6: resolution: {integrity: sha512-t5c9VNR84nRoF+eLiz6wFrEp1SE2Acg0wS+Ysa2zF0eROes+LzOfuTaVHxGy8AbS8rq7FHEJzjnCZo1BupwdJg==} dependencies: @@ -12508,7 +12701,7 @@ packages: graceful-fs: 4.2.11 inherits: 2.0.4 map-limit: 0.0.1 - resolve: 1.22.2 + resolve: 1.22.4 dev: false /glslify@7.1.1: @@ -12525,7 +12718,7 @@ packages: glslify-bundle: 5.1.1 glslify-deps: 1.3.2 minimist: 1.2.8 - resolve: 1.22.2 + resolve: 1.22.4 stack-trace: 0.0.9 static-eval: 2.1.0 through2: 2.0.5 @@ -12989,6 +13182,12 @@ packages: resolution: {integrity: sha512-Q4ZuBAe2FUsKtyQJoQHlvP8OvBERxO3jEmy1I7hcRXcJBGGHFh/aJBswbXuS9sgrDH2QUO8ilkwNPHvHMd8clg==} dependencies: has: 1.0.3 + dev: true + + /is-core-module@2.13.0: + resolution: {integrity: sha512-Z7dk6Qo8pOCp3l4tsX2C5ZVas4V+UxwQodwZhLopL91TX8UyyHEXafPcyoeeWuLrwzHcr3igO78wNLwHJHsMCQ==} + dependencies: + has: 1.0.3 /is-date-object@1.0.5: resolution: {integrity: sha512-9YQaSxsAiSwcvS33MBk3wTCVnWK+HhF8VZR2jRxehM16QcVOdHqPn4VPHmRK4lSr38n9JriurInLcP90xsYNfQ==} @@ -14076,6 +14275,13 @@ packages: resolution: {integrity: sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==} dev: true + /json5@1.0.2: + resolution: {integrity: sha512-g1MWMLBiz8FKi1e4w0UyVL3w+iJceWAFBAaBnnGKOpNa5f8TLktkbre1+s6oICydWAm+HRUGTmI+//xv2hvXYA==} + hasBin: true + dependencies: + minimist: 1.2.8 + dev: true + /json5@2.2.3: resolution: {integrity: sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==} engines: {node: '>=6'} @@ -15271,6 +15477,15 @@ packages: es-abstract: 1.21.2 dev: true + /object.groupby@1.0.1: + resolution: {integrity: sha512-HqaQtqLnp/8Bn4GL16cj+CUYbnpe1bh0TtEaWvybszDG4tgxCJuRpV8VGuvNaI1fAnI4lUJzDG55MXcOH4JZcQ==} + dependencies: + call-bind: 1.0.2 + define-properties: 1.2.0 + es-abstract: 1.22.1 + get-intrinsic: 1.2.1 + dev: true + /object.hasown@1.1.2: resolution: {integrity: sha512-B5UIT3J1W+WuWIU55h0mjlwaqxiE5vYENJXIXZ4VFe05pNYrkKuK0U/6aFcb0pKywYJh7IhfoqUfKVmrJJHZHw==} dependencies: @@ -15987,6 +16202,7 @@ packages: /prr@1.0.1: resolution: {integrity: sha512-yPw4Sng1gWghHQWj0B3ZggWUm4qVbPwPFcRG8KyxiU7J2OHFSoEHKS+EZ3fv5l1t9CyCiop6l/ZYeWbrgoQejw==} + requiresBuild: true optional: true /psl@1.9.0: @@ -17018,6 +17234,10 @@ packages: resolution: {integrity: sha512-C7rARubxI8bXFNB/hqcp/4iUeIXJhJZvFPFPiSPRnhU5UPxzMFIl+2E6yY6c4k9giDJAhtV+enfA+G89N6Csng==} dev: false + /resolve-pkg-maps@1.0.0: + resolution: {integrity: sha512-seS2Tj26TBVOC2NIc2rOe2y2ZO7efxITtLZcGSOnHHNOQ7CkiUBfw0Iw2ck6xkIhPwLhKNLS8BO+hEpngQlqzw==} + dev: true + /resolve-protobuf-schema@2.1.0: resolution: {integrity: sha512-kI5ffTiZWmJaS/huM8wZfEMer1eRd7oJQhDuxeCLe3t7N7mX3z94CN0xPxBQxFYQTSNz9T0i+v6inKqSdK8xrQ==} dependencies: @@ -17048,7 +17268,15 @@ packages: resolution: {integrity: sha512-Sb+mjNHOULsBv818T40qSPeRiuWLyaGMa5ewydRLFimneixmVy2zdivRl+AF6jaYPC8ERxGDmFSiqui6SfPd+g==} hasBin: true dependencies: - is-core-module: 2.12.1 + is-core-module: 2.13.0 + path-parse: 1.0.7 + supports-preserve-symlinks-flag: 1.0.0 + + /resolve@1.22.4: + resolution: {integrity: sha512-PXNdCiPqDqeUou+w1C2eTQbNfxKSuMxqTCuvlmmMsk1NWHL5fRrhY6Pl0qEYYc6+QqGClco1Qj8XnjPego4wfg==} + hasBin: true + dependencies: + is-core-module: 2.13.0 path-parse: 1.0.7 supports-preserve-symlinks-flag: 1.0.0 @@ -17208,6 +17436,16 @@ packages: tslib: 2.6.0 dev: true + /safe-array-concat@1.0.0: + resolution: {integrity: sha512-9dVEFruWIsnie89yym+xWTAYASdpw3CJV7Li/6zBewGf9z2i1j31rP6jnY0pHEO4QZh6N0K11bFjWmdR8UGdPQ==} + engines: {node: '>=0.4'} + dependencies: + call-bind: 1.0.2 + get-intrinsic: 1.2.1 + has-symbols: 1.0.3 + isarray: 2.0.5 + dev: true + /safe-buffer@5.1.1: resolution: {integrity: sha512-kKvNJn6Mm93gAczWVJg7wH+wGYWNrDHdWvpUmHyEsgCtIwwo3bqPtV4tR5tuPaUhTOo/kvhVwd8XwwOllGYkbg==} dev: true @@ -18298,6 +18536,15 @@ packages: resolution: {integrity: sha512-Y/arvbn+rrz3JCKl9C4kVNfTfSm2/mEp5FSz5EsZSANGPSlQrpRI5M4PKF+mJnE52jOO90PnPSc3Ur3bTQw0gA==} dev: true + /tsconfig-paths@3.14.2: + resolution: {integrity: sha512-o/9iXgCYc5L/JxCHPe3Hvh8Q/2xm5Z+p18PESBU6Ff33695QnCHBEjcytY2q19ua7Mbl/DavtBOLq+oG0RCL+g==} + dependencies: + '@types/json5': 0.0.29 + json5: 1.0.2 + minimist: 1.2.8 + strip-bom: 3.0.0 + dev: true + /tsconfig-paths@4.2.0: resolution: {integrity: sha512-NoZ4roiN7LnbKn9QqE1amc9DJfzvZXxF4xDavcOWt1BPkdx+m+0gJuPM+S0vCe7zTJMYUP0R8pO2XMr+Y8oLIg==} engines: {node: '>=6'} @@ -18437,6 +18684,36 @@ packages: resolution: {integrity: sha512-dzlvlNlt6AXU7EBSfpAscydQ7gXB+pPGsPnfJnZpiNJBDj7IaJzQlBZYGdEi4R9HmPdBv2XmWJ6YUtoTa7lmCw==} dev: false + /typed-array-buffer@1.0.0: + resolution: {integrity: sha512-Y8KTSIglk9OZEr8zywiIHG/kmQ7KWyjseXs1CbSo8vC42w7hg2HgYTxSWwP0+is7bWDc1H+Fo026CpHFwm8tkw==} + engines: {node: '>= 0.4'} + dependencies: + call-bind: 1.0.2 + get-intrinsic: 1.2.1 + is-typed-array: 1.1.10 + dev: true + + /typed-array-byte-length@1.0.0: + resolution: {integrity: sha512-Or/+kvLxNpeQ9DtSydonMxCx+9ZXOswtwJn17SNLvhptaXYDJvkFFP5zbfU/uLmvnBJlI4yrnXRxpdWH/M5tNA==} + engines: {node: '>= 0.4'} + dependencies: + call-bind: 1.0.2 + for-each: 0.3.3 + has-proto: 1.0.1 + is-typed-array: 1.1.10 + dev: true + + /typed-array-byte-offset@1.0.0: + resolution: {integrity: sha512-RD97prjEt9EL8YgAgpOkf3O4IF9lhJFr9g0htQkm0rchFp/Vx7LW5Q8fSXXub7BXAODyUQohRMyOc3faCPd0hg==} + engines: {node: '>= 0.4'} + dependencies: + available-typed-arrays: 1.0.5 + call-bind: 1.0.2 + for-each: 0.3.3 + has-proto: 1.0.1 + is-typed-array: 1.1.10 + dev: true + /typed-array-length@1.0.4: resolution: {integrity: sha512-KjZypGq+I/H7HI5HlOoGHkWUUGq+Q0TPhQurLbyrVrvnKTBgzLhIJ7j6J/XTQOi0d1RjyZ0wdas8bKs2p0x3Ng==} dependencies: @@ -19149,6 +19426,17 @@ packages: resolution: {integrity: sha512-iBdZ57RDvnOR9AGBhML2vFZf7h8vmBjhoaZqODJBFWHVtKkDmKuHai3cx5PgVMrX5YDNp27AofYbAwctSS+vhQ==} dev: false + /which-typed-array@1.1.11: + resolution: {integrity: sha512-qe9UWWpkeG5yzZ0tNYxDmd7vo58HDBc39mZ0xWWpolAGADdFOzkfamWLDxkOWcvHQKVmdTyQdLD4NOfjLWTKew==} + engines: {node: '>= 0.4'} + dependencies: + available-typed-arrays: 1.0.5 + call-bind: 1.0.2 + for-each: 0.3.3 + gopd: 1.0.1 + has-tostringtag: 1.0.0 + dev: true + /which-typed-array@1.1.9: resolution: {integrity: sha512-w9c4xkx6mPidwp7180ckYWfMmvxpjlZuIudNtDf4N/tTAUB8VJbX25qZoAsrtGuYNnGw3pa0AXgbGKRB8/EceA==} engines: {node: '>= 0.4'} From 3a87fcfbe439fa2f1b14a0b9d2109e394cf88c7e Mon Sep 17 00:00:00 2001 From: Nick Grosenbacher Date: Wed, 30 Aug 2023 15:37:35 -0400 Subject: [PATCH 2/6] Run `eslint src --fix` on synapse-react-client --- ...onditionsForUseButton.integration.test.tsx | 8 +- .../AddConditionsForUseButton.tsx | 2 +- ...poseRestrictionDialog.integration.test.tsx | 4 +- .../AccessApprovalCheckMark.tsx | 2 +- ...AccessRequirementList.integration.test.tsx | 8 +- .../AccessRequirementList.stories.tsx | 16 +- .../AccessRequirementList.tsx | 28 +-- .../AccessRequirementListItem.tsx | 2 +- .../AccessRequirementListUtils.ts | 2 +- .../CancelRequestDataAccess.tsx | 2 +- .../DataAccessRequestAccessorsEditor.tsx | 2 +- ...ccessRequestAccessorsFilesForm.stories.tsx | 6 +- ...taAccessRequestAccessorsFilesForm.test.tsx | 20 +-- .../DataAccessRequestAccessorsFilesForm.tsx | 4 +- .../DocumentTemplate.tsx | 4 +- ...gedACTAccessRequirementFormWikiWrapper.tsx | 2 +- .../ManagedACTAccessRequirementItem.test.tsx | 10 +- .../ManagedACTAccessRequirementItem.tsx | 9 +- .../ResearchProjectForm.stories.tsx | 2 +- .../ResearchProjectForm.test.tsx | 6 +- .../ResearchProjectForm.tsx | 2 +- .../UploadDocumentField.tsx | 4 +- .../AuthenticatedRequirement.tsx | 4 +- .../CertificationRequirement.stories.ts | 2 +- .../CertificationRequirement.tsx | 4 +- .../RequirementItem.stories.tsx | 2 +- .../RequirementItem/RequirementItem.tsx | 4 +- .../SelfSignAccessRequirementItem.stories.tsx | 14 +- .../SelfSignAccessRequirementItem.test.tsx | 12 +- .../SelfSignAccessRequirementItem.tsx | 6 +- ...woFactorAuthEnabledRequirement.stories.tsx | 4 +- .../TwoFactorAuthEnabledRequirement.tsx | 4 +- ...anagedACTAccessRequirementItem.stories.tsx | 12 +- ...UnmanagedACTAccessRequirementItem.test.tsx | 10 +- .../UnmanagedACTAccessRequirementItem.tsx | 6 +- .../ValidationRequirement.stories.ts | 2 +- .../RequirementItem/ValidationRequirement.tsx | 4 +- .../AccessTokenCard/AccessTokenCard.test.tsx | 2 +- .../AccessTokenCard/AccessTokenCard.tsx | 12 +- .../AccessTokenPage/AccessTokenPage.test.tsx | 8 +- .../CreateAccessTokenModal.test.tsx | 8 +- .../CreateAccessTokenModal.tsx | 6 +- .../AccountLevelBadge.test.tsx | 6 +- .../src/components/AddToDownloadListV2.tsx | 6 +- .../Authentication/LastLoginInfo.stories.ts | 2 +- .../Authentication/LastLoginInfo.test.tsx | 2 +- .../components/Authentication/Login.test.tsx | 10 +- .../Authentication/LoginFlowBackButton.tsx | 2 +- .../components/Authentication/LoginForm.tsx | 4 +- .../LoginMethodButton.stories.ts | 2 +- .../Authentication/LoginMethodButton.test.tsx | 4 +- .../Authentication/LoginPage.stories.ts | 2 +- .../components/Authentication/LoginPage.tsx | 6 +- .../src/components/Authentication/Logout.tsx | 2 +- .../Authentication/RecoveryCodeGrid.tsx | 2 +- .../RegenerateBackupCodesWarning.tsx | 2 +- .../Authentication/StandaloneLoginForm.tsx | 2 +- .../TwoFactorAuthSettingsPanel.stories.tsx | 2 +- .../TwoFactorAuthSettingsPanel.test.tsx | 2 +- .../TwoFactorAuthSettingsPanel.tsx | 2 +- .../TwoFactorBackupCodes.test.tsx | 2 +- .../Authentication/TwoFactorBackupCodes.tsx | 8 +- .../TwoFactorEnrollmentForm.stories.ts | 2 +- .../TwoFactorEnrollmentForm.test.tsx | 10 +- .../TwoFactorEnrollmentForm.tsx | 6 +- .../Authentication/TwoFactorSecretDialog.tsx | 2 +- .../src/components/Authentication/index.ts | 8 +- .../CardContainer.integration.test.tsx | 8 +- .../CardContainer/CardContainer.tsx | 14 +- .../CardContainerLogic.stories.ts | 2 +- .../CardContainerLogic.test.tsx | 2 +- .../CardContainerLogic/CardContainerLogic.tsx | 8 +- .../src/components/Carousel/Carousel.test.tsx | 2 +- .../src/components/Carousel/Carousel.tsx | 2 +- .../CertificationQuiz.integration.test.tsx | 2 +- .../CertificationQuiz/CertificationQuiz.tsx | 13 +- .../ChallengeDataDownload.tsx | 4 +- .../ChallengeDataTable.tsx | 4 +- .../ChallengeDataDownload/Renderers.tsx | 6 +- .../ChallengeRegisterButton.tsx | 2 +- .../ChallengeSubmission.stories.ts | 2 +- .../ChallengeSubmission.tsx | 20 +-- .../ChallengeSubmissionStepper.tsx | 10 +- .../EvaluationQueueList.tsx | 2 +- .../SubmissionCommitList.tsx | 4 +- .../SubmissionDirectoryList.tsx | 14 +- .../ChallengeTeamTable.tsx | 12 +- .../ChallengeTeamWizard.test.tsx | 16 +- .../ChallengeTeamWizard.tsx | 17 +- .../RegistrationSuccessful.tsx | 3 +- .../SelectChallengeTeam.tsx | 2 +- .../ChangePassword/ChangePassword.tsx | 6 +- .../ColorGradient/ColorGradient.test.ts | 2 +- .../src/components/CopyToClipboardIcon.tsx | 3 +- .../CreateProjectModal.integration.test.tsx | 8 +- .../DirectDownload.integration.test.tsx | 12 +- .../DirectDownload/DirectDownload.tsx | 4 +- .../FileEntityDirectDownload.tsx | 4 +- .../ActionRequiredCard.stories.tsx | 4 +- .../ActionRequiredCard/ActionRequiredCard.tsx | 2 +- .../AvailableForDownloadTable.tsx | 3 +- .../DownloadCart/CreatePackageV2.tsx | 2 +- .../DownloadCart/DownloadCartPage.tsx | 21 ++- .../DownloadCart/DownloadDetails.tsx | 4 +- .../DownloadListActionsRequired.tsx | 4 +- .../DownloadCart/DownloadListTable.test.tsx | 6 +- .../DownloadCart/DownloadListTable.tsx | 10 +- .../EnableTwoFaRequirementCard.test.tsx | 6 +- .../EnableTwoFaRequirementCard.tsx | 2 +- ...AccessRequirementCard.integration.test.tsx | 16 +- .../MeetAccessRequirementCard.tsx | 4 +- .../RequestDownloadCard.integration.test.tsx | 2 +- .../DownloadCart/RequestDownloadCard.tsx | 2 +- .../DownloadCart/ShowDownloadV2.tsx | 4 +- .../src/components/DownloadCart/index.ts | 2 +- .../EntityBadgeIcons/EntityBadgeIcons.tsx | 12 +- .../EntityFinder/EntityFinder.stories.ts | 2 +- .../components/EntityFinder/EntityFinder.tsx | 8 +- .../EntityFinder/EntityFinderModal.test.tsx | 4 +- .../components/EntityFinder/SelectionPane.tsx | 10 +- .../details/EntityDetailsList.tsx | 9 +- .../configurations/EntityChildrenDetails.tsx | 2 +- .../configurations/ProjectListDetails.tsx | 6 +- .../details/configurations/SearchDetails.tsx | 2 +- .../EntityFinder/details/view/DetailsView.tsx | 14 +- .../view/DetailsViewTableRenderers.tsx | 10 +- .../EntityFinder/tree/EntityTree.tsx | 14 +- .../EntityFinder/tree/VirtualizedTree.tsx | 6 +- .../src/components/EntityForm/EntityForm.tsx | 4 +- .../src/components/EntityLink.tsx | 2 +- .../Evaluation/CreatedOnByUserDiv.tsx | 2 +- .../EvaluationCard.integration.test.tsx | 8 +- .../components/Evaluation/EvaluationCard.tsx | 14 +- .../EvaluationEditor.integration.test.tsx | 6 +- .../Evaluation/EvaluationEditor.tsx | 4 +- .../Evaluation/EvaluationEditorPage.test.tsx | 2 +- .../Evaluation/EvaluationEditorPage.tsx | 2 +- .../Evaluation/EvaluationIdRenderer.test.tsx | 3 +- .../Evaluation/EvaluationRoundEditor.test.tsx | 8 +- .../Evaluation/EvaluationRoundEditor.tsx | 20 +-- .../EvaluationRoundEditorList.test.tsx | 4 +- .../Evaluation/EvaluationRoundEditorList.tsx | 16 +- .../src/components/Evaluation/index.ts | 2 +- .../Evaluation/input_models/models.test.ts | 2 +- .../EvaluationRoundLimitOptions.test.tsx | 10 +- .../ExperimentalMode/ExperimentalMode.tsx | 5 +- .../ExternalFileHandleLink.tsx | 2 +- .../FeaturedDataTabs/FacetPlotsCard.tsx | 30 ++-- .../FeaturedDataTabs/FeaturedDataPlots.tsx | 2 +- .../FeaturedDataTabs.stories.ts | 2 +- .../FeaturedDataTabs.test.tsx | 2 +- .../FeaturedDataTabs/FeaturedDataTabs.tsx | 8 +- .../QueryPerFacetPlotsCard.tsx | 2 +- .../SingleQueryFacetPlotsCards.tsx | 4 +- .../FeaturedToolsList.test.tsx | 4 +- .../FeaturedToolsList/FeaturedToolsList.tsx | 6 +- .../EntityPreview.integration.test.tsx | 2 +- .../components/FilePreview/EntityPreview.tsx | 6 +- .../FileEntityPreview.integration.test.tsx | 16 +- .../FilePreview/FileEntityPreview.tsx | 14 +- ...HandleContentRenderer.integration.test.tsx | 22 +-- .../FilePreview/FileHandleContentRenderer.tsx | 4 +- .../HtmlPreview.integration.test.tsx | 10 +- .../FilePreview/HtmlPreview/HtmlPreview.tsx | 2 +- .../FilePreview/PreviewUtils.test.ts | 2 +- .../components/FilePreview/PreviewUtils.ts | 2 +- .../FileUpload/FileUpload.stories.tsx | 2 +- .../src/components/FileUpload/FileUpload.tsx | 4 +- .../src/components/Forum/DiscussionReply.tsx | 10 +- .../Forum/DiscussionSearchResult.tsx | 19 +- .../DiscussionThread.integration.test.tsx | 18 +- .../src/components/Forum/DiscussionThread.tsx | 20 +-- .../Forum/ForumPage.integration.test.tsx | 22 +-- .../src/components/Forum/ForumPage.tsx | 8 +- .../src/components/Forum/ForumTable.tsx | 10 +- .../components/Forum/ForumThreadEditor.tsx | 2 +- .../src/components/Forum/SubscribersModal.tsx | 4 +- .../src/components/Forum/index.ts | 2 +- .../components/ForumSearch/ForumSearch.tsx | 6 +- .../FullWidthAlert/FullWidthAlert.stories.tsx | 2 +- .../FullWidthAlert/FullWidthAlert.test.tsx | 2 +- .../GenericCard.integration.test.tsx | 28 +-- .../components/GenericCard/GenericCard.tsx | 24 +-- .../GenericCard/SynapseCardLabel.test.tsx | 6 +- .../GenericCard/SynapseCardLabel.tsx | 4 +- .../src/components/Goals/Goals.Desktop.tsx | 4 +- .../src/components/Goals/Goals.Mobile.tsx | 4 +- .../src/components/Goals/Goals.tsx | 4 +- .../GoogleMap/GoogleMap.integration.test.tsx | 14 +- .../GoogleMap/SynapseUserMarker.tsx | 3 +- .../src/components/HasAccess/HasAccessV2.tsx | 14 +- .../src/components/HeaderCard.tsx | 2 +- .../components/HelpPopover/HelpPopover.tsx | 2 +- .../IDUReport/IDUReport.integration.test.tsx | 5 +- .../src/components/IDUReport/IDUReport.tsx | 2 +- .../IDUReport/IDUReportSubmissionInfo.tsx | 2 +- .../src/components/IconSvg/IconSvg.tsx | 6 +- .../LoadingScreen/LoadingScreen.test.tsx | 2 +- .../components/Markdown/MarkdownCollapse.tsx | 2 +- .../components/Markdown/MarkdownEditor.tsx | 2 +- .../Markdown/MarkdownPopover.test.tsx | 2 +- .../components/Markdown/MarkdownPopover.tsx | 4 +- .../components/Markdown/MarkdownSynapse.tsx | 12 +- .../src/components/Markdown/TOC.test.tsx | 2 +- .../components/Markdown/UserMentionModal.tsx | 2 +- .../src/components/Markdown/index.ts | 10 +- .../widget/SynapsePlots.integration.test.tsx | 2 +- ...ngQueryResultsWarning.integration.test.tsx | 4 +- .../MissingQueryResultsWarning.tsx | 4 +- .../ModalDownload/ModalDownload.FormSchema.ts | 2 +- .../ModalDownload/ModalDownload.test.tsx | 8 +- .../ModalDownload/ModalDownload.tsx | 8 +- .../CreateOAuthClient.integration.test.tsx | 2 +- .../CreateOAuthClient.tsx | 6 +- .../OAuthManagement.integration.test.tsx | 2 +- .../OAuthClientManagement/OAuthManagement.tsx | 8 +- .../OrientationBanner.test.tsx | 4 +- .../src/components/Plot/BarPlot.tsx | 8 +- .../src/components/Plot/DotPlot.tsx | 8 +- .../components/Plot/StatisticsPlot.test.tsx | 6 +- .../src/components/Plot/SynapsePlot.tsx | 4 +- .../src/components/Plot/ThemesPlot.tsx | 28 ++- .../src/components/Plot/UpsetPlot.tsx | 2 +- .../src/components/Plot/index.ts | 7 +- .../PlotlyWrapper/PlotlyWrapper.stories.ts | 2 +- ...rammaticTableDownload.integration.test.tsx | 10 +- .../components/Programs/Programs.Desktop.tsx | 2 +- .../components/Programs/Programs.Mobile.tsx | 2 +- .../src/components/Programs/Programs.tsx | 4 +- .../ProjectViewCarousel.test.tsx | 8 +- .../ProvenanceGraph/ActivityNodeLabel.tsx | 5 +- .../ProvenanceGraph/EntityNodeLabel.tsx | 4 +- .../ProvenanceGraph/ProvenanceEntityIcon.tsx | 2 +- .../ProvenanceGraph.integration.test.tsx | 4 +- .../ProvenanceGraph/ProvenanceGraph.tsx | 21 +-- .../ProvenanceGraph/ProvenanceGraphUtils.ts | 8 +- .../ProvenanceGraph/ProvenanceUtils.tsx | 12 +- .../components/QueryContext/QueryContext.tsx | 4 +- .../src/components/QueryCount/QueryCount.tsx | 2 +- .../src/components/QuerySortSelector.tsx | 4 +- ...yVisualizationWrapper.integration.test.tsx | 24 +-- .../QueryVisualizationWrapper.tsx | 4 +- .../QueryWrapper/QueryWrapper.test.tsx | 27 ++- .../components/QueryWrapper/QueryWrapper.tsx | 14 +- .../TableRowSelectionState.test.tsx | 4 +- .../QueryWrapper/useQueryWrapperData.test.tsx | 6 +- .../QueryWrapper/useQueryWrapperData.ts | 13 +- ...useQueryWrapperPaginationControls.test.tsx | 4 +- .../components/QueryWrapperErrorBanner.tsx | 2 +- .../QueryWrapperPlotNav/LastUpdatedOn.tsx | 4 +- .../QueryWrapperPlotNav.stories.tsx | 14 +- .../QueryWrapperPlotNav.tsx | 8 +- .../Resources/Resources.Desktop.tsx | 2 +- .../components/Resources/Resources.Mobile.tsx | 2 +- .../src/components/Resources/Resources.tsx | 4 +- .../components/RssFeedCards/RssFeedCards.tsx | 2 +- .../SchemaDrivenAnnotationEditor.stories.ts | 2 +- .../SchemaDrivenAnnotationEditor.tsx | 26 +-- ...ivenAnnotationsEditor.integration.test.tsx | 10 +- .../field/AdditionalPropertiesSchemaField.tsx | 2 +- .../field/CustomObjectField.tsx | 4 +- .../template/ArrayFieldTemplate.tsx | 2 +- .../template/BaseInputTemplate.tsx | 3 +- .../template/FieldDescriptionTable.tsx | 2 +- .../template/ObjectFieldTemplate.tsx | 2 +- .../src/components/Skeleton/index.ts | 2 +- .../SpinnerButton/SpinnerButton.stories.tsx | 2 +- .../SpinnerButton/SpinnerButton.tsx | 2 +- .../StandaloneQueryWrapper.tsx | 2 +- .../src/components/StatisticsPlot.tsx | 2 +- .../StepperDialog/StepperDialog.stories.tsx | 2 +- .../StepperDialog/StepperDialog.tsx | 3 +- .../components/StorybookComponentWrapper.tsx | 10 +- .../SubscriptionPage/ForumTopic.tsx | 2 +- .../SubscriptionPage.integration.test.tsx | 2 +- .../SubscriptionPage.stories.ts | 2 +- .../SubscriptionPage/SubscriptionPage.tsx | 4 +- .../SubscriptionPage/ThreadTopic.tsx | 2 +- .../SubsectionRowRenderer.test.tsx | 6 +- .../SubsectionRowRenderer.tsx | 16 +- .../components/SynapseForm/Header.test.tsx | 2 +- .../SynapseForm/NavButtons.test.tsx | 2 +- .../SynapseForm/StepsSideNav.test.tsx | 2 +- .../SynapseForm/SummaryTable.test.tsx | 4 +- .../components/SynapseForm/SummaryTable.tsx | 2 +- .../SynapseForm/SynapseForm.test.tsx | 2 +- .../components/SynapseForm/SynapseForm.tsx | 90 +++++----- ...seFormSubmissionsGrid.integration.test.tsx | 8 +- .../SynapseFormSubmissionsGrid.stories.tsx | 10 +- .../SynapseFormSubmissionsGrid.tsx | 8 +- .../SynapseForm/SynapseFormUtils.test.ts | 2 +- .../SynapseForm/SynapseFormUtils.ts | 2 +- .../SynapseForm/SynapseFormWrapper.tsx | 4 +- .../SynapseForm/WarningDialog.test.tsx | 2 +- .../src/components/SynapseForm/index.ts | 2 +- .../SynapseHomepage/SynapseHomepage.tsx | 8 +- .../SynapsePriceFeatureRow.tsx | 2 +- .../SynapseNavDrawer.test.tsx | 8 +- .../SynapseTable/EntityIDColumnCopyIcon.tsx | 2 +- .../RowSelection/RowSelection.stories.tsx | 4 +- .../RowSelection/RowSelectionControls.tsx | 8 +- .../RowSelection/RowSelectionUI.tsx | 2 +- .../src/components/SynapseTable/SearchV2.tsx | 2 +- ...icaConfirmationDialog.integration.test.tsx | 10 +- .../SendToCavaticaConfirmationDialog.tsx | 8 +- .../SynapseTable.integration.test.tsx | 20 +-- .../SynapseTable/SynapseTable.stories.tsx | 4 +- .../components/SynapseTable/SynapseTable.tsx | 34 ++-- .../SynapseTableCell/EntityIdList.test.tsx | 5 +- .../JSON/ComplexJSONRenderer.tsx | 2 +- .../JSON/JSONArrayRenderer.tsx | 4 +- .../JSON/JSONTableCellRenderer.test.tsx | 2 +- .../JSON/JSONTableCellRenderer.tsx | 2 +- .../SynapseTableCell/SynapseTableCell.tsx | 24 +-- .../SynapseTableCell/UserIdList.test.tsx | 2 +- .../SynapseTableCell/UserIdList.tsx | 2 +- .../SynapseTable/SynapseTableRenderers.tsx | 14 +- .../SynapseTable/SynapseTableUtils.test.ts | 14 +- .../SynapseTable/TablePagination.tsx | 2 +- .../TopLevelControls/TopLevelControls.tsx | 14 +- .../TopLevelControlsUtils.test.ts | 2 +- .../TopLevelControls/TopLevelControlsUtils.ts | 4 +- .../DatasetItemsEditor.integration.test.tsx | 18 +- .../datasets/DatasetItemsEditor.tsx | 12 +- .../table-top/ColumnSelection.tsx | 2 +- .../table-top/DownloadLoginModal.test.tsx | 4 +- .../table-top/DownloadLoginModal.tsx | 2 +- .../DownloadOptions.integration.test.tsx | 14 +- .../table-top/DownloadOptions.tsx | 6 +- .../SynapseTable/usePrefetchTableData.ts | 4 +- .../components/SynapseTable/useTableSort.tsx | 2 +- .../TableFeedCards/TableFeedCards.test.tsx | 5 +- .../TableFeedCards/TableFeedCards.tsx | 4 +- .../src/components/TeamBadge.tsx | 2 +- .../TermsAndConditions.stories.ts | 2 +- .../TermsAndConditions.test.tsx | 6 +- .../TermsAndConditions/TermsAndConditions.tsx | 6 +- .../TermsAndConditionsItem.test.tsx | 8 +- .../TermsAndConditionsItem.tsx | 4 +- .../TotalQueryResults.integration.test.tsx | 10 +- .../src/components/TotalQueryResults.tsx | 6 +- .../src/components/UserCard/Avatar.tsx | 6 +- .../src/components/UserCard/UserCard.tsx | 5 +- .../src/components/UserCard/UserCardLarge.tsx | 2 +- .../components/UserCard/UserCardMedium.tsx | 7 +- .../src/components/UserCard/UserCardSmall.tsx | 6 +- .../UserCardList.integration.test.tsx | 4 +- .../components/UserCardList/UserCardList.tsx | 8 +- .../UserCardListGroups.Desktop.tsx | 2 +- .../UserCardListGroups.Mobile.tsx | 2 +- .../UserCardListGroups/UserCardListGroups.tsx | 4 +- .../UserCardListRotate.stories.ts | 2 +- .../UserCardList/UserCardListRotate.test.tsx | 2 +- .../UserCardList/UserCardListRotate.tsx | 16 +- .../src/components/UserCardList/index.ts | 2 +- .../UserOrTeamBadge/UserOrTeamBadge.tsx | 2 +- .../UserProfileLinks/UserChallenges.test.tsx | 4 +- .../UserProfileLinks/UserChallenges.tsx | 2 +- .../UserProfileLinks/UserProfileLinks.tsx | 2 +- .../UserProfileLinks/UserProjects.test.tsx | 4 +- .../UserProfileLinks/UserProjects.tsx | 6 +- .../UserProfileLinks/UserTeams.test.tsx | 4 +- .../components/UserProfileLinks/UserTeams.tsx | 2 +- .../UserSearchBox/UserSearchBox.tsx | 7 +- .../UserSearchBoxV2.integration.test.tsx | 2 +- .../UserSearchBox/UserSearchBoxV2.tsx | 3 +- .../AccessApprovalsTable.integration.test.tsx | 14 +- .../dataaccess/AccessApprovalsTable.tsx | 4 +- ...ccessHistoryDashboard.integration.test.tsx | 10 +- .../dataaccess/AccessHistoryDashboard.tsx | 10 +- ...equestSubmissionTable.integration.test.tsx | 21 +-- .../AccessRequestSubmissionTable.tsx | 13 +- ...sRequirementDashboard.integration.test.tsx | 8 +- .../dataaccess/AccessRequirementDashboard.tsx | 6 +- ...sRequirementSearchBox.integration.test.tsx | 6 +- .../AccessRequirementSearchBox.stories.ts | 2 +- ...ccessRequirementTable.integration.test.tsx | 16 +- .../dataaccess/AccessRequirementTable.tsx | 14 +- ...ssSubmissionDashboard.integration.test.tsx | 4 +- .../dataaccess/AccessSubmissionDashboard.tsx | 7 +- ...ataAccessRequestModal.integration.test.tsx | 14 +- .../RejectDataAccessRequestModal.tsx | 14 +- .../ReviewerDashboard.integration.test.tsx | 4 +- .../dataaccess/ReviewerDashboard.tsx | 4 +- .../SubmissionPage.integration.test.tsx | 16 +- .../dataaccess/SubmissionPage.stories.tsx | 2 +- .../components/dataaccess/SubmissionPage.tsx | 12 +- .../DownloadConfirmationUI.stories.tsx | 2 +- .../DownloadConfirmationUI.test.tsx | 4 +- .../download_list/DownloadConfirmationUI.tsx | 2 +- .../download_list/DownloadDetails.test.tsx | 2 +- .../download_list/DownloadDetails.tsx | 10 +- .../FolderDownloadConfirmation.tsx | 2 +- .../TableQueryDownloadConfirmation.test.tsx | 6 +- .../TableQueryDownloadConfirmation.tsx | 6 +- .../src/components/download_list/index.ts | 2 +- .../AnnotationsTable.integration.test.tsx | 2 +- .../metadata/EntityModal.integration.test.tsx | 4 +- .../entity/metadata/EntityModal.tsx | 6 +- .../MetadataTable.integration.test.tsx | 2 +- .../CreatedByModifiedBy.integration.test.tsx | 10 +- .../entity/page/CreatedByModifiedBy.tsx | 4 +- .../action_menu/EntityActionMenu.test.tsx | 6 +- .../EntityPageTitleBar.integration.test.tsx | 12 +- .../title_bar/EntityPageTitleBar.stories.tsx | 2 +- .../page/title_bar/EntityPageTitleBar.tsx | 4 +- ...tyTitleBarVersionInfo.integration.test.tsx | 14 +- .../title_bar/EntityTitleBarVersionInfo.tsx | 6 +- .../useGetEntityTitleBarProperties.tsx | 10 +- .../components/error/ErrorBanner.stories.tsx | 2 +- .../components/error/ErrorChip.stories.tsx | 2 +- .../src/components/error/ErrorChip.tsx | 2 +- .../FavoriteButton.integration.test.tsx | 10 +- .../components/favorites/FavoriteButton.tsx | 2 +- .../FavoritesPage.integration.test.tsx | 2 +- .../components/favorites/FavoritesPage.tsx | 6 +- .../src/components/menu/ComplexMenu.test.tsx | 2 +- .../components/menu/DropdownMenu.stories.tsx | 2 +- .../src/components/menu/DropdownMenu.test.tsx | 4 +- .../src/components/row_renderers/Dataset.tsx | 8 +- .../row_renderers/ObservationCard.tsx | 6 +- .../components/row_renderers/utils/index.tsx | 4 +- .../trash/TrashCanList.integration.test.tsx | 10 +- .../src/components/trash/TrashCanList.tsx | 4 +- .../src/components/widgets/Checkbox.test.tsx | 2 +- .../widgets/ElementWithTooltip.test.tsx | 4 +- .../components/widgets/ElementWithTooltip.tsx | 4 +- .../components/widgets/ImageFileHandle.tsx | 2 +- .../widgets/LoginAwareButton.stories.tsx | 2 +- .../widgets/LoginAwareButton.test.tsx | 4 +- .../components/widgets/RadioGroup.test.tsx | 2 +- .../RangeSlider/RangeSlider.stories.tsx | 2 +- .../widgets/RangeSlider/RangeSlider.tsx | 5 +- .../components/widgets/SynapseImage.test.tsx | 2 +- .../src/components/widgets/SynapseImage.tsx | 4 +- .../src/components/widgets/SynapseVideo.tsx | 5 +- .../facet-nav/FacetNav.integration.test.tsx | 8 +- .../components/widgets/facet-nav/FacetNav.tsx | 8 +- .../FacetNavPanel.integration.test.tsx | 4 +- .../widgets/facet-nav/FacetNavPanel.tsx | 20 +-- .../widgets/facet-nav/FacetPlotLegendList.tsx | 4 +- .../facet-nav/FacetPlotLegendTable.tsx | 2 +- .../facet-nav/SelectionCriteriaPills.tsx | 32 ++-- .../CombinedRangeFacetFilter.test.tsx | 8 +- .../query-filter/CombinedRangeFacetFilter.tsx | 13 +- .../query-filter/EnumFacetFilter.stories.tsx | 4 +- .../widgets/query-filter/EnumFacetFilter.tsx | 10 +- .../FacetFilterControls.integration.test.tsx | 14 +- .../query-filter/FacetFilterControls.tsx | 12 +- .../widgets/query-filter/RangeFacetFilter.tsx | 11 +- packages/synapse-react-client/src/index.ts | 12 +- .../src/mocks/discussion/mock_discussion.ts | 2 +- .../src/mocks/entity/MockEntityData.ts | 2 +- .../src/mocks/entity/mockFileView.ts | 2 +- .../src/mocks/entity/mockProject.ts | 4 +- .../src/mocks/entity/mockProjectView.ts | 2 +- .../src/mocks/faker/fakerUtils.ts | 2 +- .../src/mocks/faker/generateDiscussion.ts | 2 +- .../src/mocks/mockAccessRequest.ts | 7 +- .../src/mocks/mockAccessRequirements.ts | 2 +- .../src/mocks/mockCertificationQuiz.ts | 7 +- .../src/mocks/mockSchema.ts | 2 +- .../src/mocks/mock_drug_tool_data.ts | 7 +- .../src/mocks/msw/handlers.ts | 10 +- .../msw/handlers/accessRequirementHandlers.ts | 14 +- .../mocks/msw/handlers/discussionHandlers.ts | 2 +- .../src/mocks/msw/handlers/entityHandlers.ts | 25 +-- .../msw/handlers/researchProjectHandlers.ts | 2 +- .../mocks/msw/handlers/tableQueryHandlers.ts | 12 +- .../mocks/msw/handlers/userProfileHandlers.ts | 14 +- .../src/mocks/msw/handlers/wikiHandlers.ts | 2 +- .../src/mocks/user/mock_user_profile.ts | 10 +- .../SynapseClient.integration.test.ts | 4 +- .../src/synapse-client/SynapseClient.test.ts | 6 +- .../src/synapse-client/SynapseClient.ts | 168 +++++++++--------- .../synapse-client/SynapseClientUtils.test.ts | 10 +- .../dataaccess/useAccessApprovals.ts | 6 +- .../dataaccess/useAccessRequirements.ts | 10 +- .../dataaccess/useDataAccessSubmission.ts | 12 +- .../useGetApprovedSubmissionInfo.ts | 6 +- .../synapse-queries/docker/useGetDockerTag.ts | 4 +- .../download/useDownloadList.ts | 10 +- .../entity/useActionsRequiredForTableQuery.ts | 4 +- .../src/synapse-queries/entity/useEntity.ts | 8 +- .../entity/useEntityBoundSchema.ts | 6 +- .../entity/useEntityBundle.test.tsx | 2 +- .../synapse-queries/entity/useEntityBundle.ts | 6 +- .../entity/useExportToCavatica.test.tsx | 4 +- .../entity/useExportToCavatica.ts | 8 +- .../entity/useGetEntityActionsRequired.ts | 2 +- .../entity/useGetEntityChallenge.ts | 2 +- .../entity/useGetEntityChildren.test.ts | 8 +- .../entity/useGetEntityChildren.ts | 6 +- .../entity/useGetEntityForum.ts | 2 +- .../entity/useGetEntityHeaders.test.tsx | 2 +- .../entity/useGetEntityHeaders.ts | 6 +- .../entity/useGetQueryResultBundle.test.tsx | 20 +-- .../entity/useGetQueryResultBundle.ts | 10 +- .../src/synapse-queries/entity/useSchema.ts | 2 +- .../src/synapse-queries/file/useFiles.ts | 6 +- .../file/useUploadDestination.ts | 2 +- .../src/synapse-queries/forum/useForum.ts | 11 +- .../src/synapse-queries/forum/useReply.ts | 10 +- .../synapse-queries/oauth/useOAuthClient.ts | 2 +- .../provenance/useGetActivityForEntity.ts | 2 +- .../synapse-queries/search/useSearch.test.tsx | 2 +- .../src/synapse-queries/search/useSearch.ts | 2 +- .../subscription/useSubscription.ts | 2 +- .../src/synapse-queries/team/useTeam.ts | 2 +- .../src/synapse-queries/team/useTeamList.ts | 6 +- .../synapse-queries/team/useTeamMembers.ts | 8 +- .../src/synapse-queries/trash/useTrashCan.ts | 6 +- .../user/useFavorites.test.tsx | 2 +- .../src/synapse-queries/user/useFavorites.ts | 9 +- .../user/useGetUserChallenges.ts | 6 +- .../user/useGetUserProjects.ts | 6 +- .../synapse-queries/user/useGetUserTeams.ts | 7 +- .../user/usePersonalAccessToken.ts | 2 +- .../synapse-queries/user/useProjects.test.tsx | 2 +- .../src/synapse-queries/user/useProjects.ts | 6 +- .../src/synapse-queries/user/useUserBundle.ts | 12 +- .../user/useUserGroupHeader.ts | 2 +- .../src/theme/DefaultTheme.tsx | 6 +- .../session/ApplicationSession.test.tsx | 24 +-- .../session/ApplicationSessionContext.tsx | 2 +- .../session/ApplicationSessionManager.tsx | 8 +- .../src/utils/context/FullContextProvider.tsx | 2 +- .../src/utils/functions/DateFormatter.ts | 2 +- .../utils/functions/EntityTypeUtils.test.ts | 14 +- .../src/utils/functions/FileHandleUtils.ts | 2 - .../utils/functions/ResolveLinkEntity.test.ts | 2 +- .../src/utils/functions/ResolveLinkEntity.ts | 2 +- .../src/utils/functions/SqlFunctions.ts | 5 +- .../src/utils/functions/queryUtils.ts | 6 +- .../src/utils/functions/sqlFunctions.test.ts | 12 +- .../src/utils/functions/stringUtils.test.ts | 2 +- .../src/utils/functions/testDownloadSpeed.ts | 18 +- .../src/utils/hooks/index.ts | 8 +- .../src/utils/hooks/useDetectSSOCode.test.ts | 10 +- .../src/utils/hooks/useDetectSSOCode.ts | 8 +- .../utils/hooks/useGetInfoFromIds.test.tsx | 4 +- .../src/utils/hooks/useGetInfoFromIds.ts | 14 +- .../useGetIsAllSelectedInfiniteList.test.ts | 2 +- .../useImmutableTableQuery.test.tsx | 10 +- .../useImmutableTableQuery.ts | 6 +- .../src/utils/hooks/useListState.test.tsx | 2 +- .../src/utils/hooks/useLogin.test.tsx | 8 +- .../src/utils/hooks/useLogin.ts | 6 +- .../usePreFetchResource.integration.test.tsx | 2 +- .../src/utils/hooks/useTheme.test.tsx | 4 +- .../test/containers/EntityForm.test.tsx | 2 +- 551 files changed, 1860 insertions(+), 1843 deletions(-) diff --git a/packages/synapse-react-client/src/components/AccessRequirement/AddConditionsForUseButton/AddConditionsForUseButton.integration.test.tsx b/packages/synapse-react-client/src/components/AccessRequirement/AddConditionsForUseButton/AddConditionsForUseButton.integration.test.tsx index f7a3a932fc..dce85b2697 100644 --- a/packages/synapse-react-client/src/components/AccessRequirement/AddConditionsForUseButton/AddConditionsForUseButton.integration.test.tsx +++ b/packages/synapse-react-client/src/components/AccessRequirement/AddConditionsForUseButton/AddConditionsForUseButton.integration.test.tsx @@ -1,9 +1,7 @@ import React from 'react' import { EntityBundle, UserBundle } from '@sage-bionetworks/synapse-types' -import AddConditionsForUseButton, { - AddConditionsForUseButtonProps, -} from './AddConditionsForUseButton' import { render, screen, waitFor } from '@testing-library/react' +import userEvent from '@testing-library/user-event' import { createWrapper } from '../../../testutils/TestingLibraryUtils' import { rest, server } from '../../../mocks/msw/server' import { @@ -12,9 +10,11 @@ import { } from '../../../utils/functions/getEndpoint' import { ENTITY_BUNDLE_V2, USER_BUNDLE } from '../../../utils/APIConstants' import mockFileEntity from '../../../mocks/entity/mockFileEntity' -import userEvent from '@testing-library/user-event' import { mockUnmetControlledDataRestrictionInformationACT } from '../../../mocks/mock_has_access_data' import { mockUserBundle } from '../../../mocks/user/mock_user_profile' +import AddConditionsForUseButton, { + AddConditionsForUseButtonProps, +} from './AddConditionsForUseButton' function renderComponent(props: AddConditionsForUseButtonProps) { return render(, { diff --git a/packages/synapse-react-client/src/components/AccessRequirement/AddConditionsForUseButton/AddConditionsForUseButton.tsx b/packages/synapse-react-client/src/components/AccessRequirement/AddConditionsForUseButton/AddConditionsForUseButton.tsx index 540c896045..d57bb970be 100644 --- a/packages/synapse-react-client/src/components/AccessRequirement/AddConditionsForUseButton/AddConditionsForUseButton.tsx +++ b/packages/synapse-react-client/src/components/AccessRequirement/AddConditionsForUseButton/AddConditionsForUseButton.tsx @@ -1,12 +1,12 @@ import React, { useState } from 'react' import { Button } from '@mui/material' +import { RestrictionLevel } from '@sage-bionetworks/synapse-types' import IconSvg from '../../IconSvg/IconSvg' import ImposeRestrictionDialog from '../ImposeRestrictionDialog/ImposeRestrictionDialog' import { useGetEntityBundle, useIsCurrentUserACTMember, } from '../../../synapse-queries' -import { RestrictionLevel } from '@sage-bionetworks/synapse-types' import { isEntityRefCollectionView, isEntityView, diff --git a/packages/synapse-react-client/src/components/AccessRequirement/ImposeRestrictionDialog/ImposeRestrictionDialog.integration.test.tsx b/packages/synapse-react-client/src/components/AccessRequirement/ImposeRestrictionDialog/ImposeRestrictionDialog.integration.test.tsx index 7e3f8e1339..1cb7b254f4 100644 --- a/packages/synapse-react-client/src/components/AccessRequirement/ImposeRestrictionDialog/ImposeRestrictionDialog.integration.test.tsx +++ b/packages/synapse-react-client/src/components/AccessRequirement/ImposeRestrictionDialog/ImposeRestrictionDialog.integration.test.tsx @@ -1,15 +1,15 @@ import React from 'react' import { render, screen, waitFor, within } from '@testing-library/react' +import userEvent from '@testing-library/user-event' import { createWrapper } from '../../../testutils/TestingLibraryUtils' -import ImposeRestrictionDialog from './ImposeRestrictionDialog' import { rest, server } from '../../../mocks/msw/server' import mockFileEntityData from '../../../mocks/entity/mockFileEntity' import { BackendDestinationEnum, getEndpoint, } from '../../../utils/functions/getEndpoint' -import userEvent from '@testing-library/user-event' import { mockLockAccessRequirement } from '../../../mocks/mockAccessRequirements' +import ImposeRestrictionDialog from './ImposeRestrictionDialog' const mockOnClose = jest.fn() diff --git a/packages/synapse-react-client/src/components/AccessRequirementList/AccessApprovalCheckMark.tsx b/packages/synapse-react-client/src/components/AccessRequirementList/AccessApprovalCheckMark.tsx index e5a2c675e6..d006f4ea29 100644 --- a/packages/synapse-react-client/src/components/AccessRequirementList/AccessApprovalCheckMark.tsx +++ b/packages/synapse-react-client/src/components/AccessRequirementList/AccessApprovalCheckMark.tsx @@ -5,9 +5,9 @@ import { LockTwoTone, } from '@mui/icons-material' import Skeleton from '@mui/material/Skeleton' -import ConditionalWrapper from '../utils/ConditionalWrapper' import { Avatar, AvatarProps, styled, SxProps, useTheme } from '@mui/material' import { StyledComponent } from '@emotion/styled/dist/emotion-styled.cjs' +import ConditionalWrapper from '../utils/ConditionalWrapper' export enum RequirementItemStatus { COMPLETE = 'COMPLETE', diff --git a/packages/synapse-react-client/src/components/AccessRequirementList/AccessRequirementList.integration.test.tsx b/packages/synapse-react-client/src/components/AccessRequirementList/AccessRequirementList.integration.test.tsx index 261432b460..4379b3b23c 100644 --- a/packages/synapse-react-client/src/components/AccessRequirementList/AccessRequirementList.integration.test.tsx +++ b/packages/synapse-react-client/src/components/AccessRequirementList/AccessRequirementList.integration.test.tsx @@ -1,10 +1,7 @@ import { act, render, screen, waitFor } from '@testing-library/react' import React from 'react' -import AccessRequirementList, { - AccessRequirementListProps, -} from './AccessRequirementList' -import { createWrapper } from '../../testutils/TestingLibraryUtils' import { AccessRequirement } from '@sage-bionetworks/synapse-types' +import { createWrapper } from '../../testutils/TestingLibraryUtils' import mockFileEntityData from '../../mocks/entity/mockFileEntity' import { server } from '../../mocks/msw/server' import { @@ -13,6 +10,9 @@ import { mockSelfSignAccessRequirement, mockToUAccessRequirement, } from '../../mocks/mockAccessRequirements' +import AccessRequirementList, { + AccessRequirementListProps, +} from './AccessRequirementList' import * as AccessRequirementListUtils from './AccessRequirementListUtils' const MOCK_FILE_ENTITY_ID = mockFileEntityData.id diff --git a/packages/synapse-react-client/src/components/AccessRequirementList/AccessRequirementList.stories.tsx b/packages/synapse-react-client/src/components/AccessRequirementList/AccessRequirementList.stories.tsx index c418e30f58..86fb9778fa 100644 --- a/packages/synapse-react-client/src/components/AccessRequirementList/AccessRequirementList.stories.tsx +++ b/packages/synapse-react-client/src/components/AccessRequirementList/AccessRequirementList.stories.tsx @@ -1,7 +1,12 @@ import React from 'react' import { Meta, StoryObj } from '@storybook/react' import { rest } from 'msw' -import { MOCK_REPO_ORIGIN } from '../../utils/functions/getEndpoint' +import { + AccessApproval, + ApprovalState, + SubmissionState, + TwoFactorAuthStatus, +} from '@sage-bionetworks/synapse-types' import { ACCESS_APPROVAL } from '../../utils/APIConstants' import { mockACTAccessRequirement, @@ -14,14 +19,8 @@ import { SynapseContextConsumer, SynapseContextProvider, } from '../../utils/context/SynapseContext' -import { - AccessApproval, - ApprovalState, - SubmissionState, - TwoFactorAuthStatus, -} from '@sage-bionetworks/synapse-types' +import { MOCK_REPO_ORIGIN } from '../../utils/functions/getEndpoint' import { MOCK_USER_ID } from '../../mocks/user/mock_user_profile' -import AccessRequirementList from './AccessRequirementList' import { getWikiHandlers } from '../../mocks/msw/handlers/wikiHandlers' import { getAccessRequirementEntityBindingHandlers, @@ -32,6 +31,7 @@ import { getEntityHandlers } from '../../mocks/msw/handlers/entityHandlers' import { mockApprovedSubmission } from '../../mocks/dataaccess/MockSubmission' import { getCurrentUserCertifiedValidatedHandler } from '../../mocks/msw/handlers/userProfileHandlers' import { getResearchProjectHandlers } from '../../mocks/msw/handlers/researchProjectHandlers' +import AccessRequirementList from './AccessRequirementList' const meta: Meta = { title: 'Governance/Data Access Request Flow/AccessRequirementList', diff --git a/packages/synapse-react-client/src/components/AccessRequirementList/AccessRequirementList.tsx b/packages/synapse-react-client/src/components/AccessRequirementList/AccessRequirementList.tsx index 6dfe6e42f8..574e46f972 100644 --- a/packages/synapse-react-client/src/components/AccessRequirementList/AccessRequirementList.tsx +++ b/packages/synapse-react-client/src/components/AccessRequirementList/AccessRequirementList.tsx @@ -1,8 +1,4 @@ import React, { useMemo, useState } from 'react' -import { PRODUCTION_ENDPOINT_CONFIG } from '../../utils/functions/getEndpoint' -import useGetInfoFromIds, { - UseGetInfoFromIdsProps, -} from '../../utils/hooks/useGetInfoFromIds' import { AccessRequirement, EntityHeader, @@ -10,12 +6,6 @@ import { Renewal, Request, } from '@sage-bionetworks/synapse-types' -import IconSvg from '../IconSvg/IconSvg' -import StandaloneLoginForm from '../Authentication/StandaloneLoginForm' -import CancelRequestDataAccess from './ManagedACTAccessRequirementRequestFlow/CancelRequestDataAccess' -import ResearchProjectForm from './ManagedACTAccessRequirementRequestFlow/ResearchProjectForm/ResearchProjectForm' -import DataAccessRequestAccessorsFilesForm from './ManagedACTAccessRequirementRequestFlow/DataAccessRequestAccessorsFilesForm/DataAccessRequestAccessorsFilesForm' -import RequestDataAccessSuccess from './ManagedACTAccessRequirementRequestFlow/RequestDataAccessSuccess' import { Box, Dialog, @@ -28,18 +18,28 @@ import { Typography, TypographyProps, } from '@mui/material' -import AuthenticatedRequirement from './RequirementItem/AuthenticatedRequirement' -import CertificationRequirement from './RequirementItem/CertificationRequirement' -import ValidationRequirement from './RequirementItem/ValidationRequirement' import { StyledComponent } from '@emotion/styled' +import { PRODUCTION_ENDPOINT_CONFIG } from '../../utils/functions/getEndpoint' +import useGetInfoFromIds, { + UseGetInfoFromIdsProps, +} from '../../utils/hooks/useGetInfoFromIds' +import IconSvg from '../IconSvg/IconSvg' +import StandaloneLoginForm from '../Authentication/StandaloneLoginForm' import { useGetAccessRequirementsForEntity, useGetAccessRequirementsForTeam, useSortAccessRequirementIdsByCompletion, } from '../../synapse-queries' +import { useSynapseContext } from '../../utils/context/SynapseContext' +import CancelRequestDataAccess from './ManagedACTAccessRequirementRequestFlow/CancelRequestDataAccess' +import ResearchProjectForm from './ManagedACTAccessRequirementRequestFlow/ResearchProjectForm/ResearchProjectForm' +import DataAccessRequestAccessorsFilesForm from './ManagedACTAccessRequirementRequestFlow/DataAccessRequestAccessorsFilesForm/DataAccessRequestAccessorsFilesForm' +import RequestDataAccessSuccess from './ManagedACTAccessRequirementRequestFlow/RequestDataAccessSuccess' +import AuthenticatedRequirement from './RequirementItem/AuthenticatedRequirement' +import CertificationRequirement from './RequirementItem/CertificationRequirement' +import ValidationRequirement from './RequirementItem/ValidationRequirement' import TwoFactorAuthEnabledRequirement from './RequirementItem/TwoFactorAuthEnabledRequirement' import { AccessRequirementListItem } from './AccessRequirementListItem' -import { useSynapseContext } from '../../utils/context/SynapseContext' import { useCanShowManagedACTWikiInWizard } from './AccessRequirementListUtils' export type AccessRequirementListProps = { diff --git a/packages/synapse-react-client/src/components/AccessRequirementList/AccessRequirementListItem.tsx b/packages/synapse-react-client/src/components/AccessRequirementList/AccessRequirementListItem.tsx index 687b03029e..b86dc5a8ab 100644 --- a/packages/synapse-react-client/src/components/AccessRequirementList/AccessRequirementListItem.tsx +++ b/packages/synapse-react-client/src/components/AccessRequirementList/AccessRequirementListItem.tsx @@ -2,9 +2,9 @@ import { AccessRequirement, ManagedACTAccessRequirement, } from '@sage-bionetworks/synapse-types' +import React from 'react' import UnmanagedACTAccessRequirementItem from './RequirementItem/UnmanagedACTAccessRequirementItem' import ManagedACTAccessRequirementItem from './ManagedACTAccessRequirementRequestFlow/ManagedACTAccessRequirementItem' -import React from 'react' import SelfSignAccessRequirementItem from './RequirementItem/SelfSignAccessRequirementItem' export type AccessRequirementListItemProps = { diff --git a/packages/synapse-react-client/src/components/AccessRequirementList/AccessRequirementListUtils.ts b/packages/synapse-react-client/src/components/AccessRequirementList/AccessRequirementListUtils.ts index 88fd019f68..41af861fdd 100644 --- a/packages/synapse-react-client/src/components/AccessRequirementList/AccessRequirementListUtils.ts +++ b/packages/synapse-react-client/src/components/AccessRequirementList/AccessRequirementListUtils.ts @@ -1,6 +1,6 @@ import { sortBy } from 'lodash-es' -import { getAccessRequirementStatus } from '../../synapse-client/SynapseClient' import { useMediaQuery, useTheme } from '@mui/material' +import { getAccessRequirementStatus } from '../../synapse-client/SynapseClient' /** * Given an array of access requirement IDs, return the IDs sorted by the user's status, where diff --git a/packages/synapse-react-client/src/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/CancelRequestDataAccess.tsx b/packages/synapse-react-client/src/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/CancelRequestDataAccess.tsx index 2b61549a4e..5e4a5fed14 100644 --- a/packages/synapse-react-client/src/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/CancelRequestDataAccess.tsx +++ b/packages/synapse-react-client/src/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/CancelRequestDataAccess.tsx @@ -1,6 +1,5 @@ import React, { useState } from 'react' import { Renewal, Request } from '@sage-bionetworks/synapse-types' -import { AlertProps } from './DataAccessRequestAccessorsFilesForm/DataAccessRequestAccessorsFilesForm' import { Alert, Box, @@ -14,6 +13,7 @@ import { } from '@mui/material' import IconSvg from '../../IconSvg/IconSvg' import { useUpdateDataAccessRequest } from '../../../synapse-queries' +import { AlertProps } from './DataAccessRequestAccessorsFilesForm/DataAccessRequestAccessorsFilesForm' export type CancelRequestDataAccessProps = { /* The data access request with unsaved changes */ diff --git a/packages/synapse-react-client/src/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/DataAccessRequestAccessorsEditor.tsx b/packages/synapse-react-client/src/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/DataAccessRequestAccessorsEditor.tsx index 1361e91a6d..75375dc206 100644 --- a/packages/synapse-react-client/src/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/DataAccessRequestAccessorsEditor.tsx +++ b/packages/synapse-react-client/src/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/DataAccessRequestAccessorsEditor.tsx @@ -1,13 +1,13 @@ import React from 'react' import { Form } from 'react-bootstrap' import { Button, Stack, Typography } from '@mui/material' -import UserCard from '../../UserCard/UserCard' import { AccessorChange, AccessType, TYPE_FILTER, UserGroupHeader, } from '@sage-bionetworks/synapse-types' +import UserCard from '../../UserCard/UserCard' import IconSvg from '../../IconSvg/IconSvg' import { RadioGroup } from '../../widgets/RadioGroup' import { useGetCurrentUserProfile } from '../../../synapse-queries' diff --git a/packages/synapse-react-client/src/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/DataAccessRequestAccessorsFilesForm/DataAccessRequestAccessorsFilesForm.stories.tsx b/packages/synapse-react-client/src/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/DataAccessRequestAccessorsFilesForm/DataAccessRequestAccessorsFilesForm.stories.tsx index bf5c654526..fa691392c8 100644 --- a/packages/synapse-react-client/src/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/DataAccessRequestAccessorsFilesForm/DataAccessRequestAccessorsFilesForm.stories.tsx +++ b/packages/synapse-react-client/src/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/DataAccessRequestAccessorsFilesForm/DataAccessRequestAccessorsFilesForm.stories.tsx @@ -1,8 +1,5 @@ import React from 'react' import { Meta, StoryObj } from '@storybook/react' -import DataAccessRequestAccessorsFilesForm, { - DataAccessRequestAccessorsFilesFormProps, -} from './DataAccessRequestAccessorsFilesForm' import { mockManagedACTAccessRequirement } from '../../../../mocks/mockAccessRequirements' import { MOCK_FOLDER_ID } from '../../../../mocks/entity/mockEntity' import { MOCK_RESEARCH_PROJECT_ID } from '../../../../mocks/dataaccess/MockResearchProject' @@ -17,6 +14,9 @@ import { SynapseContextConsumer, SynapseContextProvider, } from '../../../../index' +import DataAccessRequestAccessorsFilesForm, { + DataAccessRequestAccessorsFilesFormProps, +} from './DataAccessRequestAccessorsFilesForm' const meta = { title: diff --git a/packages/synapse-react-client/src/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/DataAccessRequestAccessorsFilesForm/DataAccessRequestAccessorsFilesForm.test.tsx b/packages/synapse-react-client/src/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/DataAccessRequestAccessorsFilesForm/DataAccessRequestAccessorsFilesForm.test.tsx index 1da5fccbbb..2ec53d31c4 100644 --- a/packages/synapse-react-client/src/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/DataAccessRequestAccessorsFilesForm/DataAccessRequestAccessorsFilesForm.test.tsx +++ b/packages/synapse-react-client/src/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/DataAccessRequestAccessorsFilesForm/DataAccessRequestAccessorsFilesForm.test.tsx @@ -1,8 +1,12 @@ import React from 'react' import { act, render, screen, waitFor, within } from '@testing-library/react' -import DataAccessRequestAccessorsFilesForm, { - DataAccessRequestAccessorsFilesFormProps, -} from './DataAccessRequestAccessorsFilesForm' +import { + AccessorChange, + AccessType, + RestrictableObjectType, + SubmissionState, +} from '@sage-bionetworks/synapse-types' +import userEvent from '@testing-library/user-event' import { MOCK_RESEARCH_PROJECT_ID } from '../../../../mocks/dataaccess/MockResearchProject' import { createWrapper } from '../../../../testutils/TestingLibraryUtils' import { MOCK_FILE_ENTITY_ID } from '../../../../mocks/entity/mockFileEntity' @@ -29,18 +33,14 @@ import { mockManagedACTAccessRequirementWikiPageKey, } from '../../../../mocks/mockAccessRequirements' import { mockSubmittedSubmission } from '../../../../mocks/dataaccess/MockSubmission' -import { - AccessorChange, - AccessType, - RestrictableObjectType, - SubmissionState, -} from '@sage-bionetworks/synapse-types' -import userEvent from '@testing-library/user-event' import { MOCK_ACCESS_TOKEN } from '../../../../mocks/MockSynapseContext' import * as UserSearchBoxV2Module from '../../../UserSearchBox/UserSearchBoxV2' import { SynapseClientError } from '../../../../utils/SynapseClientError' import MarkdownSynapse from '../../../Markdown/MarkdownSynapse' import * as AccessRequirementListUtils from '../../AccessRequirementListUtils' +import DataAccessRequestAccessorsFilesForm, { + DataAccessRequestAccessorsFilesFormProps, +} from './DataAccessRequestAccessorsFilesForm' const MARKDOWN_SYNAPSE_TEST_ID = 'MarkdownSynapseContent' jest.mock('../../../Markdown/MarkdownSynapse', () => ({ diff --git a/packages/synapse-react-client/src/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/DataAccessRequestAccessorsFilesForm/DataAccessRequestAccessorsFilesForm.tsx b/packages/synapse-react-client/src/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/DataAccessRequestAccessorsFilesForm/DataAccessRequestAccessorsFilesForm.tsx index 19856280ac..687814a186 100644 --- a/packages/synapse-react-client/src/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/DataAccessRequestAccessorsFilesForm/DataAccessRequestAccessorsFilesForm.tsx +++ b/packages/synapse-react-client/src/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/DataAccessRequestAccessorsFilesForm/DataAccessRequestAccessorsFilesForm.tsx @@ -11,7 +11,6 @@ import { RestrictableObjectType, UploadCallbackResp, } from '@sage-bionetworks/synapse-types' -import IconSvg from '../../../IconSvg/IconSvg' import { Alert, AlertProps as MuiAlertProps, @@ -26,6 +25,8 @@ import { Stack, Typography, } from '@mui/material' +import { deepEquals } from '@rjsf/utils' +import IconSvg from '../../../IconSvg/IconSvg' import { useGetCurrentUserProfile, useGetDataAccessRequestForUpdate, @@ -41,7 +42,6 @@ import { UploadDocumentField } from '../UploadDocumentField' import DocumentTemplate from '../DocumentTemplate' import ManagedACTAccessRequirementFormWikiWrapper from '../ManagedACTAccessRequirementFormWikiWrapper' import { SynapseErrorBoundary } from '../../../error/ErrorBanner' -import { deepEquals } from '@rjsf/utils' import { useSynapseContext } from '../../../../utils' function AccessorRequirementHelpText(props: { diff --git a/packages/synapse-react-client/src/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/DocumentTemplate.tsx b/packages/synapse-react-client/src/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/DocumentTemplate.tsx index e2ad1b8a59..3f518f1cfe 100644 --- a/packages/synapse-react-client/src/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/DocumentTemplate.tsx +++ b/packages/synapse-react-client/src/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/DocumentTemplate.tsx @@ -1,8 +1,8 @@ import { Box, Typography } from '@mui/material' -import DirectDownloadButton from '../../DirectDownloadButton' import { FileHandleAssociation } from '@sage-bionetworks/synapse-types' -import IconSvg from '../../IconSvg/IconSvg' import React from 'react' +import DirectDownloadButton from '../../DirectDownloadButton' +import IconSvg from '../../IconSvg/IconSvg' import { useGetFileBatch } from '../../../synapse-queries/file/useFiles' export type DownloadDocumentTemplateProps = { diff --git a/packages/synapse-react-client/src/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/ManagedACTAccessRequirementFormWikiWrapper.tsx b/packages/synapse-react-client/src/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/ManagedACTAccessRequirementFormWikiWrapper.tsx index 6bbc836ba0..d87ad28a53 100644 --- a/packages/synapse-react-client/src/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/ManagedACTAccessRequirementFormWikiWrapper.tsx +++ b/packages/synapse-react-client/src/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/ManagedACTAccessRequirementFormWikiWrapper.tsx @@ -1,7 +1,7 @@ import React from 'react' +import { Grid, Typography } from '@mui/material' import { useGetAccessRequirementWikiPageKey } from '../../../synapse-queries' import { useCanShowManagedACTWikiInWizard } from '../AccessRequirementListUtils' -import { Grid, Typography } from '@mui/material' import MarkdownSynapse from '../../Markdown/MarkdownSynapse' type ManagedACTAccessRequirementFormWikiWrapperProps = React.PropsWithChildren<{ diff --git a/packages/synapse-react-client/src/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/ManagedACTAccessRequirementItem.test.tsx b/packages/synapse-react-client/src/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/ManagedACTAccessRequirementItem.test.tsx index e90d6621a5..ad7ef4645c 100644 --- a/packages/synapse-react-client/src/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/ManagedACTAccessRequirementItem.test.tsx +++ b/packages/synapse-react-client/src/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/ManagedACTAccessRequirementItem.test.tsx @@ -1,13 +1,11 @@ import { act, render, screen, waitFor } from '@testing-library/react' import React from 'react' -import ManagedACTAccessRequirementItem, { - ManagedACTAccessRequirementItemProps, -} from './ManagedACTAccessRequirementItem' -import { createWrapper } from '../../../testutils/TestingLibraryUtils' import { AccessRequirementStatus, SubmissionState, } from '@sage-bionetworks/synapse-types' +import userEvent from '@testing-library/user-event' +import { createWrapper } from '../../../testutils/TestingLibraryUtils' import { MOCK_FILE_ENTITY_ID } from '../../../mocks/entity/mockFileEntity' import { mockManagedACTAccessRequirement, @@ -15,9 +13,11 @@ import { } from '../../../mocks/mockAccessRequirements' import { SynapseClient, SynapseContextType } from '../../../index' import { MOCK_USER_ID } from '../../../mocks/user/mock_user_profile' -import userEvent from '@testing-library/user-event' import MarkdownSynapse from '../../Markdown/MarkdownSynapse' import { MOCK_ACCESS_TOKEN } from '../../../mocks/MockSynapseContext' +import ManagedACTAccessRequirementItem, { + ManagedACTAccessRequirementItemProps, +} from './ManagedACTAccessRequirementItem' async function renderComponent( props: ManagedACTAccessRequirementItemProps, diff --git a/packages/synapse-react-client/src/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/ManagedACTAccessRequirementItem.tsx b/packages/synapse-react-client/src/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/ManagedACTAccessRequirementItem.tsx index ab5390c79d..a2ed37f930 100644 --- a/packages/synapse-react-client/src/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/ManagedACTAccessRequirementItem.tsx +++ b/packages/synapse-react-client/src/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/ManagedACTAccessRequirementItem.tsx @@ -1,13 +1,11 @@ -import React from 'react' -import { useState } from 'react' -import MarkdownSynapse from '../../Markdown/MarkdownSynapse' +import React, { useState } from 'react' import { ManagedACTAccessRequirement, SubmissionState, + ManagedACTAccessRequirementStatus, } from '@sage-bionetworks/synapse-types' -import { ManagedACTAccessRequirementStatus } from '@sage-bionetworks/synapse-types' -import { AlertProps } from './DataAccessRequestAccessorsFilesForm/DataAccessRequestAccessorsFilesForm' import { Alert, Box, ButtonProps, Link, Typography } from '@mui/material' +import MarkdownSynapse from '../../Markdown/MarkdownSynapse' import RequirementItem from '../RequirementItem/RequirementItem' import { useCancelDataAccessRequest, @@ -15,6 +13,7 @@ import { useGetAccessRequirementWikiPageKey, } from '../../../synapse-queries' import { RequirementItemStatus } from '../AccessApprovalCheckMark' +import { AlertProps } from './DataAccessRequestAccessorsFilesForm/DataAccessRequestAccessorsFilesForm' export type ManagedACTAccessRequirementItemProps = { entityId: string diff --git a/packages/synapse-react-client/src/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/ResearchProjectForm/ResearchProjectForm.stories.tsx b/packages/synapse-react-client/src/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/ResearchProjectForm/ResearchProjectForm.stories.tsx index 853eb36e56..22d707dfde 100644 --- a/packages/synapse-react-client/src/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/ResearchProjectForm/ResearchProjectForm.stories.tsx +++ b/packages/synapse-react-client/src/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/ResearchProjectForm/ResearchProjectForm.stories.tsx @@ -1,10 +1,10 @@ import { Meta, StoryObj } from '@storybook/react' import { mockManagedACTAccessRequirement } from '../../../../mocks/mockAccessRequirements' import { MOCK_REPO_ORIGIN } from '../../../../utils/functions/getEndpoint' -import ResearchProjectForm from './ResearchProjectForm' import { getResearchProjectHandlers } from '../../../../mocks/msw/handlers/researchProjectHandlers' import { getAccessRequirementHandlers } from '../../../../mocks/msw/handlers/accessRequirementHandlers' import { getWikiHandlers } from '../../../../mocks/msw/handlers/wikiHandlers' +import ResearchProjectForm from './ResearchProjectForm' const meta: Meta = { title: diff --git a/packages/synapse-react-client/src/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/ResearchProjectForm/ResearchProjectForm.test.tsx b/packages/synapse-react-client/src/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/ResearchProjectForm/ResearchProjectForm.test.tsx index 752913d960..03c677671e 100644 --- a/packages/synapse-react-client/src/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/ResearchProjectForm/ResearchProjectForm.test.tsx +++ b/packages/synapse-react-client/src/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/ResearchProjectForm/ResearchProjectForm.test.tsx @@ -1,7 +1,4 @@ import React from 'react' -import ResearchProjectForm, { - ResearchProjectFormProps, -} from './ResearchProjectForm' import { act, render, screen, waitFor, within } from '@testing-library/react' import userEvent from '@testing-library/user-event' import { createWrapper } from '../../../../testutils/TestingLibraryUtils' @@ -18,6 +15,9 @@ import { MOCK_ACCESS_TOKEN } from '../../../../mocks/MockSynapseContext' import { SynapseClientError } from '../../../../utils/SynapseClientError' import * as AccessRequirementListUtils from '../../AccessRequirementListUtils' import MarkdownSynapse from '../../../Markdown/MarkdownSynapse' +import ResearchProjectForm, { + ResearchProjectFormProps, +} from './ResearchProjectForm' const MARKDOWN_SYNAPSE_TEST_ID = 'MarkdownSynapseContent' jest.mock('../../../Markdown/MarkdownSynapse', () => ({ diff --git a/packages/synapse-react-client/src/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/ResearchProjectForm/ResearchProjectForm.tsx b/packages/synapse-react-client/src/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/ResearchProjectForm/ResearchProjectForm.tsx index 49db39851e..49745db738 100644 --- a/packages/synapse-react-client/src/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/ResearchProjectForm/ResearchProjectForm.tsx +++ b/packages/synapse-react-client/src/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/ResearchProjectForm/ResearchProjectForm.tsx @@ -3,7 +3,6 @@ import { ManagedACTAccessRequirement, ResearchProject, } from '@sage-bionetworks/synapse-types' -import { AlertProps } from '../DataAccessRequestAccessorsFilesForm/DataAccessRequestAccessorsFilesForm' import { Alert, Box, @@ -15,6 +14,7 @@ import { Stack, Typography, } from '@mui/material' +import { AlertProps } from '../DataAccessRequestAccessorsFilesForm/DataAccessRequestAccessorsFilesForm' import IconSvg from '../../../IconSvg/IconSvg' import { useGetResearchProject, diff --git a/packages/synapse-react-client/src/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/UploadDocumentField.tsx b/packages/synapse-react-client/src/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/UploadDocumentField.tsx index 6ba254b367..fa2ffd6bdb 100644 --- a/packages/synapse-react-client/src/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/UploadDocumentField.tsx +++ b/packages/synapse-react-client/src/components/AccessRequirementList/ManagedACTAccessRequirementRequestFlow/UploadDocumentField.tsx @@ -2,12 +2,12 @@ import { FileHandleAssociation, UploadCallbackResp, } from '@sage-bionetworks/synapse-types' -import { useGetFileBatch } from '../../../synapse-queries/file/useFiles' import { Box, Button } from '@mui/material' +import React, { useState } from 'react' +import { useGetFileBatch } from '../../../synapse-queries/file/useFiles' import FileUpload from '../../FileUpload/FileUpload' import IconSvg from '../../IconSvg/IconSvg' import DirectDownloadButton from '../../DirectDownloadButton' -import React, { useState } from 'react' type UploadDocumentFieldProps = { id: string diff --git a/packages/synapse-react-client/src/components/AccessRequirementList/RequirementItem/AuthenticatedRequirement.tsx b/packages/synapse-react-client/src/components/AccessRequirementList/RequirementItem/AuthenticatedRequirement.tsx index 204a35de4b..b8a2f080e9 100644 --- a/packages/synapse-react-client/src/components/AccessRequirementList/RequirementItem/AuthenticatedRequirement.tsx +++ b/packages/synapse-react-client/src/components/AccessRequirementList/RequirementItem/AuthenticatedRequirement.tsx @@ -1,11 +1,11 @@ import React from 'react' -import { useGetCurrentUserProfile } from '../../../synapse-queries' import { Link, Typography } from '@mui/material' +import { useGetCurrentUserProfile } from '../../../synapse-queries' import { PRODUCTION_ENDPOINT_CONFIG } from '../../../utils/functions/getEndpoint' import { SynapseConstants } from '../../../utils' import { useSynapseContext } from '../../../utils/context/SynapseContext' -import RequirementItem from './RequirementItem' import { RequirementItemStatus } from '../AccessApprovalCheckMark' +import RequirementItem from './RequirementItem' /** * Displays a data access request requirement prompts the user to authenticate if not already signed in. diff --git a/packages/synapse-react-client/src/components/AccessRequirementList/RequirementItem/CertificationRequirement.stories.ts b/packages/synapse-react-client/src/components/AccessRequirementList/RequirementItem/CertificationRequirement.stories.ts index f250727bec..32819037f0 100644 --- a/packages/synapse-react-client/src/components/AccessRequirementList/RequirementItem/CertificationRequirement.stories.ts +++ b/packages/synapse-react-client/src/components/AccessRequirementList/RequirementItem/CertificationRequirement.stories.ts @@ -1,7 +1,7 @@ import { Meta, StoryObj } from '@storybook/react' import { MOCK_REPO_ORIGIN } from '../../../utils/functions/getEndpoint' -import CertificationRequirement from './CertificationRequirement' import { getCurrentUserCertifiedValidatedHandler } from '../../../mocks/msw/handlers/userProfileHandlers' +import CertificationRequirement from './CertificationRequirement' const meta: Meta = { title: diff --git a/packages/synapse-react-client/src/components/AccessRequirementList/RequirementItem/CertificationRequirement.tsx b/packages/synapse-react-client/src/components/AccessRequirementList/RequirementItem/CertificationRequirement.tsx index 72e1374d80..a3aaaec124 100644 --- a/packages/synapse-react-client/src/components/AccessRequirementList/RequirementItem/CertificationRequirement.tsx +++ b/packages/synapse-react-client/src/components/AccessRequirementList/RequirementItem/CertificationRequirement.tsx @@ -1,9 +1,9 @@ import React from 'react' -import { useGetCurrentUserBundle } from '../../../synapse-queries' import { Link, Typography } from '@mui/material' +import { useGetCurrentUserBundle } from '../../../synapse-queries' import { PRODUCTION_ENDPOINT_CONFIG } from '../../../utils/functions/getEndpoint' -import RequirementItem from './RequirementItem' import { RequirementItemStatus } from '../AccessApprovalCheckMark' +import RequirementItem from './RequirementItem' /** * When creating requests for access requirements on a particular file, one or more access requirements may require that the diff --git a/packages/synapse-react-client/src/components/AccessRequirementList/RequirementItem/RequirementItem.stories.tsx b/packages/synapse-react-client/src/components/AccessRequirementList/RequirementItem/RequirementItem.stories.tsx index 27ed33d48c..553bfc5e6e 100644 --- a/packages/synapse-react-client/src/components/AccessRequirementList/RequirementItem/RequirementItem.stories.tsx +++ b/packages/synapse-react-client/src/components/AccessRequirementList/RequirementItem/RequirementItem.stories.tsx @@ -1,11 +1,11 @@ import React from 'react' import { Meta, StoryObj } from '@storybook/react' import { Paper } from '@mui/material' -import RequirementItem from './RequirementItem' import { displayToast } from '../../ToastMessage/ToastMessage' import MarkdownSynapse from '../../Markdown/MarkdownSynapse' import { mockManagedACTAccessRequirementWikiPage } from '../../../mocks/mockWiki' import { RequirementItemStatus } from '../AccessApprovalCheckMark' +import RequirementItem from './RequirementItem' const meta = { title: 'Governance/Data Access Request Flow/Requirements/RequirementItem', diff --git a/packages/synapse-react-client/src/components/AccessRequirementList/RequirementItem/RequirementItem.tsx b/packages/synapse-react-client/src/components/AccessRequirementList/RequirementItem/RequirementItem.tsx index 66f9ee4dd4..bb159ec02d 100644 --- a/packages/synapse-react-client/src/components/AccessRequirementList/RequirementItem/RequirementItem.tsx +++ b/packages/synapse-react-client/src/components/AccessRequirementList/RequirementItem/RequirementItem.tsx @@ -1,9 +1,9 @@ import React from 'react' +import { Box, BoxProps, Button, ButtonProps, styled } from '@mui/material' +import { StyledComponent } from '@emotion/styled' import AccessApprovalCheckMark, { RequirementItemStatus, } from '../AccessApprovalCheckMark' -import { Box, BoxProps, Button, ButtonProps, styled } from '@mui/material' -import { StyledComponent } from '@emotion/styled' export type RequirementItemProps = React.PropsWithChildren<{ status: RequirementItemStatus diff --git a/packages/synapse-react-client/src/components/AccessRequirementList/RequirementItem/SelfSignAccessRequirementItem.stories.tsx b/packages/synapse-react-client/src/components/AccessRequirementList/RequirementItem/SelfSignAccessRequirementItem.stories.tsx index 26f2ff0fc5..1ce653c582 100644 --- a/packages/synapse-react-client/src/components/AccessRequirementList/RequirementItem/SelfSignAccessRequirementItem.stories.tsx +++ b/packages/synapse-react-client/src/components/AccessRequirementList/RequirementItem/SelfSignAccessRequirementItem.stories.tsx @@ -1,6 +1,11 @@ import React from 'react' import { Meta, StoryObj } from '@storybook/react' -import SelfSignAccessRequirementItem from './SelfSignAccessRequirementItem' +import { rest } from 'msw' +import { + AccessApproval, + AccessRequirementStatus, + ApprovalState, +} from '@sage-bionetworks/synapse-types' import { SynapseContextConsumer, SynapseContextProvider, @@ -11,20 +16,15 @@ import { mockToUAccessRequirementWithWiki, } from '../../../mocks/mockAccessRequirements' import { MOCK_REPO_ORIGIN } from '../../../utils/functions/getEndpoint' -import { rest } from 'msw' import { ACCESS_APPROVAL, ACCESS_REQUIREMENT_STATUS, } from '../../../utils/APIConstants' -import { - AccessApproval, - AccessRequirementStatus, - ApprovalState, -} from '@sage-bionetworks/synapse-types' import { MOCK_USER_ID } from '../../../mocks/user/mock_user_profile' import { getAccessRequirementHandlers } from '../../../mocks/msw/handlers/accessRequirementHandlers' import { getWikiHandlers } from '../../../mocks/msw/handlers/wikiHandlers' import { getCurrentUserCertifiedValidatedHandler } from '../../../mocks/msw/handlers/userProfileHandlers' +import SelfSignAccessRequirementItem from './SelfSignAccessRequirementItem' const meta: Meta = { title: diff --git a/packages/synapse-react-client/src/components/AccessRequirementList/RequirementItem/SelfSignAccessRequirementItem.test.tsx b/packages/synapse-react-client/src/components/AccessRequirementList/RequirementItem/SelfSignAccessRequirementItem.test.tsx index 058f673d8b..c493a00f52 100644 --- a/packages/synapse-react-client/src/components/AccessRequirementList/RequirementItem/SelfSignAccessRequirementItem.test.tsx +++ b/packages/synapse-react-client/src/components/AccessRequirementList/RequirementItem/SelfSignAccessRequirementItem.test.tsx @@ -1,29 +1,29 @@ import React from 'react' import { act, render, screen, waitFor } from '@testing-library/react' -import { createWrapper } from '../../../testutils/TestingLibraryUtils' -import { SynapseClient, SynapseContextType } from '../../../index' import { AccessApproval, AccessRequirementStatus, ApprovalState, } from '@sage-bionetworks/synapse-types' +import userEvent from '@testing-library/user-event' +import { createWrapper } from '../../../testutils/TestingLibraryUtils' +import { SynapseClient, SynapseContextType } from '../../../index' import { mockAccessRequirementWikiPageKeys, mockSelfSignAccessRequirement, mockSelfSignAccessRequirementWikiPageKey, mockToUAccessRequirement, } from '../../../mocks/mockAccessRequirements' -import userEvent from '@testing-library/user-event' import { MarkdownSynapseProps } from '../../Markdown' -import SelfSignAccessRequirementItem, { - SelfSignAccessRequirementItemProps, -} from './SelfSignAccessRequirementItem' import { MOCK_USER_ID, mockUserBundle, mockUserProfileData, } from '../../../mocks/user/mock_user_profile' import MarkdownSynapse from '../../Markdown/MarkdownSynapse' +import SelfSignAccessRequirementItem, { + SelfSignAccessRequirementItemProps, +} from './SelfSignAccessRequirementItem' jest.mock('../../Markdown/MarkdownSynapse', () => ({ __esModule: true, diff --git a/packages/synapse-react-client/src/components/AccessRequirementList/RequirementItem/SelfSignAccessRequirementItem.tsx b/packages/synapse-react-client/src/components/AccessRequirementList/RequirementItem/SelfSignAccessRequirementItem.tsx index 94bd78f2bc..a36ce6c1af 100644 --- a/packages/synapse-react-client/src/components/AccessRequirementList/RequirementItem/SelfSignAccessRequirementItem.tsx +++ b/packages/synapse-react-client/src/components/AccessRequirementList/RequirementItem/SelfSignAccessRequirementItem.tsx @@ -1,13 +1,13 @@ import React, { useState } from 'react' -import MarkdownSynapse from '../../Markdown/MarkdownSynapse' import { AccessApproval, ApprovalState, SelfSignAccessRequirement, TermsOfUseAccessRequirement, } from '@sage-bionetworks/synapse-types' -import { useSynapseContext } from '../../../utils/context/SynapseContext' import { Alert, Box, ButtonProps, Link, Typography } from '@mui/material' +import { useSynapseContext } from '../../../utils/context/SynapseContext' +import MarkdownSynapse from '../../Markdown/MarkdownSynapse' import { useCreateAccessApproval, useGetAccessRequirementStatus, @@ -15,9 +15,9 @@ import { useGetCurrentUserBundle, useGetCurrentUserProfile, } from '../../../synapse-queries' -import RequirementItem from './RequirementItem' import { RequirementItemStatus } from '../AccessApprovalCheckMark' import { isTermsOfUseAccessRequirement } from '../../../utils/types/IsType' +import RequirementItem from './RequirementItem' export type SelfSignAccessRequirementItemProps = { accessRequirement: SelfSignAccessRequirement | TermsOfUseAccessRequirement diff --git a/packages/synapse-react-client/src/components/AccessRequirementList/RequirementItem/TwoFactorAuthEnabledRequirement.stories.tsx b/packages/synapse-react-client/src/components/AccessRequirementList/RequirementItem/TwoFactorAuthEnabledRequirement.stories.tsx index 9769f93f6c..30b80cec26 100644 --- a/packages/synapse-react-client/src/components/AccessRequirementList/RequirementItem/TwoFactorAuthEnabledRequirement.stories.tsx +++ b/packages/synapse-react-client/src/components/AccessRequirementList/RequirementItem/TwoFactorAuthEnabledRequirement.stories.tsx @@ -1,11 +1,11 @@ import React from 'react' import { Meta, StoryObj } from '@storybook/react' import { rest } from 'msw' -import { MOCK_REPO_ORIGIN } from '../../../utils/functions/getEndpoint' -import TwoFactorAuthEnabledRequirement from './TwoFactorAuthEnabledRequirement' import { TwoFactorAuthStatus } from '@sage-bionetworks/synapse-types' +import { MOCK_REPO_ORIGIN } from '../../../utils/functions/getEndpoint' import { SynapseContextConsumer } from '../../../utils/context/SynapseContext' import FullContextProvider from '../../../utils/context/FullContextProvider' +import TwoFactorAuthEnabledRequirement from './TwoFactorAuthEnabledRequirement' const meta: Meta = { title: diff --git a/packages/synapse-react-client/src/components/AccessRequirementList/RequirementItem/TwoFactorAuthEnabledRequirement.tsx b/packages/synapse-react-client/src/components/AccessRequirementList/RequirementItem/TwoFactorAuthEnabledRequirement.tsx index 0ce856d954..a0918905eb 100644 --- a/packages/synapse-react-client/src/components/AccessRequirementList/RequirementItem/TwoFactorAuthEnabledRequirement.tsx +++ b/packages/synapse-react-client/src/components/AccessRequirementList/RequirementItem/TwoFactorAuthEnabledRequirement.tsx @@ -1,5 +1,6 @@ import React from 'react' import { ButtonProps, Typography } from '@mui/material' +import { TwoFactorAuthStatus } from '@sage-bionetworks/synapse-types' import { BackendDestinationEnum, getEndpoint, @@ -7,9 +8,8 @@ import { import { useSynapseContext } from '../../../utils/context/SynapseContext' import { TWO_FACTOR_DOCS_LINK } from '../../Authentication/TwoFactorEnrollmentForm' import { useGetTwoFactorEnrollmentStatus } from '../../../synapse-queries/auth/useTwoFactorEnrollment' -import RequirementItem, { RequirementItemProps } from './RequirementItem' -import { TwoFactorAuthStatus } from '@sage-bionetworks/synapse-types' import { RequirementItemStatus } from '../AccessApprovalCheckMark' +import RequirementItem, { RequirementItemProps } from './RequirementItem' const TWO_FACTOR_ENROLLMENT_LINK = `${getEndpoint( BackendDestinationEnum.PORTAL_ENDPOINT, diff --git a/packages/synapse-react-client/src/components/AccessRequirementList/RequirementItem/UnmanagedACTAccessRequirementItem.stories.tsx b/packages/synapse-react-client/src/components/AccessRequirementList/RequirementItem/UnmanagedACTAccessRequirementItem.stories.tsx index 390e4c575b..458e8fe62c 100644 --- a/packages/synapse-react-client/src/components/AccessRequirementList/RequirementItem/UnmanagedACTAccessRequirementItem.stories.tsx +++ b/packages/synapse-react-client/src/components/AccessRequirementList/RequirementItem/UnmanagedACTAccessRequirementItem.stories.tsx @@ -1,5 +1,11 @@ import React from 'react' import { Meta, StoryObj } from '@storybook/react' +import { rest } from 'msw' +import { + AccessApproval, + AccessRequirementStatus, + ApprovalState, +} from '@sage-bionetworks/synapse-types' import { SynapseContextConsumer, SynapseContextProvider, @@ -11,16 +17,10 @@ import { mockToUAccessRequirementWithWiki, } from '../../../mocks/mockAccessRequirements' import { MOCK_REPO_ORIGIN } from '../../../utils/functions/getEndpoint' -import { rest } from 'msw' import { ACCESS_APPROVAL, ACCESS_REQUIREMENT_STATUS, } from '../../../utils/APIConstants' -import { - AccessApproval, - AccessRequirementStatus, - ApprovalState, -} from '@sage-bionetworks/synapse-types' import { MOCK_USER_ID } from '../../../mocks/user/mock_user_profile' import { getAccessRequirementHandlers } from '../../../mocks/msw/handlers/accessRequirementHandlers' import { getWikiHandlers } from '../../../mocks/msw/handlers/wikiHandlers' diff --git a/packages/synapse-react-client/src/components/AccessRequirementList/RequirementItem/UnmanagedACTAccessRequirementItem.test.tsx b/packages/synapse-react-client/src/components/AccessRequirementList/RequirementItem/UnmanagedACTAccessRequirementItem.test.tsx index 56581e83a5..b86c27c23b 100644 --- a/packages/synapse-react-client/src/components/AccessRequirementList/RequirementItem/UnmanagedACTAccessRequirementItem.test.tsx +++ b/packages/synapse-react-client/src/components/AccessRequirementList/RequirementItem/UnmanagedACTAccessRequirementItem.test.tsx @@ -1,17 +1,17 @@ import React from 'react' import { act, render, screen, waitFor } from '@testing-library/react' +import { AccessRequirementStatus } from '@sage-bionetworks/synapse-types' +import userEvent from '@testing-library/user-event' import { createWrapper } from '../../../testutils/TestingLibraryUtils' -import UnmanagedACTAccessRequirementItem, { - UnmanagedACTAccessRequirementItemProps, -} from './UnmanagedACTAccessRequirementItem' import { SynapseClient, SynapseContextType } from '../../../index' -import { AccessRequirementStatus } from '@sage-bionetworks/synapse-types' import { mockACTAccessRequirement, mockManagedACTAccessRequirement, } from '../../../mocks/mockAccessRequirements' import { MOCK_FILE_ENTITY_ID } from '../../../mocks/entity/mockFileEntity' -import userEvent from '@testing-library/user-event' +import UnmanagedACTAccessRequirementItem, { + UnmanagedACTAccessRequirementItemProps, +} from './UnmanagedACTAccessRequirementItem' function renderComponent( props: UnmanagedACTAccessRequirementItemProps, diff --git a/packages/synapse-react-client/src/components/AccessRequirementList/RequirementItem/UnmanagedACTAccessRequirementItem.tsx b/packages/synapse-react-client/src/components/AccessRequirementList/RequirementItem/UnmanagedACTAccessRequirementItem.tsx index c054c7b733..77e10f60e8 100644 --- a/packages/synapse-react-client/src/components/AccessRequirementList/RequirementItem/UnmanagedACTAccessRequirementItem.tsx +++ b/packages/synapse-react-client/src/components/AccessRequirementList/RequirementItem/UnmanagedACTAccessRequirementItem.tsx @@ -1,15 +1,15 @@ import React, { useState } from 'react' -import MarkdownSynapse from '../../Markdown/MarkdownSynapse' import { ACTAccessRequirement } from '@sage-bionetworks/synapse-types' +import { Box, ButtonProps, Link, Typography } from '@mui/material' +import MarkdownSynapse from '../../Markdown/MarkdownSynapse' import { useSynapseContext } from '../../../utils/context/SynapseContext' import { PRODUCTION_ENDPOINT_CONFIG } from '../../../utils/functions/getEndpoint' -import { Box, ButtonProps, Link, Typography } from '@mui/material' import { useGetAccessRequirementStatus, useGetAccessRequirementWikiPageKey, } from '../../../synapse-queries' -import RequirementItem from './RequirementItem' import { RequirementItemStatus } from '../AccessApprovalCheckMark' +import RequirementItem from './RequirementItem' export type UnmanagedACTAccessRequirementItemProps = { entityId: string diff --git a/packages/synapse-react-client/src/components/AccessRequirementList/RequirementItem/ValidationRequirement.stories.ts b/packages/synapse-react-client/src/components/AccessRequirementList/RequirementItem/ValidationRequirement.stories.ts index 1434dcb1bf..140e0de4d5 100644 --- a/packages/synapse-react-client/src/components/AccessRequirementList/RequirementItem/ValidationRequirement.stories.ts +++ b/packages/synapse-react-client/src/components/AccessRequirementList/RequirementItem/ValidationRequirement.stories.ts @@ -1,7 +1,7 @@ import { Meta, StoryObj } from '@storybook/react' import { MOCK_REPO_ORIGIN } from '../../../utils/functions/getEndpoint' -import ValidationRequirement from './ValidationRequirement' import { getCurrentUserCertifiedValidatedHandler } from '../../../mocks/msw/handlers/userProfileHandlers' +import ValidationRequirement from './ValidationRequirement' const meta: Meta = { title: diff --git a/packages/synapse-react-client/src/components/AccessRequirementList/RequirementItem/ValidationRequirement.tsx b/packages/synapse-react-client/src/components/AccessRequirementList/RequirementItem/ValidationRequirement.tsx index 008ae547b3..5742d01bd2 100644 --- a/packages/synapse-react-client/src/components/AccessRequirementList/RequirementItem/ValidationRequirement.tsx +++ b/packages/synapse-react-client/src/components/AccessRequirementList/RequirementItem/ValidationRequirement.tsx @@ -1,9 +1,9 @@ import React from 'react' -import { useGetCurrentUserBundle } from '../../../synapse-queries' import { Link, Typography } from '@mui/material' +import { useGetCurrentUserBundle } from '../../../synapse-queries' import { PRODUCTION_ENDPOINT_CONFIG } from '../../../utils/functions/getEndpoint' -import RequirementItem from './RequirementItem' import { RequirementItemStatus } from '../AccessApprovalCheckMark' +import RequirementItem from './RequirementItem' /** * When creating requests for access requirements on a particular file, one or more access requirements may require that the diff --git a/packages/synapse-react-client/src/components/AccessTokenPage/AccessTokenCard/AccessTokenCard.test.tsx b/packages/synapse-react-client/src/components/AccessTokenPage/AccessTokenCard/AccessTokenCard.test.tsx index 7a8d12ab23..d437cdeb05 100644 --- a/packages/synapse-react-client/src/components/AccessTokenPage/AccessTokenCard/AccessTokenCard.test.tsx +++ b/packages/synapse-react-client/src/components/AccessTokenPage/AccessTokenCard/AccessTokenCard.test.tsx @@ -2,10 +2,10 @@ import { render, screen, waitFor, within } from '@testing-library/react' import userEvent from '@testing-library/user-event' import React from 'react' import { SynapseClient } from '../../../index' -import { AccessTokenCard, AccessTokenCardProps } from './AccessTokenCard' import { createWrapper } from '../../../testutils/TestingLibraryUtils' import * as SynapseContext from '../../../utils/context/SynapseContext' import { MOCK_CONTEXT_VALUE } from '../../../mocks/MockSynapseContext' +import { AccessTokenCard, AccessTokenCardProps } from './AccessTokenCard' const mockOnDelete = jest.fn(() => null) diff --git a/packages/synapse-react-client/src/components/AccessTokenPage/AccessTokenCard/AccessTokenCard.tsx b/packages/synapse-react-client/src/components/AccessTokenPage/AccessTokenCard/AccessTokenCard.tsx index 7d1a3e7825..405d368209 100644 --- a/packages/synapse-react-client/src/components/AccessTokenPage/AccessTokenCard/AccessTokenCard.tsx +++ b/packages/synapse-react-client/src/components/AccessTokenPage/AccessTokenCard/AccessTokenCard.tsx @@ -1,15 +1,17 @@ import dayjs from 'dayjs' import React, { useState } from 'react' import { useErrorHandler } from 'react-error-boundary' -import SynapseClient from '../../../synapse-client' -import { useSynapseContext } from '../../../utils/context/SynapseContext' -import { AccessTokenRecord } from '@sage-bionetworks/synapse-types' -import { scopeDescriptions } from '@sage-bionetworks/synapse-types' +import { + AccessTokenRecord, + scopeDescriptions, +} from '@sage-bionetworks/synapse-types' import { Button, Tooltip } from '@mui/material' import DeleteTwoToneIcon from '@mui/icons-material/DeleteTwoTone' +import relativeTime from 'dayjs/plugin/relativeTime' +import SynapseClient from '../../../synapse-client' +import { useSynapseContext } from '../../../utils/context/SynapseContext' import IconSvg from '../../IconSvg/IconSvg' import WarningDialog from '../../SynapseForm/WarningDialog' -import relativeTime from 'dayjs/plugin/relativeTime' dayjs.extend(relativeTime) diff --git a/packages/synapse-react-client/src/components/AccessTokenPage/AccessTokenPage.test.tsx b/packages/synapse-react-client/src/components/AccessTokenPage/AccessTokenPage.test.tsx index 4f3c979e72..c1a3bc2498 100644 --- a/packages/synapse-react-client/src/components/AccessTokenPage/AccessTokenPage.test.tsx +++ b/packages/synapse-react-client/src/components/AccessTokenPage/AccessTokenPage.test.tsx @@ -1,13 +1,13 @@ import { render, screen, waitFor } from '@testing-library/react' import userEvent from '@testing-library/user-event' import React from 'react' -import { AccessTokenCardProps } from './AccessTokenCard/AccessTokenCard' -import { AccessTokenPage, AccessTokenPageProps } from './AccessTokenPage' -import { CreateAccessTokenModalProps } from './CreateAccessTokenModal' +import { AccessTokenRecordList } from '@sage-bionetworks/synapse-types' import { createWrapper } from '../../testutils/TestingLibraryUtils' import SynapseClient from '../../synapse-client' import { SynapseContextType } from '../../utils/context/SynapseContext' -import { AccessTokenRecordList } from '@sage-bionetworks/synapse-types' +import { AccessTokenCardProps } from './AccessTokenCard/AccessTokenCard' +import { AccessTokenPage, AccessTokenPageProps } from './AccessTokenPage' +import { CreateAccessTokenModalProps } from './CreateAccessTokenModal' // Mock the CreateAccessTokenModal with a simple dialog with buttons to easily invoke passed props jest.mock( diff --git a/packages/synapse-react-client/src/components/AccessTokenPage/CreateAccessTokenModal.test.tsx b/packages/synapse-react-client/src/components/AccessTokenPage/CreateAccessTokenModal.test.tsx index ddfa5ab67a..27fd0853c9 100644 --- a/packages/synapse-react-client/src/components/AccessTokenPage/CreateAccessTokenModal.test.tsx +++ b/packages/synapse-react-client/src/components/AccessTokenPage/CreateAccessTokenModal.test.tsx @@ -1,16 +1,16 @@ import { render, screen, waitFor } from '@testing-library/react' import userEvent from '@testing-library/user-event' import React from 'react' -import { - CreateAccessTokenModal, - CreateAccessTokenModalProps, -} from './CreateAccessTokenModal' import { createWrapper } from '../../testutils/TestingLibraryUtils' import * as SynapseContext from '../../utils/context/SynapseContext' import { MOCK_CONTEXT_VALUE } from '../../mocks/MockSynapseContext' import { CLOSE_BUTTON_LABEL } from '../DialogBase' import { CANCEL_BUTTON_TEXT } from '../ConfirmationDialog/ConfirmationDialog' import SynapseClient from '../../synapse-client' +import { + CreateAccessTokenModal, + CreateAccessTokenModalProps, +} from './CreateAccessTokenModal' const EXAMPLE_PAT = 'abcdefghiklmnop' jest.mock('../../synapse-client', () => ({ diff --git a/packages/synapse-react-client/src/components/AccessTokenPage/CreateAccessTokenModal.tsx b/packages/synapse-react-client/src/components/AccessTokenPage/CreateAccessTokenModal.tsx index 5c6f56adf4..0c08a47334 100644 --- a/packages/synapse-react-client/src/components/AccessTokenPage/CreateAccessTokenModal.tsx +++ b/packages/synapse-react-client/src/components/AccessTokenPage/CreateAccessTokenModal.tsx @@ -1,9 +1,11 @@ import React from 'react' import { Typography } from '@mui/material' +import { + AccessTokenGenerationRequest, + scopeDescriptions, +} from '@sage-bionetworks/synapse-types' import SynapseClient from '../../synapse-client' import { useSynapseContext } from '../../utils/context/SynapseContext' -import { AccessTokenGenerationRequest } from '@sage-bionetworks/synapse-types' -import { scopeDescriptions } from '@sage-bionetworks/synapse-types' import { CopyToClipboardInput } from '../CopyToClipboardInput/CopyToClipboardInput' import { ErrorBanner } from '../error/ErrorBanner' import loadingScreen from '../LoadingScreen/LoadingScreen' diff --git a/packages/synapse-react-client/src/components/AccountLevelBadge/AccountLevelBadge.test.tsx b/packages/synapse-react-client/src/components/AccountLevelBadge/AccountLevelBadge.test.tsx index 9d619263ac..1e75d90f4e 100644 --- a/packages/synapse-react-client/src/components/AccountLevelBadge/AccountLevelBadge.test.tsx +++ b/packages/synapse-react-client/src/components/AccountLevelBadge/AccountLevelBadge.test.tsx @@ -1,14 +1,14 @@ import { render, screen } from '@testing-library/react' import React from 'react' +import { UserBundle } from '@sage-bionetworks/synapse-types' +import { createWrapper } from '../../testutils/TestingLibraryUtils' +import SynapseClient from '../../synapse-client' import { AccountLevelBadge, accountLevelCertifiedLabel, accountLevelRegisteredLabel, accountLevelVerifiedLabel, } from './AccountLevelBadge' -import { createWrapper } from '../../testutils/TestingLibraryUtils' -import { UserBundle } from '@sage-bionetworks/synapse-types' -import SynapseClient from '../../synapse-client' jest.mock('../../synapse-client', () => ({ getUserBundle: jest.fn(), diff --git a/packages/synapse-react-client/src/components/AddToDownloadListV2.tsx b/packages/synapse-react-client/src/components/AddToDownloadListV2.tsx index 28130f1541..967c8da67c 100644 --- a/packages/synapse-react-client/src/components/AddToDownloadListV2.tsx +++ b/packages/synapse-react-client/src/components/AddToDownloadListV2.tsx @@ -1,10 +1,10 @@ import React from 'react' -import IconSvg from './IconSvg/IconSvg' -import { useSynapseContext } from '../utils/context/SynapseContext' -import { displayToast } from './ToastMessage/ToastMessage' import { Link, Tooltip } from '@mui/material' +import { useSynapseContext } from '../utils/context/SynapseContext' import { useAddFileToDownloadList } from '../synapse-queries/download/useDownloadList' import { useGetEntity } from '../synapse-queries' +import { displayToast } from './ToastMessage/ToastMessage' +import IconSvg from './IconSvg/IconSvg' export type AddToDownloadListV2Props = { entityId: string diff --git a/packages/synapse-react-client/src/components/Authentication/LastLoginInfo.stories.ts b/packages/synapse-react-client/src/components/Authentication/LastLoginInfo.stories.ts index b42645a490..91c921db6d 100644 --- a/packages/synapse-react-client/src/components/Authentication/LastLoginInfo.stories.ts +++ b/packages/synapse-react-client/src/components/Authentication/LastLoginInfo.stories.ts @@ -1,8 +1,8 @@ import { Meta, StoryObj } from '@storybook/react' +import { LOGIN_METHOD_EMAIL } from '../../utils/SynapseConstants' import LastLoginInfo from './LastLoginInfo' import { LoginMethods } from './LoginMethod' -import { LOGIN_METHOD_EMAIL } from '../../utils/SynapseConstants' const meta = { title: 'Authentication/LastLoginInfo', diff --git a/packages/synapse-react-client/src/components/Authentication/LastLoginInfo.test.tsx b/packages/synapse-react-client/src/components/Authentication/LastLoginInfo.test.tsx index 1956ea2a60..63a8d2373c 100644 --- a/packages/synapse-react-client/src/components/Authentication/LastLoginInfo.test.tsx +++ b/packages/synapse-react-client/src/components/Authentication/LastLoginInfo.test.tsx @@ -1,10 +1,10 @@ import { render, screen, within } from '@testing-library/react' import userEvent from '@testing-library/user-event' import React from 'react' -import LastLoginInfo, { LastLoginInfoProps } from './LastLoginInfo' import { LOGIN_METHOD_OAUTH2_GOOGLE } from '../../utils/SynapseConstants' import { SynapseContextType } from '../../utils/context/SynapseContext' import { createWrapper } from '../../testutils/TestingLibraryUtils' +import LastLoginInfo, { LastLoginInfoProps } from './LastLoginInfo' const defaultProps = { currentSourceAppName: 'AD Knowledge Portal', diff --git a/packages/synapse-react-client/src/components/Authentication/Login.test.tsx b/packages/synapse-react-client/src/components/Authentication/Login.test.tsx index 5b38c4f79d..da5f5847d7 100644 --- a/packages/synapse-react-client/src/components/Authentication/Login.test.tsx +++ b/packages/synapse-react-client/src/components/Authentication/Login.test.tsx @@ -1,17 +1,17 @@ import { render, screen, waitFor } from '@testing-library/react' import userEvent from '@testing-library/user-event' import React from 'react' -import StandaloneLoginForm, { - StandaloneLoginFormProps, -} from './StandaloneLoginForm' -import SynapseClient from '../../synapse-client' -import { LoginResponse } from '@sage-bionetworks/synapse-types' import { + LoginResponse, ErrorResponseCode, TwoFactorAuthErrorResponse, } from '@sage-bionetworks/synapse-types' +import SynapseClient from '../../synapse-client' import { createWrapper } from '../../testutils/TestingLibraryUtils' import { AUTHENTICATION_RECEIPT_LOCALSTORAGE_KEY } from '../../utils/SynapseConstants' +import StandaloneLoginForm, { + StandaloneLoginFormProps, +} from './StandaloneLoginForm' const username = 'myUsername' const password = 'myPassword' diff --git a/packages/synapse-react-client/src/components/Authentication/LoginFlowBackButton.tsx b/packages/synapse-react-client/src/components/Authentication/LoginFlowBackButton.tsx index 72cff92b74..4e36219960 100644 --- a/packages/synapse-react-client/src/components/Authentication/LoginFlowBackButton.tsx +++ b/packages/synapse-react-client/src/components/Authentication/LoginFlowBackButton.tsx @@ -1,6 +1,6 @@ import { IconButton, SxProps } from '@mui/material' -import IconSvg from '../IconSvg/IconSvg' import React from 'react' +import IconSvg from '../IconSvg/IconSvg' import { UseLoginReturn } from '../../utils/hooks' import { LOGIN_BACK_BUTTON_CLASS_NAME } from '../../utils/SynapseConstants' diff --git a/packages/synapse-react-client/src/components/Authentication/LoginForm.tsx b/packages/synapse-react-client/src/components/Authentication/LoginForm.tsx index 73557431db..870911493e 100644 --- a/packages/synapse-react-client/src/components/Authentication/LoginForm.tsx +++ b/packages/synapse-react-client/src/components/Authentication/LoginForm.tsx @@ -1,12 +1,12 @@ import React from 'react' +import { Box, Link } from '@mui/material' +import { TwoFactorAuthErrorResponse } from '@sage-bionetworks/synapse-types' import { BackendDestinationEnum, getEndpoint, } from '../../utils/functions/getEndpoint' -import { Box, Link } from '@mui/material' import FullWidthAlert from '../FullWidthAlert/FullWidthAlert' import { UseLoginReturn } from '../../utils/hooks' -import { TwoFactorAuthErrorResponse } from '@sage-bionetworks/synapse-types' import TOTPForm from './TOTPForm' import UsernamePasswordForm from './UsernamePasswordForm' import AuthenticationMethodSelection from './AuthenticationMethodSelection' diff --git a/packages/synapse-react-client/src/components/Authentication/LoginMethodButton.stories.ts b/packages/synapse-react-client/src/components/Authentication/LoginMethodButton.stories.ts index ffbb39a846..80c8ef8fd8 100644 --- a/packages/synapse-react-client/src/components/Authentication/LoginMethodButton.stories.ts +++ b/packages/synapse-react-client/src/components/Authentication/LoginMethodButton.stories.ts @@ -1,8 +1,8 @@ import { Meta, StoryObj } from '@storybook/react' +import { IconStrings } from '../IconSvg/IconSvg' import { LoginMethods } from './LoginMethod' import LoginMethodButton from './LoginMethodButton' -import { IconStrings } from '../IconSvg/IconSvg' const meta = { title: 'Authentication/LoginMethodButton', diff --git a/packages/synapse-react-client/src/components/Authentication/LoginMethodButton.test.tsx b/packages/synapse-react-client/src/components/Authentication/LoginMethodButton.test.tsx index fce989c6f9..295e868653 100644 --- a/packages/synapse-react-client/src/components/Authentication/LoginMethodButton.test.tsx +++ b/packages/synapse-react-client/src/components/Authentication/LoginMethodButton.test.tsx @@ -1,8 +1,6 @@ import { render, screen, waitFor, within } from '@testing-library/react' import userEvent from '@testing-library/user-event' import React from 'react' -import { clearLastLoginInfo } from './LastLoginInfo' -import LoginMethodButton, { LoginMethodButtonProps } from './LoginMethodButton' import { CURRENT_SOURCEAPP_NAME_LOCALSTORAGE_KEY, LAST_LOGIN_DATE_LOCALSTORAGE_KEY, @@ -14,6 +12,8 @@ import { } from '../../utils/SynapseConstants' import { SynapseContextType } from '../../utils/context/SynapseContext' import { createWrapper } from '../../testutils/TestingLibraryUtils' +import LoginMethodButton, { LoginMethodButtonProps } from './LoginMethodButton' +import { clearLastLoginInfo } from './LastLoginInfo' const onClick = jest.fn() diff --git a/packages/synapse-react-client/src/components/Authentication/LoginPage.stories.ts b/packages/synapse-react-client/src/components/Authentication/LoginPage.stories.ts index dce55fd573..9b77344f3f 100644 --- a/packages/synapse-react-client/src/components/Authentication/LoginPage.stories.ts +++ b/packages/synapse-react-client/src/components/Authentication/LoginPage.stories.ts @@ -1,8 +1,8 @@ import { Meta, StoryObj } from '@storybook/react' -import LoginPage from './LoginPage' import { sessionChangeHandler } from '../StorybookComponentWrapper' import { displayToast } from '../ToastMessage/ToastMessage' +import LoginPage from './LoginPage' const meta = { title: 'Authentication/LoginPage', diff --git a/packages/synapse-react-client/src/components/Authentication/LoginPage.tsx b/packages/synapse-react-client/src/components/Authentication/LoginPage.tsx index 3e3a9ba78f..9a425d9237 100644 --- a/packages/synapse-react-client/src/components/Authentication/LoginPage.tsx +++ b/packages/synapse-react-client/src/components/Authentication/LoginPage.tsx @@ -8,13 +8,13 @@ import { TypographyProps, useTheme, } from '@mui/material' +import { StyledComponent } from '@emotion/styled' import { LeftRightPanel } from '../styled/LeftRightPanel' import useShowDesktop from '../../utils/hooks/useShowDesktop' -import LoginFlowBackButton from './LoginFlowBackButton' import useLogin from '../../utils/hooks/useLogin' -import LoginForm from './LoginForm' -import { StyledComponent } from '@emotion/styled' import SystemUseNotification from '../SystemUseNotification/SystemUseNotification' +import LoginFlowBackButton from './LoginFlowBackButton' +import LoginForm from './LoginForm' const LOST_ACCOUNT_SERVICE_DESK_ISSUE_TITLE = encodeURIComponent( 'Lost access to my Synapse account', diff --git a/packages/synapse-react-client/src/components/Authentication/Logout.tsx b/packages/synapse-react-client/src/components/Authentication/Logout.tsx index d0002e6006..7be45ce661 100644 --- a/packages/synapse-react-client/src/components/Authentication/Logout.tsx +++ b/packages/synapse-react-client/src/components/Authentication/Logout.tsx @@ -1,6 +1,6 @@ -import SynapseClient from '../../synapse-client' import React from 'react' import { Button } from '@mui/material' +import SynapseClient from '../../synapse-client' export type LogoutProps = { callback: () => void diff --git a/packages/synapse-react-client/src/components/Authentication/RecoveryCodeGrid.tsx b/packages/synapse-react-client/src/components/Authentication/RecoveryCodeGrid.tsx index 3a0728db49..0daf87dfe8 100644 --- a/packages/synapse-react-client/src/components/Authentication/RecoveryCodeGrid.tsx +++ b/packages/synapse-react-client/src/components/Authentication/RecoveryCodeGrid.tsx @@ -1,8 +1,8 @@ import { Box } from '@mui/material' -import ConditionalWrapper from '../utils/ConditionalWrapper' import Skeleton from '@mui/material/Skeleton' import React from 'react' import { TwoFactorAuthRecoveryCodes } from '@sage-bionetworks/synapse-types' +import ConditionalWrapper from '../utils/ConditionalWrapper' const DEFAULT_RECOVERY_CODE_COUNT = 10 diff --git a/packages/synapse-react-client/src/components/Authentication/RegenerateBackupCodesWarning.tsx b/packages/synapse-react-client/src/components/Authentication/RegenerateBackupCodesWarning.tsx index e2cc1b1ee0..75a3a725a8 100644 --- a/packages/synapse-react-client/src/components/Authentication/RegenerateBackupCodesWarning.tsx +++ b/packages/synapse-react-client/src/components/Authentication/RegenerateBackupCodesWarning.tsx @@ -1,6 +1,6 @@ import { Avatar, Box, Button, Paper, Typography, useTheme } from '@mui/material' -import FrontHand from '../../assets/icons/FrontHand' import React from 'react' +import FrontHand from '../../assets/icons/FrontHand' type RegenerateBackupCodesWarningProps = { onConfirm: () => void diff --git a/packages/synapse-react-client/src/components/Authentication/StandaloneLoginForm.tsx b/packages/synapse-react-client/src/components/Authentication/StandaloneLoginForm.tsx index fc92d25533..3c62b85f06 100644 --- a/packages/synapse-react-client/src/components/Authentication/StandaloneLoginForm.tsx +++ b/packages/synapse-react-client/src/components/Authentication/StandaloneLoginForm.tsx @@ -1,7 +1,7 @@ import React from 'react' import { Box, Typography } from '@mui/material' -import useLogin from '../../utils/hooks/useLogin' import { TwoFactorAuthErrorResponse } from '@sage-bionetworks/synapse-types' +import useLogin from '../../utils/hooks/useLogin' import LoginForm from './LoginForm' import LoginFlowBackButton from './LoginFlowBackButton' diff --git a/packages/synapse-react-client/src/components/Authentication/TwoFactorAuthSettingsPanel.stories.tsx b/packages/synapse-react-client/src/components/Authentication/TwoFactorAuthSettingsPanel.stories.tsx index eeb558b388..1154a3be49 100644 --- a/packages/synapse-react-client/src/components/Authentication/TwoFactorAuthSettingsPanel.stories.tsx +++ b/packages/synapse-react-client/src/components/Authentication/TwoFactorAuthSettingsPanel.stories.tsx @@ -1,8 +1,8 @@ import React from 'react' import { Meta, StoryObj } from '@storybook/react' +import { Paper } from '@mui/material' import { displayToast } from '../ToastMessage/ToastMessage' import TwoFactorAuthSettingsPanel from './TwoFactorAuthSettingsPanel' -import { Paper } from '@mui/material' const meta = { title: 'Authentication/TwoFactorSettingsPanel', diff --git a/packages/synapse-react-client/src/components/Authentication/TwoFactorAuthSettingsPanel.test.tsx b/packages/synapse-react-client/src/components/Authentication/TwoFactorAuthSettingsPanel.test.tsx index da61e48be7..eb63e59fc9 100644 --- a/packages/synapse-react-client/src/components/Authentication/TwoFactorAuthSettingsPanel.test.tsx +++ b/packages/synapse-react-client/src/components/Authentication/TwoFactorAuthSettingsPanel.test.tsx @@ -1,12 +1,12 @@ import { render, screen, waitFor } from '@testing-library/react' import userEvent from '@testing-library/user-event' import React from 'react' +import { TwoFactorAuthStatus } from '@sage-bionetworks/synapse-types' import SynapseClient from '../../synapse-client' import { createWrapper } from '../../testutils/TestingLibraryUtils' import TwoFactorAuthSettingsPanel, { TwoFactorAuthSettingsPanelProps, } from './TwoFactorAuthSettingsPanel' -import { TwoFactorAuthStatus } from '@sage-bionetworks/synapse-types' const enabledStatus: TwoFactorAuthStatus = { status: 'ENABLED', diff --git a/packages/synapse-react-client/src/components/Authentication/TwoFactorAuthSettingsPanel.tsx b/packages/synapse-react-client/src/components/Authentication/TwoFactorAuthSettingsPanel.tsx index 9bbb0309d4..18cf93646d 100644 --- a/packages/synapse-react-client/src/components/Authentication/TwoFactorAuthSettingsPanel.tsx +++ b/packages/synapse-react-client/src/components/Authentication/TwoFactorAuthSettingsPanel.tsx @@ -1,13 +1,13 @@ import { Box, Button, Typography, Stack, Skeleton } from '@mui/material' import React from 'react' import IconSvg from '../IconSvg/IconSvg' -import { TWO_FACTOR_DOCS_LINK } from './TwoFactorEnrollmentForm' import { useDisableTwoFactorAuth, useGetTwoFactorEnrollmentStatus, } from '../../synapse-queries/auth/useTwoFactorEnrollment' import ConditionalWrapper from '../utils/ConditionalWrapper' import { displayToast } from '../ToastMessage/ToastMessage' +import { TWO_FACTOR_DOCS_LINK } from './TwoFactorEnrollmentForm' export type TwoFactorAuthSettingsPanelProps = { onRegenerateBackupCodes: () => void diff --git a/packages/synapse-react-client/src/components/Authentication/TwoFactorBackupCodes.test.tsx b/packages/synapse-react-client/src/components/Authentication/TwoFactorBackupCodes.test.tsx index a38346b4ec..2a013bc73d 100644 --- a/packages/synapse-react-client/src/components/Authentication/TwoFactorBackupCodes.test.tsx +++ b/packages/synapse-react-client/src/components/Authentication/TwoFactorBackupCodes.test.tsx @@ -1,12 +1,12 @@ import { render, screen, waitFor, within } from '@testing-library/react' import userEvent from '@testing-library/user-event' import React from 'react' +import { TwoFactorAuthRecoveryCodes } from '@sage-bionetworks/synapse-types' import SynapseClient from '../../synapse-client' import { createWrapper } from '../../testutils/TestingLibraryUtils' import TwoFactorBackupCodes, { TwoFactorBackupCodesProps, } from './TwoFactorBackupCodes' -import { TwoFactorAuthRecoveryCodes } from '@sage-bionetworks/synapse-types' const newCodes: TwoFactorAuthRecoveryCodes = { codes: [ diff --git a/packages/synapse-react-client/src/components/Authentication/TwoFactorBackupCodes.tsx b/packages/synapse-react-client/src/components/Authentication/TwoFactorBackupCodes.tsx index f171303fc6..51d962cfc2 100644 --- a/packages/synapse-react-client/src/components/Authentication/TwoFactorBackupCodes.tsx +++ b/packages/synapse-react-client/src/components/Authentication/TwoFactorBackupCodes.tsx @@ -7,17 +7,17 @@ import { Typography, useTheme, } from '@mui/material' +import { useMutation } from 'react-query' +import { TwoFactorAuthRecoveryCodes } from '@sage-bionetworks/synapse-types' import { LeftRightPanel, StyledOuterContainer } from '../styled/LeftRightPanel' import IconSvg from '../IconSvg/IconSvg' -import { useMutation } from 'react-query' import { createRecoveryCodes } from '../../synapse-client/SynapseClient' import { useSynapseContext } from '../../utils/context/SynapseContext' import { displayToast } from '../ToastMessage/ToastMessage' -import { RegenerateBackupCodesWarning } from './RegenerateBackupCodesWarning' -import { RecoveryCodeGrid } from './RecoveryCodeGrid' -import { TwoFactorAuthRecoveryCodes } from '@sage-bionetworks/synapse-types' import { SynapseClientError } from '../../utils/SynapseClientError' import { useMediaPrintOnly } from '../../utils/hooks/useMediaPrintOnly' +import { RegenerateBackupCodesWarning } from './RegenerateBackupCodesWarning' +import { RecoveryCodeGrid } from './RecoveryCodeGrid' export type TwoFactorBackupCodesProps = { /* Whether to show a warning before generating new codes, to prevent users from overwriting their existing codes */ diff --git a/packages/synapse-react-client/src/components/Authentication/TwoFactorEnrollmentForm.stories.ts b/packages/synapse-react-client/src/components/Authentication/TwoFactorEnrollmentForm.stories.ts index 7e99aa67d1..d3c7d67db9 100644 --- a/packages/synapse-react-client/src/components/Authentication/TwoFactorEnrollmentForm.stories.ts +++ b/packages/synapse-react-client/src/components/Authentication/TwoFactorEnrollmentForm.stories.ts @@ -1,6 +1,6 @@ import { Meta, StoryObj } from '@storybook/react' -import TwoFactorEnrollmentForm from './TwoFactorEnrollmentForm' import { displayToast } from '../ToastMessage/ToastMessage' +import TwoFactorEnrollmentForm from './TwoFactorEnrollmentForm' const meta = { title: 'Authentication/TwoFactorEnrollment', diff --git a/packages/synapse-react-client/src/components/Authentication/TwoFactorEnrollmentForm.test.tsx b/packages/synapse-react-client/src/components/Authentication/TwoFactorEnrollmentForm.test.tsx index f179fedde1..d651620962 100644 --- a/packages/synapse-react-client/src/components/Authentication/TwoFactorEnrollmentForm.test.tsx +++ b/packages/synapse-react-client/src/components/Authentication/TwoFactorEnrollmentForm.test.tsx @@ -1,16 +1,16 @@ import { render, screen, waitFor, within } from '@testing-library/react' import userEvent from '@testing-library/user-event' import React from 'react' -import SynapseClient from '../../synapse-client' +import { TotpSecret } from '@sage-bionetworks/synapse-types' import { createWrapper } from '../../testutils/TestingLibraryUtils' +import SynapseClient from '../../synapse-client' +import { SynapseClientError } from '../../utils/SynapseClientError' +import { mockUserProfileData } from '../../mocks/user/mock_user_profile' +import { MOCK_CONTEXT_VALUE } from '../../mocks/MockSynapseContext' import TwoFactorEnrollmentForm, { EXPORTED_FOR_UNIT_TESTING, TwoFactorEnrollmentFormProps, } from './TwoFactorEnrollmentForm' -import { TotpSecret } from '@sage-bionetworks/synapse-types' -import { SynapseClientError } from '../../utils/SynapseClientError' -import { mockUserProfileData } from '../../mocks/user/mock_user_profile' -import { MOCK_CONTEXT_VALUE } from '../../mocks/MockSynapseContext' const returnedSecret: TotpSecret = { secretId: '1234', diff --git a/packages/synapse-react-client/src/components/Authentication/TwoFactorEnrollmentForm.tsx b/packages/synapse-react-client/src/components/Authentication/TwoFactorEnrollmentForm.tsx index 481f259346..bc5c7e69f0 100644 --- a/packages/synapse-react-client/src/components/Authentication/TwoFactorEnrollmentForm.tsx +++ b/packages/synapse-react-client/src/components/Authentication/TwoFactorEnrollmentForm.tsx @@ -11,11 +11,11 @@ import { styled, Typography, } from '@mui/material' -import { StyledOuterContainer } from '../styled/LeftRightPanel' import { StyledComponent } from '@emotion/styled' import { TotpSecret } from '@sage-bionetworks/synapse-types' -import { useGetNotificationEmail } from '../../synapse-queries' import { toCanvas } from 'qrcode' +import { useGetNotificationEmail } from '../../synapse-queries' +import { StyledOuterContainer } from '../styled/LeftRightPanel' import TextField from '../TextField/TextField' import { SynapseSpinner } from '../LoadingScreen/LoadingScreen' import FullWidthAlert from '../FullWidthAlert/FullWidthAlert' @@ -23,8 +23,8 @@ import { useFinishTwoFactorEnrollment, useStartTwoFactorEnrollment, } from '../../synapse-queries/auth/useTwoFactorEnrollment' -import TwoFactorSecretDialog from './TwoFactorSecretDialog' import IconSvg from '../IconSvg/IconSvg' +import TwoFactorSecretDialog from './TwoFactorSecretDialog' /** * Returns a URL that can be used to generate a QR code that 2FA authenticator apps can interpret diff --git a/packages/synapse-react-client/src/components/Authentication/TwoFactorSecretDialog.tsx b/packages/synapse-react-client/src/components/Authentication/TwoFactorSecretDialog.tsx index ace2a1ad0b..63f1b3aaee 100644 --- a/packages/synapse-react-client/src/components/Authentication/TwoFactorSecretDialog.tsx +++ b/packages/synapse-react-client/src/components/Authentication/TwoFactorSecretDialog.tsx @@ -9,8 +9,8 @@ import { Stack, Typography, } from '@mui/material' -import IconSvg from '../IconSvg/IconSvg' import React from 'react' +import IconSvg from '../IconSvg/IconSvg' import { monospaceFontFamily } from '../../theme/typography/Typography' type TwoFactorSecretDialogProps = { diff --git a/packages/synapse-react-client/src/components/Authentication/index.ts b/packages/synapse-react-client/src/components/Authentication/index.ts index e7c53b0bd9..be126e8f09 100644 --- a/packages/synapse-react-client/src/components/Authentication/index.ts +++ b/packages/synapse-react-client/src/components/Authentication/index.ts @@ -3,15 +3,15 @@ import { useLastLoginInfoState, useLastLoginInfo, } from './LastLoginInfo' +import { default as StandaloneLoginForm } from './StandaloneLoginForm' +import { default as TwoFactorAuthSettingsPanel } from './TwoFactorAuthSettingsPanel' +import { default as TwoFactorEnrollmentForm } from './TwoFactorEnrollmentForm' +import { default as TwoFactorBackupCodes } from './TwoFactorBackupCodes' import type { LastLoginInfoProps } from './LastLoginInfo' import type { LoginMethod } from './LoginMethod' -import { default as StandaloneLoginForm } from './StandaloneLoginForm' import type { StandaloneLoginFormProps } from './StandaloneLoginForm' -import { default as TwoFactorAuthSettingsPanel } from './TwoFactorAuthSettingsPanel' import type { TwoFactorAuthSettingsPanelProps } from './TwoFactorAuthSettingsPanel' -import { default as TwoFactorEnrollmentForm } from './TwoFactorEnrollmentForm' import type { TwoFactorEnrollmentFormProps } from './TwoFactorEnrollmentForm' -import { default as TwoFactorBackupCodes } from './TwoFactorBackupCodes' import type { TwoFactorBackupCodesProps } from './TwoFactorBackupCodes' export { diff --git a/packages/synapse-react-client/src/components/CardContainer/CardContainer.integration.test.tsx b/packages/synapse-react-client/src/components/CardContainer/CardContainer.integration.test.tsx index e905fbd5b0..e06897a41c 100644 --- a/packages/synapse-react-client/src/components/CardContainer/CardContainer.integration.test.tsx +++ b/packages/synapse-react-client/src/components/CardContainer/CardContainer.integration.test.tsx @@ -1,11 +1,10 @@ import { render, screen, waitFor } from '@testing-library/react' import userEvent from '@testing-library/user-event' import React from 'react' -import { SynapseConstants } from '../../utils' -import CardContainer, { CardContainerProps } from './CardContainer' +import { QueryBundleRequest } from '@sage-bionetworks/synapse-types' +import { cloneDeep } from 'lodash-es' import { QueryVisualizationWrapper } from '../QueryVisualizationWrapper/QueryVisualizationWrapper' import { createWrapper } from '../../testutils/TestingLibraryUtils' -import { QueryBundleRequest } from '@sage-bionetworks/synapse-types' import syn16787123Json from '../../mocks/query/syn16787123' import { DEFAULT_PAGE_SIZE, @@ -16,9 +15,10 @@ import { server } from '../../mocks/msw/server' import { mockUserProfileData } from '../../mocks/user/mock_user_profile' import { QueryWrapper } from '../QueryWrapper' import { getHandlersForTableQuery } from '../../mocks/msw/handlers/tableQueryHandlers' -import { cloneDeep } from 'lodash-es' +import { SynapseConstants } from '../../utils' import { QueryContextConsumer } from '../QueryContext' import { InfiniteQueryContextType } from '../QueryContext/QueryContext' +import CardContainer, { CardContainerProps } from './CardContainer' const sql = 'SELECT * FROM syn16787123' diff --git a/packages/synapse-react-client/src/components/CardContainer/CardContainer.tsx b/packages/synapse-react-client/src/components/CardContainer/CardContainer.tsx index a01b13c1fc..33ad28429a 100644 --- a/packages/synapse-react-client/src/components/CardContainer/CardContainer.tsx +++ b/packages/synapse-react-client/src/components/CardContainer/CardContainer.tsx @@ -1,4 +1,11 @@ import React from 'react' +import { + ColumnTypeEnum, + EntityHeader, + Row, +} from '@sage-bionetworks/synapse-types' +import { Box } from '@mui/material' +import { useAtomValue } from 'jotai' import useGetInfoFromIds from '../../utils/hooks/useGetInfoFromIds' import { DATASET, @@ -7,11 +14,6 @@ import { MEDIUM_USER_CARD, OBSERVATION_CARD, } from '../../utils/SynapseConstants' -import { - ColumnTypeEnum, - EntityHeader, - Row, -} from '@sage-bionetworks/synapse-types' import { CardConfiguration } from '../CardContainerLogic' import GenericCard from '../GenericCard' import loadingScreen from '../LoadingScreen/LoadingScreen' @@ -25,8 +27,6 @@ import { import TotalQueryResults from '../TotalQueryResults' import UserCardList from '../UserCardList/UserCardList' import WideButton from '../styled/WideButton' -import { Box } from '@mui/material' -import { useAtomValue } from 'jotai' import { tableQueryDataAtom } from '../QueryWrapper/QueryWrapper' export type CardContainerProps = { diff --git a/packages/synapse-react-client/src/components/CardContainerLogic/CardContainerLogic.stories.ts b/packages/synapse-react-client/src/components/CardContainerLogic/CardContainerLogic.stories.ts index 0bca27428a..f3701a6711 100644 --- a/packages/synapse-react-client/src/components/CardContainerLogic/CardContainerLogic.stories.ts +++ b/packages/synapse-react-client/src/components/CardContainerLogic/CardContainerLogic.stories.ts @@ -6,8 +6,8 @@ import { OBSERVATION_CARD, PUBLICATION, } from '../../utils/SynapseConstants' -import CardContainerLogic from './index' import { GenericCardSchema } from '../GenericCard' +import CardContainerLogic from './index' const meta = { title: 'Explore/CardContainerLogic', diff --git a/packages/synapse-react-client/src/components/CardContainerLogic/CardContainerLogic.test.tsx b/packages/synapse-react-client/src/components/CardContainerLogic/CardContainerLogic.test.tsx index 148994a217..2761ba2a33 100644 --- a/packages/synapse-react-client/src/components/CardContainerLogic/CardContainerLogic.test.tsx +++ b/packages/synapse-react-client/src/components/CardContainerLogic/CardContainerLogic.test.tsx @@ -1,13 +1,13 @@ import { render, screen, waitFor } from '@testing-library/react' import React from 'react' import { SynapseConstants } from '../../utils' -import CardContainerLogic, { CardContainerLogicProps } from './index' import * as QueryVisualizationWrapperModule from '../QueryVisualizationWrapper/QueryVisualizationWrapper' import { QueryVisualizationWrapper } from '../QueryVisualizationWrapper/QueryVisualizationWrapper' import { createWrapper } from '../../testutils/TestingLibraryUtils' import { NoContentPlaceholderType } from '../SynapseTable/NoContentPlaceholderType' import * as CardContainerModule from '../CardContainer/CardContainer' import QueryWrapper from '../QueryWrapper' +import CardContainerLogic, { CardContainerLogicProps } from './index' jest.mock('../../../src/components/QueryWrapper/QueryWrapper', () => ({ QueryWrapper: jest.fn(props => { diff --git a/packages/synapse-react-client/src/components/CardContainerLogic/CardContainerLogic.tsx b/packages/synapse-react-client/src/components/CardContainerLogic/CardContainerLogic.tsx index 7dc1c90cd7..8f0ba62a83 100644 --- a/packages/synapse-react-client/src/components/CardContainerLogic/CardContainerLogic.tsx +++ b/packages/synapse-react-client/src/components/CardContainerLogic/CardContainerLogic.tsx @@ -1,14 +1,14 @@ import React from 'react' +import { + QueryBundleRequest, + SortDirection, +} from '@sage-bionetworks/synapse-types' import { SynapseConstants } from '../../utils' import { getAdditionalFilters, parseEntityIdFromSqlStatement, SQLOperator, } from '../../utils/functions/SqlFunctions' -import { - QueryBundleRequest, - SortDirection, -} from '@sage-bionetworks/synapse-types' import CardContainer from '../CardContainer/CardContainer' import { ErrorBanner } from '../error/ErrorBanner' import { GenericCardSchema } from '../GenericCard' diff --git a/packages/synapse-react-client/src/components/Carousel/Carousel.test.tsx b/packages/synapse-react-client/src/components/Carousel/Carousel.test.tsx index 2ace5b76bb..de81809d88 100644 --- a/packages/synapse-react-client/src/components/Carousel/Carousel.test.tsx +++ b/packages/synapse-react-client/src/components/Carousel/Carousel.test.tsx @@ -2,8 +2,8 @@ import { render } from '@testing-library/react' import userEvent from '@testing-library/user-event' import React from 'react' import SizeMe from 'react-sizeme' -import Carousel from './Carousel' import { createWrapper } from '../../testutils/TestingLibraryUtils' +import Carousel from './Carousel' SizeMe.noPlaceholders = true describe('basic functionality', () => { diff --git a/packages/synapse-react-client/src/components/Carousel/Carousel.tsx b/packages/synapse-react-client/src/components/Carousel/Carousel.tsx index 6813437b07..526e75d740 100644 --- a/packages/synapse-react-client/src/components/Carousel/Carousel.tsx +++ b/packages/synapse-react-client/src/components/Carousel/Carousel.tsx @@ -2,9 +2,9 @@ import BrainhubCarousel, { CarouselProps as BrainhubCarouselProps, } from '@brainhubeu/react-carousel' import React, { useState } from 'react' +import { SizeMe } from 'react-sizeme' import Arrow from '../../assets/icons/Arrow' import useShowDesktop from '../../utils/hooks/useShowDesktop' -import { SizeMe } from 'react-sizeme' import '@brainhubeu/react-carousel/lib/style.css' // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Remainder diff --git a/packages/synapse-react-client/src/components/CertificationQuiz/CertificationQuiz.integration.test.tsx b/packages/synapse-react-client/src/components/CertificationQuiz/CertificationQuiz.integration.test.tsx index e0421c5d7a..8792667466 100644 --- a/packages/synapse-react-client/src/components/CertificationQuiz/CertificationQuiz.integration.test.tsx +++ b/packages/synapse-react-client/src/components/CertificationQuiz/CertificationQuiz.integration.test.tsx @@ -1,7 +1,6 @@ import { render, screen, waitFor } from '@testing-library/react' import userEvent from '@testing-library/user-event' import React from 'react' -import CertificationQuiz from './CertificationQuiz' import * as ToastMessage from '../ToastMessage/ToastMessage' import { createWrapper } from '../../testutils/TestingLibraryUtils' import { @@ -10,6 +9,7 @@ import { } from '../../utils/functions/getEndpoint' import { rest, server } from '../../mocks/msw/server' import { mockQuiz, mockPassingRecord } from '../../mocks/mockCertificationQuiz' +import CertificationQuiz from './CertificationQuiz' window.open = jest.fn() diff --git a/packages/synapse-react-client/src/components/CertificationQuiz/CertificationQuiz.tsx b/packages/synapse-react-client/src/components/CertificationQuiz/CertificationQuiz.tsx index e654c6f9a5..de6cd7bfee 100644 --- a/packages/synapse-react-client/src/components/CertificationQuiz/CertificationQuiz.tsx +++ b/packages/synapse-react-client/src/components/CertificationQuiz/CertificationQuiz.tsx @@ -1,21 +1,18 @@ import React, { useEffect, useState } from 'react' -import SynapseClient from '../../synapse-client' -import { useSynapseContext } from '../../utils/context/SynapseContext' import { PassingRecord, QuizResponse, Quiz, -} from '@sage-bionetworks/synapse-types' -import { MULTICHOICE_RESPONSE_CONCRETE_TYPE_VALUE, QuestionResponse, } from '@sage-bionetworks/synapse-types' -import { displayToast } from '../ToastMessage/ToastMessage' -import { Button, Link } from '@mui/material' -import { MarkdownPopover } from '../Markdown/MarkdownPopover' +import { Button, Link, ButtonProps, Typography } from '@mui/material' import { HelpOutlineTwoTone } from '@mui/icons-material' -import { ButtonProps, Typography } from '@mui/material' import { useErrorHandler } from 'react-error-boundary' +import SynapseClient from '../../synapse-client' +import { useSynapseContext } from '../../utils/context/SynapseContext' +import { displayToast } from '../ToastMessage/ToastMessage' +import { MarkdownPopover } from '../Markdown/MarkdownPopover' const CertificationQuiz: React.FunctionComponent = () => { const { accessToken } = useSynapseContext() diff --git a/packages/synapse-react-client/src/components/ChallengeDataDownload/ChallengeDataDownload.tsx b/packages/synapse-react-client/src/components/ChallengeDataDownload/ChallengeDataDownload.tsx index aa4bcf7217..ddf53dfb4b 100644 --- a/packages/synapse-react-client/src/components/ChallengeDataDownload/ChallengeDataDownload.tsx +++ b/packages/synapse-react-client/src/components/ChallengeDataDownload/ChallengeDataDownload.tsx @@ -1,15 +1,15 @@ import React, { useCallback } from 'react' import AddCircleTwoToneIcon from '@mui/icons-material/AddCircleTwoTone' import { EntityType } from '@sage-bionetworks/synapse-types' +import { Box, Button } from '@mui/material' import { EntityDetailsListSharedProps } from '../EntityFinder/details/EntityDetailsList' import { VersionSelectionType } from '../EntityFinder/VersionSelectionType' import { EntityFinderHeader } from '../EntityFinder/EntityFinderHeader' import { useEntitySelection } from '../EntityFinder/useEntitySelection' -import { ChallengeEntityChildrenDetails } from './ChallengeEntityChildrenDetails' -import { Box, Button } from '@mui/material' import { useAddFileBatchToDownloadList } from '../../synapse-queries' import { displayToast } from '../ToastMessage' import { useSynapseContext } from '../../utils' +import { ChallengeEntityChildrenDetails } from './ChallengeEntityChildrenDetails' export type ChallengeDataDownloadProps = { parentContainerId: string diff --git a/packages/synapse-react-client/src/components/ChallengeDataDownload/ChallengeDataTable.tsx b/packages/synapse-react-client/src/components/ChallengeDataDownload/ChallengeDataTable.tsx index 44512d386d..697321529a 100644 --- a/packages/synapse-react-client/src/components/ChallengeDataDownload/ChallengeDataTable.tsx +++ b/packages/synapse-react-client/src/components/ChallengeDataDownload/ChallengeDataTable.tsx @@ -5,12 +5,12 @@ import BaseTable, { } from '@sage-bionetworks/react-base-table' import React, { useCallback, useEffect, useMemo, useState } from 'react' import { useQueryClient } from 'react-query' -import { EntityFinderHeader } from '../EntityFinder/EntityFinderHeader' import { Direction, EntityHeader, SortBy, } from '@sage-bionetworks/synapse-types' +import { EntityFinderHeader } from '../EntityFinder/EntityFinderHeader' import { useSynapseContext } from '../../utils' import { getEntityTypeFromHeader, @@ -32,11 +32,11 @@ import { } from '../EntityFinder/details/view/DetailsViewTableRenderers' import { BlockingLoader } from '../LoadingScreen/LoadingScreen' import { getEntityVersions } from '../../synapse-client' -import { DownloadRenderer, SizeRenderer } from './Renderers' import { DetailsViewProps, EntityFinderTableViewRowData, } from '../EntityFinder/details/view/DetailsView' +import { DownloadRenderer, SizeRenderer } from './Renderers' const MIN_TABLE_WIDTH = 1200 const ROW_HEIGHT = 46 diff --git a/packages/synapse-react-client/src/components/ChallengeDataDownload/Renderers.tsx b/packages/synapse-react-client/src/components/ChallengeDataDownload/Renderers.tsx index 7b3a6e7118..a9dfe06311 100644 --- a/packages/synapse-react-client/src/components/ChallengeDataDownload/Renderers.tsx +++ b/packages/synapse-react-client/src/components/ChallengeDataDownload/Renderers.tsx @@ -1,11 +1,11 @@ import React from 'react' -import { CellRendererProps } from './types' +import { Skeleton } from '@mui/material' +import { FileHandle } from '@sage-bionetworks/synapse-types' import { calculateFriendlyFileSize } from '../../utils/functions/calculateFriendlyFileSize' import { EntityIdAndVersionNumber } from '../EntityFinder/details/view/DetailsViewTableRenderers' -import { Skeleton } from '@mui/material' import { useGetEntityBundle } from '../../synapse-queries' -import { FileHandle } from '@sage-bionetworks/synapse-types' import FileEntityDirectDownload from '../DirectDownload/FileEntityDirectDownload' +import { CellRendererProps } from './types' type FileHandleWithPreview = FileHandle & { isPreview?: boolean diff --git a/packages/synapse-react-client/src/components/ChallengeRegisterButton/ChallengeRegisterButton.tsx b/packages/synapse-react-client/src/components/ChallengeRegisterButton/ChallengeRegisterButton.tsx index 5a73247284..eb544a0aab 100644 --- a/packages/synapse-react-client/src/components/ChallengeRegisterButton/ChallengeRegisterButton.tsx +++ b/packages/synapse-react-client/src/components/ChallengeRegisterButton/ChallengeRegisterButton.tsx @@ -1,6 +1,7 @@ import React, { useEffect, useState } from 'react' import ExitToAppIcon from '@mui/icons-material/ExitToApp' import { Box } from '@mui/system' +import { Challenge, PaginatedIds } from '@sage-bionetworks/synapse-types' import SpinnerButton from '../SpinnerButton/SpinnerButton' import { useSynapseContext } from '../../utils' import { @@ -8,7 +9,6 @@ import { useGetEntityChallenge, useGetUserSubmissionTeamsInfinite, } from '../../synapse-queries' -import { Challenge, PaginatedIds } from '@sage-bionetworks/synapse-types' import { useGetIsUserMemberOfTeam } from '../../synapse-queries/team/useTeamMembers' import { SynapseClientError } from '../../utils/SynapseClientError' diff --git a/packages/synapse-react-client/src/components/ChallengeSubmission/ChallengeSubmission.stories.ts b/packages/synapse-react-client/src/components/ChallengeSubmission/ChallengeSubmission.stories.ts index 8dc98f93f8..deffb56c29 100644 --- a/packages/synapse-react-client/src/components/ChallengeSubmission/ChallengeSubmission.stories.ts +++ b/packages/synapse-react-client/src/components/ChallengeSubmission/ChallengeSubmission.stories.ts @@ -1,6 +1,6 @@ import { Meta, StoryObj } from '@storybook/react' -import ChallengeSubmission from './ChallengeSubmission' import { EntityType } from '@sage-bionetworks/synapse-types' +import ChallengeSubmission from './ChallengeSubmission' const meta = { title: 'Synapse/Challenge/ChallengeSubmission', diff --git a/packages/synapse-react-client/src/components/ChallengeSubmission/ChallengeSubmission.tsx b/packages/synapse-react-client/src/components/ChallengeSubmission/ChallengeSubmission.tsx index 10269f2635..ded6282570 100644 --- a/packages/synapse-react-client/src/components/ChallengeSubmission/ChallengeSubmission.tsx +++ b/packages/synapse-react-client/src/components/ChallengeSubmission/ChallengeSubmission.tsx @@ -1,4 +1,14 @@ import React, { useEffect, useState } from 'react' +import { + ACCESS_TYPE, + Challenge, + Project, + ResourceAccess, + Team, + PROJECT_CONCRETE_TYPE_VALUE, + EntityType, + Entity, +} from '@sage-bionetworks/synapse-types' import { useGetCurrentUserProfile, useGetEntityACL, @@ -9,21 +19,11 @@ import { useUpdateEntityACL, } from '../../synapse-queries' import { useSynapseContext } from '../../utils' -import { - ACCESS_TYPE, - Challenge, - Project, - ResourceAccess, - Team, -} from '@sage-bionetworks/synapse-types' import { ErrorBanner, SynapseErrorBoundary } from '../error/ErrorBanner' import { useGetTeam } from '../../synapse-queries/team/useTeam' import { createEntity } from '../../synapse-client' -import { PROJECT_CONCRETE_TYPE_VALUE } from '@sage-bionetworks/synapse-types' import SubmissionDirectoryList from './SubmissionDirectoryList' import ChallengeSubmissionStepper from './ChallengeSubmissionStepper' -import { EntityType } from '@sage-bionetworks/synapse-types' -import { Entity } from '@sage-bionetworks/synapse-types' export type EntityItem = Entity & { repositoryName?: string diff --git a/packages/synapse-react-client/src/components/ChallengeSubmission/ChallengeSubmissionStepper.tsx b/packages/synapse-react-client/src/components/ChallengeSubmission/ChallengeSubmissionStepper.tsx index 73a9c80691..fd3eab0431 100644 --- a/packages/synapse-react-client/src/components/ChallengeSubmission/ChallengeSubmissionStepper.tsx +++ b/packages/synapse-react-client/src/components/ChallengeSubmission/ChallengeSubmissionStepper.tsx @@ -2,18 +2,18 @@ import React, { useState } from 'react' import { DockerCommit, TeamSubmissionEligibility, + EvaluationSubmission, + EntityType, } from '@sage-bionetworks/synapse-types' +import { Typography } from '@mui/material' import StepperDialog from '../StepperDialog' import { Step } from '../StepperDialog/StepperDialog' import { useSynapseContext } from '../../utils' +import SynapseClient from '../../synapse-client' +import { displayToast } from '../ToastMessage' import SubmissionCommitList from './SubmissionCommitList' import EvaluationQueueList from './EvaluationQueueList' -import { Typography } from '@mui/material' -import { EvaluationSubmission } from '@sage-bionetworks/synapse-types' -import SynapseClient from '../../synapse-client' import { EntityItem } from './ChallengeSubmission' -import { EntityType } from '@sage-bionetworks/synapse-types' -import { displayToast } from '../ToastMessage' enum StepsEnum { SELECT_COMMIT = 'SELECT_COMMIT', diff --git a/packages/synapse-react-client/src/components/ChallengeSubmission/EvaluationQueueList.tsx b/packages/synapse-react-client/src/components/ChallengeSubmission/EvaluationQueueList.tsx index 11a1e4e83c..00482fc386 100644 --- a/packages/synapse-react-client/src/components/ChallengeSubmission/EvaluationQueueList.tsx +++ b/packages/synapse-react-client/src/components/ChallengeSubmission/EvaluationQueueList.tsx @@ -1,8 +1,8 @@ import { Alert, Box, TextField, Typography } from '@mui/material' import React from 'react' -import { useGetEntityEvaluations } from '../../synapse-queries' import { ACCESS_TYPE } from '@sage-bionetworks/synapse-types' import { DataGrid, GridColDef } from '@mui/x-data-grid' +import { useGetEntityEvaluations } from '../../synapse-queries' import { RadioOption } from '../widgets/RadioGroup' type EvaluationQueueListProps = { diff --git a/packages/synapse-react-client/src/components/ChallengeSubmission/SubmissionCommitList.tsx b/packages/synapse-react-client/src/components/ChallengeSubmission/SubmissionCommitList.tsx index 341b3bd297..f6cb26c8ee 100644 --- a/packages/synapse-react-client/src/components/ChallengeSubmission/SubmissionCommitList.tsx +++ b/packages/synapse-react-client/src/components/ChallengeSubmission/SubmissionCommitList.tsx @@ -1,14 +1,14 @@ import React, { useState } from 'react' import { Box, Typography } from '@mui/material' import { DataGrid, GridColDef } from '@mui/x-data-grid' -import { RadioOption } from '../widgets/RadioGroup' import { Direction, DockerCommit, SortBy, } from '@sage-bionetworks/synapse-types' -import { formatDate } from '../../utils/functions/DateFormatter' import dayjs from 'dayjs' +import { RadioOption } from '../widgets/RadioGroup' +import { formatDate } from '../../utils/functions/DateFormatter' import { useGetDockerTags } from '../../synapse-queries/docker' import { EntityItem } from './ChallengeSubmission' diff --git a/packages/synapse-react-client/src/components/ChallengeSubmission/SubmissionDirectoryList.tsx b/packages/synapse-react-client/src/components/ChallengeSubmission/SubmissionDirectoryList.tsx index bbbd7c5322..e65e43fffe 100644 --- a/packages/synapse-react-client/src/components/ChallengeSubmission/SubmissionDirectoryList.tsx +++ b/packages/synapse-react-client/src/components/ChallengeSubmission/SubmissionDirectoryList.tsx @@ -1,7 +1,6 @@ import React, { useEffect, useState } from 'react' import { Box, Button, Typography } from '@mui/material' import { DataGrid, GridCellParams, GridColDef } from '@mui/x-data-grid' -import { RadioOption } from '../widgets/RadioGroup' import { Direction, Entity, @@ -12,8 +11,14 @@ import { FILE_ENTITY_CONCRETE_TYPE_VALUE, FileUploadComplete, SortBy, + UploadCallbackResp, + FileEntity, } from '@sage-bionetworks/synapse-types' import { Link } from 'react-router-dom' +import dayjs from 'dayjs' +import { InfoTwoTone } from '@mui/icons-material' +import { useQueryClient } from 'react-query' +import { RadioOption } from '../widgets/RadioGroup' import { BackendDestinationEnum, getEndpoint, @@ -24,20 +29,15 @@ import { useGetEntityChildren, } from '../../synapse-queries' import { formatDate } from '../../utils/functions/DateFormatter' -import dayjs from 'dayjs' import CopyToClipboardIcon from '../CopyToClipboardIcon' -import { InfoTwoTone } from '@mui/icons-material' import SynapseClient from '../../synapse-client' import { useSynapseContext } from '../../utils' import { ErrorBanner } from '../error/ErrorBanner' import FileUpload from '../FileUpload' import IconSvg from '../IconSvg' -import { UploadCallbackResp } from '@sage-bionetworks/synapse-types' -import { FileEntity } from '@sage-bionetworks/synapse-types' import { SynapseClientError } from '../../utils/SynapseClientError' -import { EntityItem } from './ChallengeSubmission' import ConfirmationDialog from '../ConfirmationDialog' -import { useQueryClient } from 'react-query' +import { EntityItem } from './ChallengeSubmission' type SubmissionDirectoryRow = { id: string diff --git a/packages/synapse-react-client/src/components/ChallengeTeamWizard/ChallengeTeamTable.tsx b/packages/synapse-react-client/src/components/ChallengeTeamWizard/ChallengeTeamTable.tsx index d03f1e94b4..466685929e 100644 --- a/packages/synapse-react-client/src/components/ChallengeTeamWizard/ChallengeTeamTable.tsx +++ b/packages/synapse-react-client/src/components/ChallengeTeamWizard/ChallengeTeamTable.tsx @@ -1,21 +1,21 @@ import React, { ChangeEvent, useEffect, useState } from 'react' import { DataGrid, GridCellParams, GridColDef } from '@mui/x-data-grid' -import { formatDate } from '../../utils/functions/DateFormatter' import dayjs from 'dayjs' -import { RadioOption } from '../widgets/RadioGroup' -import { ChallengeTeamSearch } from './ChallengeTeamSearch' -import { SkeletonTable } from '../Skeleton' import { Team } from '@sage-bionetworks/synapse-types' +import { Box } from '@mui/material' +import { Link } from 'react-router-dom' import { useGetChallengeTeamList, useGetTeamList, } from '../../synapse-queries/team/useTeamList' -import { Box } from '@mui/material' -import { Link } from 'react-router-dom' +import { SkeletonTable } from '../Skeleton' +import { RadioOption } from '../widgets/RadioGroup' +import { formatDate } from '../../utils/functions/DateFormatter' import { BackendDestinationEnum, getEndpoint, } from '../../utils/functions/getEndpoint' +import { ChallengeTeamSearch } from './ChallengeTeamSearch' export type ChallengeTeamTableProps = { challengeId: string diff --git a/packages/synapse-react-client/src/components/ChallengeTeamWizard/ChallengeTeamWizard.test.tsx b/packages/synapse-react-client/src/components/ChallengeTeamWizard/ChallengeTeamWizard.test.tsx index 22da02ff6d..6b4486f770 100644 --- a/packages/synapse-react-client/src/components/ChallengeTeamWizard/ChallengeTeamWizard.test.tsx +++ b/packages/synapse-react-client/src/components/ChallengeTeamWizard/ChallengeTeamWizard.test.tsx @@ -6,9 +6,10 @@ import { screen, within, } from '@testing-library/react' -import { createWrapper } from '../../testutils/TestingLibraryUtils' -import { SynapseClient, SynapseContextType } from '../../index' -import ChallengeTeamWizard from './index' +import userEvent from '@testing-library/user-event' +import { Router } from 'react-router-dom' +import { createMemoryHistory } from 'history' +import { mockUserProfileData } from '../../mocks/user/mock_user_profile' import { MOCK_CHALLENGE_PROJECT_ID, mockChallenge, @@ -17,15 +18,14 @@ import { mockChallengeTeamResults, mockTeamList, } from '../../mocks/mockChallenge' -import { mockUserProfileData } from '../../mocks/user/mock_user_profile' -import { ChallengeTeamWizardProps } from './ChallengeTeamWizard' -import userEvent from '@testing-library/user-event' -import { Router } from 'react-router-dom' -import { createMemoryHistory } from 'history' +import { SynapseClient, SynapseContextType } from '../../index' +import { createWrapper } from '../../testutils/TestingLibraryUtils' import { BackendDestinationEnum, getEndpoint, } from '../../utils/functions/getEndpoint' +import { ChallengeTeamWizardProps } from './ChallengeTeamWizard' +import ChallengeTeamWizard from './index' const challengeTeamResults = mockChallengeTeamResults() const challengeTeams = mockTeamList(challengeTeamResults.results) diff --git a/packages/synapse-react-client/src/components/ChallengeTeamWizard/ChallengeTeamWizard.tsx b/packages/synapse-react-client/src/components/ChallengeTeamWizard/ChallengeTeamWizard.tsx index a68c6918e7..c6c7129758 100644 --- a/packages/synapse-react-client/src/components/ChallengeTeamWizard/ChallengeTeamWizard.tsx +++ b/packages/synapse-react-client/src/components/ChallengeTeamWizard/ChallengeTeamWizard.tsx @@ -1,15 +1,13 @@ import React, { useEffect, useState } from 'react' -import StepperDialog, { Step } from '../StepperDialog/StepperDialog' - import { ErrorResponse, Team, TeamMembershipStatus, } from '@sage-bionetworks/synapse-types' -import { CreateChallengeTeam, CreateTeamRequest } from './CreateChallengeTeam' -import { SelectChallengeTeam } from './SelectChallengeTeam' -import { RegistrationSuccessful } from './RegistrationSuccessful' -import { JoinRequestForm } from './JoinRequestForm' +import { Typography } from '@mui/material' +import { useQueryClient } from 'react-query' +import StepperDialog, { Step } from '../StepperDialog/StepperDialog' + import { useSynapseContext } from '../../utils' import { addTeamMemberAsAuthenticatedUserOrAdmin, @@ -26,9 +24,10 @@ import { import { ANONYMOUS_PRINCIPAL_ID } from '../../utils/SynapseConstants' import { useGetMembershipStatus } from '../../synapse-queries/team/useTeamMembers' import { SynapseClientError } from '../../utils/SynapseClientError' - -import { Typography } from '@mui/material' -import { useQueryClient } from 'react-query' +import { JoinRequestForm } from './JoinRequestForm' +import { RegistrationSuccessful } from './RegistrationSuccessful' +import { SelectChallengeTeam } from './SelectChallengeTeam' +import { CreateChallengeTeam, CreateTeamRequest } from './CreateChallengeTeam' enum StepsEnum { SELECT_YOUR_CHALLENGE_TEAM = 'SELECT_YOUR_CHALLENGE_TEAM', diff --git a/packages/synapse-react-client/src/components/ChallengeTeamWizard/RegistrationSuccessful.tsx b/packages/synapse-react-client/src/components/ChallengeTeamWizard/RegistrationSuccessful.tsx index 96277a6ba5..03cd8f1245 100644 --- a/packages/synapse-react-client/src/components/ChallengeTeamWizard/RegistrationSuccessful.tsx +++ b/packages/synapse-react-client/src/components/ChallengeTeamWizard/RegistrationSuccessful.tsx @@ -1,5 +1,4 @@ -import { Typography } from '@mui/material' -import { Box } from '@mui/material' +import { Typography, Box } from '@mui/material' import React from 'react' type RegistrationSuccessfulProps = { diff --git a/packages/synapse-react-client/src/components/ChallengeTeamWizard/SelectChallengeTeam.tsx b/packages/synapse-react-client/src/components/ChallengeTeamWizard/SelectChallengeTeam.tsx index d13acc5046..44b7a8b533 100644 --- a/packages/synapse-react-client/src/components/ChallengeTeamWizard/SelectChallengeTeam.tsx +++ b/packages/synapse-react-client/src/components/ChallengeTeamWizard/SelectChallengeTeam.tsx @@ -1,9 +1,9 @@ import { Box, Button, Typography } from '@mui/material' import React from 'react' import ControlPointIcon from '@mui/icons-material/ControlPoint' -import ChallengeTeamTable from './ChallengeTeamTable' import { Stack } from '@mui/system' import { Team } from '@sage-bionetworks/synapse-types' +import ChallengeTeamTable from './ChallengeTeamTable' type SelectChallengeTeamProps = { challengeId: string diff --git a/packages/synapse-react-client/src/components/ChangePassword/ChangePassword.tsx b/packages/synapse-react-client/src/components/ChangePassword/ChangePassword.tsx index 885a050299..31bd3e808a 100644 --- a/packages/synapse-react-client/src/components/ChangePassword/ChangePassword.tsx +++ b/packages/synapse-react-client/src/components/ChangePassword/ChangePassword.tsx @@ -1,10 +1,12 @@ import React, { useEffect, useState } from 'react' import { Button, TextField } from '@mui/material' -import { ChangePasswordWithCurrentPassword } from '@sage-bionetworks/synapse-types' +import { + ChangePasswordWithCurrentPassword, + UserProfile, +} from '@sage-bionetworks/synapse-types' import { displayToast } from '../ToastMessage/ToastMessage' import SynapseClient from '../../synapse-client' import { useSynapseContext } from '../../utils/context/SynapseContext' -import { UserProfile } from '@sage-bionetworks/synapse-types' export const ChangePassword: React.FunctionComponent = () => { const { accessToken } = useSynapseContext() diff --git a/packages/synapse-react-client/src/components/ColorGradient/ColorGradient.test.ts b/packages/synapse-react-client/src/components/ColorGradient/ColorGradient.test.ts index b27c8372c4..6f4ec33c73 100644 --- a/packages/synapse-react-client/src/components/ColorGradient/ColorGradient.test.ts +++ b/packages/synapse-react-client/src/components/ColorGradient/ColorGradient.test.ts @@ -1,8 +1,8 @@ -import { getColorPalette } from './ColorGradient' import { COLOR_PALETTE_EVEN, COLOR_PALETTE_ODD, } from '../../utils/functions/colorPalette' +import { getColorPalette } from './ColorGradient' describe('the color gradient calculated is correct', () => { it('calculates the odd case', () => { diff --git a/packages/synapse-react-client/src/components/CopyToClipboardIcon.tsx b/packages/synapse-react-client/src/components/CopyToClipboardIcon.tsx index 1529d8cd63..2d664a26e8 100644 --- a/packages/synapse-react-client/src/components/CopyToClipboardIcon.tsx +++ b/packages/synapse-react-client/src/components/CopyToClipboardIcon.tsx @@ -1,7 +1,6 @@ import React from 'react' -import { Box, IconButton } from '@mui/material' +import { Box, IconButton, BoxProps } from '@mui/material' import { ToastMessage } from './ToastMessage/ToastMessage' -import { BoxProps } from '@mui/material' import IconSvg from './IconSvg' export type CopyToClipboardIconProps = BoxProps & { diff --git a/packages/synapse-react-client/src/components/CreateProjectModal/CreateProjectModal.integration.test.tsx b/packages/synapse-react-client/src/components/CreateProjectModal/CreateProjectModal.integration.test.tsx index 6139ef27d1..3eec43351c 100644 --- a/packages/synapse-react-client/src/components/CreateProjectModal/CreateProjectModal.integration.test.tsx +++ b/packages/synapse-react-client/src/components/CreateProjectModal/CreateProjectModal.integration.test.tsx @@ -1,10 +1,6 @@ import { render, screen } from '@testing-library/react' import userEvent from '@testing-library/user-event' import React from 'react' -import { - CreateProjectModal, - CreateProjectModalProps, -} from './CreateProjectModal' import { createWrapper } from '../../testutils/TestingLibraryUtils' import { SynapseContextType } from '../../utils/context/SynapseContext' import { MOCK_INVALID_PROJECT_NAME } from '../../mocks/entity/mockEntity' @@ -12,6 +8,10 @@ import mockProjectEntityData from '../../mocks/entity/mockProject' import { server } from '../../mocks/msw/server' import { CLOSE_BUTTON_LABEL } from '../DialogBase' import { CANCEL_BUTTON_TEXT } from '../ConfirmationDialog/ConfirmationDialog' +import { + CreateProjectModal, + CreateProjectModalProps, +} from './CreateProjectModal' const MOCK_PROJECT_NAME = mockProjectEntityData.name diff --git a/packages/synapse-react-client/src/components/DirectDownload/DirectDownload.integration.test.tsx b/packages/synapse-react-client/src/components/DirectDownload/DirectDownload.integration.test.tsx index f5fdd89867..33aee1eb53 100644 --- a/packages/synapse-react-client/src/components/DirectDownload/DirectDownload.integration.test.tsx +++ b/packages/synapse-react-client/src/components/DirectDownload/DirectDownload.integration.test.tsx @@ -1,20 +1,20 @@ import { render, screen } from '@testing-library/react' import React from 'react' import { mockAllIsIntersecting } from 'react-intersection-observer/test-utils' -import DirectDownload, { DirectFileDownloadProps } from './DirectDownload' -import { createWrapper } from '../../testutils/TestingLibraryUtils' -import { - BackendDestinationEnum, - getEndpoint, -} from '../../utils/functions/getEndpoint' import { BatchFileResult, FileHandleAssociateType, S3FileHandle, } from '@sage-bionetworks/synapse-types' +import { createWrapper } from '../../testutils/TestingLibraryUtils' +import { + BackendDestinationEnum, + getEndpoint, +} from '../../utils/functions/getEndpoint' import mockFileEntityData from '../../mocks/entity/mockFileEntity' import { rest, server } from '../../mocks/msw/server' import { MOCK_USER_ID } from '../../mocks/user/mock_user_profile' +import DirectDownload, { DirectFileDownloadProps } from './DirectDownload' const MOCK_FILE_ENTITY_ID = mockFileEntityData.id const mockFileEntity = mockFileEntityData.entity diff --git a/packages/synapse-react-client/src/components/DirectDownload/DirectDownload.tsx b/packages/synapse-react-client/src/components/DirectDownload/DirectDownload.tsx index 939f73542c..0f18ae8368 100644 --- a/packages/synapse-react-client/src/components/DirectDownload/DirectDownload.tsx +++ b/packages/synapse-react-client/src/components/DirectDownload/DirectDownload.tsx @@ -5,12 +5,12 @@ import { FileHandleAssociateType, FileHandleAssociation, } from '@sage-bionetworks/synapse-types' +import { UAParser } from 'ua-parser-js' +import { Tooltip } from '@mui/material' import { getFiles } from '../../synapse-client/SynapseClient' import IconSvg, { IconSvgProps } from '../IconSvg/IconSvg' import { useSynapseContext } from '../../utils/context/SynapseContext' import { TOOLTIP_DELAY_SHOW } from '../SynapseTable/SynapseTableConstants' -import { UAParser } from 'ua-parser-js' -import { Tooltip } from '@mui/material' import { implementsExternalFileHandleInterface } from '../../utils/types/IsType' import { useGetFileBatch } from '../../synapse-queries/file/useFiles' diff --git a/packages/synapse-react-client/src/components/DirectDownload/FileEntityDirectDownload.tsx b/packages/synapse-react-client/src/components/DirectDownload/FileEntityDirectDownload.tsx index d219540f40..db9e17bc86 100644 --- a/packages/synapse-react-client/src/components/DirectDownload/FileEntityDirectDownload.tsx +++ b/packages/synapse-react-client/src/components/DirectDownload/FileEntityDirectDownload.tsx @@ -1,9 +1,9 @@ import React from 'react' -import { useGetEntity } from '../../synapse-queries' import { FileHandleAssociateType } from '@sage-bionetworks/synapse-types' +import { Skeleton } from '@mui/material' +import { useGetEntity } from '../../synapse-queries' import { isFileEntity } from '../../utils/types/IsType' import DirectDownload, { DirectFileDownloadProps } from './DirectDownload' -import { Skeleton } from '@mui/material' export type FileEntityDirectDownloadProps = Omit< DirectFileDownloadProps, diff --git a/packages/synapse-react-client/src/components/DownloadCart/ActionRequiredCard/ActionRequiredCard.stories.tsx b/packages/synapse-react-client/src/components/DownloadCart/ActionRequiredCard/ActionRequiredCard.stories.tsx index 32795e37f1..ba0cedb621 100644 --- a/packages/synapse-react-client/src/components/DownloadCart/ActionRequiredCard/ActionRequiredCard.stories.tsx +++ b/packages/synapse-react-client/src/components/DownloadCart/ActionRequiredCard/ActionRequiredCard.stories.tsx @@ -1,9 +1,9 @@ import { Meta, StoryObj } from '@storybook/react' -import { ActionRequiredCard } from './ActionRequiredCard' import React from 'react' +import { Button, Typography } from '@mui/material' import { WideButton } from '../../styled/WideButton' import { EASY_DIFFICULTY } from '../../../utils/SynapseConstants' -import { Button, Typography } from '@mui/material' +import { ActionRequiredCard } from './ActionRequiredCard' const meta = { title: 'Download/ActionRequiredCard', diff --git a/packages/synapse-react-client/src/components/DownloadCart/ActionRequiredCard/ActionRequiredCard.tsx b/packages/synapse-react-client/src/components/DownloadCart/ActionRequiredCard/ActionRequiredCard.tsx index aab9bd2145..e902c23311 100644 --- a/packages/synapse-react-client/src/components/DownloadCart/ActionRequiredCard/ActionRequiredCard.tsx +++ b/packages/synapse-react-client/src/components/DownloadCart/ActionRequiredCard/ActionRequiredCard.tsx @@ -7,8 +7,8 @@ import { styled, Typography, } from '@mui/material' -import Icon from '../../Icon' import { StyledComponent } from '@emotion/styled' +import Icon from '../../Icon' export type ActionRequiredCardProps = | { diff --git a/packages/synapse-react-client/src/components/DownloadCart/AvailableForDownloadTable.tsx b/packages/synapse-react-client/src/components/DownloadCart/AvailableForDownloadTable.tsx index 6d410949ad..33ca54258a 100644 --- a/packages/synapse-react-client/src/components/DownloadCart/AvailableForDownloadTable.tsx +++ b/packages/synapse-react-client/src/components/DownloadCart/AvailableForDownloadTable.tsx @@ -1,9 +1,8 @@ import React from 'react' import { QueryClient, QueryClientProvider } from 'react-query' import { useSynapseContext } from '../../utils/context/SynapseContext' -import { DownloadListTableProps } from './DownloadListTable' import { SynapseErrorBoundary } from '../error/ErrorBanner' -import DownloadListTable from './DownloadListTable' +import DownloadListTable, { DownloadListTableProps } from './DownloadListTable' /** * Table of the files added to the Download Cart that are currently available for download. diff --git a/packages/synapse-react-client/src/components/DownloadCart/CreatePackageV2.tsx b/packages/synapse-react-client/src/components/DownloadCart/CreatePackageV2.tsx index 77152f30ca..06e13a943b 100644 --- a/packages/synapse-react-client/src/components/DownloadCart/CreatePackageV2.tsx +++ b/packages/synapse-react-client/src/components/DownloadCart/CreatePackageV2.tsx @@ -1,11 +1,11 @@ import React, { useState } from 'react' import { Box, Button, InputAdornment, TextField } from '@mui/material' +import { DownloadListPackageResponse } from '@sage-bionetworks/synapse-types' import { createPackageFromDownloadListV2, getFileHandleByIdURL, } from '../../synapse-client/SynapseClient' import { useSynapseContext } from '../../utils/context/SynapseContext' -import { DownloadListPackageResponse } from '@sage-bionetworks/synapse-types' import FullWidthAlert, { FullWidthAlertVariant, } from '../FullWidthAlert/FullWidthAlert' diff --git a/packages/synapse-react-client/src/components/DownloadCart/DownloadCartPage.tsx b/packages/synapse-react-client/src/components/DownloadCart/DownloadCartPage.tsx index 154d9a4298..c7e6e567cb 100644 --- a/packages/synapse-react-client/src/components/DownloadCart/DownloadCartPage.tsx +++ b/packages/synapse-react-client/src/components/DownloadCart/DownloadCartPage.tsx @@ -1,22 +1,21 @@ -import React from 'react' -import { useEffect, useState } from 'react' -import AvailableForDownloadTable from './AvailableForDownloadTable' -import DownloadListStats from './DownloadListStats' +import React, { useEffect, useState } from 'react' +import { Button, Tooltip, Typography } from '@mui/material' +import { DeleteTwoTone } from '@mui/icons-material' import { useGetDownloadListStatistics } from '../../synapse-queries/download/useDownloadList' -import { - DownloadListActionsRequired, - DownloadListActionsRequiredProps, -} from './DownloadListActionsRequired' import { useSynapseContext } from '../../utils/context/SynapseContext' import SynapseClient from '../../synapse-client' import IconSvg from '../IconSvg/IconSvg' -import { CreatePackageV2 } from './CreatePackageV2' import FullWidthAlert from '../FullWidthAlert/FullWidthAlert' import { ErrorBanner } from '../error/ErrorBanner' -import { Button, Tooltip, Typography } from '@mui/material' import { HelpPopover } from '../HelpPopover/HelpPopover' import { ProgrammaticInstructionsModal } from '../ProgrammaticInstructionsModal/ProgrammaticInstructionsModal' -import { DeleteTwoTone } from '@mui/icons-material' +import { CreatePackageV2 } from './CreatePackageV2' +import { + DownloadListActionsRequired, + DownloadListActionsRequiredProps, +} from './DownloadListActionsRequired' +import DownloadListStats from './DownloadListStats' +import AvailableForDownloadTable from './AvailableForDownloadTable' const pythonDownloadCode = `import synapseclient syn = synapseclient.login() diff --git a/packages/synapse-react-client/src/components/DownloadCart/DownloadDetails.tsx b/packages/synapse-react-client/src/components/DownloadCart/DownloadDetails.tsx index 5eb1b566fd..50de2c1e67 100644 --- a/packages/synapse-react-client/src/components/DownloadCart/DownloadDetails.tsx +++ b/packages/synapse-react-client/src/components/DownloadCart/DownloadDetails.tsx @@ -1,9 +1,9 @@ import React from 'react' +import { Tooltip } from '@mui/material' +import pluralize from 'pluralize' import { calculateFriendlyFileSize } from '../../utils/functions/calculateFriendlyFileSize' import { TOOLTIP_DELAY_SHOW } from '../SynapseTable/SynapseTableConstants' import IconSvg from '../IconSvg/IconSvg' -import { Tooltip } from '@mui/material' -import pluralize from 'pluralize' export type DownloadDetailsProps = { numFiles: number diff --git a/packages/synapse-react-client/src/components/DownloadCart/DownloadListActionsRequired.tsx b/packages/synapse-react-client/src/components/DownloadCart/DownloadListActionsRequired.tsx index aec85a2d1c..cfe0792b5b 100644 --- a/packages/synapse-react-client/src/components/DownloadCart/DownloadListActionsRequired.tsx +++ b/packages/synapse-react-client/src/components/DownloadCart/DownloadListActionsRequired.tsx @@ -1,9 +1,9 @@ import React, { useEffect } from 'react' -import { useGetDownloadListActionsRequiredInfinite } from '../../synapse-queries/download/useDownloadList' import { useInView } from 'react-intersection-observer' import { ActionRequiredCount } from '@sage-bionetworks/synapse-types' -import { LoadingActionRequiredCard } from './ActionRequiredCard/ActionRequiredCard' import { Box } from '@mui/material' +import { useGetDownloadListActionsRequiredInfinite } from '../../synapse-queries/download/useDownloadList' +import { LoadingActionRequiredCard } from './ActionRequiredCard/ActionRequiredCard' import { ActionRequiredListItem } from './ActionRequiredListItem' export type DownloadListActionsRequiredProps = { diff --git a/packages/synapse-react-client/src/components/DownloadCart/DownloadListTable.test.tsx b/packages/synapse-react-client/src/components/DownloadCart/DownloadListTable.test.tsx index fae8825695..e63b767c41 100644 --- a/packages/synapse-react-client/src/components/DownloadCart/DownloadListTable.test.tsx +++ b/packages/synapse-react-client/src/components/DownloadCart/DownloadListTable.test.tsx @@ -2,14 +2,14 @@ import '@testing-library/jest-dom' import { render, screen } from '@testing-library/react' import React from 'react' import { mockAllIsIntersecting } from 'react-intersection-observer/test-utils' -import { mockUserProfileData } from '../../mocks/user/mock_user_profile' -import { mockFileStatistics } from '../../mocks/mock_file_statistics' import userEvent from '@testing-library/user-event' -import DownloadListTableV2 from './DownloadListTable' import { DownloadListItemResult } from '@sage-bionetworks/synapse-types' +import { mockFileStatistics } from '../../mocks/mock_file_statistics' +import { mockUserProfileData } from '../../mocks/user/mock_user_profile' import { SynapseTestContext } from '../../mocks/MockSynapseContext' import * as useDownloadList from '../../synapse-queries/download/useDownloadList' import SynapseClient from '../../synapse-client' +import DownloadListTableV2 from './DownloadListTable' jest.spyOn(SynapseClient, 'removeItemFromDownloadListV2').mockResolvedValue({ numberOfFilesRemoved: 2, diff --git a/packages/synapse-react-client/src/components/DownloadCart/DownloadListTable.tsx b/packages/synapse-react-client/src/components/DownloadCart/DownloadListTable.tsx index 02b0c3f48d..b2e36ec943 100644 --- a/packages/synapse-react-client/src/components/DownloadCart/DownloadListTable.tsx +++ b/packages/synapse-react-client/src/components/DownloadCart/DownloadListTable.tsx @@ -10,11 +10,13 @@ import { SortField, } from '@sage-bionetworks/synapse-types' import { Dropdown, Table } from 'react-bootstrap' +import { useInView } from 'react-intersection-observer' +import dayjs from 'dayjs' +import { Tooltip } from '@mui/material' +import localizedFormat from 'dayjs/plugin/localizedFormat' import { calculateFriendlyFileSize } from '../../utils/functions/calculateFriendlyFileSize' import { useGetAvailableFilesToDownloadInfinite } from '../../synapse-queries' -import { useInView } from 'react-intersection-observer' import SynapseClient from '../../synapse-client' -import dayjs from 'dayjs' import UserCard from '../UserCard/UserCard' import SortIcon from '../../assets/icons/Sort' import { useSynapseContext } from '../../utils' @@ -23,12 +25,10 @@ import IconSvg from '../IconSvg/IconSvg' import { TOOLTIP_DELAY_SHOW } from '../SynapseTable/SynapseTableConstants' import { SkeletonTable } from '../Skeleton' import { displayToast } from '../ToastMessage' -import DirectProgrammaticDownload from './DirectProgrammaticDownload' import { BlockingLoader } from '../LoadingScreen/LoadingScreen' -import { Tooltip } from '@mui/material' import { InteractiveCopyIdsIcon } from '../InteractiveCopyIdsIcon' -import localizedFormat from 'dayjs/plugin/localizedFormat' import FileEntityDirectDownload from '../DirectDownload/FileEntityDirectDownload' +import DirectProgrammaticDownload from './DirectProgrammaticDownload' export const TESTING_TRASH_BTN_CLASS = 'TESTING_TRASH_BTN_CLASS' diff --git a/packages/synapse-react-client/src/components/DownloadCart/EnableTwoFaRequirementCard.test.tsx b/packages/synapse-react-client/src/components/DownloadCart/EnableTwoFaRequirementCard.test.tsx index aba10fe841..75e1c3ea3c 100644 --- a/packages/synapse-react-client/src/components/DownloadCart/EnableTwoFaRequirementCard.test.tsx +++ b/packages/synapse-react-client/src/components/DownloadCart/EnableTwoFaRequirementCard.test.tsx @@ -1,15 +1,15 @@ import { act, render, screen } from '@testing-library/react' import React from 'react' -import { createWrapper } from '../../testutils/TestingLibraryUtils' import userEvent from '@testing-library/user-event' +import { createWrapper } from '../../testutils/TestingLibraryUtils' import SynapseClient from '../../synapse-client' +import { mockManagedACTAccessRequirement } from '../../mocks/mockAccessRequirements' +import * as AccessRequirementListModule from '../AccessRequirementList/AccessRequirementList' import { EnableTwoFaRequirementCard, EnableTwoFaRequirementCardProps, REQUIRES_2FA_CARD_TITLE, } from './EnableTwoFaRequirementCard' -import { mockManagedACTAccessRequirement } from '../../mocks/mockAccessRequirements' -import * as AccessRequirementListModule from '../AccessRequirementList/AccessRequirementList' const MOCK_ACCESS_REQUIREMENT_LIST_COMPONENT = 'mock-access-requirement-list-component' diff --git a/packages/synapse-react-client/src/components/DownloadCart/EnableTwoFaRequirementCard.tsx b/packages/synapse-react-client/src/components/DownloadCart/EnableTwoFaRequirementCard.tsx index 21dee3f513..4eb0ce36f2 100644 --- a/packages/synapse-react-client/src/components/DownloadCart/EnableTwoFaRequirementCard.tsx +++ b/packages/synapse-react-client/src/components/DownloadCart/EnableTwoFaRequirementCard.tsx @@ -1,9 +1,9 @@ import React, { useState } from 'react' import { EASY_DIFFICULTY } from '../../utils/SynapseConstants' import AccessRequirementList from '../AccessRequirementList/AccessRequirementList' -import { ActionRequiredCard } from './ActionRequiredCard/ActionRequiredCard' import WideButton from '../../components/styled/WideButton' import { useGetAccessRequirements } from '../../synapse-queries' +import { ActionRequiredCard } from './ActionRequiredCard/ActionRequiredCard' export type EnableTwoFaRequirementCardProps = { accessRequirementId: number diff --git a/packages/synapse-react-client/src/components/DownloadCart/MeetAccessRequirementCard.integration.test.tsx b/packages/synapse-react-client/src/components/DownloadCart/MeetAccessRequirementCard.integration.test.tsx index 9648026275..d4bf70541e 100644 --- a/packages/synapse-react-client/src/components/DownloadCart/MeetAccessRequirementCard.integration.test.tsx +++ b/packages/synapse-react-client/src/components/DownloadCart/MeetAccessRequirementCard.integration.test.tsx @@ -1,13 +1,5 @@ import { render, screen } from '@testing-library/react' import React from 'react' -import { - MeetAccessRequirementCard, - MeetAccessRequirementCardProps, - TERMS_OF_USE_TITLE, - SELF_SIGN_TITLE, - ACT_TITLE, - LOCK_TITLE, -} from './MeetAccessRequirementCard' import { createWrapper } from '../../testutils/TestingLibraryUtils' import { SynapseContextType } from '../../utils/context/SynapseContext' import { rest, server } from '../../mocks/msw/server' @@ -22,6 +14,14 @@ import { BackendDestinationEnum, getEndpoint, } from '../../utils/functions/getEndpoint' +import { + MeetAccessRequirementCard, + MeetAccessRequirementCardProps, + TERMS_OF_USE_TITLE, + SELF_SIGN_TITLE, + ACT_TITLE, + LOCK_TITLE, +} from './MeetAccessRequirementCard' const ACCESS_REQUIREMENT_ID = 1111 const defaultProps: MeetAccessRequirementCardProps = { diff --git a/packages/synapse-react-client/src/components/DownloadCart/MeetAccessRequirementCard.tsx b/packages/synapse-react-client/src/components/DownloadCart/MeetAccessRequirementCard.tsx index 0a7325d9f6..76a133fb47 100644 --- a/packages/synapse-react-client/src/components/DownloadCart/MeetAccessRequirementCard.tsx +++ b/packages/synapse-react-client/src/components/DownloadCart/MeetAccessRequirementCard.tsx @@ -1,14 +1,14 @@ import React, { useState } from 'react' -import { useGetAccessRequirements } from '../../synapse-queries/dataaccess/useAccessRequirements' import { SelfSignAccessRequirement } from '@sage-bionetworks/synapse-types' +import { useGetAccessRequirements } from '../../synapse-queries/dataaccess/useAccessRequirements' import { EASY_DIFFICULTY, MEDIUM_DIFFICULTY, VARIABLE_DIFFICULTY, } from '../../utils/SynapseConstants' import AccessRequirementList from '../AccessRequirementList/AccessRequirementList' -import { ActionRequiredCard } from './ActionRequiredCard/ActionRequiredCard' import WideButton from '../../components/styled/WideButton' +import { ActionRequiredCard } from './ActionRequiredCard/ActionRequiredCard' export type MeetAccessRequirementCardProps = { accessRequirementId: number diff --git a/packages/synapse-react-client/src/components/DownloadCart/RequestDownloadCard.integration.test.tsx b/packages/synapse-react-client/src/components/DownloadCart/RequestDownloadCard.integration.test.tsx index e50b8910b5..73237d83ef 100644 --- a/packages/synapse-react-client/src/components/DownloadCart/RequestDownloadCard.integration.test.tsx +++ b/packages/synapse-react-client/src/components/DownloadCart/RequestDownloadCard.integration.test.tsx @@ -1,5 +1,6 @@ import { render, screen } from '@testing-library/react' import React from 'react' +import userEvent from '@testing-library/user-event' import { createWrapper } from '../../testutils/TestingLibraryUtils' import { SynapseContextType } from '../../utils/context/SynapseContext' import { rest, server } from '../../mocks/msw/server' @@ -13,7 +14,6 @@ import { RequestDownloadCardProps, REQUEST_DOWNLOAD_TITLE, } from './RequestDownloadCard' -import userEvent from '@testing-library/user-event' const ENTITY_ID = 'syn29218' const onViewSharingSettingsClicked = jest.fn() diff --git a/packages/synapse-react-client/src/components/DownloadCart/RequestDownloadCard.tsx b/packages/synapse-react-client/src/components/DownloadCart/RequestDownloadCard.tsx index 2597e6b8c7..686727e220 100644 --- a/packages/synapse-react-client/src/components/DownloadCart/RequestDownloadCard.tsx +++ b/packages/synapse-react-client/src/components/DownloadCart/RequestDownloadCard.tsx @@ -1,7 +1,7 @@ import React from 'react' +import { Button, Typography } from '@mui/material' import { useGetEntityHeader } from '../../synapse-queries/entity/useGetEntityHeaders' import { DOWNLOAD_PERMISSION_REQUIRED } from '../../utils/SynapseConstants' -import { Button, Typography } from '@mui/material' import { ActionRequiredCard } from './ActionRequiredCard/ActionRequiredCard' export type RequestDownloadCardProps = { diff --git a/packages/synapse-react-client/src/components/DownloadCart/ShowDownloadV2.tsx b/packages/synapse-react-client/src/components/DownloadCart/ShowDownloadV2.tsx index 50a6bc0a91..88219462b9 100644 --- a/packages/synapse-react-client/src/components/DownloadCart/ShowDownloadV2.tsx +++ b/packages/synapse-react-client/src/components/DownloadCart/ShowDownloadV2.tsx @@ -1,10 +1,10 @@ import React, { useEffect } from 'react' +import { useErrorHandler } from 'react-error-boundary' +import { Tooltip } from '@mui/material' import { TOOLTIP_DELAY_SHOW } from '../SynapseTable/SynapseTableConstants' import { useSynapseContext } from '../../utils/context/SynapseContext' -import { useErrorHandler } from 'react-error-boundary' import { useGetDownloadListStatistics } from '../../synapse-queries/download/useDownloadList' import IconSvg from '../IconSvg/IconSvg' -import { Tooltip } from '@mui/material' export type ShowDownloadV2Props = { to: string diff --git a/packages/synapse-react-client/src/components/DownloadCart/index.ts b/packages/synapse-react-client/src/components/DownloadCart/index.ts index 2d5497caf0..24432a76e3 100644 --- a/packages/synapse-react-client/src/components/DownloadCart/index.ts +++ b/packages/synapse-react-client/src/components/DownloadCart/index.ts @@ -1,6 +1,6 @@ -import type { DownloadListActionsRequiredProps as DownloadCartPageProps } from './DownloadListActionsRequired' import { DownloadCartPage } from './DownloadCartPage' import { ShowDownloadV2 } from './ShowDownloadV2' +import type { DownloadListActionsRequiredProps as DownloadCartPageProps } from './DownloadListActionsRequired' import type { ShowDownloadV2Props } from './ShowDownloadV2' export { diff --git a/packages/synapse-react-client/src/components/EntityBadgeIcons/EntityBadgeIcons.tsx b/packages/synapse-react-client/src/components/EntityBadgeIcons/EntityBadgeIcons.tsx index 328cfb993c..920c3a12b5 100644 --- a/packages/synapse-react-client/src/components/EntityBadgeIcons/EntityBadgeIcons.tsx +++ b/packages/synapse-react-client/src/components/EntityBadgeIcons/EntityBadgeIcons.tsx @@ -10,6 +10,12 @@ import { import { isEmpty } from 'lodash-es' import React, { useEffect, useState } from 'react' import { useInView } from 'react-intersection-observer' +import { + ALL_ENTITY_BUNDLE_FIELDS, + EntityBundle, + EntityType, +} from '@sage-bionetworks/synapse-types' +import { Tooltip } from '@mui/material' import { useDeleteEntity } from '../../synapse-queries/entity/useEntity' import { useGetSchemaBinding, @@ -22,14 +28,8 @@ import { PUBLIC_PRINCIPAL_ID, } from '../../utils/SynapseConstants' import { useSynapseContext } from '../../utils/context/SynapseContext' -import { - ALL_ENTITY_BUNDLE_FIELDS, - EntityBundle, - EntityType, -} from '@sage-bionetworks/synapse-types' import { EntityModal } from '../entity/metadata/EntityModal' import WarningDialog from '../SynapseForm/WarningDialog' -import { Tooltip } from '@mui/material' function isPublic(bundle: EntityBundle): boolean { return bundle.benefactorAcl.resourceAccess.some(ra => { diff --git a/packages/synapse-react-client/src/components/EntityFinder/EntityFinder.stories.ts b/packages/synapse-react-client/src/components/EntityFinder/EntityFinder.stories.ts index c1189b5f4d..359bde56a8 100644 --- a/packages/synapse-react-client/src/components/EntityFinder/EntityFinder.stories.ts +++ b/packages/synapse-react-client/src/components/EntityFinder/EntityFinder.stories.ts @@ -1,8 +1,8 @@ import { Meta, StoryObj } from '@storybook/react' +import { EntityType } from '@sage-bionetworks/synapse-types' import EntityFinder from './EntityFinder' import { FinderScope } from './tree/EntityTree' -import { EntityType } from '@sage-bionetworks/synapse-types' import { VersionSelectionType } from './VersionSelectionType' const meta = { diff --git a/packages/synapse-react-client/src/components/EntityFinder/EntityFinder.tsx b/packages/synapse-react-client/src/components/EntityFinder/EntityFinder.tsx index efa5c960dd..37c0ce87ed 100644 --- a/packages/synapse-react-client/src/components/EntityFinder/EntityFinder.tsx +++ b/packages/synapse-react-client/src/components/EntityFinder/EntityFinder.tsx @@ -14,6 +14,11 @@ import { useErrorHandler } from 'react-error-boundary' import { ReflexContainer, ReflexElement, ReflexSplitter } from 'react-reflex' import 'react-reflex/styles.css' import { SizeMe } from 'react-sizeme' +import { + Reference, + EntityType, + KeyValue, +} from '@sage-bionetworks/synapse-types' import SynapseClient from '../../synapse-client' import { entityTypeToFriendlyName, @@ -21,9 +26,6 @@ import { } from '../../utils/functions/EntityTypeUtils' import { parseSynId } from '../../utils/functions/RegularExpressions' import { useSynapseContext } from '../../utils/context/SynapseContext' -import { Reference } from '@sage-bionetworks/synapse-types' -import { EntityType } from '@sage-bionetworks/synapse-types' -import { KeyValue } from '@sage-bionetworks/synapse-types' import { SynapseErrorBoundary } from '../error/ErrorBanner' import { BreadcrumbItem, Breadcrumbs, BreadcrumbsProps } from './Breadcrumbs' import { diff --git a/packages/synapse-react-client/src/components/EntityFinder/EntityFinderModal.test.tsx b/packages/synapse-react-client/src/components/EntityFinder/EntityFinderModal.test.tsx index 4a0d4de3e9..caad66bb7b 100644 --- a/packages/synapse-react-client/src/components/EntityFinder/EntityFinderModal.test.tsx +++ b/packages/synapse-react-client/src/components/EntityFinder/EntityFinderModal.test.tsx @@ -8,6 +8,8 @@ import { } from '@testing-library/react' import userEvent from '@testing-library/user-event' import React from 'react' +import { EntityType, Reference } from '@sage-bionetworks/synapse-types' +import { createWrapper } from '../../testutils/TestingLibraryUtils' import * as EntityFinderModule from './EntityFinder' import { EntityFinderModal, @@ -15,8 +17,6 @@ import { UNSAVED_CHANGES, } from './EntityFinderModal' import { FinderScope } from './tree/EntityTree' -import { createWrapper } from '../../testutils/TestingLibraryUtils' -import { EntityType, Reference } from '@sage-bionetworks/synapse-types' let capturedOnSelectionChange: ((selected: Reference[]) => void) | undefined diff --git a/packages/synapse-react-client/src/components/EntityFinder/SelectionPane.tsx b/packages/synapse-react-client/src/components/EntityFinder/SelectionPane.tsx index 51869e5736..68de614f0b 100644 --- a/packages/synapse-react-client/src/components/EntityFinder/SelectionPane.tsx +++ b/packages/synapse-react-client/src/components/EntityFinder/SelectionPane.tsx @@ -1,14 +1,12 @@ import { Clear } from '@mui/icons-material' import React, { useEffect, useState } from 'react' -import useGetEntityBundle from '../../synapse-queries/entity/useEntityBundle' import { Reference } from '@sage-bionetworks/synapse-types' -import { Typography } from '@mui/material' -import { EntityTypeIcon } from '../EntityIcon' -import { NO_VERSION_NUMBER } from './EntityFinder' +import { Typography, Skeleton, Tooltip } from '@mui/material' import { Map } from 'immutable' -import { Skeleton } from '@mui/material' -import { Tooltip } from '@mui/material' +import { EntityTypeIcon } from '../EntityIcon' +import useGetEntityBundle from '../../synapse-queries/entity/useEntityBundle' import { TOOLTIP_DELAY_SHOW } from '../SynapseTable/SynapseTableConstants' +import { NO_VERSION_NUMBER } from './EntityFinder' export type SelectionPaneProps = { title: string | ((count: number) => string) diff --git a/packages/synapse-react-client/src/components/EntityFinder/details/EntityDetailsList.tsx b/packages/synapse-react-client/src/components/EntityFinder/details/EntityDetailsList.tsx index 5b69990a41..50762dbccf 100644 --- a/packages/synapse-react-client/src/components/EntityFinder/details/EntityDetailsList.tsx +++ b/packages/synapse-react-client/src/components/EntityFinder/details/EntityDetailsList.tsx @@ -1,10 +1,13 @@ import { Map } from 'immutable' import React, { Dispatch, SetStateAction, useState } from 'react' import useDeepCompareEffect from 'use-deep-compare-effect' +import { + EntityType, + Reference, + GetProjectsParameters, + SearchQuery, +} from '@sage-bionetworks/synapse-types' import { getIsAllSelectedFromInfiniteList } from '../../../utils/hooks/useGetIsAllSelectedInfiniteList' -import { EntityType, Reference } from '@sage-bionetworks/synapse-types' -import { GetProjectsParameters } from '@sage-bionetworks/synapse-types' -import { SearchQuery } from '@sage-bionetworks/synapse-types' import { SynapseErrorBoundary } from '../../error/ErrorBanner' import { EntityFinderHeader } from '../EntityFinderHeader' import { EntityTreeContainer } from '../tree/EntityTree' diff --git a/packages/synapse-react-client/src/components/EntityFinder/details/configurations/EntityChildrenDetails.tsx b/packages/synapse-react-client/src/components/EntityFinder/details/configurations/EntityChildrenDetails.tsx index 3c8d5f3c78..354f298e3a 100644 --- a/packages/synapse-react-client/src/components/EntityFinder/details/configurations/EntityChildrenDetails.tsx +++ b/packages/synapse-react-client/src/components/EntityFinder/details/configurations/EntityChildrenDetails.tsx @@ -1,6 +1,6 @@ import React, { useState } from 'react' -import { useGetEntityChildrenInfinite } from '../../../../synapse-queries/entity/useGetEntityChildren' import { Direction, SortBy } from '@sage-bionetworks/synapse-types' +import { useGetEntityChildrenInfinite } from '../../../../synapse-queries/entity/useGetEntityChildren' import { EntityDetailsListSharedProps } from '../EntityDetailsList' import { DetailsView } from '../view/DetailsView' import useGetIsAllSelectedFromInfiniteList from '../../../../utils/hooks/useGetIsAllSelectedInfiniteList' diff --git a/packages/synapse-react-client/src/components/EntityFinder/details/configurations/ProjectListDetails.tsx b/packages/synapse-react-client/src/components/EntityFinder/details/configurations/ProjectListDetails.tsx index 65529506fe..75f3b58400 100644 --- a/packages/synapse-react-client/src/components/EntityFinder/details/configurations/ProjectListDetails.tsx +++ b/packages/synapse-react-client/src/components/EntityFinder/details/configurations/ProjectListDetails.tsx @@ -1,8 +1,10 @@ import React from 'react' +import { + ProjectHeader, + GetProjectsParameters, +} from '@sage-bionetworks/synapse-types' import { useGetProjectsInfinite } from '../../../../synapse-queries/user/useProjects' import useGetIsAllSelectedFromInfiniteList from '../../../../utils/hooks/useGetIsAllSelectedInfiniteList' -import { ProjectHeader } from '@sage-bionetworks/synapse-types' -import { GetProjectsParameters } from '@sage-bionetworks/synapse-types' import { EntityHeaderFromProjectHeader } from '../../EntityFinderHeader' import { EntityDetailsListSharedProps } from '../EntityDetailsList' import { DetailsView } from '../view/DetailsView' diff --git a/packages/synapse-react-client/src/components/EntityFinder/details/configurations/SearchDetails.tsx b/packages/synapse-react-client/src/components/EntityFinder/details/configurations/SearchDetails.tsx index bbca6acd21..ddcb6b139b 100644 --- a/packages/synapse-react-client/src/components/EntityFinder/details/configurations/SearchDetails.tsx +++ b/packages/synapse-react-client/src/components/EntityFinder/details/configurations/SearchDetails.tsx @@ -1,7 +1,7 @@ import React from 'react' +import { Hit, SearchQuery } from '@sage-bionetworks/synapse-types' import { convertToConcreteEntityType } from '../../../../utils/functions/EntityTypeUtils' import { useSearchInfinite } from '../../../../synapse-queries/search/useSearch' -import { Hit, SearchQuery } from '@sage-bionetworks/synapse-types' import { EntityHeaderFromHit } from '../../EntityFinderHeader' import { EntityDetailsListSharedProps } from '../EntityDetailsList' import { DetailsView } from '../view/DetailsView' diff --git a/packages/synapse-react-client/src/components/EntityFinder/details/view/DetailsView.tsx b/packages/synapse-react-client/src/components/EntityFinder/details/view/DetailsView.tsx index cd9760aa8b..5826ee4de3 100644 --- a/packages/synapse-react-client/src/components/EntityFinder/details/view/DetailsView.tsx +++ b/packages/synapse-react-client/src/components/EntityFinder/details/view/DetailsView.tsx @@ -5,13 +5,6 @@ import BaseTable, { } from '@sage-bionetworks/react-base-table' import React, { useCallback, useEffect, useMemo, useState } from 'react' import { useQueryClient } from 'react-query' -import { - getEntityTypeFromHeader, - isContainerType, - isVersionableEntityType, -} from '../../../../utils/functions/EntityTypeUtils' -import { getEntityVersions } from '../../../../synapse-client/SynapseClient' -import { useSynapseContext } from '../../../../utils/context/SynapseContext' import { Direction, EntityChildrenRequest, @@ -19,6 +12,13 @@ import { EntityType, SortBy, } from '@sage-bionetworks/synapse-types' +import { + getEntityTypeFromHeader, + isContainerType, + isVersionableEntityType, +} from '../../../../utils/functions/EntityTypeUtils' +import { getEntityVersions } from '../../../../synapse-client/SynapseClient' +import { useSynapseContext } from '../../../../utils/context/SynapseContext' import { BlockingLoader } from '../../../LoadingScreen/LoadingScreen' import { Checkbox } from '../../../widgets/Checkbox' import { NO_VERSION_NUMBER } from '../../EntityFinder' diff --git a/packages/synapse-react-client/src/components/EntityFinder/details/view/DetailsViewTableRenderers.tsx b/packages/synapse-react-client/src/components/EntityFinder/details/view/DetailsViewTableRenderers.tsx index 3f357bb8bc..b0b6bf72f2 100644 --- a/packages/synapse-react-client/src/components/EntityFinder/details/view/DetailsViewTableRenderers.tsx +++ b/packages/synapse-react-client/src/components/EntityFinder/details/view/DetailsViewTableRenderers.tsx @@ -7,6 +7,11 @@ import BaseTable, { import dayjs from 'dayjs' import React, { SyntheticEvent, useEffect } from 'react' import { Form } from 'react-bootstrap' +import { + EntityRef, + EntityType, + Reference, +} from '@sage-bionetworks/synapse-types' import SortIcon from '../../../../assets/icons/Sort' import { formatDate } from '../../../../utils/functions/DateFormatter' import { isTableType } from '../../../../utils/functions/EntityTypeUtils' @@ -16,11 +21,6 @@ import { } from '../../../../synapse-queries/entity/useEntity' import useGetEntityBundle from '../../../../synapse-queries/entity/useEntityBundle' import { SMALL_USER_CARD } from '../../../../utils/SynapseConstants' -import { - EntityRef, - EntityType, - Reference, -} from '@sage-bionetworks/synapse-types' import { EntityBadgeIcons } from '../../../EntityBadgeIcons/EntityBadgeIcons' import { EntityTypeIcon } from '../../../EntityIcon' import { EntityLink } from '../../../EntityLink' diff --git a/packages/synapse-react-client/src/components/EntityFinder/tree/EntityTree.tsx b/packages/synapse-react-client/src/components/EntityFinder/tree/EntityTree.tsx index 983a54002b..23d33d0f0e 100644 --- a/packages/synapse-react-client/src/components/EntityFinder/tree/EntityTree.tsx +++ b/packages/synapse-react-client/src/components/EntityFinder/tree/EntityTree.tsx @@ -8,6 +8,12 @@ import React, { useState, } from 'react' import { Dropdown } from 'react-bootstrap' +import { + ALL_ENTITY_BUNDLE_FIELDS, + EntityPath, + EntityType, + Reference, +} from '@sage-bionetworks/synapse-types' import { convertToEntityType } from '../../../utils/functions/EntityTypeUtils' import { SYNAPSE_ENTITY_ID_REGEX } from '../../../utils/functions/RegularExpressions' import useGetEntityBundle from '../../../synapse-queries/entity/useEntityBundle' @@ -17,12 +23,6 @@ import { useGetFavorites, useGetProjectsInfinite, } from '../../../synapse-queries' -import { - ALL_ENTITY_BUNDLE_FIELDS, - EntityPath, - EntityType, - Reference, -} from '@sage-bionetworks/synapse-types' import { SynapseSpinner } from '../../LoadingScreen/LoadingScreen' import { BreadcrumbItem } from '../Breadcrumbs' import { toEntityHeader } from '../details/configurations/ProjectListDetails' @@ -31,12 +31,12 @@ import { EntityDetailsListDataConfigurationType, } from '../details/EntityDetailsList' import { EntityFinderHeader } from '../EntityFinderHeader' +import { displayToast } from '../../ToastMessage/ToastMessage' import { EntityTreeNodeType, RootNodeConfiguration, VirtualizedTree, } from './VirtualizedTree' -import { displayToast } from '../../ToastMessage/ToastMessage' const isEntityIdInPath = (entityId: string, path: EntityPath): boolean => { for (const eh of path.path) { diff --git a/packages/synapse-react-client/src/components/EntityFinder/tree/VirtualizedTree.tsx b/packages/synapse-react-client/src/components/EntityFinder/tree/VirtualizedTree.tsx index 87d6a98980..7944078259 100644 --- a/packages/synapse-react-client/src/components/EntityFinder/tree/VirtualizedTree.tsx +++ b/packages/synapse-react-client/src/components/EntityFinder/tree/VirtualizedTree.tsx @@ -1,4 +1,4 @@ -import { Skeleton } from '@mui/material' +import { Skeleton, Tooltip, Typography } from '@mui/material' import { Map } from 'immutable' import { cloneDeep } from 'lodash-es' import dayjs from 'dayjs' @@ -13,6 +13,7 @@ import { VariableSizeTree, } from 'react-vtree' import { NodeComponentProps } from 'react-vtree/dist/es/Tree' +import { EntityType } from '@sage-bionetworks/synapse-types' import SynapseClient from '../../../synapse-client' import { formatDate } from '../../../utils/functions/DateFormatter' import { @@ -20,10 +21,7 @@ import { isContainerType, } from '../../../utils/functions/EntityTypeUtils' import { useSynapseContext } from '../../../utils/context/SynapseContext' -import { EntityType } from '@sage-bionetworks/synapse-types' -import { Tooltip } from '@mui/material' import { Writable } from '../../../utils/types/Writable' -import { Typography } from '@mui/material' import { EntityBadgeIcons } from '../../EntityBadgeIcons/EntityBadgeIcons' import { EntityTypeIcon } from '../../EntityIcon' import { SynapseSpinner } from '../../LoadingScreen/LoadingScreen' diff --git a/packages/synapse-react-client/src/components/EntityForm/EntityForm.tsx b/packages/synapse-react-client/src/components/EntityForm/EntityForm.tsx index b9bedd1537..14138c16e6 100644 --- a/packages/synapse-react-client/src/components/EntityForm/EntityForm.tsx +++ b/packages/synapse-react-client/src/components/EntityForm/EntityForm.tsx @@ -4,16 +4,16 @@ // Will give you the Synapse ID of the FileEntity that contains the user form data. import React from 'react' import Form from '@rjsf/core' -import SynapseClient from '../../synapse-client' import { EntityId, EntityLookupRequest, FileEntity, UserProfile, } from '@sage-bionetworks/synapse-types' +import validator from '@rjsf/validator-ajv8' +import SynapseClient from '../../synapse-client' import { getFileHandleContent } from '../../synapse-client/SynapseClient' import { SynapseContext } from '../../utils/context/SynapseContext' -import validator from '@rjsf/validator-ajv8' export type EntityFormProps = { // Provide the parent container (folder/project), that should contain a folder (named ) that this user can write to. diff --git a/packages/synapse-react-client/src/components/EntityLink.tsx b/packages/synapse-react-client/src/components/EntityLink.tsx index 0ec28b070d..98f058ea10 100644 --- a/packages/synapse-react-client/src/components/EntityLink.tsx +++ b/packages/synapse-react-client/src/components/EntityLink.tsx @@ -1,12 +1,12 @@ import { Link, Skeleton } from '@mui/material' import React from 'react' +import { Entity, EntityHeader } from '@sage-bionetworks/synapse-types' import { convertToEntityType, getEntityTypeFromHeader, } from '../utils/functions/EntityTypeUtils' import { PRODUCTION_ENDPOINT_CONFIG } from '../utils/functions/getEndpoint' import { useGetEntityHeader } from '../synapse-queries' -import { Entity, EntityHeader } from '@sage-bionetworks/synapse-types' import { EntityTypeIcon } from './EntityIcon' import { ErrorBanner } from './error/ErrorBanner' import ErrorChip from './error/ErrorChip' diff --git a/packages/synapse-react-client/src/components/Evaluation/CreatedOnByUserDiv.tsx b/packages/synapse-react-client/src/components/Evaluation/CreatedOnByUserDiv.tsx index 0708ac9ee8..1e16f183d9 100644 --- a/packages/synapse-react-client/src/components/Evaluation/CreatedOnByUserDiv.tsx +++ b/packages/synapse-react-client/src/components/Evaluation/CreatedOnByUserDiv.tsx @@ -1,6 +1,6 @@ +import React from 'react' import UserCard from '../UserCard/UserCard' import { SynapseConstants } from '../../utils' -import React from 'react' import { useSynapseContext } from '../../utils/context/SynapseContext' export type CreatedOnByUserDivProps = { diff --git a/packages/synapse-react-client/src/components/Evaluation/EvaluationCard.integration.test.tsx b/packages/synapse-react-client/src/components/Evaluation/EvaluationCard.integration.test.tsx index c56a91a502..6c2e3552dd 100644 --- a/packages/synapse-react-client/src/components/Evaluation/EvaluationCard.integration.test.tsx +++ b/packages/synapse-react-client/src/components/Evaluation/EvaluationCard.integration.test.tsx @@ -2,16 +2,16 @@ import React from 'react' import { render, screen, within } from '@testing-library/react' import userEvent, { PointerEventsCheckLevel } from '@testing-library/user-event' import JestMockPromise from 'jest-mock-promise' +import { UserEvaluationPermissions } from '@sage-bionetworks/synapse-types' import SynapseClient from '../../synapse-client' +import { createWrapper } from '../../testutils/TestingLibraryUtils' +import { server } from '../../mocks/msw/server' import { EvaluationCard, EvaluationCardProps, ExistingEvaluation, } from './EvaluationCard' -import { createWrapper } from '../../testutils/TestingLibraryUtils' -import { UserEvaluationPermissions } from '@sage-bionetworks/synapse-types' -import { server } from '../../mocks/msw/server' -import { UserEvent } from '@testing-library/user-event/dist/types/setup/setup' +import type { UserEvent } from '@testing-library/user-event/dist/types/setup/setup' describe('test Evaluation Card', () => { let permissions: UserEvaluationPermissions diff --git a/packages/synapse-react-client/src/components/Evaluation/EvaluationCard.tsx b/packages/synapse-react-client/src/components/Evaluation/EvaluationCard.tsx index 1e4731c50f..a4520fd0d9 100644 --- a/packages/synapse-react-client/src/components/Evaluation/EvaluationCard.tsx +++ b/packages/synapse-react-client/src/components/Evaluation/EvaluationCard.tsx @@ -1,19 +1,21 @@ import React, { useEffect, useState } from 'react' +import { + Evaluation, + UserEvaluationPermissions, +} from '@sage-bionetworks/synapse-types' +import { Button } from '@mui/material' +import { Card, Col, Dropdown, Row } from 'react-bootstrap' +import { SynapseClientError } from '../../utils/SynapseClientError' import { deleteEvaluation, getEvaluationPermissions, } from '../../synapse-client/SynapseClient' -import { SynapseClientError } from '../../utils/SynapseClientError' -import { Evaluation } from '@sage-bionetworks/synapse-types' -import { Button } from '@mui/material' -import { Card, Col, Dropdown, Row } from 'react-bootstrap' import { ErrorBanner } from '../error/ErrorBanner' -import { CreatedOnByUserDiv } from './CreatedOnByUserDiv' -import { UserEvaluationPermissions } from '@sage-bionetworks/synapse-types' import { RequiredProperties } from '../../utils' import WarningDialog from '../SynapseForm/WarningDialog' import { useSynapseContext } from '../../utils/context/SynapseContext' import IconSvg from '../IconSvg/IconSvg' +import { CreatedOnByUserDiv } from './CreatedOnByUserDiv' export type ExistingEvaluation = RequiredProperties< Evaluation, diff --git a/packages/synapse-react-client/src/components/Evaluation/EvaluationEditor.integration.test.tsx b/packages/synapse-react-client/src/components/Evaluation/EvaluationEditor.integration.test.tsx index 51ad80569d..5558b3c8be 100644 --- a/packages/synapse-react-client/src/components/Evaluation/EvaluationEditor.integration.test.tsx +++ b/packages/synapse-react-client/src/components/Evaluation/EvaluationEditor.integration.test.tsx @@ -1,17 +1,17 @@ import { render, screen, waitFor, within } from '@testing-library/react' import userEvent, { PointerEventsCheckLevel } from '@testing-library/user-event' -import { UserEvent } from '@testing-library/user-event/dist/types/setup/setup' import React from 'react' -import { EvaluationEditor, EvaluationEditorProps } from './EvaluationEditor' +import { Evaluation } from '@sage-bionetworks/synapse-types' import { createWrapper } from '../../testutils/TestingLibraryUtils' import { EVALUATION, EVALUATION_BY_ID } from '../../utils/APIConstants' import { BackendDestinationEnum, getEndpoint, } from '../../utils/functions/getEndpoint' -import { Evaluation } from '@sage-bionetworks/synapse-types' import { rest, server } from '../../mocks/msw/server' import { MOCK_USER_ID } from '../../mocks/user/mock_user_profile' +import { EvaluationEditor, EvaluationEditorProps } from './EvaluationEditor' +import type { UserEvent } from '@testing-library/user-event/setup/setup' describe('test EvaluationEditor', () => { const evaluationId = '1234' diff --git a/packages/synapse-react-client/src/components/Evaluation/EvaluationEditor.tsx b/packages/synapse-react-client/src/components/Evaluation/EvaluationEditor.tsx index 4fedad7fda..45b308ba26 100644 --- a/packages/synapse-react-client/src/components/Evaluation/EvaluationEditor.tsx +++ b/packages/synapse-react-client/src/components/Evaluation/EvaluationEditor.tsx @@ -1,14 +1,14 @@ import { Alert, Button } from '@mui/material' import { Col, Dropdown, Form, Row } from 'react-bootstrap' import React, { useEffect, useState } from 'react' +import { Evaluation } from '@sage-bionetworks/synapse-types' import SynapseClient from '../../synapse-client' import { SynapseClientError } from '../../utils/SynapseClientError' import { ErrorBanner } from '../error/ErrorBanner' -import { Evaluation } from '@sage-bionetworks/synapse-types' -import { CreatedOnByUserDiv } from './CreatedOnByUserDiv' import WarningDialog from '../SynapseForm/WarningDialog' import { useSynapseContext } from '../../utils/context/SynapseContext' import IconSvg from '../IconSvg/IconSvg' +import { CreatedOnByUserDiv } from './CreatedOnByUserDiv' export type EvaluationEditorProps = { /** Use if UPDATING an existing Evaluation. Id of the evaluation to edit */ diff --git a/packages/synapse-react-client/src/components/Evaluation/EvaluationEditorPage.test.tsx b/packages/synapse-react-client/src/components/Evaluation/EvaluationEditorPage.test.tsx index 53509b1914..673ad584ee 100644 --- a/packages/synapse-react-client/src/components/Evaluation/EvaluationEditorPage.test.tsx +++ b/packages/synapse-react-client/src/components/Evaluation/EvaluationEditorPage.test.tsx @@ -1,11 +1,11 @@ import { render, screen, act } from '@testing-library/react' import React from 'react' +import { createWrapper } from '../../testutils/TestingLibraryUtils' import { EvaluationEditor as mockEvaluationEditor } from './EvaluationEditor' import { EvaluationEditorPage, EvaluationEditorPageProps, } from './EvaluationEditorPage' -import { createWrapper } from '../../testutils/TestingLibraryUtils' jest.mock( '../../../src/components/Evaluation/EvaluationRoundEditorList', diff --git a/packages/synapse-react-client/src/components/Evaluation/EvaluationEditorPage.tsx b/packages/synapse-react-client/src/components/Evaluation/EvaluationEditorPage.tsx index 6adeb7913d..78a21fabc7 100644 --- a/packages/synapse-react-client/src/components/Evaluation/EvaluationEditorPage.tsx +++ b/packages/synapse-react-client/src/components/Evaluation/EvaluationEditorPage.tsx @@ -1,7 +1,7 @@ import React, { useState } from 'react' +import { Alert, Button } from '@mui/material' import { EvaluationEditor } from './EvaluationEditor' import { EvaluationRoundEditorList } from './EvaluationRoundEditorList' -import { Alert, Button } from '@mui/material' export type EvaluationEditorPageProps = { /** Use if UPDATING an existing Evaluation. Id of the evaluation to edit */ diff --git a/packages/synapse-react-client/src/components/Evaluation/EvaluationIdRenderer.test.tsx b/packages/synapse-react-client/src/components/Evaluation/EvaluationIdRenderer.test.tsx index 90e5f10c51..420f9d416e 100644 --- a/packages/synapse-react-client/src/components/Evaluation/EvaluationIdRenderer.test.tsx +++ b/packages/synapse-react-client/src/components/Evaluation/EvaluationIdRenderer.test.tsx @@ -1,14 +1,13 @@ import React from 'react' import { mockAllIsIntersecting } from 'react-intersection-observer/test-utils' +import { act, render, screen, waitFor } from '@testing-library/react' import EvaluationIdRenderer, { EvaluationIdRendererProps, } from '../SynapseTable/SynapseTableCell/EvaluationIdRenderer' -import { act } from '@testing-library/react' import { MOCK_CONTEXT_VALUE, SynapseTestContext, } from '../../mocks/MockSynapseContext' -import { render, screen, waitFor } from '@testing-library/react' import { mockEvaluationQueue } from '../../mocks/entity/mockEvaluationQueue' import SynapseClient from '../../synapse-client' diff --git a/packages/synapse-react-client/src/components/Evaluation/EvaluationRoundEditor.test.tsx b/packages/synapse-react-client/src/components/Evaluation/EvaluationRoundEditor.test.tsx index 6db201459b..db169b12ce 100644 --- a/packages/synapse-react-client/src/components/Evaluation/EvaluationRoundEditor.test.tsx +++ b/packages/synapse-react-client/src/components/Evaluation/EvaluationRoundEditor.test.tsx @@ -9,6 +9,10 @@ import JestMockPromise from 'jest-mock-promise' import dayjs, { Dayjs } from 'dayjs' import duration from 'dayjs/plugin/duration' import React from 'react' +import { EvaluationRound } from '@sage-bionetworks/synapse-types' +import { createWrapper } from '../../testutils/TestingLibraryUtils' +import SynapseClient from '../../synapse-client' +import { MOCK_CONTEXT_VALUE } from '../../mocks/MockSynapseContext' import { EvaluationRoundEditor, EvaluationRoundEditorProps, @@ -18,10 +22,6 @@ import { EvaluationRoundInput, EvaluationRoundLimitInput, } from './input_models/models' -import { createWrapper } from '../../testutils/TestingLibraryUtils' -import SynapseClient from '../../synapse-client' -import { EvaluationRound } from '@sage-bionetworks/synapse-types' -import { MOCK_CONTEXT_VALUE } from '../../mocks/MockSynapseContext' dayjs.extend(duration) diff --git a/packages/synapse-react-client/src/components/Evaluation/EvaluationRoundEditor.tsx b/packages/synapse-react-client/src/components/Evaluation/EvaluationRoundEditor.tsx index 56fa310323..a54d2e0061 100644 --- a/packages/synapse-react-client/src/components/Evaluation/EvaluationRoundEditor.tsx +++ b/packages/synapse-react-client/src/components/Evaluation/EvaluationRoundEditor.tsx @@ -6,26 +6,26 @@ import React, { useEffect, useState } from 'react' import { Alert, Button } from '@mui/material' import { Card, Col, Form, FormControl, FormGroup, Row } from 'react-bootstrap' import dayjs, { Dayjs } from 'dayjs' -import { CalendarWithIconFormGroup } from './CalendarWithIconFormGroup' -import { EvaluationRoundLimitOptionsList } from './round_limits/EvaluationRoundLimitOptionsList' +import utc from 'dayjs/plugin/utc' +import isSameOrAfter from 'dayjs/plugin/isSameOrAfter' import { useListState } from '../../utils/hooks/useListState' -import { - convertEvaluationRoundToInput, - EvaluationRoundInput, - EvaluationRoundLimitInput, -} from './input_models/models' import { updateEvaluationRound, createEvaluationRound, deleteEvaluationRound, } from '../../synapse-client/SynapseClient' import { SynapseClientError } from '../../utils/SynapseClientError' -import { EvaluationRoundEditorDropdown } from './EvaluationRoundEditorDropdown' import { ErrorBanner } from '../error/ErrorBanner' import { useSynapseContext } from '../../utils/context/SynapseContext' import IconSvg, { IconSvgProps } from '../IconSvg/IconSvg' -import utc from 'dayjs/plugin/utc' -import isSameOrAfter from 'dayjs/plugin/isSameOrAfter' +import { EvaluationRoundEditorDropdown } from './EvaluationRoundEditorDropdown' +import { + convertEvaluationRoundToInput, + EvaluationRoundInput, + EvaluationRoundLimitInput, +} from './input_models/models' +import { EvaluationRoundLimitOptionsList } from './round_limits/EvaluationRoundLimitOptionsList' +import { CalendarWithIconFormGroup } from './CalendarWithIconFormGroup' dayjs.extend(utc) dayjs.extend(isSameOrAfter) diff --git a/packages/synapse-react-client/src/components/Evaluation/EvaluationRoundEditorList.test.tsx b/packages/synapse-react-client/src/components/Evaluation/EvaluationRoundEditorList.test.tsx index 94bf6a11ee..f81ec53b8d 100644 --- a/packages/synapse-react-client/src/components/Evaluation/EvaluationRoundEditorList.test.tsx +++ b/packages/synapse-react-client/src/components/Evaluation/EvaluationRoundEditorList.test.tsx @@ -2,11 +2,11 @@ import { render, screen } from '@testing-library/react' import userEvent from '@testing-library/user-event' import JestMockPromise from 'jest-mock-promise' import React from 'react' -import { EvaluationRoundEditorList } from './EvaluationRoundEditorList' +import { EvaluationRound } from '@sage-bionetworks/synapse-types' import { createWrapper } from '../../testutils/TestingLibraryUtils' import SynapseClient from '../../synapse-client' -import { EvaluationRound } from '@sage-bionetworks/synapse-types' import { MOCK_CONTEXT_VALUE } from '../../mocks/MockSynapseContext' +import { EvaluationRoundEditorList } from './EvaluationRoundEditorList' describe('test EvaluationRoundEditorList', () => { const evaluationId = '123123123' diff --git a/packages/synapse-react-client/src/components/Evaluation/EvaluationRoundEditorList.tsx b/packages/synapse-react-client/src/components/Evaluation/EvaluationRoundEditorList.tsx index 3ea53c38e6..95c3ccf6e0 100644 --- a/packages/synapse-react-client/src/components/Evaluation/EvaluationRoundEditorList.tsx +++ b/packages/synapse-react-client/src/components/Evaluation/EvaluationRoundEditorList.tsx @@ -1,17 +1,17 @@ import React, { useEffect, useState } from 'react' -import { useListState } from '../../utils/hooks/useListState' -import { EvaluationRoundEditor } from './EvaluationRoundEditor' import { Button } from '@mui/material' -import { - convertEvaluationRoundToInput, - EvaluationRoundInput, -} from './input_models/models' -import { getEvaluationRoundsList } from '../../synapse-client/SynapseClient' -import { SynapseClientError } from '../../utils/SynapseClientError' import shortid from 'shortid' import { EvaluationRoundListResponse } from '@sage-bionetworks/synapse-types' +import { getEvaluationRoundsList } from '../../synapse-client/SynapseClient' +import { SynapseClientError } from '../../utils/SynapseClientError' +import { useListState } from '../../utils/hooks/useListState' import { ErrorBanner } from '../error/ErrorBanner' import { useSynapseContext } from '../../utils/context/SynapseContext' +import { + convertEvaluationRoundToInput, + EvaluationRoundInput, +} from './input_models/models' +import { EvaluationRoundEditor } from './EvaluationRoundEditor' export type EvaluationRoundEditorListProps = { /** id of the Evaluation containing EvaluationRounds to edit*/ diff --git a/packages/synapse-react-client/src/components/Evaluation/index.ts b/packages/synapse-react-client/src/components/Evaluation/index.ts index 19bd709f31..9ca349d5bd 100644 --- a/packages/synapse-react-client/src/components/Evaluation/index.ts +++ b/packages/synapse-react-client/src/components/Evaluation/index.ts @@ -1,6 +1,6 @@ import { EvaluationCard } from './EvaluationCard' -import type { EvaluationCardProps } from './EvaluationCard' import { EvaluationEditorPage } from './EvaluationEditorPage' +import type { EvaluationCardProps } from './EvaluationCard' import type { EvaluationEditorPageProps } from './EvaluationEditorPage' export { diff --git a/packages/synapse-react-client/src/components/Evaluation/input_models/models.test.ts b/packages/synapse-react-client/src/components/Evaluation/input_models/models.test.ts index 035f459e7a..b8f02cdd40 100644 --- a/packages/synapse-react-client/src/components/Evaluation/input_models/models.test.ts +++ b/packages/synapse-react-client/src/components/Evaluation/input_models/models.test.ts @@ -1,6 +1,6 @@ import { EvaluationRound } from '@sage-bionetworks/synapse-types' -import { convertEvaluationRoundToInput, EvaluationRoundInput } from './models' import shortid from 'shortid' +import { convertEvaluationRoundToInput, EvaluationRoundInput } from './models' describe('test conversion from EvaluaitonRound to EvaluationRoundInput', () => { let evaluationRound!: EvaluationRound diff --git a/packages/synapse-react-client/src/components/Evaluation/round_limits/EvaluationRoundLimitOptions.test.tsx b/packages/synapse-react-client/src/components/Evaluation/round_limits/EvaluationRoundLimitOptions.test.tsx index 2195e8ae8a..db4a08e843 100644 --- a/packages/synapse-react-client/src/components/Evaluation/round_limits/EvaluationRoundLimitOptions.test.tsx +++ b/packages/synapse-react-client/src/components/Evaluation/round_limits/EvaluationRoundLimitOptions.test.tsx @@ -1,13 +1,13 @@ -import { EvaluationRoundLimitInput } from '../input_models/models' import { EvaluationRoundLimitType } from '@sage-bionetworks/synapse-types' +import React, { useState } from 'react' +import { render, screen, waitFor, within } from '@testing-library/react' +import userEvent from '@testing-library/user-event' +import { createWrapper } from '../../../testutils/TestingLibraryUtils' +import { EvaluationRoundLimitInput } from '../input_models/models' import { EvaluationRoundLimitOptions, EvaluationRoundLimitOptionsProps, } from './EvaluationRoundLimitOptions' -import React, { useState } from 'react' -import { render, screen, waitFor, within } from '@testing-library/react' -import { createWrapper } from '../../../testutils/TestingLibraryUtils' -import userEvent from '@testing-library/user-event' const onChangeSpy = jest.fn() diff --git a/packages/synapse-react-client/src/components/ExperimentalMode/ExperimentalMode.tsx b/packages/synapse-react-client/src/components/ExperimentalMode/ExperimentalMode.tsx index 09b5b33576..38a4c2c32f 100644 --- a/packages/synapse-react-client/src/components/ExperimentalMode/ExperimentalMode.tsx +++ b/packages/synapse-react-client/src/components/ExperimentalMode/ExperimentalMode.tsx @@ -1,10 +1,9 @@ -import React from 'react' +import React, { useEffect, useState } from 'react' import { Button, IconButton, Tooltip } from '@mui/material' -import { useEffect, useState } from 'react' import UniversalCookies from 'universal-cookie' +import { InfoOutlined } from '@mui/icons-material' import { isInSynapseExperimentalMode } from '../../synapse-client/SynapseClient' import { EXPERIMENTAL_MODE_COOKIE } from '../../utils/SynapseConstants' -import { InfoOutlined } from '@mui/icons-material' const experimentalModeText = 'This mode gives you early access to features that are still in development. Please note that we do not guarantee an absence of errors, and that the data created using these features may be lost during product upgrade.' diff --git a/packages/synapse-react-client/src/components/ExternalFileHandleLink/ExternalFileHandleLink.tsx b/packages/synapse-react-client/src/components/ExternalFileHandleLink/ExternalFileHandleLink.tsx index 7ddf0947b7..114b2aa002 100644 --- a/packages/synapse-react-client/src/components/ExternalFileHandleLink/ExternalFileHandleLink.tsx +++ b/packages/synapse-react-client/src/components/ExternalFileHandleLink/ExternalFileHandleLink.tsx @@ -5,8 +5,8 @@ import { FileEntity, ExternalFileHandle, } from '@sage-bionetworks/synapse-types' -import SynapseClient from '../../synapse-client' import { OpenInNewTwoTone } from '@mui/icons-material' +import SynapseClient from '../../synapse-client' import { useSynapseContext } from '../../utils/context/SynapseContext' import { isFileEntity, isExternalFileHandle } from '../../utils/types/IsType' diff --git a/packages/synapse-react-client/src/components/FeaturedDataTabs/FacetPlotsCard.tsx b/packages/synapse-react-client/src/components/FeaturedDataTabs/FacetPlotsCard.tsx index 302503868b..1c974f6d5f 100644 --- a/packages/synapse-react-client/src/components/FeaturedDataTabs/FacetPlotsCard.tsx +++ b/packages/synapse-react-client/src/components/FeaturedDataTabs/FacetPlotsCard.tsx @@ -8,6 +8,16 @@ import { FacetColumnResultValueCount, FacetColumnResultValues, } from '@sage-bionetworks/synapse-types' +import { + Box, + Button, + Divider, + Paper, + Skeleton, + Typography, +} from '@mui/material' +import { times } from 'lodash-es' +import { useAtomValue } from 'jotai' import { extractPlotDataArray, getPlotStyle, @@ -17,15 +27,12 @@ import { getFacets } from '../widgets/facet-nav/FacetNav' import { useSynapseContext } from '../../utils/context/SynapseContext' import { useQueryVisualizationContext } from '../QueryVisualizationWrapper' import { ShowMore } from '../row_renderers/utils' -import { - Box, - Button, - Divider, - Paper, - Skeleton, - Typography, -} from '@mui/material' import { FacetPlotLegendTable } from '../widgets/facet-nav/FacetPlotLegendTable' +import { SkeletonParagraph, SkeletonTable } from '../Skeleton' +import { + isLoadingNewBundleAtom, + tableQueryDataAtom, +} from '../QueryWrapper/QueryWrapper' import { FACET_PLOTS_CARD_CLASSNAME, FACET_PLOTS_CARD_PLOT_CONTAINER_CLASSNAME, @@ -33,13 +40,6 @@ import { FacetPlotsCardPlotContainer, FacetPlotsCardTitleContainer, } from './FacetPlotsCardGrid' -import { SkeletonParagraph, SkeletonTable } from '../Skeleton' -import { times } from 'lodash-es' -import { useAtomValue } from 'jotai' -import { - isLoadingNewBundleAtom, - tableQueryDataAtom, -} from '../QueryWrapper/QueryWrapper' const Plot = createPlotlyComponent(Plotly) diff --git a/packages/synapse-react-client/src/components/FeaturedDataTabs/FeaturedDataPlots.tsx b/packages/synapse-react-client/src/components/FeaturedDataTabs/FeaturedDataPlots.tsx index 0e27dda41a..8b5698ca9e 100644 --- a/packages/synapse-react-client/src/components/FeaturedDataTabs/FeaturedDataPlots.tsx +++ b/packages/synapse-react-client/src/components/FeaturedDataTabs/FeaturedDataPlots.tsx @@ -1,11 +1,11 @@ import React from 'react' +import { chunk, times } from 'lodash-es' import QueryPerFacetPlotsCard, { QueryPerFacetPlotsCardProps, } from './QueryPerFacetPlotsCard' import SingleQueryFacetPlotsCards, { SingleQueryFacetPlotsCardsProps, } from './SingleQueryFacetPlotsCards' -import { chunk, times } from 'lodash-es' import { FacetPlotsCardGridContainer } from './FacetPlotsCardGrid' import { CARDS_PER_ROW } from './FeaturedDataTabsUtils' diff --git a/packages/synapse-react-client/src/components/FeaturedDataTabs/FeaturedDataTabs.stories.ts b/packages/synapse-react-client/src/components/FeaturedDataTabs/FeaturedDataTabs.stories.ts index 5ff9cc9277..63230c3f0c 100644 --- a/packages/synapse-react-client/src/components/FeaturedDataTabs/FeaturedDataTabs.stories.ts +++ b/packages/synapse-react-client/src/components/FeaturedDataTabs/FeaturedDataTabs.stories.ts @@ -1,11 +1,11 @@ import { Meta, StoryObj } from '@storybook/react' -import FeaturedDataTabs from './FeaturedDataTabs' import { getHandlersForTableQuery } from '../../mocks/msw/handlers/tableQueryHandlers' import { MOCK_REPO_ORIGIN } from '../../utils/functions/getEndpoint' import { mockQueryPerCardResult, mockSingleQueryResult, } from '../../mocks/query/mockFeaturedDataTabsQueryData' +import FeaturedDataTabs from './FeaturedDataTabs' const meta = { title: 'Home Page/FeaturedDataTabs', diff --git a/packages/synapse-react-client/src/components/FeaturedDataTabs/FeaturedDataTabs.test.tsx b/packages/synapse-react-client/src/components/FeaturedDataTabs/FeaturedDataTabs.test.tsx index ad93878bec..67075ebe1c 100644 --- a/packages/synapse-react-client/src/components/FeaturedDataTabs/FeaturedDataTabs.test.tsx +++ b/packages/synapse-react-client/src/components/FeaturedDataTabs/FeaturedDataTabs.test.tsx @@ -1,9 +1,9 @@ import { render } from '@testing-library/react' import React from 'react' -import FeaturedDataTabs, { FeaturedDataTabsProps } from './FeaturedDataTabs' import { createWrapper } from '../../testutils/TestingLibraryUtils' import syn16787123Json from '../../mocks/query/syn16787123' import SynapseClient from '../../synapse-client' +import FeaturedDataTabs, { FeaturedDataTabsProps } from './FeaturedDataTabs' const data = syn16787123Json diff --git a/packages/synapse-react-client/src/components/FeaturedDataTabs/FeaturedDataTabs.tsx b/packages/synapse-react-client/src/components/FeaturedDataTabs/FeaturedDataTabs.tsx index e994132d65..3a12be020d 100644 --- a/packages/synapse-react-client/src/components/FeaturedDataTabs/FeaturedDataTabs.tsx +++ b/packages/synapse-react-client/src/components/FeaturedDataTabs/FeaturedDataTabs.tsx @@ -1,10 +1,8 @@ -import React from 'react' -import { useState } from 'react' -import FeaturedDataPlots, { FeaturedDataPlotsProps } from './FeaturedDataPlots' +import React, { useState } from 'react' +import { Button, Paper } from '@mui/material' import { Icon } from '../row_renderers/utils' import NoContentAvailable from '../SynapseTable/NoContentAvailable' -import { Button } from '@mui/material' -import { Paper } from '@mui/material' +import FeaturedDataPlots, { FeaturedDataPlotsProps } from './FeaturedDataPlots' export type FeatureDataTabProps = { title: string // type of data being shown, used for the tab title and explore all button diff --git a/packages/synapse-react-client/src/components/FeaturedDataTabs/QueryPerFacetPlotsCard.tsx b/packages/synapse-react-client/src/components/FeaturedDataTabs/QueryPerFacetPlotsCard.tsx index b6f01945c4..7932e44a92 100644 --- a/packages/synapse-react-client/src/components/FeaturedDataTabs/QueryPerFacetPlotsCard.tsx +++ b/packages/synapse-react-client/src/components/FeaturedDataTabs/QueryPerFacetPlotsCard.tsx @@ -1,8 +1,8 @@ import React from 'react' +import { QueryBundleRequest } from '@sage-bionetworks/synapse-types' import { SynapseConstants } from '../../utils' import { parseEntityIdFromSqlStatement } from '../../utils/functions' import { DEFAULT_PAGE_SIZE } from '../../utils/SynapseConstants' -import { QueryBundleRequest } from '@sage-bionetworks/synapse-types' import { QueryVisualizationContextType, QueryVisualizationWrapper, diff --git a/packages/synapse-react-client/src/components/FeaturedDataTabs/SingleQueryFacetPlotsCards.tsx b/packages/synapse-react-client/src/components/FeaturedDataTabs/SingleQueryFacetPlotsCards.tsx index 0e527c5ada..6067a336d3 100644 --- a/packages/synapse-react-client/src/components/FeaturedDataTabs/SingleQueryFacetPlotsCards.tsx +++ b/packages/synapse-react-client/src/components/FeaturedDataTabs/SingleQueryFacetPlotsCards.tsx @@ -1,7 +1,8 @@ import React from 'react' +import { QueryBundleRequest } from '@sage-bionetworks/synapse-types' +import { chunk } from 'lodash-es' import { SynapseConstants } from '../../utils' import { parseEntityIdFromSqlStatement } from '../../utils/functions' -import { QueryBundleRequest } from '@sage-bionetworks/synapse-types' import { QueryVisualizationContextType, QueryVisualizationWrapper, @@ -9,7 +10,6 @@ import { import { QueryWrapper } from '../QueryWrapper' import { QueryWrapperErrorBanner } from '../QueryWrapperErrorBanner' import FacetPlotsCard from './FacetPlotsCard' -import { chunk } from 'lodash-es' import { FacetPlotsCardGridContainer } from './FacetPlotsCardGrid' import { CARDS_PER_ROW } from './FeaturedDataTabsUtils' diff --git a/packages/synapse-react-client/src/components/FeaturedToolsList/FeaturedToolsList.test.tsx b/packages/synapse-react-client/src/components/FeaturedToolsList/FeaturedToolsList.test.tsx index a870d6e6d5..1b73ab00b5 100644 --- a/packages/synapse-react-client/src/components/FeaturedToolsList/FeaturedToolsList.test.tsx +++ b/packages/synapse-react-client/src/components/FeaturedToolsList/FeaturedToolsList.test.tsx @@ -1,11 +1,11 @@ import React from 'react' -import FeaturedToolsList from './FeaturedToolsList' import { QueryResultBundle } from '@sage-bionetworks/synapse-types' -import syn26344826Json from '../../mocks/query/syn26344826.json' import { render } from '@testing-library/react' import { act } from 'react-dom/test-utils' +import syn26344826Json from '../../mocks/query/syn26344826.json' import SynapseClient from '../../synapse-client' import { createWrapper } from '../../testutils/TestingLibraryUtils' +import FeaturedToolsList from './FeaturedToolsList' jest.mock('../../synapse-client', () => ({ getQueryTableResults: jest.fn(), diff --git a/packages/synapse-react-client/src/components/FeaturedToolsList/FeaturedToolsList.tsx b/packages/synapse-react-client/src/components/FeaturedToolsList/FeaturedToolsList.tsx index 4dd6c2cf5c..e10c408f6a 100644 --- a/packages/synapse-react-client/src/components/FeaturedToolsList/FeaturedToolsList.tsx +++ b/packages/synapse-react-client/src/components/FeaturedToolsList/FeaturedToolsList.tsx @@ -1,11 +1,11 @@ +import { QueryBundleRequest } from '@sage-bionetworks/synapse-types' +import React, { useState, useEffect } from 'react' import { SynapseConstants } from '../../utils' import { getFieldIndex } from '../../utils/functions/queryUtils' import useGetQueryResultBundle from '../../synapse-queries/entity/useGetQueryResultBundle' -import { QueryBundleRequest } from '@sage-bionetworks/synapse-types' -import React, { useState, useEffect } from 'react' -import { FeaturedToolCard } from './FeaturedToolCard' import { ErrorBanner } from '../error/ErrorBanner' import { useSynapseContext } from '../../utils/context/SynapseContext' +import { FeaturedToolCard } from './FeaturedToolCard' export type FeaturedToolsListProps = { entityId: string diff --git a/packages/synapse-react-client/src/components/FilePreview/EntityPreview.integration.test.tsx b/packages/synapse-react-client/src/components/FilePreview/EntityPreview.integration.test.tsx index 24c5f2e3fc..ab55bc11ce 100644 --- a/packages/synapse-react-client/src/components/FilePreview/EntityPreview.integration.test.tsx +++ b/packages/synapse-react-client/src/components/FilePreview/EntityPreview.integration.test.tsx @@ -1,12 +1,12 @@ import { render, screen, within } from '@testing-library/react' import React from 'react' -import * as FileEntityPreviewModule from './FileEntityPreview' import { createWrapper } from '../../testutils/TestingLibraryUtils' import mockFileEntityData from '../../mocks/entity/mockFileEntity' import { server } from '../../mocks/msw/server' import mockDatasetData from '../../mocks/entity/mockDataset' import { SynapseContextType } from '../../utils/context/SynapseContext' import { MOCK_CONTEXT_VALUE } from '../../mocks/MockSynapseContext' +import * as FileEntityPreviewModule from './FileEntityPreview' import EntityPreview, { EntityPreviewProps } from './EntityPreview' jest.spyOn(FileEntityPreviewModule, 'default').mockImplementation(() => { diff --git a/packages/synapse-react-client/src/components/FilePreview/EntityPreview.tsx b/packages/synapse-react-client/src/components/FilePreview/EntityPreview.tsx index 2981e983b8..1d0c7db9de 100644 --- a/packages/synapse-react-client/src/components/FilePreview/EntityPreview.tsx +++ b/packages/synapse-react-client/src/components/FilePreview/EntityPreview.tsx @@ -1,13 +1,13 @@ import React from 'react' -import { useResolveLinkEntity } from '../../utils/functions/ResolveLinkEntity' -import useGetEntityBundle from '../../synapse-queries/entity/useEntityBundle' import { ALL_ENTITY_BUNDLE_FIELDS, FileEntity, } from '@sage-bionetworks/synapse-types' +import { useResolveLinkEntity } from '../../utils/functions/ResolveLinkEntity' +import useGetEntityBundle from '../../synapse-queries/entity/useEntityBundle' import { SynapseSpinner } from '../LoadingScreen/LoadingScreen' -import FileEntityPreview from './FileEntityPreview' import { isFileEntity } from '../../utils/types/IsType' +import FileEntityPreview from './FileEntityPreview' export type EntityPreviewProps = { entityId: string diff --git a/packages/synapse-react-client/src/components/FilePreview/FileEntityPreview.integration.test.tsx b/packages/synapse-react-client/src/components/FilePreview/FileEntityPreview.integration.test.tsx index fc2d8842f0..25bdcc4261 100644 --- a/packages/synapse-react-client/src/components/FilePreview/FileEntityPreview.integration.test.tsx +++ b/packages/synapse-react-client/src/components/FilePreview/FileEntityPreview.integration.test.tsx @@ -1,13 +1,5 @@ import { render, screen, within } from '@testing-library/react' import React from 'react' -import FileEntityPreview, { FileEntityPreviewProps } from './FileEntityPreview' -import * as FileHandleContentRendererModule from './FileHandleContentRenderer' -import { PreviewRendererType } from './PreviewRendererType' -import { createWrapper } from '../../testutils/TestingLibraryUtils' -import { - BackendDestinationEnum, - getEndpoint, -} from '../../utils/functions/getEndpoint' import { BatchFileResult, EntityBundle, @@ -16,12 +8,20 @@ import { FileHandleAssociation, S3FileHandle, } from '@sage-bionetworks/synapse-types' +import { createWrapper } from '../../testutils/TestingLibraryUtils' +import { + BackendDestinationEnum, + getEndpoint, +} from '../../utils/functions/getEndpoint' import mockFileEntityData from '../../mocks/entity/mockFileEntity' import { MOCK_FILE_HANDLE_ID } from '../../mocks/mock_file_handle' import { rest, server } from '../../mocks/msw/server' import mockDatasetData from '../../mocks/entity/mockDataset' import { SynapseContextType } from '../../utils/context/SynapseContext' import { MOCK_CONTEXT_VALUE } from '../../mocks/MockSynapseContext' +import { PreviewRendererType } from './PreviewRendererType' +import * as FileHandleContentRendererModule from './FileHandleContentRenderer' +import FileEntityPreview, { FileEntityPreviewProps } from './FileEntityPreview' jest .spyOn(FileHandleContentRendererModule, 'default') diff --git a/packages/synapse-react-client/src/components/FilePreview/FileEntityPreview.tsx b/packages/synapse-react-client/src/components/FilePreview/FileEntityPreview.tsx index 452a660775..85fec8677e 100644 --- a/packages/synapse-react-client/src/components/FilePreview/FileEntityPreview.tsx +++ b/packages/synapse-react-client/src/components/FilePreview/FileEntityPreview.tsx @@ -3,19 +3,19 @@ import { EntityBundle, FileHandleAssociateType, } from '@sage-bionetworks/synapse-types' -import FileHandleContentRenderer from './FileHandleContentRenderer' -import { PreviewRendererType } from './PreviewRendererType' -import { - getOriginalFileHandleRenderer, - getPreviewFileHandleRenderer, -} from './PreviewUtils' -import { useSynapseContext } from '../../utils/context/SynapseContext' import { Alert } from '@mui/material' +import { useSynapseContext } from '../../utils/context/SynapseContext' import { SignInPrompt } from '../error/ErrorBanner' import { implementsCloudProviderFileHandleInterface, isFileEntity, } from '../../utils/types/IsType' +import FileHandleContentRenderer from './FileHandleContentRenderer' +import { PreviewRendererType } from './PreviewRendererType' +import { + getOriginalFileHandleRenderer, + getPreviewFileHandleRenderer, +} from './PreviewUtils' export type FileEntityPreviewProps = { /** An entity bundle containing a FileEntity, and its fileHandles */ diff --git a/packages/synapse-react-client/src/components/FilePreview/FileHandleContentRenderer.integration.test.tsx b/packages/synapse-react-client/src/components/FilePreview/FileHandleContentRenderer.integration.test.tsx index 7a00d103f9..68ca089889 100644 --- a/packages/synapse-react-client/src/components/FilePreview/FileHandleContentRenderer.integration.test.tsx +++ b/packages/synapse-react-client/src/components/FilePreview/FileHandleContentRenderer.integration.test.tsx @@ -1,25 +1,25 @@ import { render, screen, waitFor, within } from '@testing-library/react' import React from 'react' -import FileHandleContentRenderer, { - FileHandleContentRendererProps, -} from './FileHandleContentRenderer' -import * as HtmlPreviewModule from './HtmlPreview/HtmlPreview' -import { PreviewRendererType } from './PreviewRendererType' -import { createWrapper } from '../../testutils/TestingLibraryUtils' -import { - BackendDestinationEnum, - getEndpoint, -} from '../../utils/functions/getEndpoint' -import { MB } from '../../utils/SynapseConstants' import { BatchFileResult, FileHandle, FileHandleAssociateType, FileHandleAssociation, } from '@sage-bionetworks/synapse-types' +import { createWrapper } from '../../testutils/TestingLibraryUtils' +import { + BackendDestinationEnum, + getEndpoint, +} from '../../utils/functions/getEndpoint' +import { MB } from '../../utils/SynapseConstants' import mockFileEntityData from '../../mocks/entity/mockFileEntity' import { MOCK_FILE_HANDLE_ID } from '../../mocks/mock_file_handle' import { rest, server } from '../../mocks/msw/server' +import { PreviewRendererType } from './PreviewRendererType' +import * as HtmlPreviewModule from './HtmlPreview/HtmlPreview' +import FileHandleContentRenderer, { + FileHandleContentRendererProps, +} from './FileHandleContentRenderer' jest.spyOn(HtmlPreviewModule, 'default').mockImplementation(() => { return
diff --git a/packages/synapse-react-client/src/components/FilePreview/FileHandleContentRenderer.tsx b/packages/synapse-react-client/src/components/FilePreview/FileHandleContentRenderer.tsx index b3740dc2d9..84f3c746f0 100644 --- a/packages/synapse-react-client/src/components/FilePreview/FileHandleContentRenderer.tsx +++ b/packages/synapse-react-client/src/components/FilePreview/FileHandleContentRenderer.tsx @@ -1,11 +1,11 @@ import React from 'react' -import { useGetPresignedUrlContent } from '../../synapse-queries/file/useFiles' -import { MB } from '../../utils/SynapseConstants' import { FileHandle, FileHandleAssociation, BatchFileRequest, } from '@sage-bionetworks/synapse-types' +import { useGetPresignedUrlContent } from '../../synapse-queries/file/useFiles' +import { MB } from '../../utils/SynapseConstants' import { SynapseSpinner } from '../LoadingScreen/LoadingScreen' import HtmlPreview from './HtmlPreview/HtmlPreview' import { PreviewRendererType } from './PreviewRendererType' diff --git a/packages/synapse-react-client/src/components/FilePreview/HtmlPreview/HtmlPreview.integration.test.tsx b/packages/synapse-react-client/src/components/FilePreview/HtmlPreview/HtmlPreview.integration.test.tsx index f38fdc0109..cbc4b0e98e 100644 --- a/packages/synapse-react-client/src/components/FilePreview/HtmlPreview/HtmlPreview.integration.test.tsx +++ b/packages/synapse-react-client/src/components/FilePreview/HtmlPreview/HtmlPreview.integration.test.tsx @@ -1,9 +1,6 @@ import { render, renderHook, screen, waitFor } from '@testing-library/react' import React from 'react' -import HtmlPreview, { - EXPORTED_FOR_UNIT_TESTING, - HtmlPreviewProps, -} from './HtmlPreview' +import { TeamMember } from '@sage-bionetworks/synapse-types' import { createWrapper } from '../../../testutils/TestingLibraryUtils' import { TEAM_ID_MEMBER_ID } from '../../../utils/APIConstants' import { @@ -11,13 +8,16 @@ import { getEndpoint, } from '../../../utils/functions/getEndpoint' import { TRUSTED_HTML_USERS_TEAM_ID } from '../../../utils/SynapseConstants' -import { TeamMember } from '@sage-bionetworks/synapse-types' import { rest, server } from '../../../mocks/msw/server' import { MOCK_USER_ID, MOCK_USER_ID_2, MOCK_USER_NAME, } from '../../../mocks/user/mock_user_profile' +import HtmlPreview, { + EXPORTED_FOR_UNIT_TESTING, + HtmlPreviewProps, +} from './HtmlPreview' function renderComponent(props: HtmlPreviewProps) { return render(, { wrapper: createWrapper() }) diff --git a/packages/synapse-react-client/src/components/FilePreview/HtmlPreview/HtmlPreview.tsx b/packages/synapse-react-client/src/components/FilePreview/HtmlPreview/HtmlPreview.tsx index f3522b2d10..675089ecaf 100644 --- a/packages/synapse-react-client/src/components/FilePreview/HtmlPreview/HtmlPreview.tsx +++ b/packages/synapse-react-client/src/components/FilePreview/HtmlPreview/HtmlPreview.tsx @@ -1,10 +1,10 @@ import React, { useMemo, useEffect, useState, useRef } from 'react' import xss from 'xss' +import { Alert } from '@mui/material' import { xssOptions } from '../../../utils/functions/SanitizeHtmlUtils' import { useGetIsUserMemberOfTeam } from '../../../synapse-queries/team/useTeamMembers' import { TRUSTED_HTML_USERS_TEAM_ID } from '../../../utils/SynapseConstants' import { SynapseSpinner } from '../../LoadingScreen/LoadingScreen' -import { Alert } from '@mui/material' /** * @param options diff --git a/packages/synapse-react-client/src/components/FilePreview/PreviewUtils.test.ts b/packages/synapse-react-client/src/components/FilePreview/PreviewUtils.test.ts index cf2bf8ef29..06bc266388 100644 --- a/packages/synapse-react-client/src/components/FilePreview/PreviewUtils.test.ts +++ b/packages/synapse-react-client/src/components/FilePreview/PreviewUtils.test.ts @@ -1,3 +1,4 @@ +import { ProxyFileHandle, S3FileHandle } from '@sage-bionetworks/synapse-types' import { CODE_EXTENSIONS, getOriginalFileHandleRenderer, @@ -7,7 +8,6 @@ import { VIDEO_EXTENSIONS, } from './PreviewUtils' import { PreviewRendererType } from './PreviewRendererType' -import { ProxyFileHandle, S3FileHandle } from '@sage-bionetworks/synapse-types' const s3FileHandle: S3FileHandle = { bucketName: '', diff --git a/packages/synapse-react-client/src/components/FilePreview/PreviewUtils.ts b/packages/synapse-react-client/src/components/FilePreview/PreviewUtils.ts index 23d5147eb2..5a55229c7f 100644 --- a/packages/synapse-react-client/src/components/FilePreview/PreviewUtils.ts +++ b/packages/synapse-react-client/src/components/FilePreview/PreviewUtils.ts @@ -1,6 +1,6 @@ import { FileHandle } from '@sage-bionetworks/synapse-types' -import { PreviewRendererType } from './PreviewRendererType' import { implementsCloudProviderFileHandleInterface } from '../../utils/types/IsType' +import { PreviewRendererType } from './PreviewRendererType' export const IMAGE_CONTENT_TYPES = [ 'image/bmp', diff --git a/packages/synapse-react-client/src/components/FileUpload/FileUpload.stories.tsx b/packages/synapse-react-client/src/components/FileUpload/FileUpload.stories.tsx index c243765d4e..74027798ba 100644 --- a/packages/synapse-react-client/src/components/FileUpload/FileUpload.stories.tsx +++ b/packages/synapse-react-client/src/components/FileUpload/FileUpload.stories.tsx @@ -1,7 +1,7 @@ import React from 'react' import { Meta, StoryObj } from '@storybook/react' -import FileUpload from './FileUpload' import CloudUploadOutlinedIcon from '@mui/icons-material/CloudUploadOutlined' +import FileUpload from './FileUpload' const meta = { title: 'Components/FileUpload', diff --git a/packages/synapse-react-client/src/components/FileUpload/FileUpload.tsx b/packages/synapse-react-client/src/components/FileUpload/FileUpload.tsx index 9ba4671b44..81f80e284a 100644 --- a/packages/synapse-react-client/src/components/FileUpload/FileUpload.tsx +++ b/packages/synapse-react-client/src/components/FileUpload/FileUpload.tsx @@ -1,11 +1,11 @@ import React from 'react' import { Button, ButtonProps } from '@mui/material' -import { uploadFile } from '../../synapse-client/SynapseClient' -import { useSynapseContext } from '../../utils/context/SynapseContext' import { FileUploadComplete, UploadCallbackResp, } from '@sage-bionetworks/synapse-types' +import { uploadFile } from '../../synapse-client/SynapseClient' +import { useSynapseContext } from '../../utils/context/SynapseContext' export type FileUploadProps = { id?: string diff --git a/packages/synapse-react-client/src/components/Forum/DiscussionReply.tsx b/packages/synapse-react-client/src/components/Forum/DiscussionReply.tsx index d8026bc0a4..ca51b4a51e 100644 --- a/packages/synapse-react-client/src/components/Forum/DiscussionReply.tsx +++ b/packages/synapse-react-client/src/components/Forum/DiscussionReply.tsx @@ -1,13 +1,14 @@ import dayjs from 'dayjs' import React, { useState } from 'react' -import { formatDate } from '../../utils/functions/DateFormatter' +import { + DiscussionReplyBundle, + ObjectType, +} from '@sage-bionetworks/synapse-types' import { SMALL_USER_CARD } from '../../utils/SynapseConstants' -import { DiscussionReplyBundle } from '@sage-bionetworks/synapse-types' +import { formatDate } from '../../utils/functions/DateFormatter' import UserCard from '../UserCard/UserCard' import MarkdownSynapse from '../Markdown/MarkdownSynapse' -import { ObjectType } from '@sage-bionetworks/synapse-types' import IconSvg from '../IconSvg/IconSvg' -import { ForumThreadEditor } from './ForumThreadEditor' import { useGetCurrentUserProfile, useGetEntityBundle, @@ -19,6 +20,7 @@ import { import { displayToast } from '../ToastMessage/ToastMessage' import WarningDialog from '../SynapseForm/WarningDialog' import { SkeletonTable } from '../Skeleton/SkeletonTable' +import { ForumThreadEditor } from './ForumThreadEditor' export type DiscussionReplyProps = { reply: DiscussionReplyBundle diff --git a/packages/synapse-react-client/src/components/Forum/DiscussionSearchResult.tsx b/packages/synapse-react-client/src/components/Forum/DiscussionSearchResult.tsx index b5a46dc463..cfb432d020 100644 --- a/packages/synapse-react-client/src/components/Forum/DiscussionSearchResult.tsx +++ b/packages/synapse-react-client/src/components/Forum/DiscussionSearchResult.tsx @@ -1,4 +1,13 @@ import React, { useState, useEffect } from 'react' +import { + UserProfile, + DiscussionReplyBundle, + DiscussionThreadBundle, +} from '@sage-bionetworks/synapse-types' +import dayjs from 'dayjs' +import { Typography, Skeleton } from '@mui/material' +import { Col, Row } from 'react-bootstrap' +import { useSynapseContext } from '../../utils/context/SynapseContext' import { getReply, getReplyMessageUrl, @@ -6,19 +15,9 @@ import { getThread, getUserProfileById, } from '../../synapse-client/SynapseClient' -import { useSynapseContext } from '../../utils/context/SynapseContext' -import { UserProfile } from '@sage-bionetworks/synapse-types' -import { - DiscussionReplyBundle, - DiscussionThreadBundle, -} from '@sage-bionetworks/synapse-types' -import dayjs from 'dayjs' -import { Typography } from '@mui/material' -import { Col, Row } from 'react-bootstrap' import UserCard from '../UserCard/UserCard' import { SMALL_USER_CARD } from '../../utils/SynapseConstants' import IconSvg from '../IconSvg/IconSvg' -import { Skeleton } from '@mui/material' import { SkeletonTable } from '../Skeleton/SkeletonTable' import { PRODUCTION_ENDPOINT_CONFIG } from '../../utils/functions/getEndpoint' import { formatDate } from '../../utils/functions/DateFormatter' diff --git a/packages/synapse-react-client/src/components/Forum/DiscussionThread.integration.test.tsx b/packages/synapse-react-client/src/components/Forum/DiscussionThread.integration.test.tsx index a55ac9d674..2b077aea94 100644 --- a/packages/synapse-react-client/src/components/Forum/DiscussionThread.integration.test.tsx +++ b/packages/synapse-react-client/src/components/Forum/DiscussionThread.integration.test.tsx @@ -1,21 +1,20 @@ import { render, screen, waitFor } from '@testing-library/react' import userEvent from '@testing-library/user-event' import React from 'react' -import { DiscussionThread, DiscussionThreadProps } from './DiscussionThread' +import { + PaginatedResults, + DiscussionReplyBundle, + MessageURL, + SubscriptionObjectType, + SubscriptionPagedResults, + Topic, +} from '@sage-bionetworks/synapse-types' import { createWrapper } from '../../testutils/TestingLibraryUtils' import { THREAD, THREAD_ID, THREAD_REPLIES } from '../../utils/APIConstants' import { BackendDestinationEnum, getEndpoint, } from '../../utils/functions/getEndpoint' -import { PaginatedResults } from '@sage-bionetworks/synapse-types' -import { DiscussionReplyBundle } from '@sage-bionetworks/synapse-types' -import { MessageURL } from '@sage-bionetworks/synapse-types' -import { - SubscriptionObjectType, - SubscriptionPagedResults, - Topic, -} from '@sage-bionetworks/synapse-types' import { mockDiscussionReplyBundle, mockDiscussionThreadBundle, @@ -27,6 +26,7 @@ import { mockUserProfileData2, } from '../../mocks/user/mock_user_profile' import SynapseClient from '../../synapse-client' +import { DiscussionThread, DiscussionThreadProps } from './DiscussionThread' const MOCK_THREAD_ID = '123' const MOCK_SUBSCRIPTION_ID = '999' diff --git a/packages/synapse-react-client/src/components/Forum/DiscussionThread.tsx b/packages/synapse-react-client/src/components/Forum/DiscussionThread.tsx index 7cebf5ffb1..fb08985c8b 100644 --- a/packages/synapse-react-client/src/components/Forum/DiscussionThread.tsx +++ b/packages/synapse-react-client/src/components/Forum/DiscussionThread.tsx @@ -1,5 +1,12 @@ import dayjs from 'dayjs' import React, { useState } from 'react' +import { + SubscriptionObjectType, + ALL_ENTITY_BUNDLE_FIELDS, + ObjectType, +} from '@sage-bionetworks/synapse-types' +import { FormControl } from 'react-bootstrap' +import { Button, Typography } from '@mui/material' import { formatDate } from '../../utils/functions/DateFormatter' import { useGetRepliesInfinite } from '../../synapse-queries/forum/useReply' import { @@ -11,27 +18,20 @@ import { SMALL_USER_CARD, SRC_SIGN_IN_CLASS, } from '../../utils/SynapseConstants' -import { SubscriptionObjectType } from '@sage-bionetworks/synapse-types' import UserCard from '../UserCard/UserCard' import { displayToast } from '../ToastMessage/ToastMessage' -import { DiscussionReply } from './DiscussionReply' -import { FormControl } from 'react-bootstrap' -import { Button, Typography } from '@mui/material' import IconSvg from '../IconSvg/IconSvg' import MarkdownSynapse from '../Markdown/MarkdownSynapse' -import { - ALL_ENTITY_BUNDLE_FIELDS, - ObjectType, -} from '@sage-bionetworks/synapse-types' import { useSubscription } from '../../synapse-queries/subscription/useSubscription' import { useGetCurrentUserProfile, useGetEntityBundle, } from '../../synapse-queries' -import { ForumThreadEditor } from './ForumThreadEditor' import WarningDialog from '../SynapseForm/WarningDialog' -import { SubscribersModal } from './SubscribersModal' import { ConfirmationDialog } from '../ConfirmationDialog/ConfirmationDialog' +import { ForumThreadEditor } from './ForumThreadEditor' +import { SubscribersModal } from './SubscribersModal' +import { DiscussionReply } from './DiscussionReply' export type DiscussionThreadProps = { threadId: string diff --git a/packages/synapse-react-client/src/components/Forum/ForumPage.integration.test.tsx b/packages/synapse-react-client/src/components/Forum/ForumPage.integration.test.tsx index 078a85483b..6e287aa097 100644 --- a/packages/synapse-react-client/src/components/Forum/ForumPage.integration.test.tsx +++ b/packages/synapse-react-client/src/components/Forum/ForumPage.integration.test.tsx @@ -1,21 +1,22 @@ import { render, screen, waitFor, within } from '@testing-library/react' import userEvent from '@testing-library/user-event' import React from 'react' -import { ForumPage, ForumPageProps } from './ForumPage' -import { createWrapper } from '../../testutils/TestingLibraryUtils' -import { FORUM, FORUM_THREAD } from '../../utils/APIConstants' -import { - BackendDestinationEnum, - getEndpoint, -} from '../../utils/functions/getEndpoint' -import { PaginatedResults } from '@sage-bionetworks/synapse-types' -import { DiscussionThreadBundle } from '@sage-bionetworks/synapse-types' import { + PaginatedResults, + DiscussionThreadBundle, SubscriptionObjectType, Topic, SubscriptionPagedResults, SubscriberPagedResults, + PaginatedIds, } from '@sage-bionetworks/synapse-types' +import failOnConsole from 'jest-fail-on-console' +import { createWrapper } from '../../testutils/TestingLibraryUtils' +import { FORUM, FORUM_THREAD } from '../../utils/APIConstants' +import { + BackendDestinationEnum, + getEndpoint, +} from '../../utils/functions/getEndpoint' import { mockDiscussionThreadBundle, mockDiscussionThreadBundle2, @@ -23,8 +24,7 @@ import { import { MOCK_ACCESS_TOKEN } from '../../mocks/MockSynapseContext' import { rest, server } from '../../mocks/msw/server' import SynapseClient from '../../synapse-client' -import { PaginatedIds } from '@sage-bionetworks/synapse-types' -import failOnConsole from 'jest-fail-on-console' +import { ForumPage, ForumPageProps } from './ForumPage' const MOCK_FORUM_ID = 'syn123' const MOCK_SUBSCRIPTION_ID = '123' diff --git a/packages/synapse-react-client/src/components/Forum/ForumPage.tsx b/packages/synapse-react-client/src/components/Forum/ForumPage.tsx index 105d96af6e..89fe3320c2 100644 --- a/packages/synapse-react-client/src/components/Forum/ForumPage.tsx +++ b/packages/synapse-react-client/src/components/Forum/ForumPage.tsx @@ -1,16 +1,18 @@ import { Button, Typography } from '@mui/material' import React, { useState } from 'react' +import { + DiscussionFilter, + SubscriptionObjectType, +} from '@sage-bionetworks/synapse-types' import { useGetCurrentUserProfile } from '../../synapse-queries' import { useGetModerators } from '../../synapse-queries/forum/useForum' import { useSubscription } from '../../synapse-queries/subscription/useSubscription' import { SRC_SIGN_IN_CLASS } from '../../utils/SynapseConstants' -import { DiscussionFilter } from '@sage-bionetworks/synapse-types' -import { SubscriptionObjectType } from '@sage-bionetworks/synapse-types' import { displayToast } from '../ToastMessage/ToastMessage' +import { ConfirmationDialog } from '../ConfirmationDialog/ConfirmationDialog' import { ForumTable } from './ForumTable' import { ForumThreadEditor } from './ForumThreadEditor' import { SubscribersModal } from './SubscribersModal' -import { ConfirmationDialog } from '../ConfirmationDialog/ConfirmationDialog' export type ForumPageProps = { forumId: string diff --git a/packages/synapse-react-client/src/components/Forum/ForumTable.tsx b/packages/synapse-react-client/src/components/Forum/ForumTable.tsx index b3f24bb6fb..4bcc159b94 100644 --- a/packages/synapse-react-client/src/components/Forum/ForumTable.tsx +++ b/packages/synapse-react-client/src/components/Forum/ForumTable.tsx @@ -1,17 +1,17 @@ import dayjs from 'dayjs' import React, { useState } from 'react' import { Table } from 'react-bootstrap' -import SortIcon from '../../assets/icons/Sort' -import { useGetForumInfinite } from '../../synapse-queries/forum/useForum' -import { AVATAR, SMALL_USER_CARD } from '../../utils/SynapseConstants' -import { Direction } from '@sage-bionetworks/synapse-types' import { + Direction, DiscussionFilter, DiscussionThreadOrder, } from '@sage-bionetworks/synapse-types' +import { Button, Link } from '@mui/material' +import SortIcon from '../../assets/icons/Sort' +import { useGetForumInfinite } from '../../synapse-queries/forum/useForum' +import { AVATAR, SMALL_USER_CARD } from '../../utils/SynapseConstants' import IconSvg from '../IconSvg/IconSvg' import UserCard from '../UserCard/UserCard' -import { Button, Link } from '@mui/material' export type ForumTableProps = { forumId: string diff --git a/packages/synapse-react-client/src/components/Forum/ForumThreadEditor.tsx b/packages/synapse-react-client/src/components/Forum/ForumThreadEditor.tsx index 64e0d2cdc9..0bde8c8150 100644 --- a/packages/synapse-react-client/src/components/Forum/ForumThreadEditor.tsx +++ b/packages/synapse-react-client/src/components/Forum/ForumThreadEditor.tsx @@ -1,13 +1,13 @@ import React, { useState } from 'react' import { Box } from '@mui/material' import { FormControl } from 'react-bootstrap' +import { CreateDiscussionThread } from '@sage-bionetworks/synapse-types' import { useCreateThread, useUpdateThreadTitle, useUpdateThreadMessage, } from '../../synapse-queries/forum/useThread' import { usePostReply, usePutReply } from '../../synapse-queries/forum/useReply' -import { CreateDiscussionThread } from '@sage-bionetworks/synapse-types' import { MarkdownEditor } from '../Markdown/MarkdownEditor' import { ConfirmationButtons, diff --git a/packages/synapse-react-client/src/components/Forum/SubscribersModal.tsx b/packages/synapse-react-client/src/components/Forum/SubscribersModal.tsx index 619619f981..6ec7c0b016 100644 --- a/packages/synapse-react-client/src/components/Forum/SubscribersModal.tsx +++ b/packages/synapse-react-client/src/components/Forum/SubscribersModal.tsx @@ -1,8 +1,8 @@ import React from 'react' -import { ConfirmationDialog } from '../ConfirmationDialog/ConfirmationDialog' -import { useGetSubscribers } from '../../synapse-queries/subscription/useSubscription' import { SubscriptionObjectType } from '@sage-bionetworks/synapse-types' import { Link } from '@mui/material' +import { ConfirmationDialog } from '../ConfirmationDialog/ConfirmationDialog' +import { useGetSubscribers } from '../../synapse-queries/subscription/useSubscription' import UserCard from '../UserCard/UserCard' import { SMALL_USER_CARD } from '../../utils/SynapseConstants' diff --git a/packages/synapse-react-client/src/components/Forum/index.ts b/packages/synapse-react-client/src/components/Forum/index.ts index f7d45891ba..2da78d5c89 100644 --- a/packages/synapse-react-client/src/components/Forum/index.ts +++ b/packages/synapse-react-client/src/components/Forum/index.ts @@ -1,7 +1,7 @@ import { DiscussionThread } from './DiscussionThread' +import { ForumPage } from './ForumPage' import type { DiscussionThreadProps } from './DiscussionThread' -import { ForumPage } from './ForumPage' import type { ForumPageProps } from './ForumPage' export { DiscussionThread, DiscussionThreadProps, ForumPage, ForumPageProps } diff --git a/packages/synapse-react-client/src/components/ForumSearch/ForumSearch.tsx b/packages/synapse-react-client/src/components/ForumSearch/ForumSearch.tsx index d06b00d03d..b3b88c7b77 100644 --- a/packages/synapse-react-client/src/components/ForumSearch/ForumSearch.tsx +++ b/packages/synapse-react-client/src/components/ForumSearch/ForumSearch.tsx @@ -1,13 +1,13 @@ import React, { useEffect, useState } from 'react' -import { forumSearch, getEntity } from '../../synapse-client/SynapseClient' import { DiscussionSearchResponse, Match, + Entity, } from '@sage-bionetworks/synapse-types' +import { Button, Typography } from '@mui/material' +import { forumSearch, getEntity } from '../../synapse-client/SynapseClient' import { useSynapseContext } from '../../utils/context/SynapseContext' import DiscussionSearchResult from '../Forum/DiscussionSearchResult' -import { Entity } from '@sage-bionetworks/synapse-types' -import { Button, Typography } from '@mui/material' import NoSearchResults from '../../assets/icons/NoSearchResults' import IconSvg from '../IconSvg/IconSvg' import { displayToast } from '../ToastMessage/ToastMessage' diff --git a/packages/synapse-react-client/src/components/FullWidthAlert/FullWidthAlert.stories.tsx b/packages/synapse-react-client/src/components/FullWidthAlert/FullWidthAlert.stories.tsx index 6c3dbcfa58..24fd3a86e5 100644 --- a/packages/synapse-react-client/src/components/FullWidthAlert/FullWidthAlert.stories.tsx +++ b/packages/synapse-react-client/src/components/FullWidthAlert/FullWidthAlert.stories.tsx @@ -1,7 +1,7 @@ import { Meta, StoryObj } from '@storybook/react' import React from 'react' -import FullWidthAlert from './FullWidthAlert' import { SynapseNavDrawer } from '../SynapseNavDrawer/SynapseNavDrawer' +import FullWidthAlert from './FullWidthAlert' const meta = { title: 'UI/FullWidthAlert', diff --git a/packages/synapse-react-client/src/components/FullWidthAlert/FullWidthAlert.test.tsx b/packages/synapse-react-client/src/components/FullWidthAlert/FullWidthAlert.test.tsx index c273402b3e..72baf05efa 100644 --- a/packages/synapse-react-client/src/components/FullWidthAlert/FullWidthAlert.test.tsx +++ b/packages/synapse-react-client/src/components/FullWidthAlert/FullWidthAlert.test.tsx @@ -1,9 +1,9 @@ import { render, screen } from '@testing-library/react' import userEvent from '@testing-library/user-event' import React from 'react' -import FullWidthAlert, { FullWidthAlertProps } from './FullWidthAlert' import { createWrapper } from '../../testutils/TestingLibraryUtils' import { SynapseContextType } from '../../utils/context/SynapseContext' +import FullWidthAlert, { FullWidthAlertProps } from './FullWidthAlert' const onPrimaryButtonClicked = jest.fn() window.open = jest.fn() diff --git a/packages/synapse-react-client/src/components/GenericCard/GenericCard.integration.test.tsx b/packages/synapse-react-client/src/components/GenericCard/GenericCard.integration.test.tsx index c030230a61..7347bdaae0 100644 --- a/packages/synapse-react-client/src/components/GenericCard/GenericCard.integration.test.tsx +++ b/packages/synapse-react-client/src/components/GenericCard/GenericCard.integration.test.tsx @@ -1,22 +1,15 @@ import { render, screen, within } from '@testing-library/react' import React from 'react' import { mockAllIsIntersecting } from 'react-intersection-observer/test-utils' -import { CardLink, TargetEnum } from '../CardContainerLogic' -import GenericCard, { - CARD_SHORT_DESCRIPTION_CSS, - GenericCardSchema, - getLinkParams, - LongDescription, - ShortDescription, -} from './index' -import * as IconSvg from '../IconSvg/IconSvg' -import * as FileHandleLinkModule from '../widgets/FileHandleLink' -import * as ImageFileHandleModule from '../widgets/ImageFileHandle' -import { createWrapper } from '../../testutils/TestingLibraryUtils' import { ColumnTypeEnum, FileHandleAssociateType, } from '@sage-bionetworks/synapse-types' +import { cloneDeep } from 'lodash-es' +import * as IconSvg from '../IconSvg/IconSvg' +import * as FileHandleLinkModule from '../widgets/FileHandleLink' +import * as ImageFileHandleModule from '../widgets/ImageFileHandle' +import { createWrapper } from '../../testutils/TestingLibraryUtils' import { server } from '../../mocks/msw/server' import { MOCK_USER_ID, @@ -25,7 +18,6 @@ import { import mockTableEntityData, { mockTableEntity, } from '../../mocks/entity/mockTableEntity' -import { GenericCardProps } from './GenericCard' import { QueryVisualizationWrapper } from '../QueryVisualizationWrapper/QueryVisualizationWrapper' import QueryWrapper from '../QueryWrapper' import { @@ -33,8 +25,16 @@ import { mockQueryResultBundle, } from '../../mocks/mockFileViewQuery' import { getHandlersForTableQuery } from '../../mocks/msw/handlers/tableQueryHandlers' -import { cloneDeep } from 'lodash-es' +import { CardLink, TargetEnum } from '../CardContainerLogic' import { mockFileViewEntity } from '../../mocks/entity/mockFileView' +import { GenericCardProps } from './GenericCard' +import GenericCard, { + CARD_SHORT_DESCRIPTION_CSS, + GenericCardSchema, + getLinkParams, + LongDescription, + ShortDescription, +} from './index' const renderComponent = ( props: GenericCardProps, diff --git a/packages/synapse-react-client/src/components/GenericCard/GenericCard.tsx b/packages/synapse-react-client/src/components/GenericCard/GenericCard.tsx index 188579200e..c1a8cec1cf 100644 --- a/packages/synapse-react-client/src/components/GenericCard/GenericCard.tsx +++ b/packages/synapse-react-client/src/components/GenericCard/GenericCard.tsx @@ -1,14 +1,4 @@ import React from 'react' -import { SynapseConstants, SynapseContext } from '../../utils' -import { - isDatasetCollection, - isTableEntity, -} from '../../utils/functions/EntityTypeUtils' -import { PRODUCTION_ENDPOINT_CONFIG } from '../../utils/functions/getEndpoint' -import { - DOI_REGEX, - SYNAPSE_ENTITY_ID_REGEX, -} from '../../utils/functions/RegularExpressions' import { ColumnModel, ColumnType, @@ -20,6 +10,17 @@ import { Table, } from '@sage-bionetworks/synapse-types' import { Box, Link } from '@mui/material' +import { useAtomValue } from 'jotai' +import { SynapseConstants, SynapseContext } from '../../utils' +import { + isDatasetCollection, + isTableEntity, +} from '../../utils/functions/EntityTypeUtils' +import { PRODUCTION_ENDPOINT_CONFIG } from '../../utils/functions/getEndpoint' +import { + DOI_REGEX, + SYNAPSE_ENTITY_ID_REGEX, +} from '../../utils/functions/RegularExpressions' import { CardLink, ColumnIconConfigs, @@ -40,9 +41,8 @@ import { } from '../QueryVisualizationWrapper' import { IconOptions } from '../Icon' import { calculateFriendlyFileSize } from '../../utils/functions/calculateFriendlyFileSize' -import { SynapseCardLabel } from './SynapseCardLabel' -import { useAtomValue } from 'jotai' import { tableQueryEntityAtom } from '../QueryWrapper/QueryWrapper' +import { SynapseCardLabel } from './SynapseCardLabel' export type KeyToAlias = { key: string diff --git a/packages/synapse-react-client/src/components/GenericCard/SynapseCardLabel.test.tsx b/packages/synapse-react-client/src/components/GenericCard/SynapseCardLabel.test.tsx index 59b0c0364f..f4463a1d5e 100644 --- a/packages/synapse-react-client/src/components/GenericCard/SynapseCardLabel.test.tsx +++ b/packages/synapse-react-client/src/components/GenericCard/SynapseCardLabel.test.tsx @@ -1,9 +1,9 @@ -import { LabelLinkConfig } from '../CardContainerLogic' import { ColumnTypeEnum, SelectColumn } from '@sage-bionetworks/synapse-types' import { render, screen, within } from '@testing-library/react' -import { SynapseCardLabel } from './SynapseCardLabel' -import { createWrapper } from '../../testutils/TestingLibraryUtils' import React from 'react' +import { createWrapper } from '../../testutils/TestingLibraryUtils' +import { LabelLinkConfig } from '../CardContainerLogic' +import { SynapseCardLabel } from './SynapseCardLabel' describe('SynapseCardLabel tests', () => { const DATASETS = 'datasets' diff --git a/packages/synapse-react-client/src/components/GenericCard/SynapseCardLabel.tsx b/packages/synapse-react-client/src/components/GenericCard/SynapseCardLabel.tsx index c129e2c350..ae8e62b36b 100644 --- a/packages/synapse-react-client/src/components/GenericCard/SynapseCardLabel.tsx +++ b/packages/synapse-react-client/src/components/GenericCard/SynapseCardLabel.tsx @@ -5,10 +5,11 @@ import { Row, SelectColumn, } from '@sage-bionetworks/synapse-types' +import { Link, Tooltip } from '@mui/material' +import { isEmpty } from 'lodash-es' import UserCard from '../UserCard/UserCard' import { SMALL_USER_CARD } from '../../utils/SynapseConstants' import { SYNAPSE_ENTITY_ID_REGEX } from '../../utils/functions/RegularExpressions' -import { Link, Tooltip } from '@mui/material' import { CardLink, ColumnSpecifiedLink, @@ -17,7 +18,6 @@ import { } from '../CardContainerLogic' import { PRODUCTION_ENDPOINT_CONFIG } from '../../utils/functions/getEndpoint' import MarkdownSynapse from '../Markdown/MarkdownSynapse' -import { isEmpty } from 'lodash-es' import { getColumnIndex, getValueOrMultiValue } from './GenericCard' type SynapseCardLabelProps = { diff --git a/packages/synapse-react-client/src/components/Goals/Goals.Desktop.tsx b/packages/synapse-react-client/src/components/Goals/Goals.Desktop.tsx index ccfd7aba96..d09676256c 100644 --- a/packages/synapse-react-client/src/components/Goals/Goals.Desktop.tsx +++ b/packages/synapse-react-client/src/components/Goals/Goals.Desktop.tsx @@ -1,7 +1,7 @@ import React from 'react' -import { GoalsDataProps } from './Goals' -import QueryCount from '../QueryCount/QueryCount' import { Button } from '@mui/material' +import QueryCount from '../QueryCount/QueryCount' +import { GoalsDataProps } from './Goals' export default function GoalsDesktop({ asset, diff --git a/packages/synapse-react-client/src/components/Goals/Goals.Mobile.tsx b/packages/synapse-react-client/src/components/Goals/Goals.Mobile.tsx index c66ea0e02f..9b793d23b5 100644 --- a/packages/synapse-react-client/src/components/Goals/Goals.Mobile.tsx +++ b/packages/synapse-react-client/src/components/Goals/Goals.Mobile.tsx @@ -1,8 +1,8 @@ import React from 'react' -import { GoalsDataProps } from './Goals' +import { Button } from '@mui/material' import ExpandableContent from '../home_page/ExpandableContent' import QueryCount from '../QueryCount/QueryCount' -import { Button } from '@mui/material' +import { GoalsDataProps } from './Goals' export default function GoalsMobile({ link, diff --git a/packages/synapse-react-client/src/components/Goals/Goals.tsx b/packages/synapse-react-client/src/components/Goals/Goals.tsx index 9f06e4c4df..4a6380be31 100644 --- a/packages/synapse-react-client/src/components/Goals/Goals.tsx +++ b/packages/synapse-react-client/src/components/Goals/Goals.tsx @@ -11,10 +11,10 @@ import { SynapseClientError } from '../../utils/SynapseClientError' import { ErrorBanner } from '../error/ErrorBanner' import useGetQueryResultBundle from '../../synapse-queries/entity/useGetQueryResultBundle' import useShowDesktop from '../../utils/hooks/useShowDesktop' -import GoalsMobile from './Goals.Mobile' -import GoalsDesktop from './Goals.Desktop' import { getFieldIndex } from '../../utils/functions/queryUtils' import { useSynapseContext } from '../../utils/context/SynapseContext' +import GoalsMobile from './Goals.Mobile' +import GoalsDesktop from './Goals.Desktop' export type GoalsProps = { entityId: string diff --git a/packages/synapse-react-client/src/components/GoogleMap/GoogleMap.integration.test.tsx b/packages/synapse-react-client/src/components/GoogleMap/GoogleMap.integration.test.tsx index 6aea3303c6..2c6cecbbac 100644 --- a/packages/synapse-react-client/src/components/GoogleMap/GoogleMap.integration.test.tsx +++ b/packages/synapse-react-client/src/components/GoogleMap/GoogleMap.integration.test.tsx @@ -2,8 +2,13 @@ import { initialize } from '@googlemaps/jest-mocks' import { render, screen } from '@testing-library/react' import userEvent from '@testing-library/user-event' import React, { MouseEventHandler } from 'react' +import { + LoadScript, + GoogleMap as ReactGoogleMap, + Marker, + InfoWindow, +} from '@react-google-maps/api' import { GeoData } from '../../synapse-client' -import GoogleMap, { MapProps } from './GoogleMap' import { createWrapper } from '../../testutils/TestingLibraryUtils' import { rest, server } from '../../mocks/msw/server' import { @@ -13,12 +18,7 @@ import { MOCK_USER_NAME, MOCK_USER_NAME_2, } from '../../mocks/user/mock_user_profile' -import { - LoadScript, - GoogleMap as ReactGoogleMap, - Marker, - InfoWindow, -} from '@react-google-maps/api' +import GoogleMap, { MapProps } from './GoogleMap' /** Mock the Google Maps library */ jest.mock('@react-google-maps/api', () => ({ diff --git a/packages/synapse-react-client/src/components/GoogleMap/SynapseUserMarker.tsx b/packages/synapse-react-client/src/components/GoogleMap/SynapseUserMarker.tsx index ddc9a6fa69..21fcb323e5 100644 --- a/packages/synapse-react-client/src/components/GoogleMap/SynapseUserMarker.tsx +++ b/packages/synapse-react-client/src/components/GoogleMap/SynapseUserMarker.tsx @@ -1,8 +1,7 @@ -import { Divider } from '@mui/material' +import { Divider, Typography } from '@mui/material' import { InfoWindow, Marker } from '@react-google-maps/api' import React, { useMemo } from 'react' import { SMALL_USER_CARD } from '../../utils/SynapseConstants' -import { Typography } from '@mui/material' import UserCard from '../UserCard/UserCard' import { GeoData } from '../../synapse-client' diff --git a/packages/synapse-react-client/src/components/HasAccess/HasAccessV2.tsx b/packages/synapse-react-client/src/components/HasAccess/HasAccessV2.tsx index 119fce515e..6ea527c8b9 100644 --- a/packages/synapse-react-client/src/components/HasAccess/HasAccessV2.tsx +++ b/packages/synapse-react-client/src/components/HasAccess/HasAccessV2.tsx @@ -1,4 +1,11 @@ import React, { useMemo } from 'react' +import { + AccessRequirement, + RestrictableObjectType, + RestrictionInformationRequest, + RestrictionLevel, +} from '@sage-bionetworks/synapse-types' +import { Theme, useTheme } from '@mui/material' import SynapseClient from '../../synapse-client' import { BackendDestinationEnum, @@ -8,17 +15,10 @@ import { useGetRestrictionInformation } from '../../synapse-queries/dataaccess/u import useGetEntityBundle from '../../synapse-queries/entity/useEntityBundle' import { SRC_SIGN_IN_CLASS } from '../../utils/SynapseConstants' import { useSynapseContext } from '../../utils/context/SynapseContext' -import { - AccessRequirement, - RestrictableObjectType, - RestrictionInformationRequest, - RestrictionLevel, -} from '@sage-bionetworks/synapse-types' import AccessRequirementList, { checkHasUnsupportedRequirement, } from '../AccessRequirementList/AccessRequirementList' import IconSvg, { IconName } from '../IconSvg/IconSvg' -import { Theme, useTheme } from '@mui/material' import { isFileEntity } from '../../utils/types/IsType' export type HasAccessProps = { diff --git a/packages/synapse-react-client/src/components/HeaderCard.tsx b/packages/synapse-react-client/src/components/HeaderCard.tsx index 6ba5008936..3c23c50d26 100644 --- a/packages/synapse-react-client/src/components/HeaderCard.tsx +++ b/packages/synapse-react-client/src/components/HeaderCard.tsx @@ -1,7 +1,7 @@ +import React, { useState, useEffect } from 'react' import { CardFooter } from './row_renderers/utils' import { DescriptionConfig } from './CardContainerLogic' import MarkdownSynapse from './Markdown/MarkdownSynapse' -import React, { useState, useEffect } from 'react' export type HeaderCardProps = { rgbIndex?: number diff --git a/packages/synapse-react-client/src/components/HelpPopover/HelpPopover.tsx b/packages/synapse-react-client/src/components/HelpPopover/HelpPopover.tsx index 977b5d7ed5..b5d1409451 100644 --- a/packages/synapse-react-client/src/components/HelpPopover/HelpPopover.tsx +++ b/packages/synapse-react-client/src/components/HelpPopover/HelpPopover.tsx @@ -1,7 +1,7 @@ import React from 'react' -import { MarkdownPopover } from '../Markdown/MarkdownPopover' import { ButtonProps, TooltipProps } from '@mui/material' import { HelpOutlineTwoTone } from '@mui/icons-material' +import { MarkdownPopover } from '../Markdown/MarkdownPopover' export type HelpPopoverProps = { markdownText: string diff --git a/packages/synapse-react-client/src/components/IDUReport/IDUReport.integration.test.tsx b/packages/synapse-react-client/src/components/IDUReport/IDUReport.integration.test.tsx index 2066211e66..e5546f7968 100644 --- a/packages/synapse-react-client/src/components/IDUReport/IDUReport.integration.test.tsx +++ b/packages/synapse-react-client/src/components/IDUReport/IDUReport.integration.test.tsx @@ -1,11 +1,10 @@ -import { render, screen } from '@testing-library/react' +import { render, screen, act } from '@testing-library/react' import React from 'react' import { mockAllIsIntersecting } from 'react-intersection-observer/test-utils' import { SubmissionInfoPage, SubmissionInfoPageRequest, } from '@sage-bionetworks/synapse-types' -import IDUReport from './IDUReport' import { createWrapper } from '../../testutils/TestingLibraryUtils' import { MOCK_USER_ID, @@ -17,7 +16,7 @@ import { BackendDestinationEnum, getEndpoint, } from '../../utils/functions/getEndpoint' -import { act } from '@testing-library/react' +import IDUReport from './IDUReport' const page1: SubmissionInfoPage = { results: [ diff --git a/packages/synapse-react-client/src/components/IDUReport/IDUReport.tsx b/packages/synapse-react-client/src/components/IDUReport/IDUReport.tsx index 7de80591bc..6c33f0ebbf 100644 --- a/packages/synapse-react-client/src/components/IDUReport/IDUReport.tsx +++ b/packages/synapse-react-client/src/components/IDUReport/IDUReport.tsx @@ -1,7 +1,7 @@ import React, { useEffect } from 'react' import { useInView } from 'react-intersection-observer' -import { useGetApprovedSubmissionInfoInfinite } from '../../synapse-queries/dataaccess/useGetApprovedSubmissionInfo' import { SubmissionInfo } from '@sage-bionetworks/synapse-types' +import { useGetApprovedSubmissionInfoInfinite } from '../../synapse-queries/dataaccess/useGetApprovedSubmissionInfo' import { LoadingSubmissionInfoCard, SubmissionInfoCard, diff --git a/packages/synapse-react-client/src/components/IDUReport/IDUReportSubmissionInfo.tsx b/packages/synapse-react-client/src/components/IDUReport/IDUReportSubmissionInfo.tsx index ba1dd573d1..f92b2a971e 100644 --- a/packages/synapse-react-client/src/components/IDUReport/IDUReportSubmissionInfo.tsx +++ b/packages/synapse-react-client/src/components/IDUReport/IDUReportSubmissionInfo.tsx @@ -1,10 +1,10 @@ import React from 'react' import { Skeleton } from '@mui/material' import { SubmissionInfo } from '@sage-bionetworks/synapse-types' +import dayjs from 'dayjs' import { SMALL_USER_CARD } from '../../utils/SynapseConstants' import UserCard from '../UserCard/UserCard' import { formatDate } from '../../utils/functions/DateFormatter' -import dayjs from 'dayjs' import { SkeletonTable } from '../Skeleton/SkeletonTable' import MarkdownSynapse from '../Markdown/MarkdownSynapse' diff --git a/packages/synapse-react-client/src/components/IconSvg/IconSvg.tsx b/packages/synapse-react-client/src/components/IconSvg/IconSvg.tsx index da95f97a35..86d941fc91 100644 --- a/packages/synapse-react-client/src/components/IconSvg/IconSvg.tsx +++ b/packages/synapse-react-client/src/components/IconSvg/IconSvg.tsx @@ -96,6 +96,9 @@ import { WatchLater, } from '@mui/icons-material' import React from 'react' +import { EntityType } from '@sage-bionetworks/synapse-types' +import { Tooltip } from '@mui/material' +import { SvgIconProps } from '@mui/material/SvgIcon/SvgIcon' import AccessManagement from '../../assets/mui_components/AccessManagement' import AccountCertified from '../../assets/mui_components/AccountCertified' import AccountRegistered from '../../assets/mui_components/AccountRegistered' @@ -116,10 +119,7 @@ import Other from '../../assets/mui_components/Other' import PackagableFile from '../../assets/mui_components/PackagableFile' import Proteomics from '../../assets/mui_components/Proteomics' import Rat from '../../assets/mui_components/Rat' -import { EntityType } from '@sage-bionetworks/synapse-types' -import { Tooltip } from '@mui/material' import CreateVersion from '../../assets/icons/CreateVersion' -import { SvgIconProps } from '@mui/material/SvgIcon/SvgIcon' import { GoogleIcon24 } from '../../assets/GoogleIcon24' export const IconStrings = [ diff --git a/packages/synapse-react-client/src/components/LoadingScreen/LoadingScreen.test.tsx b/packages/synapse-react-client/src/components/LoadingScreen/LoadingScreen.test.tsx index 1f6c8de802..9f40151f00 100644 --- a/packages/synapse-react-client/src/components/LoadingScreen/LoadingScreen.test.tsx +++ b/packages/synapse-react-client/src/components/LoadingScreen/LoadingScreen.test.tsx @@ -1,6 +1,6 @@ import React from 'react' -import { BlockingLoader, BlockingLoaderProps } from './LoadingScreen' import { render, screen } from '@testing-library/react' +import { BlockingLoader, BlockingLoaderProps } from './LoadingScreen' const mockCallback = jest.fn() diff --git a/packages/synapse-react-client/src/components/Markdown/MarkdownCollapse.tsx b/packages/synapse-react-client/src/components/Markdown/MarkdownCollapse.tsx index d61188f11e..00dfda6bf6 100644 --- a/packages/synapse-react-client/src/components/Markdown/MarkdownCollapse.tsx +++ b/packages/synapse-react-client/src/components/Markdown/MarkdownCollapse.tsx @@ -3,8 +3,8 @@ import { Collapse, SafeAnchor } from 'react-bootstrap' import IconMinus from '../../assets/icons/IconMinus' import IconPlus from '../../assets/icons/IconPlus' import IconCopy from '../../assets/icons/IconCopy' -import MarkdownSynapse, { MarkdownSynapseProps } from './MarkdownSynapse' import { displayToast } from '../ToastMessage/ToastMessage' +import MarkdownSynapse, { MarkdownSynapseProps } from './MarkdownSynapse' export type MarkdownCollapseProps = { // The text that should be shown. If not given, will default to "full text" diff --git a/packages/synapse-react-client/src/components/Markdown/MarkdownEditor.tsx b/packages/synapse-react-client/src/components/Markdown/MarkdownEditor.tsx index 5c05144d55..7f9bc7afa6 100644 --- a/packages/synapse-react-client/src/components/Markdown/MarkdownEditor.tsx +++ b/packages/synapse-react-client/src/components/Markdown/MarkdownEditor.tsx @@ -4,10 +4,10 @@ import { CommandListType, MARKDOWN_COMMANDS_DATA, } from '@sage-bionetworks/synapse-types' +import { startCase } from 'lodash-es' import IconSvg from '../IconSvg/IconSvg' import MarkdownSynapse from './MarkdownSynapse' import { UserMentionModal } from './UserMentionModal' -import { startCase } from 'lodash-es' const MarkdownEditorTabs = ['WRITE', 'PREVIEW'] as const diff --git a/packages/synapse-react-client/src/components/Markdown/MarkdownPopover.test.tsx b/packages/synapse-react-client/src/components/Markdown/MarkdownPopover.test.tsx index 9109c2fb0f..069040ce27 100644 --- a/packages/synapse-react-client/src/components/Markdown/MarkdownPopover.test.tsx +++ b/packages/synapse-react-client/src/components/Markdown/MarkdownPopover.test.tsx @@ -5,9 +5,9 @@ import { } from '@testing-library/react' import userEvent from '@testing-library/user-event' import React from 'react' -import { MarkdownPopover, MarkdownPopoverProps } from './MarkdownPopover' import { createWrapper } from '../../testutils/TestingLibraryUtils' import { SynapseContextType } from '../../utils/context/SynapseContext' +import { MarkdownPopover, MarkdownPopoverProps } from './MarkdownPopover' const markdownText = 'This is markdown text.' diff --git a/packages/synapse-react-client/src/components/Markdown/MarkdownPopover.tsx b/packages/synapse-react-client/src/components/Markdown/MarkdownPopover.tsx index ee3ae9edba..236c0b6a1f 100644 --- a/packages/synapse-react-client/src/components/Markdown/MarkdownPopover.tsx +++ b/packages/synapse-react-client/src/components/Markdown/MarkdownPopover.tsx @@ -5,10 +5,10 @@ import { TooltipProps, tooltipClasses, ButtonProps, + Typography, } from '@mui/material' -import MarkdownSynapse, { MarkdownSynapseProps } from './MarkdownSynapse' -import { Typography } from '@mui/material' import LightTooltip from '../styled/LightTooltip' +import MarkdownSynapse, { MarkdownSynapseProps } from './MarkdownSynapse' export type MarkdownPopoverProps = { children: JSX.Element diff --git a/packages/synapse-react-client/src/components/Markdown/MarkdownSynapse.tsx b/packages/synapse-react-client/src/components/Markdown/MarkdownSynapse.tsx index f503d06790..8c006c60eb 100644 --- a/packages/synapse-react-client/src/components/Markdown/MarkdownSynapse.tsx +++ b/packages/synapse-react-client/src/components/Markdown/MarkdownSynapse.tsx @@ -1,24 +1,24 @@ import React from 'react' import MarkdownIt from 'markdown-it' import xss from 'xss' -import SynapseClient from '../../synapse-client' -import { xssOptions } from '../../utils/functions/SanitizeHtmlUtils' -import { SynapseClientError } from '../../utils/SynapseClientError' -import { SynapseContext } from '../../utils/context/SynapseContext' import { FileHandleResults, ObjectType, WikiPage, } from '@sage-bionetworks/synapse-types' +import { Link, Typography } from '@mui/material' +import SynapseClient from '../../synapse-client' +import { xssOptions } from '../../utils/functions/SanitizeHtmlUtils' +import { SynapseClientError } from '../../utils/SynapseClientError' +import { SynapseContext } from '../../utils/context/SynapseContext' import { ErrorBanner } from '../error/ErrorBanner' +import { SkeletonTable } from '../Skeleton/SkeletonTable' import MarkdownWidget from './MarkdownWidget' import { SynapseWikiContextProvider, SynapseWikiContextType, } from './SynapseWikiContext' import Bookmarks from './widget/Bookmarks' -import { SkeletonTable } from '../Skeleton/SkeletonTable' -import { Link, Typography } from '@mui/material' declare const katex: any declare const markdownitSynapse: any diff --git a/packages/synapse-react-client/src/components/Markdown/TOC.test.tsx b/packages/synapse-react-client/src/components/Markdown/TOC.test.tsx index a652084d5d..f0b348231e 100644 --- a/packages/synapse-react-client/src/components/Markdown/TOC.test.tsx +++ b/packages/synapse-react-client/src/components/Markdown/TOC.test.tsx @@ -1,7 +1,7 @@ import { render, screen } from '@testing-library/react' import React from 'react' -import MarkdownSynapse from './MarkdownSynapse' import { createWrapper } from '../../testutils/TestingLibraryUtils' +import MarkdownSynapse from './MarkdownSynapse' describe('renders without crashing', () => { let SynapseClient: any beforeAll(() => { diff --git a/packages/synapse-react-client/src/components/Markdown/UserMentionModal.tsx b/packages/synapse-react-client/src/components/Markdown/UserMentionModal.tsx index 21420004df..f0596c10a9 100644 --- a/packages/synapse-react-client/src/components/Markdown/UserMentionModal.tsx +++ b/packages/synapse-react-client/src/components/Markdown/UserMentionModal.tsx @@ -1,6 +1,6 @@ import React, { useCallback } from 'react' -import { DialogBase } from '../DialogBase' import { TYPE_FILTER, UserGroupHeader } from '@sage-bionetworks/synapse-types' +import { DialogBase } from '../DialogBase' import UserSearchBoxV2 from '../UserSearchBox/UserSearchBoxV2' export type UserMentionModalProps = { diff --git a/packages/synapse-react-client/src/components/Markdown/index.ts b/packages/synapse-react-client/src/components/Markdown/index.ts index b953ff36b1..2b1cbb03d9 100644 --- a/packages/synapse-react-client/src/components/Markdown/index.ts +++ b/packages/synapse-react-client/src/components/Markdown/index.ts @@ -1,15 +1,15 @@ export * from './widget' -import type { MarkdownEditorProps } from './MarkdownEditor' import { MarkdownEditor } from './MarkdownEditor' -import type { MarkdownSynapseProps } from './MarkdownSynapse' import Markdown from './MarkdownSynapse' import MarkdownSynapse from './MarkdownSynapse' -import type { MarkdownWidgetProps } from './MarkdownWidget' import { default as MarkdownWidget } from './MarkdownWidget' -import type { MarkdownCollapseProps } from './MarkdownCollapse' import { MarkdownCollapse } from './MarkdownCollapse' -import type { MarkdownPopoverProps } from './MarkdownPopover' import { MarkdownPopover } from './MarkdownPopover' +import type { MarkdownWidgetProps } from './MarkdownWidget' +import type { MarkdownCollapseProps } from './MarkdownCollapse' +import type { MarkdownPopoverProps } from './MarkdownPopover' +import type { MarkdownSynapseProps } from './MarkdownSynapse' +import type { MarkdownEditorProps } from './MarkdownEditor' export { MarkdownEditor, diff --git a/packages/synapse-react-client/src/components/Markdown/widget/SynapsePlots.integration.test.tsx b/packages/synapse-react-client/src/components/Markdown/widget/SynapsePlots.integration.test.tsx index 2fcbc16050..7f972acf7e 100644 --- a/packages/synapse-react-client/src/components/Markdown/widget/SynapsePlots.integration.test.tsx +++ b/packages/synapse-react-client/src/components/Markdown/widget/SynapsePlots.integration.test.tsx @@ -1,8 +1,8 @@ import { render, waitFor } from '@testing-library/react' import React from 'react' +import { QueryResultBundle } from '@sage-bionetworks/synapse-types' import MarkdownSynapse from '../MarkdownSynapse' import { createWrapper } from '../../../testutils/TestingLibraryUtils' -import { QueryResultBundle } from '@sage-bionetworks/synapse-types' import { getHandlersForTableQuery } from '../../../mocks/msw/handlers/tableQueryHandlers' import { server } from '../../../mocks/msw/server' diff --git a/packages/synapse-react-client/src/components/MissingQueryResultsWarning/MissingQueryResultsWarning.integration.test.tsx b/packages/synapse-react-client/src/components/MissingQueryResultsWarning/MissingQueryResultsWarning.integration.test.tsx index aecfcdafa7..48c79cd35c 100644 --- a/packages/synapse-react-client/src/components/MissingQueryResultsWarning/MissingQueryResultsWarning.integration.test.tsx +++ b/packages/synapse-react-client/src/components/MissingQueryResultsWarning/MissingQueryResultsWarning.integration.test.tsx @@ -1,12 +1,12 @@ import { render, screen } from '@testing-library/react' import userEvent from '@testing-library/user-event' import React from 'react' -import MissingQueryResultsWarning from './MissingQueryResultsWarning' -import { createWrapper } from '../../testutils/TestingLibraryUtils' import { EntityRef, Table } from '@sage-bionetworks/synapse-types' +import { createWrapper } from '../../testutils/TestingLibraryUtils' import mockDatasetEntityData from '../../mocks/entity/mockDataset' import { getHandlersForTableQuery } from '../../mocks/msw/handlers/tableQueryHandlers' import { server } from '../../mocks/msw/server' +import MissingQueryResultsWarning from './MissingQueryResultsWarning' const mockDatasetEntity = mockDatasetEntityData.entity diff --git a/packages/synapse-react-client/src/components/MissingQueryResultsWarning/MissingQueryResultsWarning.tsx b/packages/synapse-react-client/src/components/MissingQueryResultsWarning/MissingQueryResultsWarning.tsx index e2b2efaff5..16f675b6c9 100644 --- a/packages/synapse-react-client/src/components/MissingQueryResultsWarning/MissingQueryResultsWarning.tsx +++ b/packages/synapse-react-client/src/components/MissingQueryResultsWarning/MissingQueryResultsWarning.tsx @@ -1,10 +1,10 @@ import { WarningSharp } from '@mui/icons-material' import React from 'react' +import { QueryBundleRequest, Table } from '@sage-bionetworks/synapse-types' +import { Typography } from '@mui/material' import { SynapseConstants } from '../../utils' import { isDataset } from '../../utils/functions/EntityTypeUtils' import useGetQueryResultBundle from '../../synapse-queries/entity/useGetQueryResultBundle' -import { QueryBundleRequest, Table } from '@sage-bionetworks/synapse-types' -import { Typography } from '@mui/material' import { HelpPopover } from '../HelpPopover/HelpPopover' const DATASETS_CURRENT_VERSION_HELP = diff --git a/packages/synapse-react-client/src/components/ModalDownload/ModalDownload.FormSchema.ts b/packages/synapse-react-client/src/components/ModalDownload/ModalDownload.FormSchema.ts index 86e171b65d..838ce91796 100644 --- a/packages/synapse-react-client/src/components/ModalDownload/ModalDownload.FormSchema.ts +++ b/packages/synapse-react-client/src/components/ModalDownload/ModalDownload.FormSchema.ts @@ -1,5 +1,5 @@ import { UiSchema } from '@rjsf/utils' -import { JSONSchema7 } from 'json-schema' +import type { JSONSchema7 } from 'json-schema' export const writeHeaderOption = 'First line is the columns names.' export const includeRowIdAndRowVersionOption = diff --git a/packages/synapse-react-client/src/components/ModalDownload/ModalDownload.test.tsx b/packages/synapse-react-client/src/components/ModalDownload/ModalDownload.test.tsx index 8989e816bb..1563be49b1 100644 --- a/packages/synapse-react-client/src/components/ModalDownload/ModalDownload.test.tsx +++ b/packages/synapse-react-client/src/components/ModalDownload/ModalDownload.test.tsx @@ -1,15 +1,15 @@ import { render, screen, waitFor } from '@testing-library/react' import userEvent from '@testing-library/user-event' import React from 'react' -import ModalDownload, { ModalDownloadProps } from './ModalDownload' +import { createWrapper } from '../../testutils/TestingLibraryUtils' +import SynapseClient from '../../synapse-client' +import { MOCK_CONTEXT_VALUE } from '../../mocks/MockSynapseContext' import { csvOption, tsvOption, writeHeaderOption, } from './ModalDownload.FormSchema' -import { createWrapper } from '../../testutils/TestingLibraryUtils' -import SynapseClient from '../../synapse-client' -import { MOCK_CONTEXT_VALUE } from '../../mocks/MockSynapseContext' +import ModalDownload, { ModalDownloadProps } from './ModalDownload' const renderComponent = (props: ModalDownloadProps) => { return render(, { diff --git a/packages/synapse-react-client/src/components/ModalDownload/ModalDownload.tsx b/packages/synapse-react-client/src/components/ModalDownload/ModalDownload.tsx index 665d0402de..146c422304 100644 --- a/packages/synapse-react-client/src/components/ModalDownload/ModalDownload.tsx +++ b/packages/synapse-react-client/src/components/ModalDownload/ModalDownload.tsx @@ -2,14 +2,17 @@ import React from 'react' import { Button } from '@mui/material' import Form, { IChangeEvent } from '@rjsf/core' import validator from '@rjsf/validator-ajv8' -import SynapseClient from '../../synapse-client' import { DownloadFromTableRequest, DownloadFromTableResult, SortItem, QueryBundleRequest, } from '@sage-bionetworks/synapse-types' +import SynapseClient from '../../synapse-client' +import { parseEntityIdFromSqlStatement } from '../../utils/functions/SqlFunctions' +import { SynapseContext } from '../../utils/context/SynapseContext' +import { DialogBase } from '../DialogBase' import { csvOption, formSchemaArray, @@ -17,9 +20,6 @@ import { includeRowIdAndRowVersionOption, writeHeaderOption, } from './ModalDownload.FormSchema' -import { parseEntityIdFromSqlStatement } from '../../utils/functions/SqlFunctions' -import { SynapseContext } from '../../utils/context/SynapseContext' -import { DialogBase } from '../DialogBase' type ModalDownloadState = { isLoading: boolean diff --git a/packages/synapse-react-client/src/components/OAuthClientManagement/CreateOAuthClient.integration.test.tsx b/packages/synapse-react-client/src/components/OAuthClientManagement/CreateOAuthClient.integration.test.tsx index afc4469f94..3f32e81a1a 100644 --- a/packages/synapse-react-client/src/components/OAuthClientManagement/CreateOAuthClient.integration.test.tsx +++ b/packages/synapse-react-client/src/components/OAuthClientManagement/CreateOAuthClient.integration.test.tsx @@ -3,7 +3,6 @@ import userEvent from '@testing-library/user-event' import React from 'react' import { createWrapper } from '../../testutils/TestingLibraryUtils' import { rest, server } from '../../mocks/msw/server' -import { CreateOAuthModal, CreateOAuthModalProps } from './CreateOAuthClient' import { mockClientList1 } from '../../mocks/oauth/MockClient' import * as ToastMessage from '../ToastMessage/ToastMessage' import { @@ -12,6 +11,7 @@ import { } from '../../utils/functions/getEndpoint' import { WarningDialog } from '../SynapseForm/WarningDialog' import SynapseClient from '../../synapse-client' +import { CreateOAuthModal, CreateOAuthModalProps } from './CreateOAuthClient' const mockToastFn = jest .spyOn(ToastMessage, 'displayToast') diff --git a/packages/synapse-react-client/src/components/OAuthClientManagement/CreateOAuthClient.tsx b/packages/synapse-react-client/src/components/OAuthClientManagement/CreateOAuthClient.tsx index ebc2788f12..b8ebe4ec24 100644 --- a/packages/synapse-react-client/src/components/OAuthClientManagement/CreateOAuthClient.tsx +++ b/packages/synapse-react-client/src/components/OAuthClientManagement/CreateOAuthClient.tsx @@ -1,6 +1,4 @@ import React, { useEffect, useMemo, useState } from 'react' -import { useSynapseContext } from '../../utils/context/SynapseContext' -import { displayToast } from '../ToastMessage/ToastMessage' import { Alert, Box, @@ -12,13 +10,15 @@ import { Typography, } from '@mui/material' import { OAuthClient } from '@sage-bionetworks/synapse-types' +import DeleteTwoToneIcon from '@mui/icons-material/DeleteTwoTone' +import { useSynapseContext } from '../../utils/context/SynapseContext' +import { displayToast } from '../ToastMessage/ToastMessage' import { useCreateOAuthClient, useDeleteOAuthClient, useUpdateOAuthClient, } from '../../synapse-queries' import { WarningDialog } from '../SynapseForm/WarningDialog' -import DeleteTwoToneIcon from '@mui/icons-material/DeleteTwoTone' import { SynapseClientError } from '../../utils/SynapseClientError' import { SynapseSpinner } from '../LoadingScreen/LoadingScreen' import SynapseClient from '../../synapse-client' diff --git a/packages/synapse-react-client/src/components/OAuthClientManagement/OAuthManagement.integration.test.tsx b/packages/synapse-react-client/src/components/OAuthClientManagement/OAuthManagement.integration.test.tsx index 32f93e06f6..9dd7aaa018 100644 --- a/packages/synapse-react-client/src/components/OAuthClientManagement/OAuthManagement.integration.test.tsx +++ b/packages/synapse-react-client/src/components/OAuthClientManagement/OAuthManagement.integration.test.tsx @@ -2,7 +2,6 @@ import { render, screen, waitFor } from '@testing-library/react' import userEvent from '@testing-library/user-event' import dayjs from 'dayjs' import React from 'react' -import { OAuthManagement } from './OAuthManagement' import { createWrapper } from '../../testutils/TestingLibraryUtils' import { formatDate } from '../../utils/functions/DateFormatter' import { @@ -13,6 +12,7 @@ import { } from '../../synapse-queries' import { server } from '../../mocks/msw/server' import { mockClientList1, mockClientList2 } from '../../mocks/oauth/MockClient' +import { OAuthManagement } from './OAuthManagement' jest.mock('../../../src/synapse-queries/oauth/useOAuthClient', () => { return { diff --git a/packages/synapse-react-client/src/components/OAuthClientManagement/OAuthManagement.tsx b/packages/synapse-react-client/src/components/OAuthClientManagement/OAuthManagement.tsx index c070832bab..b924a3f80a 100644 --- a/packages/synapse-react-client/src/components/OAuthClientManagement/OAuthManagement.tsx +++ b/packages/synapse-react-client/src/components/OAuthClientManagement/OAuthManagement.tsx @@ -1,17 +1,17 @@ import React, { useState } from 'react' import { Table } from 'react-bootstrap' -import { formatDate } from '../../utils/functions/DateFormatter' import dayjs from 'dayjs' -import { useGetOAuthClientInfinite } from '../../synapse-queries' -import { CreateOAuthModal } from './CreateOAuthClient' import { OAuthClient } from '@sage-bionetworks/synapse-types' +import { Button, Link } from '@mui/material' +import { formatDate } from '../../utils/functions/DateFormatter' +import { useGetOAuthClientInfinite } from '../../synapse-queries' import WarningDialog from '../SynapseForm/WarningDialog' import SynapseClient from '../../synapse-client' import { useSynapseContext } from '../../utils/context/SynapseContext' import CopyToClipboardInput from '../CopyToClipboardInput/CopyToClipboardInput' import { displayToast } from '../ToastMessage/ToastMessage' import { DialogBase } from '../DialogBase' -import { Button, Link } from '@mui/material' +import { CreateOAuthModal } from './CreateOAuthClient' export const OAuthManagement: React.FunctionComponent = () => { const { accessToken } = useSynapseContext() diff --git a/packages/synapse-react-client/src/components/OrientationBanner/OrientationBanner.test.tsx b/packages/synapse-react-client/src/components/OrientationBanner/OrientationBanner.test.tsx index e258303d28..fac5c646d0 100644 --- a/packages/synapse-react-client/src/components/OrientationBanner/OrientationBanner.test.tsx +++ b/packages/synapse-react-client/src/components/OrientationBanner/OrientationBanner.test.tsx @@ -5,13 +5,13 @@ import { } from '@testing-library/react' import userEvent from '@testing-library/user-event' import React from 'react' +import { createWrapper } from '../../testutils/TestingLibraryUtils' +import { SynapseContextType } from '../../utils/context/SynapseContext' import OrientationBanner, { getOrientationBannerKey, OrientationBannerName, OrientationBannerProps, } from './OrientationBanner' -import { createWrapper } from '../../testutils/TestingLibraryUtils' -import { SynapseContextType } from '../../utils/context/SynapseContext' const onPrimaryButtonClicked = jest.fn() window.open = jest.fn() diff --git a/packages/synapse-react-client/src/components/Plot/BarPlot.tsx b/packages/synapse-react-client/src/components/Plot/BarPlot.tsx index a270af3558..b4899c32a8 100644 --- a/packages/synapse-react-client/src/components/Plot/BarPlot.tsx +++ b/packages/synapse-react-client/src/components/Plot/BarPlot.tsx @@ -1,8 +1,8 @@ import React, { FunctionComponent } from 'react' import Plotly from 'plotly.js-basic-dist' import createPlotlyComponent from 'react-plotly.js/factory' +import { cloneDeep, noop, uniq } from 'lodash-es' import { GraphItem, BarPlotColors, PlotStyle } from './types' -import _ from 'lodash-es' const Plot = createPlotlyComponent(Plotly) @@ -34,7 +34,7 @@ function getBarPlotDataPoints( if (filter) { data = data.filter(item => item.y === filter) } - const groups = _.uniq(data.map(item => item['group'])).sort() + const groups = uniq(data.map(item => item['group'])).sort() const result: any[] = [] const defaultColors = [`(28,118,175,1)`, `rgba(91,176,181,1)`] @@ -63,7 +63,7 @@ function getLayout( layoutConfig: Partial, { isTop, maxValue, backgroundColor }: LayoutOptions, ): Partial { - const layout = _.cloneDeep(layoutConfig) + const layout = cloneDeep(layoutConfig) layout.xaxis = { visible: false, range: [0, maxValue], @@ -106,7 +106,7 @@ const BarPlot: FunctionComponent = ({ })} config={optionsConfig} data={getBarPlotDataPoints(plotData, label, colors)} - onClick={e => (onClick ? onClick(e) : _.noop)} + onClick={e => (onClick ? onClick(e) : noop)} /> ) } diff --git a/packages/synapse-react-client/src/components/Plot/DotPlot.tsx b/packages/synapse-react-client/src/components/Plot/DotPlot.tsx index c4885c00b3..e34b56820d 100644 --- a/packages/synapse-react-client/src/components/Plot/DotPlot.tsx +++ b/packages/synapse-react-client/src/components/Plot/DotPlot.tsx @@ -1,8 +1,8 @@ import React, { FunctionComponent /*, useState , useEffect */ } from 'react' // importing FunctionComponent import Plotly from 'plotly.js-basic-dist' import createPlotlyComponent from 'react-plotly.js/factory' +import { cloneDeep, noop, uniq } from 'lodash-es' import { GraphItem, PlotStyle, Dictionary } from './types' -import _ from 'lodash-es' const Plot = createPlotlyComponent(Plotly) export type DotPlotProps = { @@ -31,7 +31,7 @@ function getLayout( dotPlotLayoutConfig: Partial, layoutOptions?: LayoutOptions, ): Partial { - const result = _.cloneDeep(dotPlotLayoutConfig) + const result = cloneDeep(dotPlotLayoutConfig) if (!layoutOptions) { return result } @@ -99,7 +99,7 @@ function getPlotDataPoints( markerSymbols?: Dictionary, ): any[] { const isFakeData = ySorted === undefined - const groups = _.uniq(graphItems.map(item => item.group)) + const groups = uniq(graphItems.map(item => item.group)) const data: any = [] const defaultSymbols = [ 'y-down', @@ -173,7 +173,7 @@ const DotPlot: FunctionComponent = ({ style={style} data={getPlotDataPoints(plotData, plotStyle, pointsTypes, markerSymbols)} config={optionsConfig} - onClick={e => (onClick ? onClick(e) : _.noop)} + onClick={e => (onClick ? onClick(e) : noop)} /> ) } diff --git a/packages/synapse-react-client/src/components/Plot/StatisticsPlot.test.tsx b/packages/synapse-react-client/src/components/Plot/StatisticsPlot.test.tsx index b449be90d6..e44c300948 100644 --- a/packages/synapse-react-client/src/components/Plot/StatisticsPlot.test.tsx +++ b/packages/synapse-react-client/src/components/Plot/StatisticsPlot.test.tsx @@ -6,14 +6,14 @@ import { waitFor, } from '@testing-library/react' import React from 'react' -import SynapseClient from '../../synapse-client' -import StatisticsPlot, { StatisticsPlotProps } from '../StatisticsPlot' -import { createWrapper } from '../../testutils/TestingLibraryUtils' import { MonthlyFilesStatistics, ProjectFilesStatisticsRequest, ProjectFilesStatisticsResponse, } from '@sage-bionetworks/synapse-types' +import SynapseClient from '../../synapse-client' +import StatisticsPlot, { StatisticsPlotProps } from '../StatisticsPlot' +import { createWrapper } from '../../testutils/TestingLibraryUtils' const projectFilesStatsRequest: ProjectFilesStatisticsRequest = { concreteType: diff --git a/packages/synapse-react-client/src/components/Plot/SynapsePlot.tsx b/packages/synapse-react-client/src/components/Plot/SynapsePlot.tsx index 73430865ff..d66b8bc855 100644 --- a/packages/synapse-react-client/src/components/Plot/SynapsePlot.tsx +++ b/packages/synapse-react-client/src/components/Plot/SynapsePlot.tsx @@ -1,12 +1,12 @@ import Plotly from 'plotly.js-basic-dist' import React from 'react' import createPlotlyComponent from 'react-plotly.js/factory' -import { SynapseConstants } from '../../utils' -import { getFullQueryTableResults } from '../../synapse-client/SynapseClient' import { QueryResultBundle, QueryBundleRequest, } from '@sage-bionetworks/synapse-types' +import { SynapseConstants } from '../../utils' +import { getFullQueryTableResults } from '../../synapse-client/SynapseClient' import { parseEntityIdFromSqlStatement } from '../../utils/functions/SqlFunctions' import { SynapseContext } from '../../utils/context/SynapseContext' const Plot = createPlotlyComponent(Plotly) diff --git a/packages/synapse-react-client/src/components/Plot/ThemesPlot.tsx b/packages/synapse-react-client/src/components/Plot/ThemesPlot.tsx index abfdf61a62..b68290fcc0 100644 --- a/packages/synapse-react-client/src/components/Plot/ThemesPlot.tsx +++ b/packages/synapse-react-client/src/components/Plot/ThemesPlot.tsx @@ -1,5 +1,12 @@ import React, { useEffect, useState } from 'react' // importing FunctionComponent import Plotly from 'plotly.js-basic-dist' +import { + QueryBundleRequest, + QueryResultBundle, + RowSet, +} from '@sage-bionetworks/synapse-types' +import { RequiredKeysOf } from 'type-fest' +import { cloneDeep, first, noop, orderBy } from 'lodash-es' import { ElementWithTooltip, TooltipVisualProps, @@ -7,23 +14,16 @@ import { import { unCamelCase } from '../../utils/functions/unCamelCase' import { SynapseConstants, useSynapseContext } from '../../utils' import { getFullQueryTableResults } from '../../synapse-client' -import { - QueryBundleRequest, - QueryResultBundle, - RowSet, -} from '@sage-bionetworks/synapse-types' import { resultToJson } from '../../utils/functions' +import loadingScreen from '../LoadingScreen/LoadingScreen' import { BarPlotColors, ClickCallbackParams, GraphItem, PlotProps, } from './types' -import _ from 'lodash-es' import DotPlot from './DotPlot' import BarPlot from './BarPlot' -import loadingScreen from '../LoadingScreen/LoadingScreen' -import { RequiredKeysOf } from 'type-fest' export type ThemesPlotProps = { onPointClick: ({ facetValue, type, event }: ClickCallbackParams) => void @@ -197,7 +197,7 @@ const fadeColors = (colors: { [key: string]: string }, opacity: string) => { } const getTooltip = (data: GraphItem[], filter: string) => { - return _.first(data.filter(item => item.y === filter).map(item => item.info)) + return first(data.filter(item => item.y === filter).map(item => item.info)) } export function ThemesPlot({ @@ -243,10 +243,8 @@ export function ThemesPlot({ .map(item => item.y) xMaxForSideBarPlot = Math.max(...totalsByDotPlotY.map(item => item.count)) xMaxForDotPlot = Math.max(...dotPlotQueryData.map(item => Number(item.x))) - topBarPlotDataSorted = _.orderBy(getTotalsByProp(topBarPlotData, 'y'), [ - 'y', - ]) - xLabelsForTopBarPlot = _.orderBy( + topBarPlotDataSorted = orderBy(getTotalsByProp(topBarPlotData, 'y'), ['y']) + xLabelsForTopBarPlot = orderBy( getTotalsByProp(topBarPlotData, 'group'), ['group'], ).map(item => item.group) @@ -287,7 +285,7 @@ export function ThemesPlot({
_.noop} + callbackFn={() => noop} >
diff --git a/packages/synapse-react-client/src/components/Plot/UpsetPlot.tsx b/packages/synapse-react-client/src/components/Plot/UpsetPlot.tsx index 109ca58924..f23cc47081 100644 --- a/packages/synapse-react-client/src/components/Plot/UpsetPlot.tsx +++ b/packages/synapse-react-client/src/components/Plot/UpsetPlot.tsx @@ -14,9 +14,9 @@ import UpSetJS, { UpSetFontSizes, } from '@upsetjs/react' import { QueryBundleRequest } from '@sage-bionetworks/synapse-types' +import { SizeMe } from 'react-sizeme' import SynapseClient from '../../synapse-client' import { SynapseConstants } from '../../utils' -import { SizeMe } from 'react-sizeme' import getColorPalette from '../ColorGradient/ColorGradient' import { parseEntityIdFromSqlStatement } from '../../utils/functions/SqlFunctions' import { ErrorBanner } from '../error/ErrorBanner' diff --git a/packages/synapse-react-client/src/components/Plot/index.ts b/packages/synapse-react-client/src/components/Plot/index.ts index 7a2ef221bb..1ccb71193e 100644 --- a/packages/synapse-react-client/src/components/Plot/index.ts +++ b/packages/synapse-react-client/src/components/Plot/index.ts @@ -1,11 +1,10 @@ import { ThemesPlot } from './ThemesPlot' -import type { ThemesPlotProps } from './ThemesPlot' import { UpsetPlot } from './UpsetPlot' -import type { UpsetPlotProps } from './UpsetPlot' import { SynapsePlot } from './SynapsePlot' +import type { ThemesPlotProps } from './ThemesPlot' +import type { UpsetPlotProps } from './UpsetPlot' import type { SynapsePlotProps } from './SynapsePlot' -import type { ClickCallbackParams } from './types' -import type { GraphItem } from './types' +import type { ClickCallbackParams, GraphItem } from './types' export { ThemesPlot, ThemesPlotProps, diff --git a/packages/synapse-react-client/src/components/PlotlyWrapper/PlotlyWrapper.stories.ts b/packages/synapse-react-client/src/components/PlotlyWrapper/PlotlyWrapper.stories.ts index 375cfae4d0..437cd789af 100644 --- a/packages/synapse-react-client/src/components/PlotlyWrapper/PlotlyWrapper.stories.ts +++ b/packages/synapse-react-client/src/components/PlotlyWrapper/PlotlyWrapper.stories.ts @@ -1,7 +1,7 @@ import { Meta, StoryObj } from '@storybook/react' +import Plotly from 'plotly.js-basic-dist' import PlotlyWrapper from '../PlotlyWrapper' import rawData from '../../mocks/distribution_data.json' -import Plotly from 'plotly.js-basic-dist' const meta = { title: 'Components/PlotlyWrapper', diff --git a/packages/synapse-react-client/src/components/ProgrammaticTableDownload/ProgrammaticTableDownload.integration.test.tsx b/packages/synapse-react-client/src/components/ProgrammaticTableDownload/ProgrammaticTableDownload.integration.test.tsx index 5255f029fa..96b3a69838 100644 --- a/packages/synapse-react-client/src/components/ProgrammaticTableDownload/ProgrammaticTableDownload.integration.test.tsx +++ b/packages/synapse-react-client/src/components/ProgrammaticTableDownload/ProgrammaticTableDownload.integration.test.tsx @@ -1,22 +1,22 @@ import { render, screen, within } from '@testing-library/react' import React from 'react' -import { createWrapper } from '../../testutils/TestingLibraryUtils' +import { QueryBundleRequest } from '@sage-bionetworks/synapse-types' import { BackendDestinationEnum, getEndpoint, } from '../../utils/functions/getEndpoint' -import { QueryBundleRequest } from '@sage-bionetworks/synapse-types' +import { createWrapper } from '../../testutils/TestingLibraryUtils' import { TABLE_QUERY_ASYNC_START } from '../../utils/APIConstants' import { rest, server } from '../../mocks/msw/server' import { SynapseContextType } from '../../utils/context/SynapseContext' import { MOCK_CONTEXT_VALUE } from '../../mocks/MockSynapseContext' -import ProgrammaticTableDownload, { - ProgrammaticTableDownloadProps, -} from './ProgrammaticTableDownload' import { getHandlersForTableQuery } from '../../mocks/msw/handlers/tableQueryHandlers' import { SynapseConstants } from '../../index' import { DEFAULT_PAGE_SIZE } from '../../utils/SynapseConstants' +import ProgrammaticTableDownload, { + ProgrammaticTableDownloadProps, +} from './ProgrammaticTableDownload' const onHide = jest.fn() diff --git a/packages/synapse-react-client/src/components/Programs/Programs.Desktop.tsx b/packages/synapse-react-client/src/components/Programs/Programs.Desktop.tsx index 08bc70bf80..5a135b7dec 100644 --- a/packages/synapse-react-client/src/components/Programs/Programs.Desktop.tsx +++ b/packages/synapse-react-client/src/components/Programs/Programs.Desktop.tsx @@ -1,7 +1,7 @@ import React from 'react' -import { ProgramsDataProps } from './Programs' import LargeButton from '../../components/styled/LargeButton' import { ImageFileHandle } from '../widgets/ImageFileHandle' +import { ProgramsDataProps } from './Programs' export default function ProgramsDesktop({ link, diff --git a/packages/synapse-react-client/src/components/Programs/Programs.Mobile.tsx b/packages/synapse-react-client/src/components/Programs/Programs.Mobile.tsx index d8b1c2f4f0..924ed29263 100644 --- a/packages/synapse-react-client/src/components/Programs/Programs.Mobile.tsx +++ b/packages/synapse-react-client/src/components/Programs/Programs.Mobile.tsx @@ -1,8 +1,8 @@ import React from 'react' -import { ProgramsDataProps } from './Programs' import ExpandableContent from '../home_page/ExpandableContent' import LargeButton from '../../components/styled/LargeButton' import { ImageFileHandle } from '../widgets/ImageFileHandle' +import { ProgramsDataProps } from './Programs' export default function ProgramsMobile({ link, diff --git a/packages/synapse-react-client/src/components/Programs/Programs.tsx b/packages/synapse-react-client/src/components/Programs/Programs.tsx index 94ceafccf1..2b390e1351 100644 --- a/packages/synapse-react-client/src/components/Programs/Programs.tsx +++ b/packages/synapse-react-client/src/components/Programs/Programs.tsx @@ -7,13 +7,13 @@ import { SynapseConstants } from '../../utils' import useGetQueryResultBundle from '../../synapse-queries/entity/useGetQueryResultBundle' import useShowDesktop from '../../utils/hooks/useShowDesktop' -import ProgramsMobile from './Programs.Mobile' -import ProgramsDesktop from './Programs.Desktop' import { getColorPalette } from '../ColorGradient/ColorGradient' import { CardLink } from '../CardContainerLogic' import { getFieldIndex } from '../../utils/functions/queryUtils' import { useGetEntity } from '../../synapse-queries/entity/useEntity' import { getFileHandleAssociation, getLinkParams } from '../GenericCard' +import ProgramsDesktop from './Programs.Desktop' +import ProgramsMobile from './Programs.Mobile' export type ProgramsProps = { entityId: string diff --git a/packages/synapse-react-client/src/components/ProjectViewCarousel/ProjectViewCarousel.test.tsx b/packages/synapse-react-client/src/components/ProjectViewCarousel/ProjectViewCarousel.test.tsx index 4d34da52da..382723239f 100644 --- a/packages/synapse-react-client/src/components/ProjectViewCarousel/ProjectViewCarousel.test.tsx +++ b/packages/synapse-react-client/src/components/ProjectViewCarousel/ProjectViewCarousel.test.tsx @@ -1,13 +1,13 @@ import { render, screen, waitFor } from '@testing-library/react' import React from 'react' import SizeMe from 'react-sizeme' -import ProjectViewCarousel, { - ProjectViewCarouselProps, -} from './ProjectViewCarousel' +import { ObjectType } from '@sage-bionetworks/synapse-types' import { createWrapper } from '../../testutils/TestingLibraryUtils' import SynapseClient from '../../synapse-client' import { mockQueryResult } from '../../mocks/query/mockProjectViewQueryResults' -import { ObjectType } from '@sage-bionetworks/synapse-types' +import ProjectViewCarousel, { + ProjectViewCarouselProps, +} from './ProjectViewCarousel' SizeMe.noPlaceholders = true jest diff --git a/packages/synapse-react-client/src/components/ProvenanceGraph/ActivityNodeLabel.tsx b/packages/synapse-react-client/src/components/ProvenanceGraph/ActivityNodeLabel.tsx index 188c92ab12..8cc901a609 100644 --- a/packages/synapse-react-client/src/components/ProvenanceGraph/ActivityNodeLabel.tsx +++ b/packages/synapse-react-client/src/components/ProvenanceGraph/ActivityNodeLabel.tsx @@ -1,10 +1,9 @@ import dayjs from 'dayjs' import React, { useMemo } from 'react' +import { Activity } from '@sage-bionetworks/synapse-types' +import { Tooltip, Typography } from '@mui/material' import { formatDate } from '../../utils/functions/DateFormatter' import { useGetUserProfile } from '../../synapse-queries' -import { Activity } from '@sage-bionetworks/synapse-types' -import { Tooltip } from '@mui/material' -import { Typography } from '@mui/material' import { UserCardSmall } from '../UserCard/UserCardSmall' export const ActivityNodeLabel = (data: Activity) => { diff --git a/packages/synapse-react-client/src/components/ProvenanceGraph/EntityNodeLabel.tsx b/packages/synapse-react-client/src/components/ProvenanceGraph/EntityNodeLabel.tsx index d4ed116b33..676f283ca0 100644 --- a/packages/synapse-react-client/src/components/ProvenanceGraph/EntityNodeLabel.tsx +++ b/packages/synapse-react-client/src/components/ProvenanceGraph/EntityNodeLabel.tsx @@ -1,11 +1,11 @@ import React, { useMemo } from 'react' +import { EntityHeader } from '@sage-bionetworks/synapse-types' +import { Tooltip } from '@mui/material' import { isVersionableEntityType, convertToEntityType, } from '../../utils/functions/EntityTypeUtils' import { PRODUCTION_ENDPOINT_CONFIG } from '../../utils/functions/getEndpoint' -import { EntityHeader } from '@sage-bionetworks/synapse-types' -import { Tooltip } from '@mui/material' import { ProvenanceEntityIcon } from './ProvenanceEntityIcon' export const EntityNodeLabel = (data: EntityHeader) => { diff --git a/packages/synapse-react-client/src/components/ProvenanceGraph/ProvenanceEntityIcon.tsx b/packages/synapse-react-client/src/components/ProvenanceGraph/ProvenanceEntityIcon.tsx index aa8314e9cf..216dd01d96 100644 --- a/packages/synapse-react-client/src/components/ProvenanceGraph/ProvenanceEntityIcon.tsx +++ b/packages/synapse-react-client/src/components/ProvenanceGraph/ProvenanceEntityIcon.tsx @@ -1,6 +1,6 @@ import React from 'react' -import { convertToEntityType } from '../../utils/functions/EntityTypeUtils' import { EntityHeader, EntityType } from '@sage-bionetworks/synapse-types' +import { convertToEntityType } from '../../utils/functions/EntityTypeUtils' import { EntityTypeIcon } from '../EntityIcon' import IconSvg from '../IconSvg/IconSvg' diff --git a/packages/synapse-react-client/src/components/ProvenanceGraph/ProvenanceGraph.integration.test.tsx b/packages/synapse-react-client/src/components/ProvenanceGraph/ProvenanceGraph.integration.test.tsx index cfd80fcd91..1084c7cd8d 100644 --- a/packages/synapse-react-client/src/components/ProvenanceGraph/ProvenanceGraph.integration.test.tsx +++ b/packages/synapse-react-client/src/components/ProvenanceGraph/ProvenanceGraph.integration.test.tsx @@ -1,6 +1,6 @@ import { render, screen } from '@testing-library/react' import React from 'react' -import ProvenanceGraph, { ProvenanceProps } from './ProvenanceGraph' +import { Activity } from '@sage-bionetworks/synapse-types' import { createWrapper } from '../../testutils/TestingLibraryUtils' import { ACTIVITY_FOR_ENTITY } from '../../utils/APIConstants' import { @@ -11,8 +11,8 @@ import { mockActivity } from '../../mocks/provenance/mockActivity' import mockFileEntityData from '../../mocks/entity/mockFileEntity' import { rest, server } from '../../mocks/msw/server' import { SynapseApiResponse } from '../../mocks/msw/handlers' -import { Activity } from '@sage-bionetworks/synapse-types' import { MOCK_TABLE_ENTITY_ID } from '../../mocks/entity/mockTableEntity' +import ProvenanceGraph, { ProvenanceProps } from './ProvenanceGraph' function renderComponent(props: ProvenanceProps) { return render(, { wrapper: createWrapper() }) diff --git a/packages/synapse-react-client/src/components/ProvenanceGraph/ProvenanceGraph.tsx b/packages/synapse-react-client/src/components/ProvenanceGraph/ProvenanceGraph.tsx index 13f51cb2a8..cb85bcb3e4 100644 --- a/packages/synapse-react-client/src/components/ProvenanceGraph/ProvenanceGraph.tsx +++ b/packages/synapse-react-client/src/components/ProvenanceGraph/ProvenanceGraph.tsx @@ -9,28 +9,29 @@ import ReactFlow, { ReactFlowProvider, useReactFlow, } from 'reactflow' -import { - getLayoutedElements, - isArrayEqual, - NodeType, - ProvenanceNodeData, -} from './ProvenanceUtils' import { Activity, Used, UsedEntity, UsedURL, USED_ENTITY_CONCRETE_TYPE_VALUE, + EntityHeader, + ReferenceList, } from '@sage-bionetworks/synapse-types' -import { EntityHeader, ReferenceList } from '@sage-bionetworks/synapse-types' +import { CircularProgress } from '@mui/material' +import { useErrorHandler } from 'react-error-boundary' import { useSynapseContext } from '../../utils/context/SynapseContext' import SynapseClient from '../../synapse-client' -import { ExpandGraphNodeDataProps } from './ExpandGraphNodeLabel' import { useGetEntityHeaders } from '../../synapse-queries' -import { CircularProgress } from '@mui/material' import { displayToast } from '../ToastMessage/ToastMessage' import { SynapseErrorBoundary } from '../error/ErrorBanner' -import { useErrorHandler } from 'react-error-boundary' +import { ExpandGraphNodeDataProps } from './ExpandGraphNodeLabel' +import { + getLayoutedElements, + isArrayEqual, + NodeType, + ProvenanceNodeData, +} from './ProvenanceUtils' import { addActivityNode, addEntityNode, diff --git a/packages/synapse-react-client/src/components/ProvenanceGraph/ProvenanceGraphUtils.ts b/packages/synapse-react-client/src/components/ProvenanceGraph/ProvenanceGraphUtils.ts index ccd1596a7d..26b2c1686f 100644 --- a/packages/synapse-react-client/src/components/ProvenanceGraph/ProvenanceGraphUtils.ts +++ b/packages/synapse-react-client/src/components/ProvenanceGraph/ProvenanceGraphUtils.ts @@ -1,6 +1,10 @@ import { Edge, Node } from 'reactflow' -import { EntityHeader, Reference } from '@sage-bionetworks/synapse-types' -import { Activity, UsedURL } from '@sage-bionetworks/synapse-types' +import { + EntityHeader, + Reference, + Activity, + UsedURL, +} from '@sage-bionetworks/synapse-types' import { getNodeId, getProvenanceEdge, diff --git a/packages/synapse-react-client/src/components/ProvenanceGraph/ProvenanceUtils.tsx b/packages/synapse-react-client/src/components/ProvenanceGraph/ProvenanceUtils.tsx index 7531bfe3c4..adf9cb07d9 100644 --- a/packages/synapse-react-client/src/components/ProvenanceGraph/ProvenanceUtils.tsx +++ b/packages/synapse-react-client/src/components/ProvenanceGraph/ProvenanceUtils.tsx @@ -1,5 +1,13 @@ import React from 'react' import { Node, Position, ConnectionLineType, Edge, MarkerType } from 'reactflow' +import dagre from 'dagre' +import { differenceWith, isEqual } from 'lodash-es' +import { + EntityHeader, + Reference, + Activity, + UsedURL, +} from '@sage-bionetworks/synapse-types' import { ActivityNodeLabel } from './ActivityNodeLabel' import { EntityNodeLabel } from './EntityNodeLabel' import { @@ -7,11 +15,7 @@ import { ExpandGraphNodeLabel, } from './ExpandGraphNodeLabel' import { ExternalGraphNodeLabel } from './ExternalGraphNodeLabel' -import dagre from 'dagre' -import { differenceWith, isEqual } from 'lodash-es' import { UndefinedNodeLabel } from './UndefinedNodeLabel' -import { EntityHeader, Reference } from '@sage-bionetworks/synapse-types' -import { Activity, UsedURL } from '@sage-bionetworks/synapse-types' import { EntityPlaceholderNodeLabel } from './EntityPlaceholderNodeLabel' export enum NodeType { diff --git a/packages/synapse-react-client/src/components/QueryContext/QueryContext.tsx b/packages/synapse-react-client/src/components/QueryContext/QueryContext.tsx index ed77b48ae7..8b296556e8 100644 --- a/packages/synapse-react-client/src/components/QueryContext/QueryContext.tsx +++ b/packages/synapse-react-client/src/components/QueryContext/QueryContext.tsx @@ -1,13 +1,13 @@ import React, { createContext, useContext } from 'react' -import { SynapseClientError } from '../../utils/SynapseClientError' import { AsynchronousJobStatus, ColumnModel, QueryBundleRequest, QueryResultBundle, } from '@sage-bionetworks/synapse-types' -import { ImmutableTableQueryResult } from '../../utils/hooks/useImmutableTableQuery/useImmutableTableQuery' import { ReadonlyDeep } from 'type-fest' +import { SynapseClientError } from '../../utils/SynapseClientError' +import { ImmutableTableQueryResult } from '../../utils/hooks/useImmutableTableQuery/useImmutableTableQuery' /* For details page: to lock a column (e.g. study, grant) so that the facet values and active filters diff --git a/packages/synapse-react-client/src/components/QueryCount/QueryCount.tsx b/packages/synapse-react-client/src/components/QueryCount/QueryCount.tsx index 2d9b271d5a..840f1626bd 100644 --- a/packages/synapse-react-client/src/components/QueryCount/QueryCount.tsx +++ b/packages/synapse-react-client/src/components/QueryCount/QueryCount.tsx @@ -1,8 +1,8 @@ import React from 'react' +import { Query, QueryBundleRequest } from '@sage-bionetworks/synapse-types' import { SynapseConstants } from '../../utils' import { parseEntityIdFromSqlStatement } from '../../utils/functions/SqlFunctions' import useGetQueryResultBundle from '../../synapse-queries/entity/useGetQueryResultBundle' -import { Query, QueryBundleRequest } from '@sage-bionetworks/synapse-types' export type QueryCountProps = { query: Query diff --git a/packages/synapse-react-client/src/components/QuerySortSelector.tsx b/packages/synapse-react-client/src/components/QuerySortSelector.tsx index a1f1cde695..f64fba9844 100644 --- a/packages/synapse-react-client/src/components/QuerySortSelector.tsx +++ b/packages/synapse-react-client/src/components/QuerySortSelector.tsx @@ -1,9 +1,9 @@ import React, { useState } from 'react' -import { SortConfiguration } from './CardContainerLogic' -import { useQueryContext } from './QueryContext/QueryContext' import { SortDirection } from '@sage-bionetworks/synapse-types' import { Typography } from '@mui/material' import Select, { components, ControlProps, GroupBase } from 'react-select' +import { useQueryContext } from './QueryContext/QueryContext' +import { SortConfiguration } from './CardContainerLogic' import { findValueOption } from './SchemaDrivenAnnotationEditor/widget/SelectWidget' import { useQueryVisualizationContext } from './QueryVisualizationWrapper' diff --git a/packages/synapse-react-client/src/components/QueryVisualizationWrapper/QueryVisualizationWrapper.integration.test.tsx b/packages/synapse-react-client/src/components/QueryVisualizationWrapper/QueryVisualizationWrapper.integration.test.tsx index 9da9a744c0..852efc6bba 100644 --- a/packages/synapse-react-client/src/components/QueryVisualizationWrapper/QueryVisualizationWrapper.integration.test.tsx +++ b/packages/synapse-react-client/src/components/QueryVisualizationWrapper/QueryVisualizationWrapper.integration.test.tsx @@ -1,27 +1,27 @@ import { act, render, waitFor } from '@testing-library/react' import React from 'react' import { - PaginatedQueryContextType, - usePaginatedQueryContext, -} from '../QueryContext/QueryContext' -import { - QueryVisualizationContextType, - QueryVisualizationWrapper, - QueryVisualizationWrapperProps, - useQueryVisualizationContext, -} from './QueryVisualizationWrapper' + ColumnTypeEnum, + QueryBundleRequest, +} from '@sage-bionetworks/synapse-types' import { QueryWrapper, QueryWrapperProps } from '../QueryWrapper' import { createWrapper } from '../../testutils/TestingLibraryUtils' import { SynapseConstants } from '../../utils' import { - ColumnTypeEnum, - QueryBundleRequest, -} from '@sage-bionetworks/synapse-types' + PaginatedQueryContextType, + usePaginatedQueryContext, +} from '../QueryContext/QueryContext' import queryResponse from '../../mocks/mockQueryResponseDataWithManyEnumFacets' import { getHandlersForTableQuery } from '../../mocks/msw/handlers/tableQueryHandlers' import { server } from '../../mocks/msw/server' import { MOCK_TABLE_ENTITY_ID } from '../../mocks/entity/mockTableEntity' import { DEFAULT_PAGE_SIZE } from '../../utils/SynapseConstants' +import { + QueryVisualizationContextType, + QueryVisualizationWrapper, + QueryVisualizationWrapperProps, + useQueryVisualizationContext, +} from './QueryVisualizationWrapper' const onQueryContextReceived = jest.fn() const onContextReceived = jest.fn() diff --git a/packages/synapse-react-client/src/components/QueryVisualizationWrapper/QueryVisualizationWrapper.tsx b/packages/synapse-react-client/src/components/QueryVisualizationWrapper/QueryVisualizationWrapper.tsx index 629b8e8470..9fb06ad968 100644 --- a/packages/synapse-react-client/src/components/QueryVisualizationWrapper/QueryVisualizationWrapper.tsx +++ b/packages/synapse-react-client/src/components/QueryVisualizationWrapper/QueryVisualizationWrapper.tsx @@ -7,16 +7,16 @@ import React, { useState, } from 'react' import { useDeepCompareMemoize } from 'use-deep-compare-effect' +import { ColumnType } from '@sage-bionetworks/synapse-types' +import { useAtomValue } from 'jotai' import { useQueryContext } from '../QueryContext/QueryContext' import NoContentAvailable from '../SynapseTable/NoContentAvailable' import { NoContentPlaceholderType } from '../SynapseTable/NoContentPlaceholderType' import SearchResultsNotFound from '../SynapseTable/SearchResultsNotFound' import ThisTableIsEmpty from '../SynapseTable/TableIsEmpty' import { unCamelCase } from '../../utils/functions/unCamelCase' -import { ColumnType } from '@sage-bionetworks/synapse-types' import { getDisplayValue } from '../../utils/functions/getDataFromFromStorage' import useMutuallyExclusiveState from '../../utils/hooks/useMutuallyExclusiveState' -import { useAtomValue } from 'jotai' import { tableQueryDataAtom } from '../QueryWrapper/QueryWrapper' export type QueryVisualizationContextType = { diff --git a/packages/synapse-react-client/src/components/QueryWrapper/QueryWrapper.test.tsx b/packages/synapse-react-client/src/components/QueryWrapper/QueryWrapper.test.tsx index 4be556cef2..307aa2bd19 100644 --- a/packages/synapse-react-client/src/components/QueryWrapper/QueryWrapper.test.tsx +++ b/packages/synapse-react-client/src/components/QueryWrapper/QueryWrapper.test.tsx @@ -1,6 +1,19 @@ import { act, render, screen, waitFor, within } from '@testing-library/react' import { cloneDeep } from 'lodash-es' import React from 'react' +import { + QueryBundleRequest, + QueryResultBundle, + Row, +} from '@sage-bionetworks/synapse-types' +import userEvent from '@testing-library/user-event' +import { useAtomValue, useSetAtom } from 'jotai' +import { SynapseConstants } from '../../utils' +import syn16787123Json from '../../mocks/query/syn16787123' +import { DEFAULT_PAGE_SIZE } from '../../utils/SynapseConstants' +import SynapseClient from '../../synapse-client' +import { mockCompleteAsyncJob } from '../../mocks/mockFileViewQuery' +import { createWrapper } from '../../testutils/TestingLibraryUtils' import { LockedColumn, QueryContextType, @@ -12,20 +25,6 @@ import { QueryWrapperProps, tableQueryDataAtom, } from './QueryWrapper' -import { SynapseConstants } from '../../utils' -import { - QueryBundleRequest, - QueryResultBundle, - Row, -} from '@sage-bionetworks/synapse-types' -import syn16787123Json from '../../mocks/query/syn16787123' -import { DEFAULT_PAGE_SIZE } from '../../utils/SynapseConstants' -import SynapseClient from '../../synapse-client' -import { mockCompleteAsyncJob } from '../../mocks/mockFileViewQuery' -import userEvent from '@testing-library/user-event' -import { createWrapper } from '../../testutils/TestingLibraryUtils' -import { useAtomValue } from 'jotai' -import { useSetAtom } from 'jotai' import { selectedRowsAtom } from './TableRowSelectionState' jest.mock('../../synapse-client', () => ({ diff --git a/packages/synapse-react-client/src/components/QueryWrapper/QueryWrapper.tsx b/packages/synapse-react-client/src/components/QueryWrapper/QueryWrapper.tsx index 52c62dc92e..bb35a88cc2 100644 --- a/packages/synapse-react-client/src/components/QueryWrapper/QueryWrapper.tsx +++ b/packages/synapse-react-client/src/components/QueryWrapper/QueryWrapper.tsx @@ -3,17 +3,18 @@ import { useDeepCompareEffectNoCheck, useDeepCompareMemoize, } from 'use-deep-compare-effect' +import { + QueryBundleRequest, + QueryResultBundle, + Table, +} from '@sage-bionetworks/synapse-types' +import { atom, Provider, useAtomValue, useSetAtom } from 'jotai' import { hasResettableFilters as hasResettableFiltersUtil, isFacetAvailable, removeLockedColumnFromFacetData, } from '../../utils/functions/queryUtils' import { useGetEntity } from '../../synapse-queries' -import { - QueryBundleRequest, - QueryResultBundle, - Table, -} from '@sage-bionetworks/synapse-types' import { CombineRangeFacetConfig, InfiniteQueryContextType, @@ -23,6 +24,7 @@ import { } from '../QueryContext/QueryContext' import useImmutableTableQuery from '../../utils/hooks/useImmutableTableQuery/useImmutableTableQuery' import { ConfirmationDialog } from '../ConfirmationDialog' +import { getDefaultPrimaryKey } from '../SynapseTable/SynapseTableUtils' import { hasSelectedRowsAtom, isRowSelectionVisibleAtom, @@ -31,8 +33,6 @@ import { } from './TableRowSelectionState' import useQueryWrapperData from './useQueryWrapperData' import { useQueryWrapperPaginationControls } from './useQueryWrapperPaginationControls' -import { getDefaultPrimaryKey } from '../SynapseTable/SynapseTableUtils' -import { atom, Provider, useAtomValue, useSetAtom } from 'jotai' export type QueryWrapperProps = React.PropsWithChildren<{ initQueryRequest: QueryBundleRequest diff --git a/packages/synapse-react-client/src/components/QueryWrapper/TableRowSelectionState.test.tsx b/packages/synapse-react-client/src/components/QueryWrapper/TableRowSelectionState.test.tsx index 1e416149cb..f89d3d677e 100644 --- a/packages/synapse-react-client/src/components/QueryWrapper/TableRowSelectionState.test.tsx +++ b/packages/synapse-react-client/src/components/QueryWrapper/TableRowSelectionState.test.tsx @@ -1,7 +1,8 @@ import { act, renderHook } from '@testing-library/react' -import { mockQueryResultBundle } from '../../mocks/mockFileViewQuery' import { Row } from '@sage-bionetworks/synapse-types' import { cloneDeep } from 'lodash-es' +import { Provider, useAtomValue, useSetAtom } from 'jotai' +import { mockQueryResultBundle } from '../../mocks/mockFileViewQuery' import { hasSelectedRowsAtom, isRowSelectedAtom, @@ -9,7 +10,6 @@ import { rowSelectionPrimaryKeyAtom, selectedRowsAtom, } from './TableRowSelectionState' -import { Provider, useAtomValue, useSetAtom } from 'jotai' import { tableQueryDataAtom } from './QueryWrapper' function useTableRowSelectionState() { diff --git a/packages/synapse-react-client/src/components/QueryWrapper/useQueryWrapperData.test.tsx b/packages/synapse-react-client/src/components/QueryWrapper/useQueryWrapperData.test.tsx index 926267d06e..db4d3df30e 100644 --- a/packages/synapse-react-client/src/components/QueryWrapper/useQueryWrapperData.test.tsx +++ b/packages/synapse-react-client/src/components/QueryWrapper/useQueryWrapperData.test.tsx @@ -1,8 +1,5 @@ import { act, renderHook, waitFor } from '@testing-library/react' import { noop } from 'lodash-es' -import useQueryWrapperData, { - UseQueryWrapperDataReturn, -} from './useQueryWrapperData' import { QueryBundleRequest, QueryResultBundle, @@ -11,6 +8,9 @@ import { getQueryTableAsyncJobResults } from '../../synapse-client' import { mockCompleteAsyncJob } from '../../mocks/mockFileViewQuery' import { createWrapper } from '../../testutils/TestingLibraryUtils' import { SynapseClientError } from '../../index' +import useQueryWrapperData, { + UseQueryWrapperDataReturn, +} from './useQueryWrapperData' jest.mock('../../../src/synapse-client', () => ({ getQueryTableAsyncJobResults: jest.fn(), diff --git a/packages/synapse-react-client/src/components/QueryWrapper/useQueryWrapperData.ts b/packages/synapse-react-client/src/components/QueryWrapper/useQueryWrapperData.ts index f487666348..66eda94048 100644 --- a/packages/synapse-react-client/src/components/QueryWrapper/useQueryWrapperData.ts +++ b/packages/synapse-react-client/src/components/QueryWrapper/useQueryWrapperData.ts @@ -1,16 +1,15 @@ -import React from 'react' -import { - useGetQueryResultBundleWithAsyncStatus, - useInfiniteQueryResultBundle, -} from '../../synapse-queries' +import React, { useMemo, useState } from 'react' import { AsynchronousJobStatus, QueryBundleRequest, QueryResultBundle, } from '@sage-bionetworks/synapse-types' -import { useMemo, useState } from 'react' -import { SynapseClientError } from '../../utils/SynapseClientError' import { UseInfiniteQueryResult } from 'react-query' +import { + useGetQueryResultBundleWithAsyncStatus, + useInfiniteQueryResultBundle, +} from '../../synapse-queries' +import { SynapseClientError } from '../../utils/SynapseClientError' type InfiniteDataPage = number | 'ALL' diff --git a/packages/synapse-react-client/src/components/QueryWrapper/useQueryWrapperPaginationControls.test.tsx b/packages/synapse-react-client/src/components/QueryWrapper/useQueryWrapperPaginationControls.test.tsx index 025cd56c52..695e907321 100644 --- a/packages/synapse-react-client/src/components/QueryWrapper/useQueryWrapperPaginationControls.test.tsx +++ b/packages/synapse-react-client/src/components/QueryWrapper/useQueryWrapperPaginationControls.test.tsx @@ -1,13 +1,13 @@ import { act, renderHook, waitFor } from '@testing-library/react' -import { UseQueryWrapperDataReturn } from './useQueryWrapperData' import { mockCompleteAsyncJob, mockQueryBundleRequest, mockQueryResultBundle, } from '../../mocks/mockFileViewQuery' import { createWrapper } from '../../testutils/TestingLibraryUtils' -import { useQueryWrapperPaginationControls } from './useQueryWrapperPaginationControls' import { ImmutableTableQueryResult } from '../../utils/hooks/useImmutableTableQuery/useImmutableTableQuery' +import { useQueryWrapperPaginationControls } from './useQueryWrapperPaginationControls' +import { UseQueryWrapperDataReturn } from './useQueryWrapperData' describe('useQueryWrapperPaginationControls tests', () => { const immutableTableQueryResult: ImmutableTableQueryResult = { diff --git a/packages/synapse-react-client/src/components/QueryWrapperErrorBanner.tsx b/packages/synapse-react-client/src/components/QueryWrapperErrorBanner.tsx index caa305fc6c..3e27c69505 100644 --- a/packages/synapse-react-client/src/components/QueryWrapperErrorBanner.tsx +++ b/packages/synapse-react-client/src/components/QueryWrapperErrorBanner.tsx @@ -1,8 +1,8 @@ import React from 'react' +import { useSynapseContext } from '../utils' import { ErrorBanner } from './error/ErrorBanner' import { useQueryContext } from './QueryContext/QueryContext' import { EntityActionsRequired } from './AccessRequirement/EntityActionsRequired' -import { useSynapseContext } from '../utils' /** * Error banner that automatically pulls the error from QueryContext. If 403, shows entity actions required diff --git a/packages/synapse-react-client/src/components/QueryWrapperPlotNav/LastUpdatedOn.tsx b/packages/synapse-react-client/src/components/QueryWrapperPlotNav/LastUpdatedOn.tsx index 1a6135d9ef..7ea65eed4a 100644 --- a/packages/synapse-react-client/src/components/QueryWrapperPlotNav/LastUpdatedOn.tsx +++ b/packages/synapse-react-client/src/components/QueryWrapperPlotNav/LastUpdatedOn.tsx @@ -1,9 +1,9 @@ import dayjs from 'dayjs' import React from 'react' -import { formatDate } from '../../utils/functions/DateFormatter' import { Typography } from '@mui/material' -import { useQueryVisualizationContext } from '../QueryVisualizationWrapper' import { useAtomValue } from 'jotai' +import { formatDate } from '../../utils/functions/DateFormatter' +import { useQueryVisualizationContext } from '../QueryVisualizationWrapper' import { tableQueryDataAtom } from '../QueryWrapper/QueryWrapper' export default function LastUpdatedOn() { diff --git a/packages/synapse-react-client/src/components/QueryWrapperPlotNav/QueryWrapperPlotNav.stories.tsx b/packages/synapse-react-client/src/components/QueryWrapperPlotNav/QueryWrapperPlotNav.stories.tsx index 315bf1c14e..c3d9dcad76 100644 --- a/packages/synapse-react-client/src/components/QueryWrapperPlotNav/QueryWrapperPlotNav.stories.tsx +++ b/packages/synapse-react-client/src/components/QueryWrapperPlotNav/QueryWrapperPlotNav.stories.tsx @@ -1,23 +1,21 @@ import React from 'react' import { Meta, StoryObj } from '@storybook/react' -import { - EXPERIMENTAL_TOOL, - GENERIC_CARD, - MEDIUM_USER_CARD, -} from '../../utils/SynapseConstants' import { ColumnSingleValueQueryFilter, Query, -} from '@sage-bionetworks/synapse-types' -import QueryWrapperPlotNav from './QueryWrapperPlotNav' -import { ColumnMultiValueFunction, ColumnSingleValueFilterOperator, } from '@sage-bionetworks/synapse-types' +import { + EXPERIMENTAL_TOOL, + GENERIC_CARD, + MEDIUM_USER_CARD, +} from '../../utils/SynapseConstants' import { displayToast } from '../ToastMessage' import { CustomControlCallbackData } from '../SynapseTable/TopLevelControls/TopLevelControls' import { QUERY_FILTERS_LOCAL_STORAGE_KEY } from '../../utils/functions/SqlFunctions' import { SynapseClient } from '../../index' +import QueryWrapperPlotNav from './QueryWrapperPlotNav' const meta = { title: 'Explore/QueryWrapperPlotNav', diff --git a/packages/synapse-react-client/src/components/QueryWrapperPlotNav/QueryWrapperPlotNav.tsx b/packages/synapse-react-client/src/components/QueryWrapperPlotNav/QueryWrapperPlotNav.tsx index 16dfaa8969..14ade197ca 100644 --- a/packages/synapse-react-client/src/components/QueryWrapperPlotNav/QueryWrapperPlotNav.tsx +++ b/packages/synapse-react-client/src/components/QueryWrapperPlotNav/QueryWrapperPlotNav.tsx @@ -1,4 +1,7 @@ import React, { useState } from 'react' +import { Query, QueryBundleRequest } from '@sage-bionetworks/synapse-types' +import { Box } from '@mui/material' +import { useAtomValue } from 'jotai' import { SynapseConstants } from '../../utils' import { isTable } from '../../utils/functions/EntityTypeUtils' import { @@ -8,7 +11,6 @@ import { } from '../../utils/functions' import { useGetEntity } from '../../synapse-queries' import { DEFAULT_PAGE_SIZE } from '../../utils/SynapseConstants' -import { Query, QueryBundleRequest } from '@sage-bionetworks/synapse-types' import { CardConfiguration } from '../CardContainerLogic' import FullTextSearch from '../FullTextSearch' import ModalDownload from '../ModalDownload/ModalDownload' @@ -30,13 +32,11 @@ import FacetNav, { FacetNavProps } from '../widgets/facet-nav/FacetNav' import FacetFilterControls, { FacetFilterControlsProps, } from '../widgets/query-filter/FacetFilterControls' -import FilterAndView from './FilterAndView' import { NoContentPlaceholderType } from '../SynapseTable/NoContentPlaceholderType' -import { Box } from '@mui/material' import { SynapseErrorBoundary } from '../error/ErrorBanner' import { TableQueryDownloadConfirmation } from '../download_list' -import { useAtomValue } from 'jotai' import { isLoadingNewBundleAtom } from '../QueryWrapper/QueryWrapper' +import FilterAndView from './FilterAndView' export const QUERY_FILTERS_EXPANDED_CSS: string = 'isShowingFacetFilters' export const QUERY_FILTERS_COLLAPSED_CSS: string = 'isHidingFacetFilters' diff --git a/packages/synapse-react-client/src/components/Resources/Resources.Desktop.tsx b/packages/synapse-react-client/src/components/Resources/Resources.Desktop.tsx index fe7be6c0da..c0a0a7f22d 100644 --- a/packages/synapse-react-client/src/components/Resources/Resources.Desktop.tsx +++ b/packages/synapse-react-client/src/components/Resources/Resources.Desktop.tsx @@ -1,6 +1,6 @@ -import { Data } from './Resources' import React, { useState } from 'react' import MarkdownSynapse from '../Markdown/MarkdownSynapse' +import { Data } from './Resources' export type ResourcesDesktopProps = { data: Data diff --git a/packages/synapse-react-client/src/components/Resources/Resources.Mobile.tsx b/packages/synapse-react-client/src/components/Resources/Resources.Mobile.tsx index 44203efbae..3cd0eae736 100644 --- a/packages/synapse-react-client/src/components/Resources/Resources.Mobile.tsx +++ b/packages/synapse-react-client/src/components/Resources/Resources.Mobile.tsx @@ -1,7 +1,7 @@ import React from 'react' -import { Data } from './Resources' import MarkdownSynapse from '../Markdown/MarkdownSynapse' import ExpandableContent from '../home_page/ExpandableContent' +import { Data } from './Resources' export type ResourcesMobileProps = { data: Data diff --git a/packages/synapse-react-client/src/components/Resources/Resources.tsx b/packages/synapse-react-client/src/components/Resources/Resources.tsx index 4af4335ee1..920b274bfb 100644 --- a/packages/synapse-react-client/src/components/Resources/Resources.tsx +++ b/packages/synapse-react-client/src/components/Resources/Resources.tsx @@ -3,10 +3,10 @@ import { QueryBundleRequest } from '@sage-bionetworks/synapse-types' import { SynapseConstants } from '../../utils' import { ErrorBanner } from '../error/ErrorBanner' import useGetQueryResultBundle from '../../synapse-queries/entity/useGetQueryResultBundle' -import ResourcesDesktop from './Resources.Desktop' -import ResourcesMobile from './Resources.Mobile' import useShowDesktop from '../../utils/hooks/useShowDesktop' import { getFieldIndex } from '../../utils/functions/queryUtils' +import ResourcesDesktop from './Resources.Desktop' +import ResourcesMobile from './Resources.Mobile' export type ResourcesProps = { entityId: string diff --git a/packages/synapse-react-client/src/components/RssFeedCards/RssFeedCards.tsx b/packages/synapse-react-client/src/components/RssFeedCards/RssFeedCards.tsx index 081c6fe028..395755048f 100644 --- a/packages/synapse-react-client/src/components/RssFeedCards/RssFeedCards.tsx +++ b/packages/synapse-react-client/src/components/RssFeedCards/RssFeedCards.tsx @@ -1,8 +1,8 @@ import React from 'react' import Parser from 'rss-parser' import dayjs from 'dayjs' -import { ReactComponent as SubscribePlus } from '../../assets/icons/subscribe_plus.svg' import MailchimpSubscribe from 'react-mailchimp-subscribe' +import { ReactComponent as SubscribePlus } from '../../assets/icons/subscribe_plus.svg' import { LockedColumn } from '../QueryContext/QueryContext' import NoData from '../../assets/icons/NoData' import LargeButton from '../../components/styled/LargeButton' diff --git a/packages/synapse-react-client/src/components/SchemaDrivenAnnotationEditor/SchemaDrivenAnnotationEditor.stories.ts b/packages/synapse-react-client/src/components/SchemaDrivenAnnotationEditor/SchemaDrivenAnnotationEditor.stories.ts index 6b708b8a67..130f6de771 100644 --- a/packages/synapse-react-client/src/components/SchemaDrivenAnnotationEditor/SchemaDrivenAnnotationEditor.stories.ts +++ b/packages/synapse-react-client/src/components/SchemaDrivenAnnotationEditor/SchemaDrivenAnnotationEditor.stories.ts @@ -1,6 +1,6 @@ import { Meta, StoryObj } from '@storybook/react' -import { SchemaDrivenAnnotationEditor } from './SchemaDrivenAnnotationEditor' import { mockSchemaBinding } from '../../mocks/mockSchema' +import { SchemaDrivenAnnotationEditor } from './SchemaDrivenAnnotationEditor' const meta = { title: 'Synapse/SchemaDrivenAnnotationEditor', diff --git a/packages/synapse-react-client/src/components/SchemaDrivenAnnotationEditor/SchemaDrivenAnnotationEditor.tsx b/packages/synapse-react-client/src/components/SchemaDrivenAnnotationEditor/SchemaDrivenAnnotationEditor.tsx index 4a6ab47560..df30c9951b 100644 --- a/packages/synapse-react-client/src/components/SchemaDrivenAnnotationEditor/SchemaDrivenAnnotationEditor.tsx +++ b/packages/synapse-react-client/src/components/SchemaDrivenAnnotationEditor/SchemaDrivenAnnotationEditor.tsx @@ -1,8 +1,14 @@ import Form from '@rjsf/mui' -import { JSONSchema7, JSONSchema7Definition } from 'json-schema' import isEmpty from 'lodash-es/isEmpty' import React, { useCallback, useEffect, useMemo, useRef } from 'react' import { Alert, Box, Divider, Link, Typography } from '@mui/material' +import { + ENTITY_CONCRETE_TYPE, + EntityJson, +} from '@sage-bionetworks/synapse-types' +import { RJSFValidationError } from '@rjsf/utils' +import validator from '@rjsf/validator-ajv8' +import RJSF from '@rjsf/core' import AddToList from '../../assets/icons/AddToList' import { BackendDestinationEnum, @@ -15,11 +21,12 @@ import { useUpdateViaJson, } from '../../synapse-queries' import { SynapseClientError } from '../../utils/SynapseClientError' -import { - ENTITY_CONCRETE_TYPE, - EntityJson, -} from '@sage-bionetworks/synapse-types' import { SynapseSpinner } from '../LoadingScreen/LoadingScreen' +import { entityJsonKeys } from '../../utils/functions/EntityTypeUtils' +import { + ConfirmationButtons, + ConfirmationDialog, +} from '../ConfirmationDialog/ConfirmationDialog' import { AdditionalPropertiesSchemaField } from './field/AdditionalPropertiesSchemaField' import { dropNullishArrayValues, @@ -31,13 +38,6 @@ import { DateTimeWidget } from './widget/DateTimeWidget' import { ObjectFieldTemplate } from './template/ObjectFieldTemplate' import { SelectWidget } from './widget/SelectWidget' import TextWidget from './widget/TextWidget' -import { entityJsonKeys } from '../../utils/functions/EntityTypeUtils' -import { - ConfirmationButtons, - ConfirmationDialog, -} from '../ConfirmationDialog/ConfirmationDialog' -import { RJSFValidationError } from '@rjsf/utils' -import validator from '@rjsf/validator-ajv8' import CustomObjectField from './field/CustomObjectField' import ArrayFieldItemTemplate from './template/ArrayFieldItemTemplate' import ArrayFieldTemplate from './template/ArrayFieldTemplate' @@ -48,8 +48,8 @@ import ButtonTemplate from './template/ButtonTemplate' import DescriptionFieldTemplate from './template/DescriptionFieldTemplate' import ArrayFieldDescriptionTemplate from './template/ArrayFieldDescriptionTemplate' import BaseInputTemplate from './template/BaseInputTemplate' -import RJSF from '@rjsf/core' import FieldErrorTemplate from './template/FieldErrorTemplate' +import type { JSONSchema7, JSONSchema7Definition } from 'json-schema' export type SchemaDrivenAnnotationEditorProps = { /** The entity whose annotations should be edited with the form */ diff --git a/packages/synapse-react-client/src/components/SchemaDrivenAnnotationEditor/SchemaDrivenAnnotationsEditor.integration.test.tsx b/packages/synapse-react-client/src/components/SchemaDrivenAnnotationEditor/SchemaDrivenAnnotationsEditor.integration.test.tsx index 018f4854b3..3eee2cdccf 100644 --- a/packages/synapse-react-client/src/components/SchemaDrivenAnnotationEditor/SchemaDrivenAnnotationsEditor.integration.test.tsx +++ b/packages/synapse-react-client/src/components/SchemaDrivenAnnotationEditor/SchemaDrivenAnnotationsEditor.integration.test.tsx @@ -10,10 +10,7 @@ import { } from '@testing-library/react' import userEvent from '@testing-library/user-event' import React from 'react' -import { - SchemaDrivenAnnotationEditor, - SchemaDrivenAnnotationEditorProps, -} from './SchemaDrivenAnnotationEditor' +import { cloneDeep } from 'lodash-es' import * as ToastMessage from '../ToastMessage/ToastMessage' import { createWrapper } from '../../testutils/TestingLibraryUtils' import { @@ -31,7 +28,10 @@ import { SynapseContextType } from '../../utils/context/SynapseContext' import mockFileEntity from '../../mocks/entity/mockFileEntity' import { mockSchemaBinding, mockValidationSchema } from '../../mocks/mockSchema' import { rest, server } from '../../mocks/msw/server' -import { cloneDeep } from 'lodash-es' +import { + SchemaDrivenAnnotationEditor, + SchemaDrivenAnnotationEditorProps, +} from './SchemaDrivenAnnotationEditor' async function chooseAutocompleteOption(el: HTMLElement, option: string) { await userEvent.clear(el) diff --git a/packages/synapse-react-client/src/components/SchemaDrivenAnnotationEditor/field/AdditionalPropertiesSchemaField.tsx b/packages/synapse-react-client/src/components/SchemaDrivenAnnotationEditor/field/AdditionalPropertiesSchemaField.tsx index d30e72868c..c43ab52ec8 100644 --- a/packages/synapse-react-client/src/components/SchemaDrivenAnnotationEditor/field/AdditionalPropertiesSchemaField.tsx +++ b/packages/synapse-react-client/src/components/SchemaDrivenAnnotationEditor/field/AdditionalPropertiesSchemaField.tsx @@ -6,9 +6,9 @@ import { } from '@rjsf/utils' import { isEqual } from 'lodash-es' import React, { useEffect, useState } from 'react' +import { Grid, InputLabel } from '@mui/material' import FullWidthAlert from '../../FullWidthAlert/FullWidthAlert' import { convertToArray } from '../AnnotationEditorUtils' -import { Grid, InputLabel } from '@mui/material' import { AdditionalPropertyContextProvider } from '../template/AdditionalPropertyContext' // Matches ####-##-##T##:##:##.###Z, e.g. 1970-01-01T12:00:000Z diff --git a/packages/synapse-react-client/src/components/SchemaDrivenAnnotationEditor/field/CustomObjectField.tsx b/packages/synapse-react-client/src/components/SchemaDrivenAnnotationEditor/field/CustomObjectField.tsx index a23aad402c..24d46b842c 100644 --- a/packages/synapse-react-client/src/components/SchemaDrivenAnnotationEditor/field/CustomObjectField.tsx +++ b/packages/synapse-react-client/src/components/SchemaDrivenAnnotationEditor/field/CustomObjectField.tsx @@ -1,6 +1,5 @@ import React, { useEffect } from 'react' import { getDefaultRegistry } from '@rjsf/core' -import { convertToArray } from '../AnnotationEditorUtils' import { ADDITIONAL_PROPERTY_FLAG, deepEquals, @@ -10,7 +9,8 @@ import { RJSFSchema, StrictRJSFSchema, } from '@rjsf/utils' -import { JSONSchema7Definition } from 'json-schema' +import { convertToArray } from '../AnnotationEditorUtils' +import type { JSONSchema7Definition } from 'json-schema' /** * Extends the @rjsf/core `ObjectField` and just adds a custom hook for Synapse annotation business logic diff --git a/packages/synapse-react-client/src/components/SchemaDrivenAnnotationEditor/template/ArrayFieldTemplate.tsx b/packages/synapse-react-client/src/components/SchemaDrivenAnnotationEditor/template/ArrayFieldTemplate.tsx index bb12c07927..18577a327b 100644 --- a/packages/synapse-react-client/src/components/SchemaDrivenAnnotationEditor/template/ArrayFieldTemplate.tsx +++ b/packages/synapse-react-client/src/components/SchemaDrivenAnnotationEditor/template/ArrayFieldTemplate.tsx @@ -12,7 +12,7 @@ import React, { useEffect, useState } from 'react' import { Box, Collapse, IconButton, Tooltip } from '@mui/material' import { HelpOutline } from '@mui/icons-material' import { useAdditionalPropertyContext } from './AdditionalPropertyContext' -import { JSONSchema7 } from 'json-schema' +import type { JSONSchema7 } from 'json-schema' /** The `ArrayFieldTemplate` component is the template used to render all items in an array. * diff --git a/packages/synapse-react-client/src/components/SchemaDrivenAnnotationEditor/template/BaseInputTemplate.tsx b/packages/synapse-react-client/src/components/SchemaDrivenAnnotationEditor/template/BaseInputTemplate.tsx index 076bac284d..ba456e52d8 100644 --- a/packages/synapse-react-client/src/components/SchemaDrivenAnnotationEditor/template/BaseInputTemplate.tsx +++ b/packages/synapse-react-client/src/components/SchemaDrivenAnnotationEditor/template/BaseInputTemplate.tsx @@ -1,5 +1,4 @@ -import React from 'react' -import { ChangeEvent, FocusEvent } from 'react' +import React, { ChangeEvent, FocusEvent } from 'react' import TextField, { TextFieldProps } from '@mui/material/TextField' import { ariaDescribedByIds, diff --git a/packages/synapse-react-client/src/components/SchemaDrivenAnnotationEditor/template/FieldDescriptionTable.tsx b/packages/synapse-react-client/src/components/SchemaDrivenAnnotationEditor/template/FieldDescriptionTable.tsx index 59202d7da1..a920944481 100644 --- a/packages/synapse-react-client/src/components/SchemaDrivenAnnotationEditor/template/FieldDescriptionTable.tsx +++ b/packages/synapse-react-client/src/components/SchemaDrivenAnnotationEditor/template/FieldDescriptionTable.tsx @@ -1,6 +1,6 @@ import { Collapse } from '@mui/material' import React from 'react' -import { JSONSchema7, JSONSchema7Definition } from 'json-schema' +import type { JSONSchema7, JSONSchema7Definition } from 'json-schema' export type FieldDescriptionTableProps = { schema: JSONSchema7 diff --git a/packages/synapse-react-client/src/components/SchemaDrivenAnnotationEditor/template/ObjectFieldTemplate.tsx b/packages/synapse-react-client/src/components/SchemaDrivenAnnotationEditor/template/ObjectFieldTemplate.tsx index 801fa71294..36afbeca47 100644 --- a/packages/synapse-react-client/src/components/SchemaDrivenAnnotationEditor/template/ObjectFieldTemplate.tsx +++ b/packages/synapse-react-client/src/components/SchemaDrivenAnnotationEditor/template/ObjectFieldTemplate.tsx @@ -14,7 +14,7 @@ import { Button, Tooltip } from '@mui/material' import { useDeepCompareEffectNoCheck } from 'use-deep-compare-effect' import { displayToast } from '../../ToastMessage' import AddToList from '../../../assets/icons/AddToList' -import { JSONSchema7Definition } from 'json-schema' +import type { JSONSchema7Definition } from 'json-schema' /** * Derived from the base ObjectFieldTemplate with annotations-editor-specific changes diff --git a/packages/synapse-react-client/src/components/Skeleton/index.ts b/packages/synapse-react-client/src/components/Skeleton/index.ts index 99ced14cfd..083f3aff41 100644 --- a/packages/synapse-react-client/src/components/Skeleton/index.ts +++ b/packages/synapse-react-client/src/components/Skeleton/index.ts @@ -1,8 +1,8 @@ import { SkeletonButton } from './SkeletonButton' import { SkeletonInlineBlock } from './SkeletonInlineBlock' import { SkeletonTable } from './SkeletonTable' -import type { SkeletonTableProps } from './SkeletonTable' import { SkeletonParagraph } from './SkeletonParagraph' +import type { SkeletonTableProps } from './SkeletonTable' import type { SkeletonParagraphProps } from './SkeletonParagraph' export { SkeletonButton, diff --git a/packages/synapse-react-client/src/components/SpinnerButton/SpinnerButton.stories.tsx b/packages/synapse-react-client/src/components/SpinnerButton/SpinnerButton.stories.tsx index 93af60efb0..abe0c09b2e 100644 --- a/packages/synapse-react-client/src/components/SpinnerButton/SpinnerButton.stories.tsx +++ b/packages/synapse-react-client/src/components/SpinnerButton/SpinnerButton.stories.tsx @@ -1,10 +1,10 @@ import React from 'react' import { Meta, StoryObj } from '@storybook/react' -import SpinnerButton from './SpinnerButton' import { SynapseContextConsumer, SynapseContextProvider, } from '../../utils/context' +import SpinnerButton from './SpinnerButton' const meta: Meta = { title: 'UI/SpinnerButton', diff --git a/packages/synapse-react-client/src/components/SpinnerButton/SpinnerButton.tsx b/packages/synapse-react-client/src/components/SpinnerButton/SpinnerButton.tsx index fca1e93b5e..79b42334d1 100644 --- a/packages/synapse-react-client/src/components/SpinnerButton/SpinnerButton.tsx +++ b/packages/synapse-react-client/src/components/SpinnerButton/SpinnerButton.tsx @@ -1,9 +1,9 @@ import React, { useEffect, useRef, useState } from 'react' +import { Box } from '@mui/material' import { LoginAwareButton, LoginAwareButtonProps, } from '../widgets/LoginAwareButton' -import { Box } from '@mui/material' export type SpinnerButtonProps = LoginAwareButtonProps & { showSpinner?: boolean diff --git a/packages/synapse-react-client/src/components/StandaloneQueryWrapper/StandaloneQueryWrapper.tsx b/packages/synapse-react-client/src/components/StandaloneQueryWrapper/StandaloneQueryWrapper.tsx index 4c2fd58b28..9660db7c81 100644 --- a/packages/synapse-react-client/src/components/StandaloneQueryWrapper/StandaloneQueryWrapper.tsx +++ b/packages/synapse-react-client/src/components/StandaloneQueryWrapper/StandaloneQueryWrapper.tsx @@ -1,10 +1,10 @@ import React, { useState } from 'react' +import { QueryBundleRequest } from '@sage-bionetworks/synapse-types' import { getAdditionalFilters, parseEntityIdFromSqlStatement, } from '../../utils/functions/SqlFunctions' import SynapseTable, { SynapseTableProps } from '../SynapseTable/SynapseTable' -import { QueryBundleRequest } from '@sage-bionetworks/synapse-types' import { SynapseConstants } from '../../utils' import { QueryWrapper } from '../QueryWrapper/QueryWrapper' import { QueryContextConsumer } from '../QueryContext/QueryContext' diff --git a/packages/synapse-react-client/src/components/StatisticsPlot.tsx b/packages/synapse-react-client/src/components/StatisticsPlot.tsx index da51a6fc83..f621fd5bc1 100644 --- a/packages/synapse-react-client/src/components/StatisticsPlot.tsx +++ b/packages/synapse-react-client/src/components/StatisticsPlot.tsx @@ -1,12 +1,12 @@ import React from 'react' import Plotly from 'plotly.js-basic-dist' import createPlotlyComponent from 'react-plotly.js/factory' -import SynapseClient from '../synapse-client' import { ProjectFilesStatisticsRequest, ProjectFilesStatisticsResponse, FilesCountStatistics, } from '@sage-bionetworks/synapse-types' +import SynapseClient from '../synapse-client' import { SynapseContext } from '../utils/context/SynapseContext' const Plot = createPlotlyComponent(Plotly) diff --git a/packages/synapse-react-client/src/components/StepperDialog/StepperDialog.stories.tsx b/packages/synapse-react-client/src/components/StepperDialog/StepperDialog.stories.tsx index d17f4169ed..94d28a84f8 100644 --- a/packages/synapse-react-client/src/components/StepperDialog/StepperDialog.stories.tsx +++ b/packages/synapse-react-client/src/components/StepperDialog/StepperDialog.stories.tsx @@ -1,9 +1,9 @@ import React, { useState } from 'react' import { Meta, StoryObj } from '@storybook/react' -import { StepperDialog, StepperDialogProps } from './index' import Button from '@mui/material/Button' import { Step } from './StepperDialog' +import { StepperDialog, StepperDialogProps } from './index' const steps: Record = { STEP_1: { diff --git a/packages/synapse-react-client/src/components/StepperDialog/StepperDialog.tsx b/packages/synapse-react-client/src/components/StepperDialog/StepperDialog.tsx index e613fb4c1f..6c3b4d80b1 100644 --- a/packages/synapse-react-client/src/components/StepperDialog/StepperDialog.tsx +++ b/packages/synapse-react-client/src/components/StepperDialog/StepperDialog.tsx @@ -1,9 +1,8 @@ -import { Alert, Button, Box } from '@mui/material' +import { Alert, Button, Box, DialogContentProps } from '@mui/material' import React from 'react' import { DialogBase } from '../DialogBase' import { SynapseSpinner } from '../LoadingScreen/LoadingScreen' import SpinnerButton from '../SpinnerButton/SpinnerButton' -import { DialogContentProps } from '@mui/material' export type Step = { id: string diff --git a/packages/synapse-react-client/src/components/StorybookComponentWrapper.tsx b/packages/synapse-react-client/src/components/StorybookComponentWrapper.tsx index 5d277fd502..6f40157256 100644 --- a/packages/synapse-react-client/src/components/StorybookComponentWrapper.tsx +++ b/packages/synapse-react-client/src/components/StorybookComponentWrapper.tsx @@ -1,14 +1,13 @@ import React, { useEffect, useMemo } from 'react' import { MemoryRouter } from 'react-router-dom' +import { QueryClient, QueryClientProvider } from 'react-query' +import { ReactQueryDevtools } from 'react-query/devtools' +import dayjs from 'dayjs' +import SynapseClient from '../synapse-client' import { SynapseContextProvider, SynapseContextType, } from '../utils/context/SynapseContext' -import { QueryClient, QueryClientProvider } from 'react-query' -import SynapseClient from '../synapse-client' -import { SynapseToastContainer } from './ToastMessage/ToastMessage' -import { ReactQueryDevtools } from 'react-query/devtools' -import dayjs from 'dayjs' import { getAccessTokenFromCookie, getAuthenticatedOn, @@ -19,6 +18,7 @@ import { SynapseClientError } from '../utils/SynapseClientError' import { STACK_MAP, SynapseStack } from '../utils/functions/getEndpoint' import useDetectSSOCode from '../utils/hooks/useDetectSSOCode' import { defaultQueryClientConfig } from '../utils/context/FullContextProvider' +import { SynapseToastContainer } from './ToastMessage/ToastMessage' export async function sessionChangeHandler() { let accessToken: string | undefined = await getAccessTokenFromCookie() diff --git a/packages/synapse-react-client/src/components/SubscriptionPage/ForumTopic.tsx b/packages/synapse-react-client/src/components/SubscriptionPage/ForumTopic.tsx index 1e7a33b41b..1415110987 100644 --- a/packages/synapse-react-client/src/components/SubscriptionPage/ForumTopic.tsx +++ b/packages/synapse-react-client/src/components/SubscriptionPage/ForumTopic.tsx @@ -3,7 +3,6 @@ import { Subscription, SubscriptionObjectType, } from '@sage-bionetworks/synapse-types' -import Topic from './Topic' import { useGetForumMetadata } from '../../synapse-queries/forum/useForum' import { useGetEntity } from '../../synapse-queries' import { useSubscription } from '../../synapse-queries/subscription/useSubscription' @@ -11,6 +10,7 @@ import { BackendDestinationEnum, getEndpoint, } from '../../utils/functions/getEndpoint' +import Topic from './Topic' export type SubscriptionItemProps = { subscription: Subscription diff --git a/packages/synapse-react-client/src/components/SubscriptionPage/SubscriptionPage.integration.test.tsx b/packages/synapse-react-client/src/components/SubscriptionPage/SubscriptionPage.integration.test.tsx index cb8f3c8d48..3f5ce253fb 100644 --- a/packages/synapse-react-client/src/components/SubscriptionPage/SubscriptionPage.integration.test.tsx +++ b/packages/synapse-react-client/src/components/SubscriptionPage/SubscriptionPage.integration.test.tsx @@ -1,10 +1,10 @@ import React from 'react' import userEvent from '@testing-library/user-event' import { act, render, screen, waitFor, within } from '@testing-library/react' +import { SubscriptionObjectType } from '@sage-bionetworks/synapse-types' import { SubscriptionPage, SynapseClient } from '../../index' import { createWrapper } from '../../testutils/TestingLibraryUtils' import { server } from '../../mocks/msw/server' -import { SubscriptionObjectType } from '@sage-bionetworks/synapse-types' function setUp() { const user = userEvent.setup() diff --git a/packages/synapse-react-client/src/components/SubscriptionPage/SubscriptionPage.stories.ts b/packages/synapse-react-client/src/components/SubscriptionPage/SubscriptionPage.stories.ts index 8912833223..9f192d1cc4 100644 --- a/packages/synapse-react-client/src/components/SubscriptionPage/SubscriptionPage.stories.ts +++ b/packages/synapse-react-client/src/components/SubscriptionPage/SubscriptionPage.stories.ts @@ -1,7 +1,7 @@ import { Meta, StoryObj } from '@storybook/react' -import SubscriptionPage from './index' import { MOCK_REPO_ORIGIN } from '../../utils/functions/getEndpoint' import { getHandlers } from '../../mocks/msw/handlers' +import SubscriptionPage from './index' const meta = { title: 'Synapse/Following/SubscriptionPage', diff --git a/packages/synapse-react-client/src/components/SubscriptionPage/SubscriptionPage.tsx b/packages/synapse-react-client/src/components/SubscriptionPage/SubscriptionPage.tsx index 2c16f64a93..8c9e0a9e86 100644 --- a/packages/synapse-react-client/src/components/SubscriptionPage/SubscriptionPage.tsx +++ b/packages/synapse-react-client/src/components/SubscriptionPage/SubscriptionPage.tsx @@ -1,13 +1,13 @@ import React, { useId, useState } from 'react' -import { useGetAllSubscriptions } from '../../synapse-queries/subscription/useSubscription' import { SortByType as SubscriptionSortField, SortDirection, SubscriptionObjectType, } from '@sage-bionetworks/synapse-types' -import SubscriptionItem from './SubscriptionItem' import { Box, Button, Stack, Tab, Tabs } from '@mui/material' +import { useGetAllSubscriptions } from '../../synapse-queries/subscription/useSubscription' import DropdownSelect from '../DropdownSelect' +import SubscriptionItem from './SubscriptionItem' type SortOption = { value: SortDirection; label: string } diff --git a/packages/synapse-react-client/src/components/SubscriptionPage/ThreadTopic.tsx b/packages/synapse-react-client/src/components/SubscriptionPage/ThreadTopic.tsx index 18cec45a30..732d68451d 100644 --- a/packages/synapse-react-client/src/components/SubscriptionPage/ThreadTopic.tsx +++ b/packages/synapse-react-client/src/components/SubscriptionPage/ThreadTopic.tsx @@ -4,12 +4,12 @@ import { SubscriptionObjectType, } from '@sage-bionetworks/synapse-types' import { useSubscription } from '../../synapse-queries/subscription/useSubscription' -import Topic from './Topic' import { useGetThread } from '../../synapse-queries/forum/useThread' import { BackendDestinationEnum, getEndpoint, } from '../../utils/functions/getEndpoint' +import Topic from './Topic' export type SubscriptionItemProps = { subscription: Subscription diff --git a/packages/synapse-react-client/src/components/SubsectionRowRenderer/SubsectionRowRenderer.test.tsx b/packages/synapse-react-client/src/components/SubsectionRowRenderer/SubsectionRowRenderer.test.tsx index c24db5de5b..c24cf208e4 100644 --- a/packages/synapse-react-client/src/components/SubsectionRowRenderer/SubsectionRowRenderer.test.tsx +++ b/packages/synapse-react-client/src/components/SubsectionRowRenderer/SubsectionRowRenderer.test.tsx @@ -1,14 +1,14 @@ import React from 'react' import { render, screen, waitFor } from '@testing-library/react' -import { createWrapper } from '../../testutils/TestingLibraryUtils' import { QueryResultBundle } from '@sage-bionetworks/synapse-types' +import { createWrapper } from '../../testutils/TestingLibraryUtils' import syn26433429CatalogNumberJson from '../../mocks/query/syn26433429CatalogNumber.json' import mockMultiValueColumnResultsJson from '../../mocks/query/mockMultiValueColumnResults.json' +import { SynapseContextType } from '../../utils/context/SynapseContext' +import SynapseClient from '../../synapse-client' import SubsectionRowRenderer, { SubsectionRowRendererProps, } from './SubsectionRowRenderer' -import { SynapseContextType } from '../../utils/context/SynapseContext' -import SynapseClient from '../../synapse-client' jest.mock('../../synapse-client', () => ({ getQueryTableResults: jest.fn(), diff --git a/packages/synapse-react-client/src/components/SubsectionRowRenderer/SubsectionRowRenderer.tsx b/packages/synapse-react-client/src/components/SubsectionRowRenderer/SubsectionRowRenderer.tsx index e2ee1ae8fd..0231f3fa1c 100644 --- a/packages/synapse-react-client/src/components/SubsectionRowRenderer/SubsectionRowRenderer.tsx +++ b/packages/synapse-react-client/src/components/SubsectionRowRenderer/SubsectionRowRenderer.tsx @@ -1,4 +1,12 @@ import React, { useState } from 'react' +import { + ColumnType, + ColumnTypeEnum, + QueryBundleRequest, + RowSet, +} from '@sage-bionetworks/synapse-types' +import { Typography } from '@mui/material' +import { useDeepCompareEffectNoCheck } from 'use-deep-compare-effect' import { getAdditionalFilters, parseEntityIdFromSqlStatement, @@ -6,18 +14,10 @@ import { } from '../../utils/functions/SqlFunctions' import { SynapseConstants } from '../../utils' import SynapseClient from '../../synapse-client' -import { - ColumnType, - ColumnTypeEnum, - QueryBundleRequest, - RowSet, -} from '@sage-bionetworks/synapse-types' import { useSynapseContext } from '../../utils/context/SynapseContext' import MarkdownSynapse from '../Markdown/MarkdownSynapse' import { SkeletonTable } from '../Skeleton/SkeletonTable' import { ColumnSpecifiedLink } from '../CardContainerLogic' -import { Typography } from '@mui/material' -import { useDeepCompareEffectNoCheck } from 'use-deep-compare-effect' export type FriendlyValuesMap = { [index: string]: string diff --git a/packages/synapse-react-client/src/components/SynapseForm/Header.test.tsx b/packages/synapse-react-client/src/components/SynapseForm/Header.test.tsx index 84a59279f4..745470b594 100644 --- a/packages/synapse-react-client/src/components/SynapseForm/Header.test.tsx +++ b/packages/synapse-react-client/src/components/SynapseForm/Header.test.tsx @@ -1,6 +1,6 @@ import React from 'react' -import Header, { HeaderProps } from './Header' import { render, screen } from '@testing-library/react' +import Header, { HeaderProps } from './Header' const renderComponent = (props: HeaderProps) => { render(
) diff --git a/packages/synapse-react-client/src/components/SynapseForm/NavButtons.test.tsx b/packages/synapse-react-client/src/components/SynapseForm/NavButtons.test.tsx index 8e18ad5755..7fd6600205 100644 --- a/packages/synapse-react-client/src/components/SynapseForm/NavButtons.test.tsx +++ b/packages/synapse-react-client/src/components/SynapseForm/NavButtons.test.tsx @@ -2,6 +2,7 @@ import { render, screen, within } from '@testing-library/react' import userEvent from '@testing-library/user-event' import * as _ from 'lodash-es' import React from 'react' +import { steps } from '../../mocks/mock_drug_tool_data' import { NavButtons, NavButtonsProps, @@ -9,7 +10,6 @@ import { NextStepLinkProps, } from './NavButtons' import { NavActionEnum, Step } from './types' -import { steps } from '../../mocks/mock_drug_tool_data' const stepsArray: Step[] = _.cloneDeep(steps) diff --git a/packages/synapse-react-client/src/components/SynapseForm/StepsSideNav.test.tsx b/packages/synapse-react-client/src/components/SynapseForm/StepsSideNav.test.tsx index 7f30a31e06..b424a8bec2 100644 --- a/packages/synapse-react-client/src/components/SynapseForm/StepsSideNav.test.tsx +++ b/packages/synapse-react-client/src/components/SynapseForm/StepsSideNav.test.tsx @@ -2,9 +2,9 @@ import { render, screen, within } from '@testing-library/react' import userEvent from '@testing-library/user-event' import * as _ from 'lodash-es' import React from 'react' +import { stepsWithChildren } from '../../mocks/mock_drug_tool_data' import StepsSideNav, { StepsSideNavProps } from './StepsSideNav' import { Step } from './types' -import { stepsWithChildren } from '../../mocks/mock_drug_tool_data' const stepsArray: Step[] = _.cloneDeep(stepsWithChildren) diff --git a/packages/synapse-react-client/src/components/SynapseForm/SummaryTable.test.tsx b/packages/synapse-react-client/src/components/SynapseForm/SummaryTable.test.tsx index 9bb52689c4..c5dae81179 100644 --- a/packages/synapse-react-client/src/components/SynapseForm/SummaryTable.test.tsx +++ b/packages/synapse-react-client/src/components/SynapseForm/SummaryTable.test.tsx @@ -2,14 +2,14 @@ import $RefParser from '@apidevtools/json-schema-ref-parser' import { render, screen, within } from '@testing-library/react' import * as _ from 'lodash-es' import React from 'react' -import SummaryTable, { SummaryTableProps } from './SummaryTable' -import { Step } from './types' import { mockFormData as submissionData, mockFormSchema as formSchema, mockUiSchema as formUiSchema, stepsWithUserData, } from '../../mocks/mock_drug_tool_data' +import SummaryTable, { SummaryTableProps } from './SummaryTable' +import { Step } from './types' const stepsArray: Step[] = _.cloneDeep(stepsWithUserData) diff --git a/packages/synapse-react-client/src/components/SynapseForm/SummaryTable.tsx b/packages/synapse-react-client/src/components/SynapseForm/SummaryTable.tsx index ab4a789fdb..5bf7b94387 100644 --- a/packages/synapse-react-client/src/components/SynapseForm/SummaryTable.tsx +++ b/packages/synapse-react-client/src/components/SynapseForm/SummaryTable.tsx @@ -1,6 +1,5 @@ import React from 'react' import { UiSchema } from '@rjsf/utils' -import { FormSchema, Step, SummaryFormat } from './types' import { cloneDeep, find, @@ -12,6 +11,7 @@ import { isString, keys, } from 'lodash-es' +import { FormSchema, Step, SummaryFormat } from './types' export interface SummaryTableProps { isWizard?: boolean diff --git a/packages/synapse-react-client/src/components/SynapseForm/SynapseForm.test.tsx b/packages/synapse-react-client/src/components/SynapseForm/SynapseForm.test.tsx index db53276d11..5f754fdccb 100644 --- a/packages/synapse-react-client/src/components/SynapseForm/SynapseForm.test.tsx +++ b/packages/synapse-react-client/src/components/SynapseForm/SynapseForm.test.tsx @@ -3,7 +3,6 @@ import { render, screen } from '@testing-library/react' import userEvent from '@testing-library/user-event' import React from 'react' import { MemoryRouter } from 'react-router-dom' -import SynapseForm, { SynapseFormProps } from './SynapseForm' import { createWrapper } from '../../testutils/TestingLibraryUtils' import { mockFormData as submissionData, @@ -11,6 +10,7 @@ import { mockNavSchema as formNavSchema, mockUiSchema as formUiSchema, } from '../../mocks/mock_drug_tool_data' +import SynapseForm, { SynapseFormProps } from './SynapseForm' // import { Engine } from 'json-rules-engine' diff --git a/packages/synapse-react-client/src/components/SynapseForm/SynapseForm.tsx b/packages/synapse-react-client/src/components/SynapseForm/SynapseForm.tsx index 87a3c8e6b8..4afa7bb96a 100644 --- a/packages/synapse-react-client/src/components/SynapseForm/SynapseForm.tsx +++ b/packages/synapse-react-client/src/components/SynapseForm/SynapseForm.tsx @@ -1,17 +1,32 @@ import React from 'react' -import _ from 'lodash-es' import { Engine, EngineResult } from 'json-rules-engine' import Form from '@rjsf/core' import validator from '@rjsf/validator-ajv8' -import { UiSchema, ErrorListProps, RJSFValidationError } from '@rjsf/utils' +import { ErrorListProps, RJSFValidationError, UiSchema } from '@rjsf/utils' +import Switch from 'react-switch' +import { Prompt } from 'react-router-dom' +import { + cloneDeep, + find, + findIndex, + first, + get, + isEqual, + isUndefined, + keys, + pick, + remove, + set, + trimStart, +} from 'lodash-es' import { - Step, - StepStateEnum, - NavActionEnum, - StatusEnum, FormSchema, - IRulesValidationEvent, IRulesNavigationEvent, + IRulesValidationEvent, + NavActionEnum, + StatusEnum, + Step, + StepStateEnum, } from './types' import Header from './Header' import StepsSideNav from './StepsSideNav' @@ -19,8 +34,6 @@ import { NavButtons, NextStepLink } from './NavButtons' import DataDebug from './DataDebug' import SummaryTable from './SummaryTable' import WarningDialog from './WarningDialog' -import Switch from 'react-switch' -import { Prompt } from 'react-router-dom' export interface IFormData { [key: string]: { @@ -109,10 +122,7 @@ export default class SynapseForm extends React.Component< super(props) //will modify the ui:help to render html vs text - this.uiSchema = stringToElementForProp( - _.cloneDeep(props.uiSchema), - 'ui:help', - ) + this.uiSchema = stringToElementForProp(cloneDeep(props.uiSchema), 'ui:help') //create steps array from the navSchema const steps = props.navSchema.steps .map((step, i) => { @@ -180,8 +190,8 @@ export default class SynapseForm extends React.Component< const currentStateFormData = currentState.formData //if there is a top level 'included' property in schema - update the form. Object.keys(schemaScreens).forEach((key: string) => { - if (_.get(schemaScreens[key], `properties.included`)) { - _.set(result, `${key}.included`, true) + if (get(schemaScreens[key], `properties.included`)) { + set(result, `${key}.included`, true) } }) return { ...currentStateFormData, ...result } @@ -191,8 +201,8 @@ export default class SynapseForm extends React.Component< currentState: SynapseFormState, ): IFormData => { const firstStepId = currentState.currentStep.id - const newStateData = _.cloneDeep(currentState.formData) - _.set(newStateData, `${firstStepId}.included`, true) + const newStateData = cloneDeep(currentState.formData) + set(newStateData, `${firstStepId}.included`, true) return newStateData } @@ -225,7 +235,7 @@ export default class SynapseForm extends React.Component< } //only get schema for current step. Only the portion of entire form is shown - const currentStepSlice = _.pick(this.props.schema, [ + const currentStepSlice = pick(this.props.schema, [ 'title', 'type', `properties.${id}`, @@ -308,7 +318,7 @@ export default class SynapseForm extends React.Component< }) //if we are in wizard mode we want to make sure that we include the step we are about to go to if (isMoveForwardInWizardMode) { - _.set(formData, `${nextStepId}.included`, true) + set(formData, `${nextStepId}.included`, true) } //at this point the form is valid and submitted and the data reflects the latest @@ -353,17 +363,17 @@ export default class SynapseForm extends React.Component< if (!this.isSubmitScreen()) { //since we don't know if we'll get back to that step again - exclude it. We will include it again if we // get to it. - _.set(formData, `${this.state.currentStep.id}.included`, undefined) + set(formData, `${this.state.currentStep.id}.included`, undefined) } } else { - const currentIndex = _.findIndex(this.state.steps, { + const currentIndex = findIndex(this.state.steps, { id: this.state.currentStep.id, }) if (currentIndex > 0) { previousStepId = this.state.steps[currentIndex - 1].id } } - if (!_.isUndefined(previousStepId)) { + if (!isUndefined(previousStepId)) { return this.moveStep(formData, previousStepId, isError, previousStack) } } @@ -425,7 +435,7 @@ export default class SynapseForm extends React.Component< //error property is in the format: step.somevalue.etc .welcome.submission_name example //find all the steps where there is an error const stepsWithError = errors.map( - error => _.trimStart(error.property, '.').split('.')[0], + error => trimStart(error.property, '.').split('.')[0], ) //find all steps in current schema const stepsInCurrentSchema = Object.keys(currentSchemaProperties) @@ -440,7 +450,7 @@ export default class SynapseForm extends React.Component< } else if (stepsInCurrentSchema.indexOf(step.id) > -1) { let state = StepStateEnum.COMPLETED //if we are in wizard and possibly have not visited this step - if (isWizard && !_.get(formData[step.id], 'included')) { + if (isWizard && !get(formData[step.id], 'included')) { state = step.state } @@ -459,7 +469,7 @@ export default class SynapseForm extends React.Component< handleOnChange({ formData }: any) { //this is just for form updates. submit screen goes different route if (!this.isSubmitScreen() && !this.state.currentStep.excluded) { - const hasUnsavedChanges = !_.isEqual(this.state.formData, formData) + const hasUnsavedChanges = !isEqual(this.state.formData, formData) this.setState({ formData, hasUnsavedChanges }) } } @@ -548,8 +558,8 @@ export default class SynapseForm extends React.Component< return stp }) - const formDataUpdated = _.cloneDeep(prevState.formData) - const currentStep = _.cloneDeep(prevState.currentStep) + const formDataUpdated = cloneDeep(prevState.formData) + const currentStep = cloneDeep(prevState.currentStep) //we need this because you can exclude on the ifnal screen so the currentStep.id //is not always the one we need to exclude if (currentStep.id === stepId) { @@ -558,9 +568,9 @@ export default class SynapseForm extends React.Component< //if exluding - blow away the data for the step if (isExclude) { formDataUpdated[stepId] = {} - //_.set(formDataUpdated, `${stepId}.included`, false); + //set(formDataUpdated, `${stepId}.included`, false); } else { - _.set(formDataUpdated, `${stepId}.included`, true) + set(formDataUpdated, `${stepId}.included`, true) } return { steps, @@ -684,7 +694,7 @@ export default class SynapseForm extends React.Component< ? acc.concat(value.validationRules) : acc }, []) - data = _.cloneDeep(formData) + data = cloneDeep(formData) } if (rules.length === 0) { @@ -702,7 +712,7 @@ export default class SynapseForm extends React.Component< allRules.push(rule) } else { const path = paramProp.split('[*]')[0].substring(1) - const data = _.get(formData, path) + const data = get(formData, path) // generate a rule for each item in the data array by substituting [*] w/ appropriate index if (Array.isArray(data) && typeof data !== 'string') { for (let i = 0; i < data.length; i++) { @@ -782,7 +792,7 @@ export default class SynapseForm extends React.Component< 0, error.property.lastIndexOf('.'), ) - _.remove(errors, (error: RJSFValidationError) => { + remove(errors, (error: RJSFValidationError) => { return ( (error.property || '').indexOf(parentPath) > -1 && (error.name === 'enum' || error.name === 'oneOf') @@ -1005,7 +1015,7 @@ function renderTransformedErrorObject( i: number, schema: any, ): { order: number; element: JSX.Element } { - const propPath = _.trimStart(error.property, '.') + const propPath = trimStart(error.property, '.') const propArr = propPath.split('.') // some things require labels in schema (e.g. checkboxes) so this is preferred @@ -1018,7 +1028,7 @@ function renderTransformedErrorObject( const arrayLabelFromUI = labelFromUi.replace(/\[.*?\]/, '.items') const indexMatch = labelFromSchema.match(/\[.*?\]/) - let index = _.first(indexMatch) + let index = first(indexMatch) if (index) { index = index.substring(1, index.length - 1) @@ -1026,13 +1036,13 @@ function renderTransformedErrorObject( } const label = - _.get(uiSchema, labelFromUi) || - _.get(schema.properties, labelFromSchema) || - _.get(uiSchema, arrayLabelFromUI) || - _.get(schema.properties, arrayLabelFromSchema) || + get(uiSchema, labelFromUi) || + get(schema.properties, labelFromSchema) || + get(uiSchema, arrayLabelFromUI) || + get(schema.properties, arrayLabelFromSchema) || error.property - const screen = _.find(steps, { id: propArr[0] }) || { + const screen = find(steps, { id: propArr[0] }) || { title: propArr[0], order: 0, } @@ -1052,7 +1062,7 @@ function renderTransformedErrorObject( //recursively sets property value to dangerouslySetInnerHTML of that value function stringToElementForProp(srcObject: any, key: string): object { - _.keys(srcObject).some(k => { + keys(srcObject).some(k => { if (k === key) { const value = srcObject[k] srcObject[k] = diff --git a/packages/synapse-react-client/src/components/SynapseForm/SynapseFormSubmissionsGrid.integration.test.tsx b/packages/synapse-react-client/src/components/SynapseForm/SynapseFormSubmissionsGrid.integration.test.tsx index e7b6dc0522..51a6412cba 100644 --- a/packages/synapse-react-client/src/components/SynapseForm/SynapseFormSubmissionsGrid.integration.test.tsx +++ b/packages/synapse-react-client/src/components/SynapseForm/SynapseFormSubmissionsGrid.integration.test.tsx @@ -1,17 +1,17 @@ import { act, render, screen, waitFor, within } from '@testing-library/react' import userEvent from '@testing-library/user-event' import React from 'react' -import UserFileGrid, { - SynapseFormSubmissionGridProps, -} from './SynapseFormSubmissionsGrid' +import { StatusEnum } from '@sage-bionetworks/synapse-types' import { createWrapper } from '../../testutils/TestingLibraryUtils' import SynapseClient from '../../synapse-client' -import { StatusEnum } from '@sage-bionetworks/synapse-types' import { formListDataInProgress, formListDataSubmitted, } from '../../mocks/mock_drug_tool_data' import { server } from '../../mocks/msw/server' +import UserFileGrid, { + SynapseFormSubmissionGridProps, +} from './SynapseFormSubmissionsGrid' const token: string = '123444' const pathpart = 'someTool' diff --git a/packages/synapse-react-client/src/components/SynapseForm/SynapseFormSubmissionsGrid.stories.tsx b/packages/synapse-react-client/src/components/SynapseForm/SynapseFormSubmissionsGrid.stories.tsx index 98b0971a73..d3581db6d5 100644 --- a/packages/synapse-react-client/src/components/SynapseForm/SynapseFormSubmissionsGrid.stories.tsx +++ b/packages/synapse-react-client/src/components/SynapseForm/SynapseFormSubmissionsGrid.stories.tsx @@ -1,18 +1,18 @@ import React from 'react' import { Meta, StoryObj } from '@storybook/react' import { rest } from 'msw' -import { MOCK_REPO_ORIGIN } from '../../utils/functions/getEndpoint' -import SynapseFormSubmissionGrid, { - SynapseFormSubmissionGridProps, -} from './SynapseFormSubmissionsGrid' +import { ListRequest, StatusEnum } from '@sage-bionetworks/synapse-types' import { SynapseContextConsumer } from '../../utils/context/SynapseContext' import FullContextProvider from '../../utils/context/FullContextProvider' -import { ListRequest, StatusEnum } from '@sage-bionetworks/synapse-types' +import { MOCK_REPO_ORIGIN } from '../../utils/functions/getEndpoint' import { formListDataInProgress, formListDataSubmitted, } from '../../mocks/mock_drug_tool_data' import { getHandlers } from '../../mocks/msw/handlers' +import SynapseFormSubmissionGrid, { + SynapseFormSubmissionGridProps, +} from './SynapseFormSubmissionsGrid' const meta = { title: 'Portals/SynapseFormSubmissionsGrid', diff --git a/packages/synapse-react-client/src/components/SynapseForm/SynapseFormSubmissionsGrid.tsx b/packages/synapse-react-client/src/components/SynapseForm/SynapseFormSubmissionsGrid.tsx index 16527d2d71..6dc198af91 100644 --- a/packages/synapse-react-client/src/components/SynapseForm/SynapseFormSubmissionsGrid.tsx +++ b/packages/synapse-react-client/src/components/SynapseForm/SynapseFormSubmissionsGrid.tsx @@ -1,22 +1,22 @@ import React from 'react' -import SynapseClient from '../../synapse-client' import { FormData, ListRequest, StatusEnum, ListResponse, } from '@sage-bionetworks/synapse-types' -import WarningDialog from './WarningDialog' -import { ConfirmationDialog } from '../ConfirmationDialog/ConfirmationDialog' -import WideButton from '../styled/WideButton' import { Box, Button, IconButton, Link, Typography } from '@mui/material' import DeleteTwoToneIcon from '@mui/icons-material/DeleteTwoTone' import PhoneTwoToneIcon from '@mui/icons-material/PhoneTwoTone' import dayjs from 'dayjs' import calendar from 'dayjs/plugin/calendar' +import WideButton from '../styled/WideButton' +import { ConfirmationDialog } from '../ConfirmationDialog/ConfirmationDialog' +import SynapseClient from '../../synapse-client' import { SRC_SIGN_IN_CLASS } from '../../utils/SynapseConstants' import { ReactComponent as NoSubmissionsIcon } from '../../assets/icons/json-form-tool-no-submissions.svg' +import WarningDialog from './WarningDialog' dayjs.extend(calendar) /** diff --git a/packages/synapse-react-client/src/components/SynapseForm/SynapseFormUtils.test.ts b/packages/synapse-react-client/src/components/SynapseForm/SynapseFormUtils.test.ts index 23a58ceb37..5b18c8a51e 100644 --- a/packages/synapse-react-client/src/components/SynapseForm/SynapseFormUtils.test.ts +++ b/packages/synapse-react-client/src/components/SynapseForm/SynapseFormUtils.test.ts @@ -1,8 +1,8 @@ -import { getFileEntityData } from './SynapseFormUtils' import SynapseClient from '../../synapse-client' import mockFileEntityData from '../../mocks/entity/mockFileEntity' import { mockFormSchema } from '../../mocks/mock_drug_tool_data' import { mockFileHandle } from '../../mocks/mock_file_handle' +import { getFileEntityData } from './SynapseFormUtils' const mockFileEntity = mockFileEntityData.entity const token: string = '123444' diff --git a/packages/synapse-react-client/src/components/SynapseForm/SynapseFormUtils.ts b/packages/synapse-react-client/src/components/SynapseForm/SynapseFormUtils.ts index 65151e38b4..a95a8a44a8 100644 --- a/packages/synapse-react-client/src/components/SynapseForm/SynapseFormUtils.ts +++ b/packages/synapse-react-client/src/components/SynapseForm/SynapseFormUtils.ts @@ -1,5 +1,5 @@ -import SynapseClient from '../../synapse-client' import { FileEntity } from '@sage-bionetworks/synapse-types' +import SynapseClient from '../../synapse-client' //gets a file entity with content export async function getFileEntityData( diff --git a/packages/synapse-react-client/src/components/SynapseForm/SynapseFormWrapper.tsx b/packages/synapse-react-client/src/components/SynapseForm/SynapseFormWrapper.tsx index 4eb14035f4..1313192604 100644 --- a/packages/synapse-react-client/src/components/SynapseForm/SynapseFormWrapper.tsx +++ b/packages/synapse-react-client/src/components/SynapseForm/SynapseFormWrapper.tsx @@ -2,11 +2,11 @@ import $RefParser from '@apidevtools/json-schema-ref-parser' import { get, includes } from 'lodash-es' import React from 'react' import { Button } from '@mui/material' -import FullWidthAlert from '../FullWidthAlert' import { UiSchema } from '@rjsf/utils' +import { FormData } from '@sage-bionetworks/synapse-types' +import FullWidthAlert from '../FullWidthAlert' import SynapseClient from '../../synapse-client' import { SRC_SIGN_IN_CLASS } from '../../utils/SynapseConstants' -import { FormData } from '@sage-bionetworks/synapse-types' import SynapseForm from './SynapseForm' import { StatusEnum } from './types' import { getFileEntityData } from './SynapseFormUtils' diff --git a/packages/synapse-react-client/src/components/SynapseForm/WarningDialog.test.tsx b/packages/synapse-react-client/src/components/SynapseForm/WarningDialog.test.tsx index 17ce70b881..c399817c78 100644 --- a/packages/synapse-react-client/src/components/SynapseForm/WarningDialog.test.tsx +++ b/packages/synapse-react-client/src/components/SynapseForm/WarningDialog.test.tsx @@ -1,9 +1,9 @@ import React from 'react' import * as _ from 'lodash-es' -import WarningDialog, { WarningDialogProps } from './WarningDialog' import { render, screen, within } from '@testing-library/react' import userEvent from '@testing-library/user-event' +import WarningDialog, { WarningDialogProps } from './WarningDialog' const renderComponent = (props: WarningDialogProps) => { return render() diff --git a/packages/synapse-react-client/src/components/SynapseForm/index.ts b/packages/synapse-react-client/src/components/SynapseForm/index.ts index 829b8cda66..3d42bf54ff 100644 --- a/packages/synapse-react-client/src/components/SynapseForm/index.ts +++ b/packages/synapse-react-client/src/components/SynapseForm/index.ts @@ -1,6 +1,6 @@ import { SynapseFormWrapper } from './SynapseFormWrapper' -import type { SynapseFormWrapperProps } from './SynapseFormWrapper' import { SynapseFormSubmissionGrid } from './SynapseFormSubmissionsGrid' +import type { SynapseFormWrapperProps } from './SynapseFormWrapper' import type { SynapseFormSubmissionGridProps } from './SynapseFormSubmissionsGrid' export { SynapseFormWrapper, diff --git a/packages/synapse-react-client/src/components/SynapseHomepage/SynapseHomepage.tsx b/packages/synapse-react-client/src/components/SynapseHomepage/SynapseHomepage.tsx index a3d161519c..2062058e08 100644 --- a/packages/synapse-react-client/src/components/SynapseHomepage/SynapseHomepage.tsx +++ b/packages/synapse-react-client/src/components/SynapseHomepage/SynapseHomepage.tsx @@ -7,7 +7,9 @@ import { Grid, Link, Typography, + Box, } from '@mui/material' +import { ExpandMoreTwoTone } from '@mui/icons-material' import RLogo from '../../assets/icons/RLogo' import Python from '../../assets/icons/Python' import Terminal from '../../assets/icons/Terminal' @@ -17,20 +19,18 @@ import { getEndpoint, BackendDestinationEnum, } from '../../utils/functions/getEndpoint' -import { SynapsePoweredPortal } from './SynapsePoweredPortal' import { useSynapseContext } from '../../utils/context/SynapseContext' import SynapseFullLogo from '../../assets/icons/SynapseFullLogo' import IconSvg from '../IconSvg/IconSvg' -import { SynapseFeatureItem } from './SynapseFeatureItem' import AccessDataAnywhere from '../../assets/icons/AccessDataAnywhere' import QueryStructuredData from '../../assets/icons/QueryStructuredData' import CommunicateFindings from '../../assets/icons/CommunicateFindings' import RecordProvenance from '../../assets/icons/RecordProvenance' import ShareYourResearch from '../../assets/icons/ShareYourResearch' import MintDoi from '../../assets/icons/MintDoi' -import { Box } from '@mui/material' +import { SynapseFeatureItem } from './SynapseFeatureItem' +import { SynapsePoweredPortal } from './SynapsePoweredPortal' import { SynapsePriceTableCell } from './SynapsePriceTableCell' -import { ExpandMoreTwoTone } from '@mui/icons-material' import { SynapsePriceFeatureRow } from './SynapsePriceFeatureRow' import PlatformOfferingsGrid from './PlatformOfferingsGrid' diff --git a/packages/synapse-react-client/src/components/SynapseHomepage/SynapsePriceFeatureRow.tsx b/packages/synapse-react-client/src/components/SynapseHomepage/SynapsePriceFeatureRow.tsx index 0c6bd5ea98..dbf512abae 100644 --- a/packages/synapse-react-client/src/components/SynapseHomepage/SynapsePriceFeatureRow.tsx +++ b/packages/synapse-react-client/src/components/SynapseHomepage/SynapsePriceFeatureRow.tsx @@ -1,7 +1,7 @@ import { Typography } from '@mui/material' import React from 'react' -import { SynapsePriceTableCell } from './SynapsePriceTableCell' import { CheckTwoTone } from '@mui/icons-material' +import { SynapsePriceTableCell } from './SynapsePriceTableCell' import PlatformOfferingsGrid from './PlatformOfferingsGrid' export type SynapsePriceFeatureRowProps = { diff --git a/packages/synapse-react-client/src/components/SynapseNavDrawer/SynapseNavDrawer.test.tsx b/packages/synapse-react-client/src/components/SynapseNavDrawer/SynapseNavDrawer.test.tsx index 6e83879009..c367cdffe0 100644 --- a/packages/synapse-react-client/src/components/SynapseNavDrawer/SynapseNavDrawer.test.tsx +++ b/packages/synapse-react-client/src/components/SynapseNavDrawer/SynapseNavDrawer.test.tsx @@ -1,6 +1,9 @@ import { render, screen, within } from '@testing-library/react' import React from 'react' -import { SynapseNavDrawer, SynapseNavDrawerProps } from './SynapseNavDrawer' +import { + SubmissionState, + SubmissionSearchResult, +} from '@sage-bionetworks/synapse-types' import { createWrapper } from '../../testutils/TestingLibraryUtils' import { SynapseContextType } from '../../utils/context/SynapseContext' import { @@ -9,10 +12,9 @@ import { mockUserBundle, } from '../../mocks/user/mock_user_profile' import { SynapseClient } from '../../index' -import { SubmissionState } from '@sage-bionetworks/synapse-types' -import { SubmissionSearchResult } from '@sage-bionetworks/synapse-types' import { mockManagedACTAccessRequirement } from '../../mocks/mockAccessRequirements' import { mockSubmittedSubmission } from '../../mocks/dataaccess/MockSubmission' +import { SynapseNavDrawer, SynapseNavDrawerProps } from './SynapseNavDrawer' const defaultProps: SynapseNavDrawerProps = { initIsOpen: false, diff --git a/packages/synapse-react-client/src/components/SynapseTable/EntityIDColumnCopyIcon.tsx b/packages/synapse-react-client/src/components/SynapseTable/EntityIDColumnCopyIcon.tsx index 808c1be292..747c0baa26 100644 --- a/packages/synapse-react-client/src/components/SynapseTable/EntityIDColumnCopyIcon.tsx +++ b/packages/synapse-react-client/src/components/SynapseTable/EntityIDColumnCopyIcon.tsx @@ -1,4 +1,5 @@ import React from 'react' +import { QueryResultBundle, Row } from '@sage-bionetworks/synapse-types' import { useQueryContext } from '../QueryContext/QueryContext' import { useSynapseContext } from '../../utils/context/SynapseContext' import { @@ -6,7 +7,6 @@ import { InteractiveCopyIdsIconProps, } from '../InteractiveCopyIdsIcon' import { displayToast } from '../ToastMessage/ToastMessage' -import { QueryResultBundle, Row } from '@sage-bionetworks/synapse-types' import { SynapseSpinner } from '../LoadingScreen/LoadingScreen' import { SynapseConstants } from '../../utils' import { getFullQueryTableResults } from '../../synapse-client/SynapseClient' diff --git a/packages/synapse-react-client/src/components/SynapseTable/RowSelection/RowSelection.stories.tsx b/packages/synapse-react-client/src/components/SynapseTable/RowSelection/RowSelection.stories.tsx index 41a35bca72..ae0741e8d5 100644 --- a/packages/synapse-react-client/src/components/SynapseTable/RowSelection/RowSelection.stories.tsx +++ b/packages/synapse-react-client/src/components/SynapseTable/RowSelection/RowSelection.stories.tsx @@ -1,10 +1,10 @@ import React from 'react' import { Meta, StoryObj } from '@storybook/react' -import { displayToast } from '../../../index' import { GetApp } from '@mui/icons-material' -import { RowSelectionUI, RowSelectionUIProps } from './RowSelectionUI' import { Button } from '@mui/material' import { times } from 'lodash-es' +import { displayToast } from '../../../index' +import { RowSelectionUI, RowSelectionUIProps } from './RowSelectionUI' const meta = { title: 'Explore/RowSelection', diff --git a/packages/synapse-react-client/src/components/SynapseTable/RowSelection/RowSelectionControls.tsx b/packages/synapse-react-client/src/components/SynapseTable/RowSelection/RowSelectionControls.tsx index 86d1b43ed6..1cb3550e1e 100644 --- a/packages/synapse-react-client/src/components/SynapseTable/RowSelection/RowSelectionControls.tsx +++ b/packages/synapse-react-client/src/components/SynapseTable/RowSelection/RowSelectionControls.tsx @@ -1,19 +1,19 @@ import React from 'react' -import { CustomControl } from '../TopLevelControls/TopLevelControls' import { Button } from '@mui/material' -import { RowSelectionUI } from './RowSelectionUI' +import { GetAppTwoTone } from '@mui/icons-material' +import { useAtom, useAtomValue } from 'jotai' import { useQueryContext } from '../../QueryContext' import { useQueryVisualizationContext } from '../../QueryVisualizationWrapper' import { Cavatica } from '../../../assets/icons/Cavatica' -import { GetAppTwoTone } from '@mui/icons-material' import { canTableQueryBeAddedToDownloadList } from '../../../utils/functions/queryUtils' -import { useAtom, useAtomValue } from 'jotai' +import { CustomControl } from '../TopLevelControls/TopLevelControls' import { tableQueryDataAtom, tableQueryEntityAtom, } from '../../QueryWrapper/QueryWrapper' import { selectedRowsAtom } from '../../QueryWrapper/TableRowSelectionState' import { getFileColumnModelId } from '../SynapseTableUtils' +import { RowSelectionUI } from './RowSelectionUI' export type RowSelectionControlsProps = { showExportToCavatica?: boolean diff --git a/packages/synapse-react-client/src/components/SynapseTable/RowSelection/RowSelectionUI.tsx b/packages/synapse-react-client/src/components/SynapseTable/RowSelection/RowSelectionUI.tsx index 6c3d7b6ebe..6c9a03801f 100644 --- a/packages/synapse-react-client/src/components/SynapseTable/RowSelection/RowSelectionUI.tsx +++ b/packages/synapse-react-client/src/components/SynapseTable/RowSelection/RowSelectionUI.tsx @@ -1,7 +1,7 @@ import React from 'react' import { Box, Button, Paper, Typography } from '@mui/material' -import InlineBadge from '../../styled/InlineBadge' import pluralize from 'pluralize' +import InlineBadge from '../../styled/InlineBadge' export type RowSelectionUIProps = { show?: boolean diff --git a/packages/synapse-react-client/src/components/SynapseTable/SearchV2.tsx b/packages/synapse-react-client/src/components/SynapseTable/SearchV2.tsx index a3d4f7db05..93c494d4ed 100644 --- a/packages/synapse-react-client/src/components/SynapseTable/SearchV2.tsx +++ b/packages/synapse-react-client/src/components/SynapseTable/SearchV2.tsx @@ -11,6 +11,7 @@ import { QueryFilter, QueryResultBundle, } from '@sage-bionetworks/synapse-types' +import { useAtomValue } from 'jotai' import { QueryVisualizationContextType } from '../QueryVisualizationWrapper' import { LockedColumn, QueryContextType } from '../QueryContext/QueryContext' import IconSvg from '../IconSvg/IconSvg' @@ -18,7 +19,6 @@ import { isColumnMultiValueFunctionQueryFilter, isColumnSingleValueQueryFilter, } from '../../utils/types/IsType' -import { useAtomValue } from 'jotai' import { tableQueryDataAtom } from '../QueryWrapper/QueryWrapper' type SearchState = { diff --git a/packages/synapse-react-client/src/components/SynapseTable/SendToCavaticaConfirmationDialog.integration.test.tsx b/packages/synapse-react-client/src/components/SynapseTable/SendToCavaticaConfirmationDialog.integration.test.tsx index ebdc42fa84..6a63a70bcd 100644 --- a/packages/synapse-react-client/src/components/SynapseTable/SendToCavaticaConfirmationDialog.integration.test.tsx +++ b/packages/synapse-react-client/src/components/SynapseTable/SendToCavaticaConfirmationDialog.integration.test.tsx @@ -1,9 +1,10 @@ import React from 'react' -import SendToCavaticaConfirmationDialog from './SendToCavaticaConfirmationDialog' -import { QueryWrapper } from '../../index' import { act, render, screen, waitFor } from '@testing-library/react' -import { createWrapper } from '../../testutils/TestingLibraryUtils' import userEvent from '@testing-library/user-event' +import { ColumnSingleValueFilterOperator } from '@sage-bionetworks/synapse-types' +import { useSetAtom } from 'jotai' +import { QueryWrapper } from '../../index' +import { createWrapper } from '../../testutils/TestingLibraryUtils' import { mockQueryBundleRequest, mockQueryResultBundle, @@ -13,18 +14,17 @@ import { QueryVisualizationWrapper, useQueryVisualizationContext, } from '../QueryVisualizationWrapper' -import { ColumnSingleValueFilterOperator } from '@sage-bionetworks/synapse-types' import { mockManagedACTAccessRequirement } from '../../mocks/mockAccessRequirements' import * as UseExportToCavaticaModule from '../../synapse-queries/entity/useExportToCavatica' import * as UseActionsRequiredForTableQueryModule from '../../synapse-queries/entity/useActionsRequiredForTableQuery' import { server } from '../../mocks/msw/server' import { getHandlersForTableQuery } from '../../mocks/msw/handlers/tableQueryHandlers' -import { useSetAtom } from 'jotai' import { selectedRowsAtom } from '../QueryWrapper/TableRowSelectionState' import { getUseQueryLoadingMock, getUseQuerySuccessMock, } from '../../testutils/ReactQueryMockUtils' +import SendToCavaticaConfirmationDialog from './SendToCavaticaConfirmationDialog' const onExportToCavatica = jest.fn() diff --git a/packages/synapse-react-client/src/components/SynapseTable/SendToCavaticaConfirmationDialog.tsx b/packages/synapse-react-client/src/components/SynapseTable/SendToCavaticaConfirmationDialog.tsx index b7a0b81ebc..2fa26f3fcd 100644 --- a/packages/synapse-react-client/src/components/SynapseTable/SendToCavaticaConfirmationDialog.tsx +++ b/packages/synapse-react-client/src/components/SynapseTable/SendToCavaticaConfirmationDialog.tsx @@ -1,25 +1,25 @@ import React, { useMemo } from 'react' -import { ConfirmationDialog } from '../ConfirmationDialog' import { Box, Link, Stack, Typography } from '@mui/material' -import { ActionRequiredListItem } from '../DownloadCart/ActionRequiredListItem' import { ActionRequiredCount, ColumnModel, } from '@sage-bionetworks/synapse-types' +import { useAtomValue } from 'jotai' +import { ConfirmationDialog } from '../ConfirmationDialog' +import { ActionRequiredListItem } from '../DownloadCart/ActionRequiredListItem' import { useQueryContext } from '../QueryContext' import { SkeletonParagraph } from '../Skeleton' import { useExportToCavatica } from '../../synapse-queries/entity/useExportToCavatica' import { useQueryVisualizationContext } from '../QueryVisualizationWrapper' -import { getNumberOfResultsToInvokeActionCopy } from './TopLevelControls/TopLevelControlsUtils' import { useGetActionsRequiredForTableQuery } from '../../synapse-queries/entity/useActionsRequiredForTableQuery' import { getPrimaryKeyINFilter } from '../../utils/functions/QueryFilterUtils' import { tableQueryDataAtom } from '../QueryWrapper/QueryWrapper' -import { useAtomValue } from 'jotai' import { hasSelectedRowsAtom, rowSelectionPrimaryKeyAtom, selectedRowsAtom, } from '../QueryWrapper/TableRowSelectionState' +import { getNumberOfResultsToInvokeActionCopy } from './TopLevelControls/TopLevelControlsUtils' export type SendToCavaticaConfirmationDialogProps = { fileIdColumnName?: string diff --git a/packages/synapse-react-client/src/components/SynapseTable/SynapseTable.integration.test.tsx b/packages/synapse-react-client/src/components/SynapseTable/SynapseTable.integration.test.tsx index 794a9aecc7..0912f15141 100644 --- a/packages/synapse-react-client/src/components/SynapseTable/SynapseTable.integration.test.tsx +++ b/packages/synapse-react-client/src/components/SynapseTable/SynapseTable.integration.test.tsx @@ -4,16 +4,6 @@ import userEvent from '@testing-library/user-event' import { cloneDeep } from 'lodash-es' import React from 'react' import { mockAllIsIntersecting } from 'react-intersection-observer/test-utils' -import { SynapseConstants } from '../../utils' -import { QueryVisualizationWrapper } from '../QueryVisualizationWrapper' -import SynapseTable, { SynapseTableProps } from './SynapseTable' -import { createWrapper } from '../../testutils/TestingLibraryUtils' -import { ENTITY_HEADERS, ENTITY_ID_VERSION } from '../../utils/APIConstants' -import { - BackendDestinationEnum, - getEndpoint, -} from '../../utils/functions/getEndpoint' -import { DEFAULT_PAGE_SIZE } from '../../utils/SynapseConstants' import { EntityHeader, FileEntity, @@ -24,6 +14,15 @@ import { ReferenceList, Table, } from '@sage-bionetworks/synapse-types' +import { createWrapper } from '../../testutils/TestingLibraryUtils' +import { ENTITY_HEADERS, ENTITY_ID_VERSION } from '../../utils/APIConstants' +import { + BackendDestinationEnum, + getEndpoint, +} from '../../utils/functions/getEndpoint' +import { DEFAULT_PAGE_SIZE } from '../../utils/SynapseConstants' +import { QueryVisualizationWrapper } from '../QueryVisualizationWrapper' +import { SynapseConstants } from '../../utils' import { rest, server } from '../../mocks/msw/server' import queryResultBundle from '../../mocks/query/syn16787123' import { MOCK_USER_ID } from '../../mocks/user/mock_user_profile' @@ -46,6 +45,7 @@ import { mockFileHandle } from '../../mocks/mock_file_handle' import { mockFileViewEntity } from '../../mocks/entity/mockFileView' import { mockProjectViewEntity } from '../../mocks/entity/mockProjectView' import { mockDatasetEntity } from '../../mocks/entity/mockDataset' +import SynapseTable, { SynapseTableProps } from './SynapseTable' const synapseTableEntityId = 'syn16787123' diff --git a/packages/synapse-react-client/src/components/SynapseTable/SynapseTable.stories.tsx b/packages/synapse-react-client/src/components/SynapseTable/SynapseTable.stories.tsx index ea33a0ab8f..56bef2bbbd 100644 --- a/packages/synapse-react-client/src/components/SynapseTable/SynapseTable.stories.tsx +++ b/packages/synapse-react-client/src/components/SynapseTable/SynapseTable.stories.tsx @@ -1,15 +1,15 @@ -import { getHandlersForTableQuery } from '../../mocks/msw/handlers/tableQueryHandlers' import React from 'react' import { Meta, StoryObj } from '@storybook/react' import { rest } from 'msw' +import { getHandlersForTableQuery } from '../../mocks/msw/handlers/tableQueryHandlers' import { MOCK_REPO_ORIGIN } from '../../utils/functions/getEndpoint' import queryResultBundleJson from '../../mocks/query/syn16787123' -import SynapseTable from './SynapseTable' import { QueryWrapper } from '../QueryWrapper' import { QueryVisualizationWrapper } from '../QueryVisualizationWrapper/QueryVisualizationWrapper' import { SynapseConstants } from '../../utils' import { DEFAULT_PAGE_SIZE } from '../../utils/SynapseConstants' import { mockTableEntity } from '../../mocks/entity/mockTableEntity' +import SynapseTable from './SynapseTable' const meta: Meta = { title: 'Explore/SynapseTable', diff --git a/packages/synapse-react-client/src/components/SynapseTable/SynapseTable.tsx b/packages/synapse-react-client/src/components/SynapseTable/SynapseTable.tsx index d02d2c4056..9b91041dc1 100644 --- a/packages/synapse-react-client/src/components/SynapseTable/SynapseTable.tsx +++ b/packages/synapse-react-client/src/components/SynapseTable/SynapseTable.tsx @@ -1,15 +1,31 @@ import React, { useMemo, useState } from 'react' -import { useSynapseContext } from '../../utils' import { ColumnTypeEnum, QueryResultBundle, Row, } from '@sage-bionetworks/synapse-types' +import { Box, Skeleton } from '@mui/material' +import { + ColumnDef, + createColumnHelper, + flexRender, + getCoreRowModel, + useReactTable, + VisibilityState, +} from '@tanstack/react-table' +import { useAtomValue } from 'jotai' +import { useSynapseContext } from '../../utils' import { LabelLinkConfig } from '../CardContainerLogic' import loadingScreen from '../LoadingScreen/LoadingScreen' import ModalDownload from '../ModalDownload/ModalDownload' import { useQueryVisualizationContext } from '../QueryVisualizationWrapper/QueryVisualizationWrapper' import { useQueryContext } from '../QueryContext' +import { + isLoadingNewBundleAtom, + tableQueryDataAtom, + tableQueryEntityAtom, +} from '../QueryWrapper/QueryWrapper' +import { isRowSelectionVisibleAtom } from '../QueryWrapper/TableRowSelectionState' import { isEntityViewOrDataset, isFileViewOrDataset, @@ -17,15 +33,6 @@ import { } from './SynapseTableUtils' import { TablePagination } from './TablePagination' import ExpandableTableDataCell from './ExpandableTableDataCell' -import { Box, Skeleton } from '@mui/material' -import { - ColumnDef, - createColumnHelper, - flexRender, - getCoreRowModel, - useReactTable, - VisibilityState, -} from '@tanstack/react-table' import { useTableSort } from './useTableSort' import { accessColumn, @@ -37,13 +44,6 @@ import { } from './SynapseTableRenderers' import { SynapseTableContext } from './SynapseTableContext' import { usePrefetchTableData } from './usePrefetchTableData' -import { useAtomValue } from 'jotai' -import { - isLoadingNewBundleAtom, - tableQueryDataAtom, - tableQueryEntityAtom, -} from '../QueryWrapper/QueryWrapper' -import { isRowSelectionVisibleAtom } from '../QueryWrapper/TableRowSelectionState' export type SynapseTableProps = { /** If true and entity is a view or dataset, renders a column that represents if the caller has permission to download the entity represented by the row */ diff --git a/packages/synapse-react-client/src/components/SynapseTable/SynapseTableCell/EntityIdList.test.tsx b/packages/synapse-react-client/src/components/SynapseTable/SynapseTableCell/EntityIdList.test.tsx index 7520795efa..64668bd31a 100644 --- a/packages/synapse-react-client/src/components/SynapseTable/SynapseTableCell/EntityIdList.test.tsx +++ b/packages/synapse-react-client/src/components/SynapseTable/SynapseTableCell/EntityIdList.test.tsx @@ -1,15 +1,14 @@ import React from 'react' import { mockAllIsIntersecting } from 'react-intersection-observer/test-utils' -import EntityIdList, { EntityIdListProps } from './EntityIdList' -import { act } from '@testing-library/react' +import { act, render, screen, waitFor } from '@testing-library/react' import { MOCK_CONTEXT_VALUE, SynapseTestContext, } from '../../../mocks/MockSynapseContext' -import { render, screen, waitFor } from '@testing-library/react' import mockFileEntity from '../../../mocks/entity/mockFileEntity' import { getEntityHeaders } from '../../../synapse-client/SynapseClient' import SynapseClient from '../../../synapse-client' +import EntityIdList, { EntityIdListProps } from './EntityIdList' jest .spyOn(SynapseClient, 'getEntityHeaders') diff --git a/packages/synapse-react-client/src/components/SynapseTable/SynapseTableCell/JSON/ComplexJSONRenderer.tsx b/packages/synapse-react-client/src/components/SynapseTable/SynapseTableCell/JSON/ComplexJSONRenderer.tsx index 51b83ad1eb..2cde2c7477 100644 --- a/packages/synapse-react-client/src/components/SynapseTable/SynapseTableCell/JSON/ComplexJSONRenderer.tsx +++ b/packages/synapse-react-client/src/components/SynapseTable/SynapseTableCell/JSON/ComplexJSONRenderer.tsx @@ -1,7 +1,7 @@ import React, { useState } from 'react' import { Box, Typography } from '@mui/material' -import ExpandCollapseButton from '../../ExpandCollapseButton' import { chromeLight, Inspector } from 'react-inspector' +import ExpandCollapseButton from '../../ExpandCollapseButton' type ComplexJSONRendererProps = { value: any diff --git a/packages/synapse-react-client/src/components/SynapseTable/SynapseTableCell/JSON/JSONArrayRenderer.tsx b/packages/synapse-react-client/src/components/SynapseTable/SynapseTableCell/JSON/JSONArrayRenderer.tsx index 2e3935f66d..d4163dfafd 100644 --- a/packages/synapse-react-client/src/components/SynapseTable/SynapseTableCell/JSON/JSONArrayRenderer.tsx +++ b/packages/synapse-react-client/src/components/SynapseTable/SynapseTableCell/JSON/JSONArrayRenderer.tsx @@ -1,8 +1,8 @@ -import { JSONPrimitiveType } from './JSONRendererUtils' import React, { useState } from 'react' import { Box, Collapse, Typography } from '@mui/material' -import { JSONPrimitiveRenderer } from './JSONPrimitiveRenderer' import ExpandCollapseButton from '../../ExpandCollapseButton' +import { JSONPrimitiveRenderer } from './JSONPrimitiveRenderer' +import { JSONPrimitiveType } from './JSONRendererUtils' type JSONArrayRendererProps = { value: JSONPrimitiveType[] } diff --git a/packages/synapse-react-client/src/components/SynapseTable/SynapseTableCell/JSON/JSONTableCellRenderer.test.tsx b/packages/synapse-react-client/src/components/SynapseTable/SynapseTableCell/JSON/JSONTableCellRenderer.test.tsx index c79857c5ac..56be47b4e5 100644 --- a/packages/synapse-react-client/src/components/SynapseTable/SynapseTableCell/JSON/JSONTableCellRenderer.test.tsx +++ b/packages/synapse-react-client/src/components/SynapseTable/SynapseTableCell/JSON/JSONTableCellRenderer.test.tsx @@ -1,6 +1,6 @@ import React from 'react' -import JSONTableCellRenderer from './index' import { render } from '@testing-library/react' +import JSONTableCellRenderer from './index' describe('JSONTableCellRenderer', () => { it.each<[string, any]>([ diff --git a/packages/synapse-react-client/src/components/SynapseTable/SynapseTableCell/JSON/JSONTableCellRenderer.tsx b/packages/synapse-react-client/src/components/SynapseTable/SynapseTableCell/JSON/JSONTableCellRenderer.tsx index 03ce410fb7..d045551acb 100644 --- a/packages/synapse-react-client/src/components/SynapseTable/SynapseTableCell/JSON/JSONTableCellRenderer.tsx +++ b/packages/synapse-react-client/src/components/SynapseTable/SynapseTableCell/JSON/JSONTableCellRenderer.tsx @@ -1,4 +1,5 @@ import React from 'react' +import { Typography } from '@mui/material' import { isJSONObjectAllPrimitiveKeys, isJSONPrimitive, @@ -7,7 +8,6 @@ import { JSONPrimitiveRenderer } from './JSONPrimitiveRenderer' import { JSONArrayRenderer } from './JSONArrayRenderer' import { JSONObjectRenderer } from './JSONObjectRenderer' import { ComplexJSONRenderer } from './ComplexJSONRenderer' -import { Typography } from '@mui/material' export type JSONTableCellRendererProps = { value: string | null diff --git a/packages/synapse-react-client/src/components/SynapseTable/SynapseTableCell/SynapseTableCell.tsx b/packages/synapse-react-client/src/components/SynapseTable/SynapseTableCell/SynapseTableCell.tsx index e4a01dbff2..69b46ffa83 100644 --- a/packages/synapse-react-client/src/components/SynapseTable/SynapseTableCell/SynapseTableCell.tsx +++ b/packages/synapse-react-client/src/components/SynapseTable/SynapseTableCell/SynapseTableCell.tsx @@ -1,11 +1,5 @@ import React from 'react' import dayjs from 'dayjs' -import { formatDate } from '../../../utils/functions/DateFormatter' -import { - isDataset, - isDatasetCollection, - isEntityView, -} from '../../../utils/functions/EntityTypeUtils' import { ColumnModel, ColumnType, @@ -14,24 +8,30 @@ import { Row, SelectColumn, } from '@sage-bionetworks/synapse-types' +import { Link, Typography } from '@mui/material' +import { useAtomValue } from 'jotai' +import { formatDate } from '../../../utils/functions/DateFormatter' +import { + isDataset, + isDatasetCollection, + isEntityView, +} from '../../../utils/functions/EntityTypeUtils' import { CardLink, ColumnSpecifiedLink, MarkdownLink, } from '../../CardContainerLogic' import DirectDownload from '../../DirectDownload/DirectDownload' -import EntityIdList from './EntityIdList' import { EntityLink } from '../../EntityLink' -import EvaluationIdRenderer from './EvaluationIdRenderer' import { SynapseCardLabel } from '../../GenericCard' import { NOT_SET_DISPLAY_VALUE } from '../SynapseTableConstants' -import UserIdList from './UserIdList' -import JSONTableCellRenderer from './JSON/JSONTableCellRenderer' -import { Link, Typography } from '@mui/material' import UserOrTeamBadge from '../../UserOrTeamBadge' import { isFileViewOrDataset } from '../SynapseTableUtils' -import { useAtomValue } from 'jotai' import { tableQueryEntityAtom } from '../../QueryWrapper/QueryWrapper' +import JSONTableCellRenderer from './JSON/JSONTableCellRenderer' +import UserIdList from './UserIdList' +import EvaluationIdRenderer from './EvaluationIdRenderer' +import EntityIdList from './EntityIdList' export type SynapseTableCellProps = { columnType: ColumnType diff --git a/packages/synapse-react-client/src/components/SynapseTable/SynapseTableCell/UserIdList.test.tsx b/packages/synapse-react-client/src/components/SynapseTable/SynapseTableCell/UserIdList.test.tsx index bb4b1029b1..997988ef96 100644 --- a/packages/synapse-react-client/src/components/SynapseTable/SynapseTableCell/UserIdList.test.tsx +++ b/packages/synapse-react-client/src/components/SynapseTable/SynapseTableCell/UserIdList.test.tsx @@ -1,11 +1,11 @@ import React from 'react' -import UserIdList, { UserIdListProps } from './UserIdList' import { render, screen, waitFor } from '@testing-library/react' import { MOCK_USER_ID, MOCK_USER_ID_2, } from '../../../mocks/user/mock_user_profile' import { createWrapper } from '../../../testutils/TestingLibraryUtils' +import UserIdList, { UserIdListProps } from './UserIdList' const USER_OR_TEAM_BADGE_TEST_ID = 'UserOrTeamBadge' diff --git a/packages/synapse-react-client/src/components/SynapseTable/SynapseTableCell/UserIdList.tsx b/packages/synapse-react-client/src/components/SynapseTable/SynapseTableCell/UserIdList.tsx index 93f9d1f4d8..9907b5977d 100644 --- a/packages/synapse-react-client/src/components/SynapseTable/SynapseTableCell/UserIdList.tsx +++ b/packages/synapse-react-client/src/components/SynapseTable/SynapseTableCell/UserIdList.tsx @@ -1,6 +1,6 @@ import React from 'react' -import UserOrTeamBadge from '../../UserOrTeamBadge' import { Box } from '@mui/material' +import UserOrTeamBadge from '../../UserOrTeamBadge' export type UserIdListProps = { userIds: string[] diff --git a/packages/synapse-react-client/src/components/SynapseTable/SynapseTableRenderers.tsx b/packages/synapse-react-client/src/components/SynapseTable/SynapseTableRenderers.tsx index b9f0869d8a..2016317d8c 100644 --- a/packages/synapse-react-client/src/components/SynapseTable/SynapseTableRenderers.tsx +++ b/packages/synapse-react-client/src/components/SynapseTable/SynapseTableRenderers.tsx @@ -9,21 +9,18 @@ import { FacetColumnResultValues, Row, } from '@sage-bionetworks/synapse-types' -import { Checkbox } from '../widgets/Checkbox' import { isEqual } from 'lodash-es' import React from 'react' +import { IconButton, Tooltip } from '@mui/material' +import { useAtom, useAtomValue } from 'jotai' +import { Checkbox } from '../widgets/Checkbox' import AddToDownloadListV2 from '../AddToDownloadListV2' import { useGetEntityHeader } from '../../synapse-queries' import FileEntityDirectDownload from '../DirectDownload/FileEntityDirectDownload' import HasAccessV2 from '../HasAccess' import { EnumFacetFilter } from '../widgets/query-filter/EnumFacetFilter' -import { IconButton, Tooltip } from '@mui/material' import IconSvg from '../IconSvg' -import EntityIDColumnCopyIcon from './EntityIDColumnCopyIcon' import { useQueryVisualizationContext } from '../QueryVisualizationWrapper/QueryVisualizationWrapper' -import SynapseTableCell from './SynapseTableCell' -import { useSynapseTableContext } from './SynapseTableContext' -import { useAtom, useAtomValue } from 'jotai' import { lockedColumnAtom, tableQueryDataAtom, @@ -32,6 +29,9 @@ import { isRowSelectedAtom, selectedRowsAtom, } from '../QueryWrapper/TableRowSelectionState' +import EntityIDColumnCopyIcon from './EntityIDColumnCopyIcon' +import SynapseTableCell from './SynapseTableCell' +import { useSynapseTableContext } from './SynapseTableContext' // Add a prefix to these column IDs so they don't collide with actual column names const columnIdPrefix = @@ -168,7 +168,7 @@ export function TableDataColumnHeader( return <>{column.id} } - const displayColumnName = getColumnDisplayName(selectColumn!.name) + const displayColumnName = getColumnDisplayName(selectColumn.name) // we have to figure out if the current column is a facet selection const facetIndex: number = facets.findIndex( (facetColumnResult: FacetColumnResult) => { diff --git a/packages/synapse-react-client/src/components/SynapseTable/SynapseTableUtils.test.ts b/packages/synapse-react-client/src/components/SynapseTable/SynapseTableUtils.test.ts index 08742496e0..8ffba96ee4 100644 --- a/packages/synapse-react-client/src/components/SynapseTable/SynapseTableUtils.test.ts +++ b/packages/synapse-react-client/src/components/SynapseTable/SynapseTableUtils.test.ts @@ -1,10 +1,3 @@ -import { - getColumnIndicesWithType, - getDefaultPrimaryKey, - getFileColumnModelId, - getUniqueEntities, - isSortableColumn, -} from './SynapseTableUtils' import { ColumnModel, ColumnTypeEnum, @@ -13,6 +6,13 @@ import { import { mockTableEntity } from '../../mocks/entity/mockTableEntity' import mockDataset from '../../mocks/entity/mockDataset' import { mockFileViewEntity } from '../../mocks/entity/mockFileView' +import { + getColumnIndicesWithType, + getDefaultPrimaryKey, + getFileColumnModelId, + getUniqueEntities, + isSortableColumn, +} from './SynapseTableUtils' describe('Synapse Table Utilities tests', () => { describe('Table cell renderer utilities', () => { diff --git a/packages/synapse-react-client/src/components/SynapseTable/TablePagination.tsx b/packages/synapse-react-client/src/components/SynapseTable/TablePagination.tsx index 807e320233..b24097ec30 100644 --- a/packages/synapse-react-client/src/components/SynapseTable/TablePagination.tsx +++ b/packages/synapse-react-client/src/components/SynapseTable/TablePagination.tsx @@ -1,7 +1,7 @@ import React from 'react' import { Pagination, Typography } from '@mui/material' -import { usePaginatedQueryContext } from '../QueryContext/QueryContext' import { useAtomValue } from 'jotai' +import { usePaginatedQueryContext } from '../QueryContext/QueryContext' import { tableQueryDataAtom } from '../QueryWrapper/QueryWrapper' export const TablePagination = () => { diff --git a/packages/synapse-react-client/src/components/SynapseTable/TopLevelControls/TopLevelControls.tsx b/packages/synapse-react-client/src/components/SynapseTable/TopLevelControls/TopLevelControls.tsx index 0e0a3046de..58285444b0 100644 --- a/packages/synapse-react-client/src/components/SynapseTable/TopLevelControls/TopLevelControls.tsx +++ b/packages/synapse-react-client/src/components/SynapseTable/TopLevelControls/TopLevelControls.tsx @@ -1,28 +1,24 @@ import { cloneDeep, partition } from 'lodash-es' import React, { useMemo, useState } from 'react' -import { SQL_EDITOR } from '../../../utils/SynapseConstants' import { Query, QueryBundleRequest, QueryResultBundle, Row, } from '@sage-bionetworks/synapse-types' +import { Button, Divider, Tooltip, Typography } from '@mui/material' +import { useAtomValue } from 'jotai' +import { SQL_EDITOR } from '../../../utils/SynapseConstants' import { useQueryVisualizationContext } from '../../QueryVisualizationWrapper' import { useQueryContext } from '../../QueryContext' import { ElementWithTooltip } from '../../widgets/ElementWithTooltip' import { ColumnSelection, DownloadOptions } from '../table-top' -import { Button, Divider, Tooltip, Typography } from '@mui/material' import QueryCount from '../../QueryCount/QueryCount' import MissingQueryResultsWarning from '../../MissingQueryResultsWarning/MissingQueryResultsWarning' import { Cavatica } from '../../../assets/icons/Cavatica' import { RowSelectionControls } from '../RowSelection/RowSelectionControls' import SendToCavaticaConfirmationDialog from '../SendToCavaticaConfirmationDialog' -import { - getNumberOfResultsToInvokeAction, - getNumberOfResultsToInvokeActionCopy, -} from './TopLevelControlsUtils' import IconSvg from '../../IconSvg' -import { useAtomValue } from 'jotai' import { lockedColumnAtom, tableQueryDataAtom, @@ -33,6 +29,10 @@ import { isRowSelectionVisibleAtom, selectedRowsAtom, } from '../../QueryWrapper/TableRowSelectionState' +import { + getNumberOfResultsToInvokeAction, + getNumberOfResultsToInvokeActionCopy, +} from './TopLevelControlsUtils' export type TopLevelControlsProps = { name?: string diff --git a/packages/synapse-react-client/src/components/SynapseTable/TopLevelControls/TopLevelControlsUtils.test.ts b/packages/synapse-react-client/src/components/SynapseTable/TopLevelControls/TopLevelControlsUtils.test.ts index 18c165dc55..dde54a0332 100644 --- a/packages/synapse-react-client/src/components/SynapseTable/TopLevelControls/TopLevelControlsUtils.test.ts +++ b/packages/synapse-react-client/src/components/SynapseTable/TopLevelControls/TopLevelControlsUtils.test.ts @@ -1,9 +1,9 @@ +import { QueryResultBundle, Row } from '@sage-bionetworks/synapse-types' import { getNumberOfResultsToAddToDownloadListCopy, getNumberOfResultsToInvokeAction, getNumberOfResultsToInvokeActionCopy, } from './TopLevelControlsUtils' -import { QueryResultBundle, Row } from '@sage-bionetworks/synapse-types' describe('TopLevelControlsUtils', () => { describe('getNumberOfResultsToInvokeAction', () => { diff --git a/packages/synapse-react-client/src/components/SynapseTable/TopLevelControls/TopLevelControlsUtils.ts b/packages/synapse-react-client/src/components/SynapseTable/TopLevelControls/TopLevelControlsUtils.ts index 9cbb033258..4e9f21ab58 100644 --- a/packages/synapse-react-client/src/components/SynapseTable/TopLevelControls/TopLevelControlsUtils.ts +++ b/packages/synapse-react-client/src/components/SynapseTable/TopLevelControls/TopLevelControlsUtils.ts @@ -1,8 +1,8 @@ -import { QueryContextType } from '../../QueryContext' -import { QueryVisualizationContextType } from '../../QueryVisualizationWrapper/QueryVisualizationWrapper' import pluralize from 'pluralize' import { upperFirst } from 'lodash-es' import { QueryResultBundle, Row } from '@sage-bionetworks/synapse-types' +import { QueryVisualizationContextType } from '../../QueryVisualizationWrapper/QueryVisualizationWrapper' +import { QueryContextType } from '../../QueryContext' const TO_DOWNLOAD_CART = 'to Download Cart' diff --git a/packages/synapse-react-client/src/components/SynapseTable/datasets/DatasetItemsEditor.integration.test.tsx b/packages/synapse-react-client/src/components/SynapseTable/datasets/DatasetItemsEditor.integration.test.tsx index 82f808d468..8576757334 100644 --- a/packages/synapse-react-client/src/components/SynapseTable/datasets/DatasetItemsEditor.integration.test.tsx +++ b/packages/synapse-react-client/src/components/SynapseTable/datasets/DatasetItemsEditor.integration.test.tsx @@ -9,10 +9,10 @@ import { cloneDeep } from 'lodash-es' import React from 'react' import { mockAllIsIntersecting } from 'react-intersection-observer/test-utils' import { - DatasetItemsEditor, - DatasetItemsEditorProps, - getCopy, -} from './DatasetItemsEditor' + EntityRef, + EntityType, + Reference, +} from '@sage-bionetworks/synapse-types' import * as ToastMessageModule from '../../ToastMessage/ToastMessage' import { displayToast } from '../../ToastMessage/ToastMessage' import { createWrapper } from '../../../testutils/TestingLibraryUtils' @@ -22,17 +22,17 @@ import { getEndpoint, } from '../../../utils/functions/getEndpoint' import { SynapseContextType } from '../../../utils/context/SynapseContext' -import { - EntityRef, - EntityType, - Reference, -} from '@sage-bionetworks/synapse-types' import mockDatasetEntityData from '../../../mocks/entity/mockDataset' import mockDatasetCollectionData from '../../../mocks/entity/mockDatasetCollection' import mockFileEntityData from '../../../mocks/entity/mockFileEntity' import { rest, server } from '../../../mocks/msw/server' import * as EntityFinderModal from '../../EntityFinder/EntityFinderModal' import * as EntityBadgeModule from '../../EntityBadgeIcons/EntityBadgeIcons' +import { + DatasetItemsEditor, + DatasetItemsEditorProps, + getCopy, +} from './DatasetItemsEditor' const mockDatasetEntity = mockDatasetEntityData.entity const mockDatasetCollectionEntity = mockDatasetCollectionData.entity const mockFileEntity = mockFileEntityData.entity diff --git a/packages/synapse-react-client/src/components/SynapseTable/datasets/DatasetItemsEditor.tsx b/packages/synapse-react-client/src/components/SynapseTable/datasets/DatasetItemsEditor.tsx index 8ed9a87012..624bba065d 100644 --- a/packages/synapse-react-client/src/components/SynapseTable/datasets/DatasetItemsEditor.tsx +++ b/packages/synapse-react-client/src/components/SynapseTable/datasets/DatasetItemsEditor.tsx @@ -7,6 +7,12 @@ import BaseTable, { import { isEqual, upperFirst } from 'lodash-es' import pluralize from 'pluralize' import React, { useEffect, useMemo, useState } from 'react' +import { + EntityRef, + EntityRefCollectionView, + EntityType, + Reference, +} from '@sage-bionetworks/synapse-types' import { SkeletonTable } from '../../Skeleton/SkeletonTable' import { convertToEntityType, @@ -20,12 +26,6 @@ import { useUpdateEntity, } from '../../../synapse-queries/entity/useEntity' import { useSet } from '../../../utils/hooks/useSet' -import { - EntityRef, - EntityRefCollectionView, - EntityType, - Reference, -} from '@sage-bionetworks/synapse-types' import { RequiredProperties } from '../../../utils/types/RequiredProperties' import { BadgeIconsRenderer, diff --git a/packages/synapse-react-client/src/components/SynapseTable/table-top/ColumnSelection.tsx b/packages/synapse-react-client/src/components/SynapseTable/table-top/ColumnSelection.tsx index db3974b371..9fbc374e09 100644 --- a/packages/synapse-react-client/src/components/SynapseTable/table-top/ColumnSelection.tsx +++ b/packages/synapse-react-client/src/components/SynapseTable/table-top/ColumnSelection.tsx @@ -1,7 +1,7 @@ import React, { useState } from 'react' import { Dropdown } from 'react-bootstrap' -import { ElementWithTooltip } from '../../widgets/ElementWithTooltip' import { SelectColumn } from '@sage-bionetworks/synapse-types' +import { ElementWithTooltip } from '../../widgets/ElementWithTooltip' import IconSvg from '../../IconSvg/IconSvg' import { useQueryVisualizationContext } from '../../QueryVisualizationWrapper' diff --git a/packages/synapse-react-client/src/components/SynapseTable/table-top/DownloadLoginModal.test.tsx b/packages/synapse-react-client/src/components/SynapseTable/table-top/DownloadLoginModal.test.tsx index f2f9ffd898..5a1c330f5b 100644 --- a/packages/synapse-react-client/src/components/SynapseTable/table-top/DownloadLoginModal.test.tsx +++ b/packages/synapse-react-client/src/components/SynapseTable/table-top/DownloadLoginModal.test.tsx @@ -1,13 +1,13 @@ import { render, screen } from '@testing-library/react' import userEvent from '@testing-library/user-event' import React from 'react' +import { SRC_SIGN_IN_CLASS } from '../../../utils/SynapseConstants' +import { CANCEL_BUTTON_TEXT } from '../../ConfirmationDialog/ConfirmationDialog' import { CONFIRM_BUTTON_TEXT, DownloadLoginModal, DownloadLoginModalProps, } from './DownloadLoginModal' -import { SRC_SIGN_IN_CLASS } from '../../../utils/SynapseConstants' -import { CANCEL_BUTTON_TEXT } from '../../ConfirmationDialog/ConfirmationDialog' const mockCallback = jest.fn() diff --git a/packages/synapse-react-client/src/components/SynapseTable/table-top/DownloadLoginModal.tsx b/packages/synapse-react-client/src/components/SynapseTable/table-top/DownloadLoginModal.tsx index 56a3689541..ad77dc9c29 100644 --- a/packages/synapse-react-client/src/components/SynapseTable/table-top/DownloadLoginModal.tsx +++ b/packages/synapse-react-client/src/components/SynapseTable/table-top/DownloadLoginModal.tsx @@ -1,6 +1,6 @@ import React from 'react' -import { ConfirmationDialog } from '../../ConfirmationDialog/ConfirmationDialog' import { Link, Typography } from '@mui/material' +import { ConfirmationDialog } from '../../ConfirmationDialog/ConfirmationDialog' import { SRC_SIGN_IN_CLASS } from '../../../utils/SynapseConstants' export type DownloadLoginModalProps = { diff --git a/packages/synapse-react-client/src/components/SynapseTable/table-top/DownloadOptions.integration.test.tsx b/packages/synapse-react-client/src/components/SynapseTable/table-top/DownloadOptions.integration.test.tsx index 987726c195..b9b6cb7483 100644 --- a/packages/synapse-react-client/src/components/SynapseTable/table-top/DownloadOptions.integration.test.tsx +++ b/packages/synapse-react-client/src/components/SynapseTable/table-top/DownloadOptions.integration.test.tsx @@ -1,8 +1,11 @@ import { render, screen, waitFor } from '@testing-library/react' import userEvent from '@testing-library/user-event' import React from 'react' -import { DownloadOptions } from './index' -import { DownloadOptionsProps } from './DownloadOptions' +import { + ColumnTypeEnum, + QueryBundleRequest, +} from '@sage-bionetworks/synapse-types' +import { cloneDeep } from 'lodash-es' import { createWrapper } from '../../../testutils/TestingLibraryUtils' import mockDatasetData from '../../../mocks/entity/mockDataset' import { mockTableEntity } from '../../../mocks/entity/mockTableEntity' @@ -12,16 +15,13 @@ import QueryWrapper from '../../QueryWrapper' import { rest, server } from '../../../mocks/msw/server' import { getHandlersForTableQuery } from '../../../mocks/msw/handlers/tableQueryHandlers' import mockQueryResponseData from '../../../mocks/mockQueryResponseData' -import { - ColumnTypeEnum, - QueryBundleRequest, -} from '@sage-bionetworks/synapse-types' import { BackendDestinationEnum, getEndpoint, } from '../../../utils/functions/getEndpoint' import { mockProjectViewEntity } from '../../../mocks/entity/mockProjectView' -import { cloneDeep } from 'lodash-es' +import { DownloadOptionsProps } from './DownloadOptions' +import { DownloadOptions } from './index' const ADD_ALL_FILES_TO_DOWNLOAD_CART = 'Add All Files to Download Cart' diff --git a/packages/synapse-react-client/src/components/SynapseTable/table-top/DownloadOptions.tsx b/packages/synapse-react-client/src/components/SynapseTable/table-top/DownloadOptions.tsx index 05a508796f..209be62e3e 100644 --- a/packages/synapse-react-client/src/components/SynapseTable/table-top/DownloadOptions.tsx +++ b/packages/synapse-react-client/src/components/SynapseTable/table-top/DownloadOptions.tsx @@ -1,5 +1,7 @@ import React from 'react' import { Dropdown } from 'react-bootstrap' +import { Tooltip } from '@mui/material' +import { useAtomValue } from 'jotai' import ModalDownload from '../../ModalDownload/ModalDownload' import { hasFilesInView, @@ -7,15 +9,12 @@ import { isEntityView, } from '../../../utils/functions/EntityTypeUtils' import { useSynapseContext } from '../../../utils' -import { Tooltip } from '@mui/material' import { useQueryContext } from '../../QueryContext' import { ElementWithTooltip } from '../../widgets/ElementWithTooltip' -import { DownloadLoginModal } from './DownloadLoginModal' import ProgrammaticTableDownload from '../../ProgrammaticTableDownload/ProgrammaticTableDownload' import { getNumberOfResultsToAddToDownloadListCopy } from '../TopLevelControls/TopLevelControlsUtils' import { canTableQueryBeAddedToDownloadList } from '../../../utils/functions/queryUtils' import { getFileColumnModelId } from '../SynapseTableUtils' -import { useAtomValue } from 'jotai' import { tableQueryDataAtom, tableQueryEntityAtom, @@ -24,6 +23,7 @@ import { hasSelectedRowsAtom, selectedRowsAtom, } from '../../QueryWrapper/TableRowSelectionState' +import { DownloadLoginModal } from './DownloadLoginModal' export type DownloadOptionsProps = { onDownloadFiles: () => void diff --git a/packages/synapse-react-client/src/components/SynapseTable/usePrefetchTableData.ts b/packages/synapse-react-client/src/components/SynapseTable/usePrefetchTableData.ts index b03adafbaf..b1b5ed1285 100644 --- a/packages/synapse-react-client/src/components/SynapseTable/usePrefetchTableData.ts +++ b/packages/synapse-react-client/src/components/SynapseTable/usePrefetchTableData.ts @@ -4,14 +4,14 @@ import { FileHandleAssociation, ReferenceList, } from '@sage-bionetworks/synapse-types' -import { isEntityViewOrDataset, isFileViewOrDataset } from './SynapseTableUtils' +import { useAtomValue } from 'jotai' import { useGetFileBatch } from '../../synapse-queries/file/useFiles' import { useGetEntityHeaders } from '../../synapse-queries' -import { useAtomValue } from 'jotai' import { tableQueryDataAtom, tableQueryEntityAtom, } from '../QueryWrapper/QueryWrapper' +import { isEntityViewOrDataset, isFileViewOrDataset } from './SynapseTableUtils' function usePrefetchFileHandleData() { const entity = useAtomValue(tableQueryEntityAtom) diff --git a/packages/synapse-react-client/src/components/SynapseTable/useTableSort.tsx b/packages/synapse-react-client/src/components/SynapseTable/useTableSort.tsx index 81106d4694..2ec979c00c 100644 --- a/packages/synapse-react-client/src/components/SynapseTable/useTableSort.tsx +++ b/packages/synapse-react-client/src/components/SynapseTable/useTableSort.tsx @@ -1,9 +1,9 @@ -import { useQueryContext } from '../QueryContext' import { useMemo } from 'react' import { SortingState, Updater } from '@tanstack/react-table' import { useDeepCompareMemoize } from 'use-deep-compare-effect' import { SortItem } from '@sage-bionetworks/synapse-types' import { ReadonlyDeep } from 'type-fest' +import { useQueryContext } from '../QueryContext' function transformQueryWrapperSortToTanStackSort( sort: ReadonlyDeep, diff --git a/packages/synapse-react-client/src/components/TableFeedCards/TableFeedCards.test.tsx b/packages/synapse-react-client/src/components/TableFeedCards/TableFeedCards.test.tsx index 479d692a94..7ecca14be7 100644 --- a/packages/synapse-react-client/src/components/TableFeedCards/TableFeedCards.test.tsx +++ b/packages/synapse-react-client/src/components/TableFeedCards/TableFeedCards.test.tsx @@ -1,11 +1,10 @@ import React from 'react' -import TableFeedCards from './TableFeedCards' import { QueryResultBundle } from '@sage-bionetworks/synapse-types' +import { act, render, fireEvent } from '@testing-library/react' import syn23519444Json from '../../mocks/query/syn23519444.json' -import { act } from '@testing-library/react' -import { render, fireEvent } from '@testing-library/react' import { SynapseTestContext } from '../../mocks/MockSynapseContext' import SynapseClient from '../../synapse-client' +import TableFeedCards from './TableFeedCards' jest.mock('../../synapse-client', () => ({ getQueryTableResults: jest.fn(), diff --git a/packages/synapse-react-client/src/components/TableFeedCards/TableFeedCards.tsx b/packages/synapse-react-client/src/components/TableFeedCards/TableFeedCards.tsx index 274b152d9d..de04d284a0 100644 --- a/packages/synapse-react-client/src/components/TableFeedCards/TableFeedCards.tsx +++ b/packages/synapse-react-client/src/components/TableFeedCards/TableFeedCards.tsx @@ -1,5 +1,3 @@ -import { SynapseConstants } from '../../utils' -import SynapseClient from '../../synapse-client' import React, { useEffect, useState } from 'react' import dayjs from 'dayjs' import { @@ -7,6 +5,8 @@ import { RowSet, SelectColumn, } from '@sage-bionetworks/synapse-types' +import SynapseClient from '../../synapse-client' +import { SynapseConstants } from '../../utils' import MarkdownSynapse from '../Markdown/MarkdownSynapse' import loadingScreen from '../LoadingScreen/LoadingScreen' import LargeButton from '../../components/styled/LargeButton' diff --git a/packages/synapse-react-client/src/components/TeamBadge.tsx b/packages/synapse-react-client/src/components/TeamBadge.tsx index ec458f846d..c25bb7c3dd 100644 --- a/packages/synapse-react-client/src/components/TeamBadge.tsx +++ b/packages/synapse-react-client/src/components/TeamBadge.tsx @@ -1,10 +1,10 @@ import React from 'react' import { PRODUCTION_ENDPOINT_CONFIG } from '../utils/functions/getEndpoint' -import IconSvg, { IconName } from './IconSvg/IconSvg' import { AUTHENTICATED_PRINCIPAL_ID, PUBLIC_PRINCIPAL_ID, } from '../utils/SynapseConstants' +import IconSvg, { IconName } from './IconSvg/IconSvg' export type TeamBadgeProps = { teamId: string | number diff --git a/packages/synapse-react-client/src/components/TermsAndConditions/TermsAndConditions.stories.ts b/packages/synapse-react-client/src/components/TermsAndConditions/TermsAndConditions.stories.ts index e4503fe20f..b1a733fab3 100644 --- a/packages/synapse-react-client/src/components/TermsAndConditions/TermsAndConditions.stories.ts +++ b/packages/synapse-react-client/src/components/TermsAndConditions/TermsAndConditions.stories.ts @@ -1,6 +1,6 @@ import { Meta, StoryObj } from '@storybook/react' -import TermsAndConditions from './TermsAndConditions' import { displayToast } from '../ToastMessage/ToastMessage' +import TermsAndConditions from './TermsAndConditions' // import { getHandlersForTableQuery } from '../mocks/msw/handlers/tableQueryHandlers' // import { MOCK_REPO_ORIGIN } from '../src/utils/functions/getEndpoint' // import mockSyn51718002 from '../mocks/query/syn51718002.json' diff --git a/packages/synapse-react-client/src/components/TermsAndConditions/TermsAndConditions.test.tsx b/packages/synapse-react-client/src/components/TermsAndConditions/TermsAndConditions.test.tsx index c5e0327327..30ab6e568b 100644 --- a/packages/synapse-react-client/src/components/TermsAndConditions/TermsAndConditions.test.tsx +++ b/packages/synapse-react-client/src/components/TermsAndConditions/TermsAndConditions.test.tsx @@ -1,10 +1,10 @@ import React from 'react' -import TermsAndConditions from './TermsAndConditions' -import { SynapseClient, SynapseContextType } from '../../index' import { QueryResultBundle } from '@sage-bionetworks/synapse-types' +import { render, screen, waitFor } from '@testing-library/react' +import { SynapseClient, SynapseContextType } from '../../index' import mockSyn51718002 from '../../mocks/query/syn51718002.json' import { createWrapper } from '../../testutils/TestingLibraryUtils' -import { render, screen, waitFor } from '@testing-library/react' +import TermsAndConditions from './TermsAndConditions' const defaultProps = { onFormChange: jest.fn(), diff --git a/packages/synapse-react-client/src/components/TermsAndConditions/TermsAndConditions.tsx b/packages/synapse-react-client/src/components/TermsAndConditions/TermsAndConditions.tsx index c49b8fa8c6..107b039ede 100644 --- a/packages/synapse-react-client/src/components/TermsAndConditions/TermsAndConditions.tsx +++ b/packages/synapse-react-client/src/components/TermsAndConditions/TermsAndConditions.tsx @@ -1,12 +1,14 @@ import React, { useEffect, useState } from 'react' -import { LoadingItem, tcItem } from './TermsAndConditionsItem' -import TermsAndConditionsItem from './TermsAndConditionsItem' import { Button, Link } from '@mui/material' import { BUNDLE_MASK_QUERY_RESULTS, URL_TERMS_CONDITIONS_AGREEMENT, } from '../../utils/SynapseConstants' import { useGetFullTableQueryResults } from '../../synapse-queries' +import TermsAndConditionsItem, { + LoadingItem, + tcItem, +} from './TermsAndConditionsItem' export type TermsAndConditionsProps = { onFormChange: (formComplete: boolean) => void diff --git a/packages/synapse-react-client/src/components/TermsAndConditions/TermsAndConditionsItem.test.tsx b/packages/synapse-react-client/src/components/TermsAndConditions/TermsAndConditionsItem.test.tsx index 4b3d4b06c3..f78c452539 100644 --- a/packages/synapse-react-client/src/components/TermsAndConditions/TermsAndConditionsItem.test.tsx +++ b/packages/synapse-react-client/src/components/TermsAndConditions/TermsAndConditionsItem.test.tsx @@ -1,14 +1,14 @@ import { render, screen } from '@testing-library/react' import userEvent from '@testing-library/user-event' import React from 'react' +import { BatchFileResult, FileResult } from '@sage-bionetworks/synapse-types' +import { SynapseClient, SynapseContextType } from '../../index' +import { mockFileHandle } from '../../mocks/mock_file_handle' +import { createWrapper } from '../../testutils/TestingLibraryUtils' import TermsAndConditionsItem, { TermsAndConditionsItemProps, tcItem, } from './TermsAndConditionsItem' -import { SynapseClient, SynapseContextType } from '../../index' -import { BatchFileResult, FileResult } from '@sage-bionetworks/synapse-types' -import { mockFileHandle } from '../../mocks/mock_file_handle' -import { createWrapper } from '../../testutils/TestingLibraryUtils' function renderComponent( itemProps: TermsAndConditionsItemProps, diff --git a/packages/synapse-react-client/src/components/TermsAndConditions/TermsAndConditionsItem.tsx b/packages/synapse-react-client/src/components/TermsAndConditions/TermsAndConditionsItem.tsx index cc6a936f57..20073dcce5 100644 --- a/packages/synapse-react-client/src/components/TermsAndConditions/TermsAndConditionsItem.tsx +++ b/packages/synapse-react-client/src/components/TermsAndConditions/TermsAndConditionsItem.tsx @@ -1,9 +1,9 @@ import React, { useEffect, useState } from 'react' -import { CheckIcon } from '../../assets/icons/terms/CheckIcon' import { FileHandleAssociateType } from '@sage-bionetworks/synapse-types' import { Link, Skeleton } from '@mui/material' -import { SkeletonParagraph } from '../Skeleton' import { times } from 'lodash-es' +import { SkeletonParagraph } from '../Skeleton' +import { CheckIcon } from '../../assets/icons/terms/CheckIcon' import { useGetPresignedUrlContentFromFHA } from '../../synapse-queries/file/useFiles' import { MarkdownSynapse } from '../Markdown' diff --git a/packages/synapse-react-client/src/components/TotalQueryResults.integration.test.tsx b/packages/synapse-react-client/src/components/TotalQueryResults.integration.test.tsx index c0b23a1bd8..2b67a9ce90 100644 --- a/packages/synapse-react-client/src/components/TotalQueryResults.integration.test.tsx +++ b/packages/synapse-react-client/src/components/TotalQueryResults.integration.test.tsx @@ -1,19 +1,19 @@ import { render, screen } from '@testing-library/react' import React from 'react' -import { SynapseConstants } from '../utils' -import { QueryVisualizationWrapper } from './QueryVisualizationWrapper/QueryVisualizationWrapper' -import TotalQueryResults, { TotalQueryResultsProps } from './TotalQueryResults' -import { createWrapper } from '../testutils/TestingLibraryUtils' import { ColumnTypeEnum, QueryBundleRequest, QueryResultBundle, RowSet, } from '@sage-bionetworks/synapse-types' +import { SynapseConstants } from '../utils' +import { createWrapper } from '../testutils/TestingLibraryUtils' import { server } from '../mocks/msw/server' import { getHandlersForTableQuery } from '../mocks/msw/handlers/tableQueryHandlers' -import QueryWrapper from './QueryWrapper' import { mockTableEntity } from '../mocks/entity/mockTableEntity' +import QueryWrapper from './QueryWrapper' +import TotalQueryResults, { TotalQueryResultsProps } from './TotalQueryResults' +import { QueryVisualizationWrapper } from './QueryVisualizationWrapper/QueryVisualizationWrapper' const mockQueryRequest: QueryBundleRequest = { concreteType: 'org.sagebionetworks.repo.model.table.QueryBundleRequest', diff --git a/packages/synapse-react-client/src/components/TotalQueryResults.tsx b/packages/synapse-react-client/src/components/TotalQueryResults.tsx index 8701aff1e9..7af4e6c403 100644 --- a/packages/synapse-react-client/src/components/TotalQueryResults.tsx +++ b/packages/synapse-react-client/src/components/TotalQueryResults.tsx @@ -1,12 +1,12 @@ import React from 'react' -import { SkeletonInlineBlock } from './Skeleton/SkeletonInlineBlock' import { FacetColumnRequest } from '@sage-bionetworks/synapse-types' +import pluralize from 'pluralize' +import { useAtomValue } from 'jotai' +import { SkeletonInlineBlock } from './Skeleton/SkeletonInlineBlock' import { useQueryVisualizationContext } from './QueryVisualizationWrapper' import { useQueryContext } from './QueryContext/QueryContext' import IconSvg from './IconSvg/IconSvg' import SelectionCriteriaPills from './widgets/facet-nav/SelectionCriteriaPills' -import pluralize from 'pluralize' -import { useAtomValue } from 'jotai' import { isLoadingNewBundleAtom, tableQueryDataAtom, diff --git a/packages/synapse-react-client/src/components/UserCard/Avatar.tsx b/packages/synapse-react-client/src/components/UserCard/Avatar.tsx index a609b755ed..99cfdd7896 100644 --- a/packages/synapse-react-client/src/components/UserCard/Avatar.tsx +++ b/packages/synapse-react-client/src/components/UserCard/Avatar.tsx @@ -1,9 +1,9 @@ import React, { useRef } from 'react' -import { getColor } from '../../utils/functions/getUserData' import { UserProfile } from '@sage-bionetworks/synapse-types' -import UserCardMedium from './UserCardMedium' -import { useOverlay } from '../../utils/hooks/useOverlay' import { Skeleton } from '@mui/material' +import { getColor } from '../../utils/functions/getUserData' +import { useOverlay } from '../../utils/hooks/useOverlay' +import UserCardMedium from './UserCardMedium' const TIMER_DELAY_SHOW = 250 // milliseconds const TIMER_DELAY_HIDE = 500 diff --git a/packages/synapse-react-client/src/components/UserCard/UserCard.tsx b/packages/synapse-react-client/src/components/UserCard/UserCard.tsx index b30f640d3f..3dd39adeed 100644 --- a/packages/synapse-react-client/src/components/UserCard/UserCard.tsx +++ b/packages/synapse-react-client/src/components/UserCard/UserCard.tsx @@ -1,4 +1,5 @@ import React, { useMemo } from 'react' +import { UserProfile, AliasType } from '@sage-bionetworks/synapse-types' import { SynapseConstants } from '../../utils' import { useGetProfileImage } from '../../synapse-queries/file/useFiles' import { @@ -8,13 +9,11 @@ import { import usePreFetchResource, { useCreateUrlForData, } from '../../utils/hooks/usePreFetchResource' -import { UserProfile } from '@sage-bionetworks/synapse-types' +import { UserCardSize } from '../../utils/SynapseConstants' import { Avatar, AvatarSize } from './Avatar' import { MenuAction } from './UserCardContextMenu' import UserCardMedium from './UserCardMedium' import { UserCardSmall } from './UserCardSmall' -import { AliasType } from '@sage-bionetworks/synapse-types' -import { UserCardSize } from '../../utils/SynapseConstants' export type UserCardProps = { /** A UserProfile may be used for data for the card. You must supply one of `userProfile`, `alias`, `ownerId` */ diff --git a/packages/synapse-react-client/src/components/UserCard/UserCardLarge.tsx b/packages/synapse-react-client/src/components/UserCard/UserCardLarge.tsx index bc2aa1ff78..0a2312f4c4 100644 --- a/packages/synapse-react-client/src/components/UserCard/UserCardLarge.tsx +++ b/packages/synapse-react-client/src/components/UserCard/UserCardLarge.tsx @@ -1,6 +1,6 @@ import React from 'react' -import CertifiedUserIcon from '../../assets/icons/CertifiedUser' import { UserProfile } from '@sage-bionetworks/synapse-types' +import CertifiedUserIcon from '../../assets/icons/CertifiedUser' type UserCardLargeProps = { userProfile: UserProfile diff --git a/packages/synapse-react-client/src/components/UserCard/UserCardMedium.tsx b/packages/synapse-react-client/src/components/UserCard/UserCardMedium.tsx index dc5f450245..7325069c68 100644 --- a/packages/synapse-react-client/src/components/UserCard/UserCardMedium.tsx +++ b/packages/synapse-react-client/src/components/UserCard/UserCardMedium.tsx @@ -1,16 +1,15 @@ -import { Skeleton } from '@mui/material' +import { Skeleton, Tooltip } from '@mui/material' import React, { useEffect, useRef, useState } from 'react' +import { UserProfile } from '@sage-bionetworks/synapse-types' import IconCopy from '../../assets/icons/IconCopy' import ValidatedProfileIcon from '../../assets/icons/ValidatedProfile' import { SkeletonTable } from '../Skeleton/SkeletonTable' import { SynapseConstants } from '../../utils' import { PRODUCTION_ENDPOINT_CONFIG } from '../../utils/functions/getEndpoint' import { useGetUserBundle } from '../../synapse-queries/user/useUserBundle' -import { UserProfile } from '@sage-bionetworks/synapse-types' -import { Tooltip } from '@mui/material' -import { Avatar } from './Avatar' import IconSvg from '../IconSvg/IconSvg' import { ToastMessage } from '../ToastMessage/ToastMessage' +import { Avatar } from './Avatar' import UserCardContextMenu, { MenuAction } from './UserCardContextMenu' import { UserCardLarge } from './UserCardLarge' diff --git a/packages/synapse-react-client/src/components/UserCard/UserCardSmall.tsx b/packages/synapse-react-client/src/components/UserCard/UserCardSmall.tsx index beb4e4036a..611f4b0dcc 100644 --- a/packages/synapse-react-client/src/components/UserCard/UserCardSmall.tsx +++ b/packages/synapse-react-client/src/components/UserCard/UserCardSmall.tsx @@ -1,13 +1,13 @@ import React, { useMemo, useRef } from 'react' +import { UserProfile } from '@sage-bionetworks/synapse-types' +import { Box, Link } from '@mui/material' import { SynapseConstants } from '../../utils' import { PRODUCTION_ENDPOINT_CONFIG } from '../../utils/functions/getEndpoint' import { useGetUserBundle } from '../../synapse-queries/user/useUserBundle' import { useOverlay } from '../../utils/hooks/useOverlay' -import { UserProfile } from '@sage-bionetworks/synapse-types' -import { Avatar, AvatarSize } from './Avatar' import IconSvg from '../IconSvg/IconSvg' +import { Avatar, AvatarSize } from './Avatar' import UserCardMedium from './UserCardMedium' -import { Box, Link } from '@mui/material' export type UserCardSmallProps = { userProfile: UserProfile diff --git a/packages/synapse-react-client/src/components/UserCardList/UserCardList.integration.test.tsx b/packages/synapse-react-client/src/components/UserCardList/UserCardList.integration.test.tsx index dd068d43d9..2e2f8bea07 100644 --- a/packages/synapse-react-client/src/components/UserCardList/UserCardList.integration.test.tsx +++ b/packages/synapse-react-client/src/components/UserCardList/UserCardList.integration.test.tsx @@ -1,12 +1,12 @@ import { render } from '@testing-library/react' import React from 'react' -import UserCardList, { UserCardListProps } from './UserCardList' +import { UserProfile } from '@sage-bionetworks/synapse-types' import { createWrapper } from '../../testutils/TestingLibraryUtils' import { SynapseConstants } from '../../utils' import { server } from '../../mocks/msw/server' import { getUserProfileWithProfilePicAttached } from '../../utils/functions/getUserData' -import { UserProfile } from '@sage-bionetworks/synapse-types' import { mockUserProfileData } from '../../mocks/user/mock_user_profile' +import UserCardList, { UserCardListProps } from './UserCardList' jest.mock('../../utils/functions/getUserData', () => ({ getUserProfileWithProfilePicAttached: jest.fn(), diff --git a/packages/synapse-react-client/src/components/UserCardList/UserCardList.tsx b/packages/synapse-react-client/src/components/UserCardList/UserCardList.tsx index a57f83baf0..526a172f56 100644 --- a/packages/synapse-react-client/src/components/UserCardList/UserCardList.tsx +++ b/packages/synapse-react-client/src/components/UserCardList/UserCardList.tsx @@ -1,14 +1,14 @@ import React from 'react' -import { getUserProfileWithProfilePicAttached } from '../../utils/functions/getUserData' -import { UserProfileList } from '../../synapse-client/SynapseClient' -import { MEDIUM_USER_CARD, UserCardSize } from '../../utils/SynapseConstants' import { ColumnTypeEnum, QueryResultBundle, UserProfile, } from '@sage-bionetworks/synapse-types' -import UserCard from '../UserCard/UserCard' import { without } from 'lodash-es' +import { getUserProfileWithProfilePicAttached } from '../../utils/functions/getUserData' +import { UserProfileList } from '../../synapse-client/SynapseClient' +import { MEDIUM_USER_CARD, UserCardSize } from '../../utils/SynapseConstants' +import UserCard from '../UserCard/UserCard' export type UserCardListProps = { /* The list of user IDs or null values to render. For null values, the card will be rendered with table data supplied by `firstName`, `lastName`, and `institution` columns supplied by the data prop. */ diff --git a/packages/synapse-react-client/src/components/UserCardList/UserCardListGroups/UserCardListGroups.Desktop.tsx b/packages/synapse-react-client/src/components/UserCardList/UserCardListGroups/UserCardListGroups.Desktop.tsx index ca8b38c407..1bc7d702c7 100644 --- a/packages/synapse-react-client/src/components/UserCardList/UserCardListGroups/UserCardListGroups.Desktop.tsx +++ b/packages/synapse-react-client/src/components/UserCardList/UserCardListGroups/UserCardListGroups.Desktop.tsx @@ -1,6 +1,6 @@ import React, { useState } from 'react' -import UserCardListRotate from '../UserCardListRotate' import { FacetColumnValuesRequest } from '@sage-bionetworks/synapse-types' +import UserCardListRotate from '../UserCardListRotate' import { UserCardListGroupsProps } from './UserCardListGroups' export default function UserCardListGroupsDesktop( diff --git a/packages/synapse-react-client/src/components/UserCardList/UserCardListGroups/UserCardListGroups.Mobile.tsx b/packages/synapse-react-client/src/components/UserCardList/UserCardListGroups/UserCardListGroups.Mobile.tsx index e214703923..09262d15c8 100644 --- a/packages/synapse-react-client/src/components/UserCardList/UserCardListGroups/UserCardListGroups.Mobile.tsx +++ b/packages/synapse-react-client/src/components/UserCardList/UserCardListGroups/UserCardListGroups.Mobile.tsx @@ -1,6 +1,6 @@ import React from 'react' -import UserCardListRotate from '../UserCardListRotate' import { FacetColumnValuesRequest } from '@sage-bionetworks/synapse-types' +import UserCardListRotate from '../UserCardListRotate' import ExpandableContent from '../../home_page/ExpandableContent' import { UserCardListGroupsProps } from './UserCardListGroups' diff --git a/packages/synapse-react-client/src/components/UserCardList/UserCardListGroups/UserCardListGroups.tsx b/packages/synapse-react-client/src/components/UserCardList/UserCardListGroups/UserCardListGroups.tsx index 828ba3e8a6..ff962ce7f1 100644 --- a/packages/synapse-react-client/src/components/UserCardList/UserCardListGroups/UserCardListGroups.tsx +++ b/packages/synapse-react-client/src/components/UserCardList/UserCardListGroups/UserCardListGroups.tsx @@ -1,9 +1,9 @@ import React from 'react' import useShowDesktop from '../../../utils/hooks/useShowDesktop' -import UserCardListGroupsMobile from './UserCardListGroups.Mobile' -import UserCardListGroupsDesktop from './UserCardListGroups.Desktop' import LargeButton from '../../../components/styled/LargeButton' import { UserCardSize } from '../../../utils/SynapseConstants' +import UserCardListGroupsMobile from './UserCardListGroups.Mobile' +import UserCardListGroupsDesktop from './UserCardListGroups.Desktop' export type UserCardListGroupsProps = { sql: string diff --git a/packages/synapse-react-client/src/components/UserCardList/UserCardListRotate.stories.ts b/packages/synapse-react-client/src/components/UserCardList/UserCardListRotate.stories.ts index c53256dea1..c656fa47fa 100644 --- a/packages/synapse-react-client/src/components/UserCardList/UserCardListRotate.stories.ts +++ b/packages/synapse-react-client/src/components/UserCardList/UserCardListRotate.stories.ts @@ -1,6 +1,6 @@ import { Meta, StoryObj } from '@storybook/react' -import UserCardListRotate from './UserCardListRotate' import { MEDIUM_USER_CARD } from '../../utils/SynapseConstants' +import UserCardListRotate from './UserCardListRotate' const meta = { title: 'Home Page/UserCardListRotate', diff --git a/packages/synapse-react-client/src/components/UserCardList/UserCardListRotate.test.tsx b/packages/synapse-react-client/src/components/UserCardList/UserCardListRotate.test.tsx index 19b37ee146..e545e8188f 100644 --- a/packages/synapse-react-client/src/components/UserCardList/UserCardListRotate.test.tsx +++ b/packages/synapse-react-client/src/components/UserCardList/UserCardListRotate.test.tsx @@ -1,10 +1,10 @@ import { render } from '@testing-library/react' import React from 'react' +import { createWrapper } from '../../testutils/TestingLibraryUtils' import UserCardListRotate, { getDisplayIds, UserCardListRotateProps, } from './UserCardListRotate' -import { createWrapper } from '../../testutils/TestingLibraryUtils' const STORED_UID_KEY = 'sage_rotate_uids' function renderComponent(props: UserCardListRotateProps) { diff --git a/packages/synapse-react-client/src/components/UserCardList/UserCardListRotate.tsx b/packages/synapse-react-client/src/components/UserCardList/UserCardListRotate.tsx index c85ab11285..a5df9d5a4b 100644 --- a/packages/synapse-react-client/src/components/UserCardList/UserCardListRotate.tsx +++ b/packages/synapse-react-client/src/components/UserCardList/UserCardListRotate.tsx @@ -1,4 +1,11 @@ import React, { useState } from 'react' +import { + FacetColumnRequest, + QueryBundleRequest, + QueryResultBundle, + ColumnTypeEnum, +} from '@sage-bionetworks/synapse-types' +import { useDeepCompareEffectNoCheck } from 'use-deep-compare-effect' import { getAdditionalFilters, parseEntityIdFromSqlStatement, @@ -6,18 +13,11 @@ import { } from '../../utils/functions/SqlFunctions' import { SynapseConstants } from '../../utils' import SynapseClient from '../../synapse-client' -import { - FacetColumnRequest, - QueryBundleRequest, - QueryResultBundle, -} from '@sage-bionetworks/synapse-types' -import { ColumnTypeEnum } from '@sage-bionetworks/synapse-types' -import UserCardList from './UserCardList' import { LARGE_USER_CARD, UserCardSize } from '../../utils/SynapseConstants' import LargeButton from '../../components/styled/LargeButton' import { useSynapseContext } from '../../utils/context/SynapseContext' import { LoadingUserCardMedium } from '../UserCard/UserCardMedium' -import { useDeepCompareEffectNoCheck } from 'use-deep-compare-effect' +import UserCardList from './UserCardList' const STORED_UID_KEY = 'sage_rotate_uids' const DEFAULT_DISPLAY_COUNT = 3 diff --git a/packages/synapse-react-client/src/components/UserCardList/index.ts b/packages/synapse-react-client/src/components/UserCardList/index.ts index 40ef7df8dc..fdcc84b1f8 100644 --- a/packages/synapse-react-client/src/components/UserCardList/index.ts +++ b/packages/synapse-react-client/src/components/UserCardList/index.ts @@ -1,6 +1,6 @@ import { UserCardList } from './UserCardList' -import type { UserCardListProps } from './UserCardList' import { UserCardListRotate } from './UserCardListRotate' +import type { UserCardListProps } from './UserCardList' import type { UserCardListRotateProps } from './UserCardListRotate' export { UserCardList, diff --git a/packages/synapse-react-client/src/components/UserOrTeamBadge/UserOrTeamBadge.tsx b/packages/synapse-react-client/src/components/UserOrTeamBadge/UserOrTeamBadge.tsx index 55d2c70c2a..bb17f4347f 100644 --- a/packages/synapse-react-client/src/components/UserOrTeamBadge/UserOrTeamBadge.tsx +++ b/packages/synapse-react-client/src/components/UserOrTeamBadge/UserOrTeamBadge.tsx @@ -1,9 +1,9 @@ import { Skeleton } from '@mui/material' import React, { useEffect, useState } from 'react' +import { UserGroupHeader } from '@sage-bionetworks/synapse-types' import { useGetUserGroupHeader } from '../../synapse-queries/user/useUserGroupHeader' import { SMALL_USER_CARD } from '../../utils/SynapseConstants' import { useSynapseContext } from '../../utils/context/SynapseContext' -import { UserGroupHeader } from '@sage-bionetworks/synapse-types' import TeamBadge from '../TeamBadge' import UserCard from '../UserCard/UserCard' diff --git a/packages/synapse-react-client/src/components/UserProfileLinks/UserChallenges.test.tsx b/packages/synapse-react-client/src/components/UserProfileLinks/UserChallenges.test.tsx index 62d6c8c1eb..63566290b3 100644 --- a/packages/synapse-react-client/src/components/UserProfileLinks/UserChallenges.test.tsx +++ b/packages/synapse-react-client/src/components/UserProfileLinks/UserChallenges.test.tsx @@ -2,10 +2,10 @@ import '@testing-library/jest-dom' import { render, screen } from '@testing-library/react' import React from 'react' import { mockAllIsIntersecting } from 'react-intersection-observer/test-utils' -import UserChallenges from './UserChallenges' -import { useGetUserChallengesInfinite } from '../../synapse-queries/user/useGetUserChallenges' import { ChallengeWithProjectHeader } from '@sage-bionetworks/synapse-types' +import { useGetUserChallengesInfinite } from '../../synapse-queries/user/useGetUserChallenges' import { SynapseTestContext } from '../../mocks/MockSynapseContext' +import UserChallenges from './UserChallenges' jest.mock('../../../src/synapse-queries/user/useGetUserChallenges', () => { return { diff --git a/packages/synapse-react-client/src/components/UserProfileLinks/UserChallenges.tsx b/packages/synapse-react-client/src/components/UserProfileLinks/UserChallenges.tsx index 58ef4fb80e..6f97b1eef7 100644 --- a/packages/synapse-react-client/src/components/UserProfileLinks/UserChallenges.tsx +++ b/packages/synapse-react-client/src/components/UserProfileLinks/UserChallenges.tsx @@ -1,9 +1,9 @@ import React, { useEffect } from 'react' import { useErrorHandler } from 'react-error-boundary' import { useInView } from 'react-intersection-observer' +import { ChallengeWithProjectHeader } from '@sage-bionetworks/synapse-types' import { PRODUCTION_ENDPOINT_CONFIG } from '../../utils/functions/getEndpoint' import { useGetUserChallengesInfinite } from '../../synapse-queries/user/useGetUserChallenges' -import { ChallengeWithProjectHeader } from '@sage-bionetworks/synapse-types' import { SkeletonTable } from '../Skeleton/SkeletonTable' export type UserChallengesProps = { diff --git a/packages/synapse-react-client/src/components/UserProfileLinks/UserProfileLinks.tsx b/packages/synapse-react-client/src/components/UserProfileLinks/UserProfileLinks.tsx index cab7e3396a..791016017e 100644 --- a/packages/synapse-react-client/src/components/UserProfileLinks/UserProfileLinks.tsx +++ b/packages/synapse-react-client/src/components/UserProfileLinks/UserProfileLinks.tsx @@ -1,7 +1,7 @@ import Skeleton from '@mui/material/Skeleton' import React, { useState, useMemo } from 'react' -import { useGetUserProfile } from '../../synapse-queries' import Typography from '@mui/material/Typography' +import { useGetUserProfile } from '../../synapse-queries' import { SynapseErrorBoundary } from '../error/ErrorBanner' import IconSvg, { IconName } from '../IconSvg/IconSvg' import UserChallenges from './UserChallenges' diff --git a/packages/synapse-react-client/src/components/UserProfileLinks/UserProjects.test.tsx b/packages/synapse-react-client/src/components/UserProfileLinks/UserProjects.test.tsx index 885a00ad42..87045ee138 100644 --- a/packages/synapse-react-client/src/components/UserProfileLinks/UserProjects.test.tsx +++ b/packages/synapse-react-client/src/components/UserProfileLinks/UserProjects.test.tsx @@ -2,10 +2,10 @@ import '@testing-library/jest-dom' import { render, screen } from '@testing-library/react' import React from 'react' import { mockAllIsIntersecting } from 'react-intersection-observer/test-utils' -import UserProjects from './UserProjects' -import { useGetUserProjectsInfinite } from '../../synapse-queries/user/useGetUserProjects' import { ProjectHeader } from '@sage-bionetworks/synapse-types' +import { useGetUserProjectsInfinite } from '../../synapse-queries/user/useGetUserProjects' import { SynapseTestContext } from '../../mocks/MockSynapseContext' +import UserProjects from './UserProjects' jest.mock('../../../src/synapse-queries/user/useGetUserProjects', () => { return { diff --git a/packages/synapse-react-client/src/components/UserProfileLinks/UserProjects.tsx b/packages/synapse-react-client/src/components/UserProfileLinks/UserProjects.tsx index dbfcc20a4c..96a9d65b69 100644 --- a/packages/synapse-react-client/src/components/UserProfileLinks/UserProjects.tsx +++ b/packages/synapse-react-client/src/components/UserProfileLinks/UserProjects.tsx @@ -1,10 +1,12 @@ import React, { useEffect } from 'react' import { useErrorHandler } from 'react-error-boundary' import { useInView } from 'react-intersection-observer' -import { ProjectHeader } from '@sage-bionetworks/synapse-types' +import { + ProjectHeader, + GetProjectsParameters, +} from '@sage-bionetworks/synapse-types' import { PRODUCTION_ENDPOINT_CONFIG } from '../../utils/functions/getEndpoint' import { useGetUserProjectsInfinite } from '../../synapse-queries/user/useGetUserProjects' -import { GetProjectsParameters } from '@sage-bionetworks/synapse-types' import { SkeletonTable } from '../Skeleton/SkeletonTable' export type UserProjectsProps = { diff --git a/packages/synapse-react-client/src/components/UserProfileLinks/UserTeams.test.tsx b/packages/synapse-react-client/src/components/UserProfileLinks/UserTeams.test.tsx index 04c04bbaf7..adac6daa0a 100644 --- a/packages/synapse-react-client/src/components/UserProfileLinks/UserTeams.test.tsx +++ b/packages/synapse-react-client/src/components/UserProfileLinks/UserTeams.test.tsx @@ -2,10 +2,10 @@ import '@testing-library/jest-dom' import { render, screen } from '@testing-library/react' import React from 'react' import { mockAllIsIntersecting } from 'react-intersection-observer/test-utils' -import UserTeams from './UserTeams' -import { useGetUserTeamsInfinite } from '../../synapse-queries/user/useGetUserTeams' import { Team } from '@sage-bionetworks/synapse-types' +import { useGetUserTeamsInfinite } from '../../synapse-queries/user/useGetUserTeams' import { SynapseTestContext } from '../../mocks/MockSynapseContext' +import UserTeams from './UserTeams' jest.mock('../../../src/synapse-queries/user/useGetUserTeams', () => { return { diff --git a/packages/synapse-react-client/src/components/UserProfileLinks/UserTeams.tsx b/packages/synapse-react-client/src/components/UserProfileLinks/UserTeams.tsx index d7ba190466..158aa4c604 100644 --- a/packages/synapse-react-client/src/components/UserProfileLinks/UserTeams.tsx +++ b/packages/synapse-react-client/src/components/UserProfileLinks/UserTeams.tsx @@ -1,9 +1,9 @@ import React, { useEffect } from 'react' import { useErrorHandler } from 'react-error-boundary' import { useInView } from 'react-intersection-observer' +import { Team } from '@sage-bionetworks/synapse-types' import { PRODUCTION_ENDPOINT_CONFIG } from '../../utils/functions/getEndpoint' import { useGetUserTeamsInfinite } from '../../synapse-queries/user/useGetUserTeams' -import { Team } from '@sage-bionetworks/synapse-types' import { SkeletonTable } from '../Skeleton/SkeletonTable' export type UserTeamsProps = { diff --git a/packages/synapse-react-client/src/components/UserSearchBox/UserSearchBox.tsx b/packages/synapse-react-client/src/components/UserSearchBox/UserSearchBox.tsx index 34bc87f843..5432184be5 100644 --- a/packages/synapse-react-client/src/components/UserSearchBox/UserSearchBox.tsx +++ b/packages/synapse-react-client/src/components/UserSearchBox/UserSearchBox.tsx @@ -1,12 +1,11 @@ import Downshift from 'downshift' -import React from 'react' -import { useState } from 'react' -import { getUserGroupHeaders } from '../../synapse-client/SynapseClient' +import React, { useState } from 'react' import { UserGroupHeader, UserGroupHeaderResponsePage, + TYPE_FILTER, } from '@sage-bionetworks/synapse-types' -import { TYPE_FILTER } from '@sage-bionetworks/synapse-types' +import { getUserGroupHeaders } from '../../synapse-client/SynapseClient' import UserOrTeamBadge from '../UserOrTeamBadge/UserOrTeamBadge' export type UserSearchBoxProps = { diff --git a/packages/synapse-react-client/src/components/UserSearchBox/UserSearchBoxV2.integration.test.tsx b/packages/synapse-react-client/src/components/UserSearchBox/UserSearchBoxV2.integration.test.tsx index f99a074e3e..fe573f052d 100644 --- a/packages/synapse-react-client/src/components/UserSearchBox/UserSearchBoxV2.integration.test.tsx +++ b/packages/synapse-react-client/src/components/UserSearchBox/UserSearchBoxV2.integration.test.tsx @@ -2,7 +2,6 @@ import { act, render, screen, waitFor } from '@testing-library/react' import userEvent from '@testing-library/user-event' import React from 'react' import selectEvent from 'react-select-event' -import UserSearchBox from './UserSearchBoxV2' import { createWrapper } from '../../testutils/TestingLibraryUtils' import { server } from '../../mocks/msw/server' import { @@ -10,6 +9,7 @@ import { MOCK_USER_ID, MOCK_USER_NAME, } from '../../mocks/user/mock_user_profile' +import UserSearchBox from './UserSearchBoxV2' describe('UserSearchBoxV2 tests', () => { beforeAll(() => server.listen()) diff --git a/packages/synapse-react-client/src/components/UserSearchBox/UserSearchBoxV2.tsx b/packages/synapse-react-client/src/components/UserSearchBox/UserSearchBoxV2.tsx index 27cdef2906..6f6c278213 100644 --- a/packages/synapse-react-client/src/components/UserSearchBox/UserSearchBoxV2.tsx +++ b/packages/synapse-react-client/src/components/UserSearchBox/UserSearchBoxV2.tsx @@ -6,11 +6,10 @@ import Select, { PropsValue, SelectComponentsConfig, } from 'react-select' +import { UserGroupHeader, TYPE_FILTER } from '@sage-bionetworks/synapse-types' import { useSearchUserGroupHeaders } from '../../synapse-queries' import { useDebouncedEffect } from '../../utils/hooks/useDebouncedEffect' import useGetInfoFromIds from '../../utils/hooks/useGetInfoFromIds' -import { UserGroupHeader } from '@sage-bionetworks/synapse-types' -import { TYPE_FILTER } from '@sage-bionetworks/synapse-types' import UserOrTeamBadge from '../UserOrTeamBadge/UserOrTeamBadge' type UserSearchBoxValueType = { diff --git a/packages/synapse-react-client/src/components/dataaccess/AccessApprovalsTable.integration.test.tsx b/packages/synapse-react-client/src/components/dataaccess/AccessApprovalsTable.integration.test.tsx index 1d51b52357..5e21a5a723 100644 --- a/packages/synapse-react-client/src/components/dataaccess/AccessApprovalsTable.integration.test.tsx +++ b/packages/synapse-react-client/src/components/dataaccess/AccessApprovalsTable.integration.test.tsx @@ -1,20 +1,20 @@ import React from 'react' -import { server } from '../../mocks/msw/server' import { render, screen } from '@testing-library/react' import { AccessApprovalSearchResult } from '@sage-bionetworks/synapse-types' -import { - AccessApprovalsTable, - AccessApprovalsTableProps, -} from './AccessApprovalsTable' +import { mockAllIsIntersecting } from 'react-intersection-observer/test-utils' +import userEvent from '@testing-library/user-event' import { createWrapper } from '../../testutils/TestingLibraryUtils' import { MOCK_USER_ID } from '../../mocks/user/mock_user_profile' import { mockAccessApprovalSearchResult2, mockApprovalSearchResponse, } from '../../mocks/MockAccessApprovals' -import { mockAllIsIntersecting } from 'react-intersection-observer/test-utils' import * as UseAccessApprovalsModule from '../../synapse-queries/dataaccess/useAccessApprovals' -import userEvent from '@testing-library/user-event' +import { server } from '../../mocks/msw/server' +import { + AccessApprovalsTable, + AccessApprovalsTableProps, +} from './AccessApprovalsTable' const mockSearchAccessApprovalsInfinite = jest.spyOn( UseAccessApprovalsModule, diff --git a/packages/synapse-react-client/src/components/dataaccess/AccessApprovalsTable.tsx b/packages/synapse-react-client/src/components/dataaccess/AccessApprovalsTable.tsx index d39021ad47..74a9ce0a26 100644 --- a/packages/synapse-react-client/src/components/dataaccess/AccessApprovalsTable.tsx +++ b/packages/synapse-react-client/src/components/dataaccess/AccessApprovalsTable.tsx @@ -1,7 +1,6 @@ import dayjs from 'dayjs' import React, { useMemo, useState } from 'react' import { Table } from 'react-bootstrap' -import { SMALL_USER_CARD } from '../../utils/SynapseConstants' import { AccessApprovalSearchRequest, AccessApprovalSearchSort, @@ -9,13 +8,14 @@ import { Direction, } from '@sage-bionetworks/synapse-types' import { Button, Typography } from '@mui/material' +import { upperFirst } from 'lodash-es' +import { SMALL_USER_CARD } from '../../utils/SynapseConstants' import UserCard from '../UserCard/UserCard' import { PRODUCTION_ENDPOINT_CONFIG } from '../../utils/functions/getEndpoint' import { useSearchAccessApprovalsInfinite } from '../../synapse-queries/dataaccess/useAccessApprovals' import { SynapseSpinner } from '../LoadingScreen/LoadingScreen' import SortIcon from '../../assets/icons/Sort' import { formatDate } from '../../utils/functions/DateFormatter' -import { upperFirst } from 'lodash-es' export type AccessApprovalsTableProps = { accessorId: string diff --git a/packages/synapse-react-client/src/components/dataaccess/AccessHistoryDashboard.integration.test.tsx b/packages/synapse-react-client/src/components/dataaccess/AccessHistoryDashboard.integration.test.tsx index 5ca16ff83e..004eda954a 100644 --- a/packages/synapse-react-client/src/components/dataaccess/AccessHistoryDashboard.integration.test.tsx +++ b/packages/synapse-react-client/src/components/dataaccess/AccessHistoryDashboard.integration.test.tsx @@ -1,9 +1,11 @@ import React from 'react' import { act, render, screen, waitFor } from '@testing-library/react' -import { UserHistoryDashboard } from './AccessHistoryDashboard' import { createMemoryHistory, MemoryHistory } from 'history' -import { createWrapper } from '../../testutils/TestingLibraryUtils' import { Router } from 'react-router-dom' +import userEvent from '@testing-library/user-event' +import selectEvent from 'react-select-event' +import { UserBundle } from '@sage-bionetworks/synapse-types' +import { createWrapper } from '../../testutils/TestingLibraryUtils' import { rest, server } from '../../mocks/msw/server' import { BackendDestinationEnum, @@ -18,16 +20,14 @@ import { mockManagedACTAccessRequirement as mockAccessRequirement, mockSearchResults, } from '../../mocks/mockAccessRequirements' -import userEvent from '@testing-library/user-event' import { MOCK_USER_ID, MOCK_USER_NAME, } from '../../mocks/user/mock_user_profile' -import selectEvent from 'react-select-event' import { getOptionLabel } from './AccessRequirementSearchBox/AccessRequirementSearchBox' import * as AccessApprovalsTableModule from './AccessApprovalsTable' import * as AccessRequestSubmissionTableModule from './AccessRequestSubmissionTable' -import { UserBundle } from '@sage-bionetworks/synapse-types' +import { UserHistoryDashboard } from './AccessHistoryDashboard' const APPROVAL_TABLE_TEST_ID = 'AccessApprovalTableTestId' const SUBMISSION_TABLE_TEST_ID = 'AccessSubmissionTableTestId' diff --git a/packages/synapse-react-client/src/components/dataaccess/AccessHistoryDashboard.tsx b/packages/synapse-react-client/src/components/dataaccess/AccessHistoryDashboard.tsx index 0bba6e2f84..730cf30623 100644 --- a/packages/synapse-react-client/src/components/dataaccess/AccessHistoryDashboard.tsx +++ b/packages/synapse-react-client/src/components/dataaccess/AccessHistoryDashboard.tsx @@ -1,9 +1,13 @@ import { omitBy } from 'lodash-es' import React, { useCallback, useEffect, useState } from 'react' import { useHistory, useLocation } from 'react-router-dom' -import { useDebouncedEffect } from '../../utils/hooks/useDebouncedEffect' import { TYPE_FILTER } from '@sage-bionetworks/synapse-types' import { Typography } from '@mui/material' +import { useDebouncedEffect } from '../../utils/hooks/useDebouncedEffect' +import UserOrTeamBadge from '../UserOrTeamBadge/UserOrTeamBadge' +import UserSearchBoxV2 from '../UserSearchBox/UserSearchBoxV2' +import { useGetCurrentUserBundle } from '../../synapse-queries' +import AccessRequirementSearchBox from './AccessRequirementSearchBox/AccessRequirementSearchBox' import { AccessApprovalsTable, AccessApprovalsTableProps, @@ -12,10 +16,6 @@ import { AccessRequestSubmissionTable, AccessRequestSubmissionTableProps, } from './AccessRequestSubmissionTable' -import UserOrTeamBadge from '../UserOrTeamBadge/UserOrTeamBadge' -import UserSearchBoxV2 from '../UserSearchBox/UserSearchBoxV2' -import AccessRequirementSearchBox from './AccessRequirementSearchBox/AccessRequirementSearchBox' -import { useGetCurrentUserBundle } from '../../synapse-queries' export const UserHistoryDashboard = () => { const [accessRequirementId, setAccessRequirementId] = useState< diff --git a/packages/synapse-react-client/src/components/dataaccess/AccessRequestSubmissionTable.integration.test.tsx b/packages/synapse-react-client/src/components/dataaccess/AccessRequestSubmissionTable.integration.test.tsx index f759e4438a..9400523f15 100644 --- a/packages/synapse-react-client/src/components/dataaccess/AccessRequestSubmissionTable.integration.test.tsx +++ b/packages/synapse-react-client/src/components/dataaccess/AccessRequestSubmissionTable.integration.test.tsx @@ -1,17 +1,18 @@ import React from 'react' import userEvent from '@testing-library/user-event' import { render, screen, waitFor } from '@testing-library/react' -import { - AccessRequestSubmissionTable, - AccessRequestSubmissionTableProps, -} from './AccessRequestSubmissionTable' -import { createWrapperAndQueryClient } from '../../testutils/TestingLibraryUtils' import { SubmissionReviewerFilterType, SubmissionSearchRequest, SubmissionSearchResponse, + AccessType, + SubmissionState, } from '@sage-bionetworks/synapse-types' -import { AccessType, SubmissionState } from '@sage-bionetworks/synapse-types' +import { upperFirst } from 'lodash-es' +import dayjs from 'dayjs' +import { Router } from 'react-router-dom' +import { createMemoryHistory } from 'history' +import { createWrapperAndQueryClient } from '../../testutils/TestingLibraryUtils' import { rest, server } from '../../mocks/msw/server' import { BackendDestinationEnum, @@ -23,11 +24,11 @@ import { MOCK_USER_NAME, MOCK_USER_NAME_2, } from '../../mocks/user/mock_user_profile' -import { upperFirst } from 'lodash-es' import { formatDate } from '../../utils/functions/DateFormatter' -import dayjs from 'dayjs' -import { Router } from 'react-router-dom' -import { createMemoryHistory } from 'history' +import { + AccessRequestSubmissionTable, + AccessRequestSubmissionTableProps, +} from './AccessRequestSubmissionTable' function renderComponent(props: AccessRequestSubmissionTableProps) { const { wrapperFn } = createWrapperAndQueryClient() diff --git a/packages/synapse-react-client/src/components/dataaccess/AccessRequestSubmissionTable.tsx b/packages/synapse-react-client/src/components/dataaccess/AccessRequestSubmissionTable.tsx index 6960969fd4..4ff071817c 100644 --- a/packages/synapse-react-client/src/components/dataaccess/AccessRequestSubmissionTable.tsx +++ b/packages/synapse-react-client/src/components/dataaccess/AccessRequestSubmissionTable.tsx @@ -3,20 +3,21 @@ import dayjs from 'dayjs' import React, { useMemo, useState } from 'react' import { Table } from 'react-bootstrap' import { Link } from 'react-router-dom' -import SortIcon from '../../assets/icons/Sort' -import { formatDate } from '../../utils/functions/DateFormatter' -import { useSearchAccessSubmissionsInfinite } from '../../synapse-queries/dataaccess/useDataAccessSubmission' -import { ACT_TEAM_ID, SMALL_USER_CARD } from '../../utils/SynapseConstants' -import { Direction, SubmissionState } from '@sage-bionetworks/synapse-types' import { + Direction, + SubmissionState, SubmissionReviewerFilterType, SubmissionSearchRequest, SubmissionSearchSort, SubmissionSortField, } from '@sage-bionetworks/synapse-types' +import { Button, Typography } from '@mui/material' +import SortIcon from '../../assets/icons/Sort' +import { formatDate } from '../../utils/functions/DateFormatter' +import { useSearchAccessSubmissionsInfinite } from '../../synapse-queries/dataaccess/useDataAccessSubmission' +import { ACT_TEAM_ID, SMALL_USER_CARD } from '../../utils/SynapseConstants' import { SynapseSpinner } from '../LoadingScreen/LoadingScreen' import UserCard from '../UserCard/UserCard' -import { Button, Typography } from '@mui/material' import UserOrTeamBadge from '../UserOrTeamBadge/UserOrTeamBadge' export type AccessRequestSubmissionTableProps = { diff --git a/packages/synapse-react-client/src/components/dataaccess/AccessRequirementDashboard.integration.test.tsx b/packages/synapse-react-client/src/components/dataaccess/AccessRequirementDashboard.integration.test.tsx index 411a8e7614..031c0871a7 100644 --- a/packages/synapse-react-client/src/components/dataaccess/AccessRequirementDashboard.integration.test.tsx +++ b/packages/synapse-react-client/src/components/dataaccess/AccessRequirementDashboard.integration.test.tsx @@ -4,16 +4,16 @@ import { createMemoryHistory, MemoryHistory } from 'history' import React from 'react' import { Router } from 'react-router-dom' import selectEvent from 'react-select-event' -import { - AccessRequirementDashboard, - AccessRequirementDashboardProps, -} from './AccessRequirementDashboard' import { createWrapper } from '../../testutils/TestingLibraryUtils' import { server } from '../../mocks/msw/server' import { MOCK_USER_ID, MOCK_USER_NAME, } from '../../mocks/user/mock_user_profile' +import { + AccessRequirementDashboard, + AccessRequirementDashboardProps, +} from './AccessRequirementDashboard' import { AccessRequirementTable } from './AccessRequirementTable' const AR_TABLE_TEST_ID = 'AccessRequirementTableTestId' diff --git a/packages/synapse-react-client/src/components/dataaccess/AccessRequirementDashboard.tsx b/packages/synapse-react-client/src/components/dataaccess/AccessRequirementDashboard.tsx index 4dc31193f7..5c480eb068 100644 --- a/packages/synapse-react-client/src/components/dataaccess/AccessRequirementDashboard.tsx +++ b/packages/synapse-react-client/src/components/dataaccess/AccessRequirementDashboard.tsx @@ -3,17 +3,17 @@ import React, { useCallback, useEffect, useMemo, useState } from 'react' import { Box, InputAdornment, TextField, Typography } from '@mui/material' import { SearchOutlined } from '@mui/icons-material' import { useHistory, useLocation } from 'react-router-dom' -import { useDebouncedEffect } from '../../utils/hooks/useDebouncedEffect' import { EntityType } from '@sage-bionetworks/synapse-types' +import { useDebouncedEffect } from '../../utils/hooks/useDebouncedEffect' import { EntityFinderModal } from '../EntityFinder/EntityFinderModal' import { FinderScope } from '../EntityFinder/tree/EntityTree' import UserSearchBoxV2 from '../UserSearchBox/UserSearchBoxV2' +import { SYNAPSE_ENTITY_ID_REGEX } from '../../utils/functions/RegularExpressions' +import { InputSizedButton } from '../styled/InputSizedButton' import { AccessRequirementTable, AccessRequirementTableProps, } from './AccessRequirementTable' -import { SYNAPSE_ENTITY_ID_REGEX } from '../../utils/functions/RegularExpressions' -import { InputSizedButton } from '../styled/InputSizedButton' export type AccessRequirementDashboardProps = { onCreateNewAccessRequirementClicked?: () => void diff --git a/packages/synapse-react-client/src/components/dataaccess/AccessRequirementSearchBox/AccessRequirementSearchBox.integration.test.tsx b/packages/synapse-react-client/src/components/dataaccess/AccessRequirementSearchBox/AccessRequirementSearchBox.integration.test.tsx index 83816cbf36..0b9ef81252 100644 --- a/packages/synapse-react-client/src/components/dataaccess/AccessRequirementSearchBox/AccessRequirementSearchBox.integration.test.tsx +++ b/packages/synapse-react-client/src/components/dataaccess/AccessRequirementSearchBox/AccessRequirementSearchBox.integration.test.tsx @@ -2,9 +2,6 @@ import { render, screen, waitFor } from '@testing-library/react' import userEvent from '@testing-library/user-event' import React from 'react' import selectEvent from 'react-select-event' -import AccessRequirementSearchBox, { - getOptionLabel, -} from './AccessRequirementSearchBox' import { createWrapper } from '../../../testutils/TestingLibraryUtils' import { ACCESS_REQUIREMENT_BY_ID, @@ -19,6 +16,9 @@ import { mockSearchResults, } from '../../../mocks/mockAccessRequirements' import { rest, server } from '../../../mocks/msw/server' +import AccessRequirementSearchBox, { + getOptionLabel, +} from './AccessRequirementSearchBox' const mockOnChange = jest.fn() const onServiceRecievedRequest = jest.fn() diff --git a/packages/synapse-react-client/src/components/dataaccess/AccessRequirementSearchBox/AccessRequirementSearchBox.stories.ts b/packages/synapse-react-client/src/components/dataaccess/AccessRequirementSearchBox/AccessRequirementSearchBox.stories.ts index f0fcf61674..65eff9ec38 100644 --- a/packages/synapse-react-client/src/components/dataaccess/AccessRequirementSearchBox/AccessRequirementSearchBox.stories.ts +++ b/packages/synapse-react-client/src/components/dataaccess/AccessRequirementSearchBox/AccessRequirementSearchBox.stories.ts @@ -1,6 +1,6 @@ import { Meta, StoryObj } from '@storybook/react' -import AccessRequirementSearchBox from './AccessRequirementSearchBox' import { displayToast } from '../../ToastMessage/ToastMessage' +import AccessRequirementSearchBox from './AccessRequirementSearchBox' const meta = { title: 'Governance/AccessRequirementSearchBox', diff --git a/packages/synapse-react-client/src/components/dataaccess/AccessRequirementTable.integration.test.tsx b/packages/synapse-react-client/src/components/dataaccess/AccessRequirementTable.integration.test.tsx index d7346a074c..19ae871d51 100644 --- a/packages/synapse-react-client/src/components/dataaccess/AccessRequirementTable.integration.test.tsx +++ b/packages/synapse-react-client/src/components/dataaccess/AccessRequirementTable.integration.test.tsx @@ -4,9 +4,10 @@ import dayjs from 'dayjs' import React from 'react' import { QueryClient } from 'react-query' import { - AccessRequirementTable, - AccessRequirementTableProps, -} from './AccessRequirementTable' + ACCESS_TYPE, + AccessRequirementSearchRequest, + AccessRequirementSearchResponse, +} from '@sage-bionetworks/synapse-types' import { createWrapperAndQueryClient } from '../../testutils/TestingLibraryUtils' import { ACCESS_REQUIREMENT_SEARCH } from '../../utils/APIConstants' import { formatDate } from '../../utils/functions/DateFormatter' @@ -14,15 +15,14 @@ import { BackendDestinationEnum, getEndpoint, } from '../../utils/functions/getEndpoint' -import { ACCESS_TYPE } from '@sage-bionetworks/synapse-types' -import { - AccessRequirementSearchRequest, - AccessRequirementSearchResponse, -} from '@sage-bionetworks/synapse-types' import mockProjectData from '../../mocks/entity/mockProject' import { mockSearchResults } from '../../mocks/mockAccessRequirements' import { rest, server } from '../../mocks/msw/server' import { MOCK_USER_NAME } from '../../mocks/user/mock_user_profile' +import { + AccessRequirementTable, + AccessRequirementTableProps, +} from './AccessRequirementTable' const MOCK_PROJECT_ID = mockProjectData.id const MOCK_PROJECT_NAME = mockProjectData.name diff --git a/packages/synapse-react-client/src/components/dataaccess/AccessRequirementTable.tsx b/packages/synapse-react-client/src/components/dataaccess/AccessRequirementTable.tsx index d88544d620..49aedbcbef 100644 --- a/packages/synapse-react-client/src/components/dataaccess/AccessRequirementTable.tsx +++ b/packages/synapse-react-client/src/components/dataaccess/AccessRequirementTable.tsx @@ -1,19 +1,19 @@ import dayjs from 'dayjs' import React, { useMemo, useState } from 'react' import { Table } from 'react-bootstrap' -import SortIcon from '../../assets/icons/Sort' -import { formatDate } from '../../utils/functions/DateFormatter' -import { PRODUCTION_ENDPOINT_CONFIG } from '../../utils/functions/getEndpoint' -import { useSearchAccessRequirementsInfinite } from '../../synapse-queries/dataaccess/useAccessRequirements' -import { ACT_TEAM_ID } from '../../utils/SynapseConstants' -import { ACCESS_TYPE } from '@sage-bionetworks/synapse-types' import { + ACCESS_TYPE, AccessRequirementSearchRequest, AccessRequirementSearchSort, } from '@sage-bionetworks/synapse-types' import { Button, Typography } from '@mui/material' -import { EntityLink } from '../EntityLink' import { StarTwoTone } from '@mui/icons-material' +import SortIcon from '../../assets/icons/Sort' +import { formatDate } from '../../utils/functions/DateFormatter' +import { PRODUCTION_ENDPOINT_CONFIG } from '../../utils/functions/getEndpoint' +import { useSearchAccessRequirementsInfinite } from '../../synapse-queries/dataaccess/useAccessRequirements' +import { ACT_TEAM_ID } from '../../utils/SynapseConstants' +import { EntityLink } from '../EntityLink' import { SynapseSpinner } from '../LoadingScreen/LoadingScreen' import UserOrTeamBadge from '../UserOrTeamBadge/UserOrTeamBadge' diff --git a/packages/synapse-react-client/src/components/dataaccess/AccessSubmissionDashboard.integration.test.tsx b/packages/synapse-react-client/src/components/dataaccess/AccessSubmissionDashboard.integration.test.tsx index 5f94fb18bd..b79dbc72fa 100644 --- a/packages/synapse-react-client/src/components/dataaccess/AccessSubmissionDashboard.integration.test.tsx +++ b/packages/synapse-react-client/src/components/dataaccess/AccessSubmissionDashboard.integration.test.tsx @@ -4,7 +4,6 @@ import { createMemoryHistory, MemoryHistory } from 'history' import React from 'react' import { Router } from 'react-router-dom' import selectEvent from 'react-select-event' -import { DataAccessSubmissionDashboard } from './AccessSubmissionDashboard' import { createWrapper } from '../../testutils/TestingLibraryUtils' import { rest, server } from '../../mocks/msw/server' import { @@ -15,7 +14,6 @@ import { mockManagedACTAccessRequirement as mockAccessRequirement, mockSearchResults, } from '../../mocks/mockAccessRequirements' -import { getOptionLabel } from './AccessRequirementSearchBox/AccessRequirementSearchBox' import { BackendDestinationEnum, getEndpoint, @@ -24,6 +22,8 @@ import { ACCESS_REQUIREMENT_BY_ID, ACCESS_REQUIREMENT_SEARCH, } from '../../utils/APIConstants' +import { getOptionLabel } from './AccessRequirementSearchBox/AccessRequirementSearchBox' +import { DataAccessSubmissionDashboard } from './AccessSubmissionDashboard' import * as AccessRequestSubmissionTableModule from './AccessRequestSubmissionTable' const SUBMISSION_TABLE_TEST_ID = 'AccessSubmissionTableTestId' diff --git a/packages/synapse-react-client/src/components/dataaccess/AccessSubmissionDashboard.tsx b/packages/synapse-react-client/src/components/dataaccess/AccessSubmissionDashboard.tsx index 39df41c578..4e7112336f 100644 --- a/packages/synapse-react-client/src/components/dataaccess/AccessSubmissionDashboard.tsx +++ b/packages/synapse-react-client/src/components/dataaccess/AccessSubmissionDashboard.tsx @@ -1,15 +1,14 @@ import { omitBy } from 'lodash-es' import React, { useCallback, useEffect, useState } from 'react' import { useHistory, useLocation } from 'react-router-dom' -import { useDebouncedEffect } from '../../utils/hooks/useDebouncedEffect' -import { SubmissionState } from '@sage-bionetworks/synapse-types' -import { TYPE_FILTER } from '@sage-bionetworks/synapse-types' +import { SubmissionState, TYPE_FILTER } from '@sage-bionetworks/synapse-types' import { Typography } from '@mui/material' +import { useDebouncedEffect } from '../../utils/hooks/useDebouncedEffect' +import UserSearchBoxV2 from '../UserSearchBox/UserSearchBoxV2' import { AccessRequestSubmissionTable, AccessRequestSubmissionTableProps, } from './AccessRequestSubmissionTable' -import UserSearchBoxV2 from '../UserSearchBox/UserSearchBoxV2' import AccessRequirementSearchBox from './AccessRequirementSearchBox/AccessRequirementSearchBox' export const DataAccessSubmissionDashboard = () => { diff --git a/packages/synapse-react-client/src/components/dataaccess/RejectDataAccessRequestModal.integration.test.tsx b/packages/synapse-react-client/src/components/dataaccess/RejectDataAccessRequestModal.integration.test.tsx index 75374ee66f..581019a788 100644 --- a/packages/synapse-react-client/src/components/dataaccess/RejectDataAccessRequestModal.integration.test.tsx +++ b/packages/synapse-react-client/src/components/dataaccess/RejectDataAccessRequestModal.integration.test.tsx @@ -1,21 +1,21 @@ import React from 'react' import { render, screen, waitFor, within } from '@testing-library/react' -import { createWrapper } from '../../testutils/TestingLibraryUtils' -import RejectDataAccessRequestModal, { - RejectDataAccessRequestModalProps, -} from './RejectDataAccessRequestModal' +import userEvent from '@testing-library/user-event' +import { SubmissionState } from '@sage-bionetworks/synapse-types' +import failOnConsoleError from 'jest-fail-on-console' import { rest, server } from '../../mocks/msw/server' import { getHandlersForTableQuery } from '../../mocks/msw/handlers/tableQueryHandlers' import mockRejectionReasonsTableQueryResultBundle from '../../mocks/query/mockRejectionReasonsTableQueryResultBundle' -import userEvent from '@testing-library/user-event' import { mockSubmittedSubmission } from '../../mocks/dataaccess/MockSubmission' import { BackendDestinationEnum, getEndpoint, } from '../../utils/functions/getEndpoint' import { DATA_ACCESS_SUBMISSION_BY_ID } from '../../utils/APIConstants' -import { SubmissionState } from '@sage-bionetworks/synapse-types' -import failOnConsoleError from 'jest-fail-on-console' +import { createWrapper } from '../../testutils/TestingLibraryUtils' +import RejectDataAccessRequestModal, { + RejectDataAccessRequestModalProps, +} from './RejectDataAccessRequestModal' const props: RejectDataAccessRequestModalProps = { submissionId: mockSubmittedSubmission.id, diff --git a/packages/synapse-react-client/src/components/dataaccess/RejectDataAccessRequestModal.tsx b/packages/synapse-react-client/src/components/dataaccess/RejectDataAccessRequestModal.tsx index beff0ce0de..31c6f60d01 100644 --- a/packages/synapse-react-client/src/components/dataaccess/RejectDataAccessRequestModal.tsx +++ b/packages/synapse-react-client/src/components/dataaccess/RejectDataAccessRequestModal.tsx @@ -15,6 +15,13 @@ import { TextField, Typography, } from '@mui/material' +import { Set } from 'immutable' +import { + QueryResultBundle, + Row, + SubmissionState, +} from '@sage-bionetworks/synapse-types' +import { UseQueryResult } from 'react-query' import IconSvg from '../IconSvg/IconSvg' import { useGetFullTableQueryResults, @@ -24,16 +31,9 @@ import { BUNDLE_MASK_QUERY_RESULTS, REJECT_SUBMISSION_CANNED_RESPONSES_TABLE, } from '../../utils/SynapseConstants' -import { Set } from 'immutable' -import { - QueryResultBundle, - Row, - SubmissionState, -} from '@sage-bionetworks/synapse-types' import { SynapseSpinner } from '../LoadingScreen/LoadingScreen' import { SynapseClientError } from '../../utils/SynapseClientError' import FullWidthAlert from '../FullWidthAlert/FullWidthAlert' -import { UseQueryResult } from 'react-query' import { ErrorBanner } from '../error/ErrorBanner' import { displayToast } from '../ToastMessage/ToastMessage' diff --git a/packages/synapse-react-client/src/components/dataaccess/ReviewerDashboard.integration.test.tsx b/packages/synapse-react-client/src/components/dataaccess/ReviewerDashboard.integration.test.tsx index 569126e1ae..a274e5f02c 100644 --- a/packages/synapse-react-client/src/components/dataaccess/ReviewerDashboard.integration.test.tsx +++ b/packages/synapse-react-client/src/components/dataaccess/ReviewerDashboard.integration.test.tsx @@ -1,16 +1,16 @@ import { render, screen } from '@testing-library/react' import userEvent from '@testing-library/user-event' import React from 'react' -import ReviewerDashboard from './ReviewerDashboard' +import { UserBundle } from '@sage-bionetworks/synapse-types' import { createWrapper } from '../../testutils/TestingLibraryUtils' import { USER_BUNDLE } from '../../utils/APIConstants' import { BackendDestinationEnum, getEndpoint, } from '../../utils/functions/getEndpoint' -import { UserBundle } from '@sage-bionetworks/synapse-types' import { rest, server } from '../../mocks/msw/server' import { MOCK_USER_ID } from '../../mocks/user/mock_user_profile' +import ReviewerDashboard from './ReviewerDashboard' import * as AccessRequirementDashboardModule from './AccessRequirementDashboard' import * as AccessRequestSubmissionDashboardModule from './AccessSubmissionDashboard' import * as UserAccessHistoryDashboardModule from './AccessHistoryDashboard' diff --git a/packages/synapse-react-client/src/components/dataaccess/ReviewerDashboard.tsx b/packages/synapse-react-client/src/components/dataaccess/ReviewerDashboard.tsx index 46963bb0ae..203eba524f 100644 --- a/packages/synapse-react-client/src/components/dataaccess/ReviewerDashboard.tsx +++ b/packages/synapse-react-client/src/components/dataaccess/ReviewerDashboard.tsx @@ -9,16 +9,16 @@ import { Switch, useParams, } from 'react-router-dom' -import { useGetCurrentUserBundle } from '../../synapse-queries/user/useUserBundle' import { Typography } from '@mui/material' +import { useGetCurrentUserBundle } from '../../synapse-queries/user/useUserBundle' import { SynapseErrorBoundary } from '../error/ErrorBanner' import IconSvg, { IconName } from '../IconSvg/IconSvg' import { SynapseSpinner } from '../LoadingScreen/LoadingScreen' +import OrientationBanner from '../OrientationBanner' import { UserHistoryDashboard } from './AccessHistoryDashboard' import { AccessRequirementDashboard } from './AccessRequirementDashboard' import { DataAccessSubmissionDashboard } from './AccessSubmissionDashboard' import SubmissionPage from './SubmissionPage' -import OrientationBanner from '../OrientationBanner' function LinkTab(props: { href: string diff --git a/packages/synapse-react-client/src/components/dataaccess/SubmissionPage.integration.test.tsx b/packages/synapse-react-client/src/components/dataaccess/SubmissionPage.integration.test.tsx index feca50e324..ea36efc34d 100644 --- a/packages/synapse-react-client/src/components/dataaccess/SubmissionPage.integration.test.tsx +++ b/packages/synapse-react-client/src/components/dataaccess/SubmissionPage.integration.test.tsx @@ -7,7 +7,13 @@ import { } from '@testing-library/react' import userEvent from '@testing-library/user-event' import React from 'react' -import SubmissionPage, { SubmissionPageProps } from './SubmissionPage' +import { + AccessControlList, + ACCESS_TYPE, + SubmissionState, + FileHandleAssociation, +} from '@sage-bionetworks/synapse-types' +import failOnConsoleError from 'jest-fail-on-console' import { createWrapper } from '../../testutils/TestingLibraryUtils' import { ACCESS_REQUIREMENT_ACL, @@ -19,12 +25,6 @@ import { BackendDestinationEnum, getEndpoint, } from '../../utils/functions/getEndpoint' -import { - AccessControlList, - ACCESS_TYPE, - SubmissionState, - FileHandleAssociation, -} from '@sage-bionetworks/synapse-types' import { mockApprovedSubmission, mockRejectedSubmission, @@ -38,8 +38,8 @@ import { MOCK_USER_NAME, MOCK_USER_NAME_2, } from '../../mocks/user/mock_user_profile' +import SubmissionPage, { SubmissionPageProps } from './SubmissionPage' import * as RejectDataAccessRequestModalModule from './RejectDataAccessRequestModal' -import failOnConsoleError from 'jest-fail-on-console' function renderComponent(props: SubmissionPageProps) { render(, { diff --git a/packages/synapse-react-client/src/components/dataaccess/SubmissionPage.stories.tsx b/packages/synapse-react-client/src/components/dataaccess/SubmissionPage.stories.tsx index 7a2b515070..52980c089c 100644 --- a/packages/synapse-react-client/src/components/dataaccess/SubmissionPage.stories.tsx +++ b/packages/synapse-react-client/src/components/dataaccess/SubmissionPage.stories.tsx @@ -10,9 +10,9 @@ import { mockManagedACTAccessRequirement } from '../../mocks/mockAccessRequireme import { MOCK_REPO_ORIGIN } from '../../utils/functions/getEndpoint' import { getHandlersForTableQuery } from '../../mocks/msw/handlers/tableQueryHandlers' import mockRejectionReasonsTableQueryResultBundle from '../../mocks/query/mockRejectionReasonsTableQueryResultBundle' -import SubmissionPage from './SubmissionPage' import { getWikiHandlers } from '../../mocks/msw/handlers/wikiHandlers' import { getUserProfileHandlers } from '../../mocks/msw/handlers/userProfileHandlers' +import SubmissionPage from './SubmissionPage' const meta = { title: 'Governance/SubmissionPage', diff --git a/packages/synapse-react-client/src/components/dataaccess/SubmissionPage.tsx b/packages/synapse-react-client/src/components/dataaccess/SubmissionPage.tsx index f9fc3cac11..6b661703d9 100644 --- a/packages/synapse-react-client/src/components/dataaccess/SubmissionPage.tsx +++ b/packages/synapse-react-client/src/components/dataaccess/SubmissionPage.tsx @@ -3,6 +3,12 @@ import { toLower, upperFirst } from 'lodash-es' import dayjs from 'dayjs' import React, { useState } from 'react' import { useErrorHandler } from 'react-error-boundary' +import { + FileHandleAssociateType, + ManagedACTAccessRequirement, + SubmissionState, +} from '@sage-bionetworks/synapse-types' +import duration from 'dayjs/plugin/duration' import { formatDate } from '../../utils/functions/DateFormatter' import useGetDataAccessSubmission, { useUpdateDataAccessSubmissionState, @@ -13,18 +19,12 @@ import { useGetAccessRequirementWikiPageKey, } from '../../synapse-queries/dataaccess/useAccessRequirements' import { ACT_TEAM_ID } from '../../utils/SynapseConstants' -import { - FileHandleAssociateType, - ManagedACTAccessRequirement, - SubmissionState, -} from '@sage-bionetworks/synapse-types' import { SynapseErrorBoundary } from '../error/ErrorBanner' import MarkdownSynapse from '../Markdown/MarkdownSynapse' import WarningDialog, { WarningDialogProps } from '../SynapseForm/WarningDialog' import UserCard from '../UserCard/UserCard' import UserOrTeamBadge from '../UserOrTeamBadge/UserOrTeamBadge' import { FileHandleLink } from '../widgets/FileHandleLink' -import duration from 'dayjs/plugin/duration' import RejectDataAccessRequestModal from './RejectDataAccessRequestModal' dayjs.extend(duration) diff --git a/packages/synapse-react-client/src/components/download_list/DownloadConfirmationUI.stories.tsx b/packages/synapse-react-client/src/components/download_list/DownloadConfirmationUI.stories.tsx index e021536133..59250d41eb 100644 --- a/packages/synapse-react-client/src/components/download_list/DownloadConfirmationUI.stories.tsx +++ b/packages/synapse-react-client/src/components/download_list/DownloadConfirmationUI.stories.tsx @@ -1,10 +1,10 @@ import React from 'react' import { Meta, StoryObj } from '@storybook/react' +import { SynapseContextConsumer, SynapseContextProvider } from '../../index' import { DownloadConfirmationUI, DownloadConfirmationUIProps, } from './DownloadConfirmationUI' -import { SynapseContextConsumer, SynapseContextProvider } from '../../index' const meta = { title: 'Download/DownloadConfirmationUI', diff --git a/packages/synapse-react-client/src/components/download_list/DownloadConfirmationUI.test.tsx b/packages/synapse-react-client/src/components/download_list/DownloadConfirmationUI.test.tsx index f2f8c0f404..3622449218 100644 --- a/packages/synapse-react-client/src/components/download_list/DownloadConfirmationUI.test.tsx +++ b/packages/synapse-react-client/src/components/download_list/DownloadConfirmationUI.test.tsx @@ -1,12 +1,12 @@ import React from 'react' import { act, render, screen } from '@testing-library/react' import userEvent from '@testing-library/user-event' +import { createWrapper } from '../../testutils/TestingLibraryUtils' +import { SynapseContextType } from '../../utils' import { DownloadConfirmationUI, DownloadConfirmationUIProps, } from './DownloadConfirmationUI' -import { createWrapper } from '../../testutils/TestingLibraryUtils' -import { SynapseContextType } from '../../utils' import * as DownloadDetailsModule from './DownloadDetails' const DOWNLOAD_DETAILS_TEST_ID = 'DownloadDetails' diff --git a/packages/synapse-react-client/src/components/download_list/DownloadConfirmationUI.tsx b/packages/synapse-react-client/src/components/download_list/DownloadConfirmationUI.tsx index 485c710988..87005ba0bf 100644 --- a/packages/synapse-react-client/src/components/download_list/DownloadConfirmationUI.tsx +++ b/packages/synapse-react-client/src/components/download_list/DownloadConfirmationUI.tsx @@ -2,8 +2,8 @@ import React, { useMemo } from 'react' import { Alert, AlertProps, Box, Button, Typography } from '@mui/material' import { useSynapseContext } from '../../utils' import SignInButton from '../SignInButton' -import DownloadDetails from './DownloadDetails' import { useGetDownloadListStatistics } from '../../synapse-queries' +import DownloadDetails from './DownloadDetails' enum StatusEnum { LOADING_INFO, diff --git a/packages/synapse-react-client/src/components/download_list/DownloadDetails.test.tsx b/packages/synapse-react-client/src/components/download_list/DownloadDetails.test.tsx index ffc0472f48..d31a3b9d1d 100644 --- a/packages/synapse-react-client/src/components/download_list/DownloadDetails.test.tsx +++ b/packages/synapse-react-client/src/components/download_list/DownloadDetails.test.tsx @@ -1,7 +1,7 @@ import React from 'react' -import DownloadDetails, { DownloadDetailsProps } from './DownloadDetails' import { act, render, screen } from '@testing-library/react' import { createWrapper } from '../../testutils/TestingLibraryUtils' +import DownloadDetails, { DownloadDetailsProps } from './DownloadDetails' jest.mock('../../../src/utils/functions/testDownloadSpeed', () => ({ testDownloadSpeed: jest.fn().mockResolvedValue(20), diff --git a/packages/synapse-react-client/src/components/download_list/DownloadDetails.tsx b/packages/synapse-react-client/src/components/download_list/DownloadDetails.tsx index 7d1245cf41..486a0bf7f2 100644 --- a/packages/synapse-react-client/src/components/download_list/DownloadDetails.tsx +++ b/packages/synapse-react-client/src/components/download_list/DownloadDetails.tsx @@ -1,10 +1,5 @@ import React, { useState, useEffect } from 'react' -import { testDownloadSpeed } from '../../utils/functions/testDownloadSpeed' -import { calculateFriendlyFileSize } from '../../utils/functions/calculateFriendlyFileSize' import dayjs from 'dayjs' -import { TOOLTIP_DELAY_SHOW } from '../SynapseTable/SynapseTableConstants' -import { useSynapseContext } from '../../utils/context/SynapseContext' -import { SkeletonInlineBlock } from '../Skeleton/SkeletonInlineBlock' import { InsertDriveFileTwoTone, LayersTwoTone, @@ -13,6 +8,11 @@ import { import { Tooltip } from '@mui/material' import duration from 'dayjs/plugin/duration' import relativeTime from 'dayjs/plugin/relativeTime' +import { testDownloadSpeed } from '../../utils/functions/testDownloadSpeed' +import { calculateFriendlyFileSize } from '../../utils/functions/calculateFriendlyFileSize' +import { TOOLTIP_DELAY_SHOW } from '../SynapseTable/SynapseTableConstants' +import { useSynapseContext } from '../../utils/context/SynapseContext' +import { SkeletonInlineBlock } from '../Skeleton/SkeletonInlineBlock' dayjs.extend(duration) dayjs.extend(relativeTime) diff --git a/packages/synapse-react-client/src/components/download_list/FolderDownloadConfirmation.tsx b/packages/synapse-react-client/src/components/download_list/FolderDownloadConfirmation.tsx index 44f7614ed3..17ce325ba7 100644 --- a/packages/synapse-react-client/src/components/download_list/FolderDownloadConfirmation.tsx +++ b/packages/synapse-react-client/src/components/download_list/FolderDownloadConfirmation.tsx @@ -1,4 +1,5 @@ import React from 'react' +import { EntityType } from '@sage-bionetworks/synapse-types' import { useSynapseContext } from '../../utils' import { useAddQueryToDownloadList, @@ -7,7 +8,6 @@ import { import { displayToast } from '../ToastMessage' import { DownloadConfirmationUI } from './DownloadConfirmationUI' import { displayFilesWereAddedToDownloadListSuccess } from './DownloadConfirmationUtils' -import { EntityType } from '@sage-bionetworks/synapse-types' export type FolderDownloadConfirmationProps = { folderId: string diff --git a/packages/synapse-react-client/src/components/download_list/TableQueryDownloadConfirmation.test.tsx b/packages/synapse-react-client/src/components/download_list/TableQueryDownloadConfirmation.test.tsx index cf7e9f6a99..1f171548c6 100644 --- a/packages/synapse-react-client/src/components/download_list/TableQueryDownloadConfirmation.test.tsx +++ b/packages/synapse-react-client/src/components/download_list/TableQueryDownloadConfirmation.test.tsx @@ -1,7 +1,6 @@ import React from 'react' import { act, render, screen, waitFor } from '@testing-library/react' import userEvent from '@testing-library/user-event' -import * as ToastMessage from '../ToastMessage/ToastMessage' import { AddToDownloadListRequest, AddToDownloadListResponse, @@ -9,8 +8,7 @@ import { QueryBundleRequest, QueryResultBundle, } from '@sage-bionetworks/synapse-types' -import * as DownloadConfirmationUIModule from './DownloadConfirmationUI' -import { TableQueryDownloadConfirmation } from './index' +import * as ToastMessage from '../ToastMessage/ToastMessage' import { SynapseClientError } from '../../index' import { QueryVisualizationContextConsumer, @@ -29,6 +27,8 @@ import { import QueryWrapper from '../QueryWrapper' import { MOCK_USER_ID } from '../../mocks/user/mock_user_profile' import { createWrapper } from '../../testutils/TestingLibraryUtils' +import * as DownloadConfirmationUIModule from './DownloadConfirmationUI' +import { TableQueryDownloadConfirmation } from './index' jest.mock('../../../src/synapse-queries', () => { const actual = jest.requireActual('../../../src/synapse-queries') diff --git a/packages/synapse-react-client/src/components/download_list/TableQueryDownloadConfirmation.tsx b/packages/synapse-react-client/src/components/download_list/TableQueryDownloadConfirmation.tsx index 740036eb35..1d7f6957df 100644 --- a/packages/synapse-react-client/src/components/download_list/TableQueryDownloadConfirmation.tsx +++ b/packages/synapse-react-client/src/components/download_list/TableQueryDownloadConfirmation.tsx @@ -1,23 +1,23 @@ import React, { useMemo } from 'react' +import { useAtomValue } from 'jotai' import { SynapseConstants, useSynapseContext } from '../../utils' import { useAddQueryToDownloadList, useGetQueryResultBundleWithAsyncStatus, } from '../../synapse-queries' import { displayToast } from '../ToastMessage' -import { DownloadConfirmationUI } from './DownloadConfirmationUI' import { useQueryContext } from '../QueryContext' import { useQueryVisualizationContext } from '../QueryVisualizationWrapper' -import { displayFilesWereAddedToDownloadListSuccess } from './DownloadConfirmationUtils' import { getPrimaryKeyINFilter } from '../../utils/functions/QueryFilterUtils' import { getFileColumnModelId } from '../SynapseTable/SynapseTableUtils' -import { useAtomValue } from 'jotai' import { tableQueryDataAtom } from '../QueryWrapper/QueryWrapper' import { hasSelectedRowsAtom, rowSelectionPrimaryKeyAtom, selectedRowsAtom, } from '../QueryWrapper/TableRowSelectionState' +import { displayFilesWereAddedToDownloadListSuccess } from './DownloadConfirmationUtils' +import { DownloadConfirmationUI } from './DownloadConfirmationUI' export function TableQueryDownloadConfirmation() { const { getCurrentQueryRequest } = useQueryContext() diff --git a/packages/synapse-react-client/src/components/download_list/index.ts b/packages/synapse-react-client/src/components/download_list/index.ts index e0aab3fc1d..feaa40fa63 100644 --- a/packages/synapse-react-client/src/components/download_list/index.ts +++ b/packages/synapse-react-client/src/components/download_list/index.ts @@ -1,7 +1,7 @@ import DownloadDetails from './DownloadDetails' import { FolderDownloadConfirmation } from './FolderDownloadConfirmation' -import type { FolderDownloadConfirmationProps } from './FolderDownloadConfirmation' import { TableQueryDownloadConfirmation } from './TableQueryDownloadConfirmation' +import type { FolderDownloadConfirmationProps } from './FolderDownloadConfirmation' export default { DownloadDetails } export { diff --git a/packages/synapse-react-client/src/components/entity/metadata/AnnotationsTable.integration.test.tsx b/packages/synapse-react-client/src/components/entity/metadata/AnnotationsTable.integration.test.tsx index b0338b7592..768cca4eb5 100644 --- a/packages/synapse-react-client/src/components/entity/metadata/AnnotationsTable.integration.test.tsx +++ b/packages/synapse-react-client/src/components/entity/metadata/AnnotationsTable.integration.test.tsx @@ -1,6 +1,5 @@ import { render, screen } from '@testing-library/react' import React from 'react' -import { AnnotationsTable, AnnotationsTableProps } from './AnnotationsTable' import { createWrapper } from '../../../testutils/TestingLibraryUtils' import { ENTITY_JSON } from '../../../utils/APIConstants' import { @@ -12,6 +11,7 @@ import mockFileEntityData from '../../../mocks/entity/mockFileEntity' import { mockSchemaBinding } from '../../../mocks/mockSchema' import { MOCK_CONTEXT_VALUE } from '../../../mocks/MockSynapseContext' import { rest, server } from '../../../mocks/msw/server' +import { AnnotationsTable, AnnotationsTableProps } from './AnnotationsTable' const { id: MOCK_FILE_ENTITY_ID, json: mockFileEntityJson } = mockFileEntityData diff --git a/packages/synapse-react-client/src/components/entity/metadata/EntityModal.integration.test.tsx b/packages/synapse-react-client/src/components/entity/metadata/EntityModal.integration.test.tsx index e58c9cc722..2e46f80953 100644 --- a/packages/synapse-react-client/src/components/entity/metadata/EntityModal.integration.test.tsx +++ b/packages/synapse-react-client/src/components/entity/metadata/EntityModal.integration.test.tsx @@ -2,7 +2,7 @@ import { render, screen } from '@testing-library/react' import userEvent from '@testing-library/user-event' import { cloneDeep } from 'lodash-es' import React from 'react' -import { EntityModal, EntityModalProps } from './EntityModal' +import { FileEntity } from '@sage-bionetworks/synapse-types' import { createWrapper } from '../../../testutils/TestingLibraryUtils' import { ENTITY_BUNDLE_V2 } from '../../../utils/APIConstants' import { @@ -12,7 +12,7 @@ import { import { SynapseContextType } from '../../../utils/context/SynapseContext' import mockFileEntityData from '../../../mocks/entity/mockFileEntity' import { rest, server } from '../../../mocks/msw/server' -import { FileEntity } from '@sage-bionetworks/synapse-types' +import { EntityModal, EntityModalProps } from './EntityModal' const { id: MOCK_FILE_ENTITY_ID, diff --git a/packages/synapse-react-client/src/components/entity/metadata/EntityModal.tsx b/packages/synapse-react-client/src/components/entity/metadata/EntityModal.tsx index 1b5841f2e2..c86f1be8d1 100644 --- a/packages/synapse-react-client/src/components/entity/metadata/EntityModal.tsx +++ b/packages/synapse-react-client/src/components/entity/metadata/EntityModal.tsx @@ -1,6 +1,8 @@ import Skeleton from '@mui/material/Skeleton' import Form from '@rjsf/core' import React, { useRef, useState } from 'react' +import { VersionableEntity } from '@sage-bionetworks/synapse-types' +import { Button, Tooltip } from '@mui/material' import { entityTypeToFriendlyName, isVersionableEntityType, @@ -10,14 +12,12 @@ import { getEndpoint, } from '../../../utils/functions/getEndpoint' import useGetEntityBundle from '../../../synapse-queries/entity/useEntityBundle' -import { VersionableEntity } from '@sage-bionetworks/synapse-types' import { SynapseErrorBoundary } from '../../error/ErrorBanner' import { displayToast } from '../../ToastMessage/ToastMessage' import { SchemaDrivenAnnotationEditor } from '../../SchemaDrivenAnnotationEditor/SchemaDrivenAnnotationEditor' +import { DialogBase } from '../../DialogBase' import { AnnotationsTable } from './AnnotationsTable' import { MetadataTable } from './MetadataTable' -import { Button, Tooltip } from '@mui/material' -import { DialogBase } from '../../DialogBase' export const EntityModalTabs = [ // non-annotation metadata about the entity diff --git a/packages/synapse-react-client/src/components/entity/metadata/MetadataTable.integration.test.tsx b/packages/synapse-react-client/src/components/entity/metadata/MetadataTable.integration.test.tsx index 7b079f249f..9aa79af80a 100644 --- a/packages/synapse-react-client/src/components/entity/metadata/MetadataTable.integration.test.tsx +++ b/packages/synapse-react-client/src/components/entity/metadata/MetadataTable.integration.test.tsx @@ -1,12 +1,12 @@ import React from 'react' import { render, screen } from '@testing-library/react' -import { MetadataTable, MetadataTableProps } from './MetadataTable' import { createWrapper } from '../../../testutils/TestingLibraryUtils' import { SynapseContextType } from '../../../utils/context/SynapseContext' import mockFileEntityData from '../../../mocks/entity/mockFileEntity' import { server } from '../../../mocks/msw/server' import { mockUserProfileData } from '../../../mocks/user/mock_user_profile' import mockProjectEntityData from '../../../mocks/entity/mockProject' +import { MetadataTable, MetadataTableProps } from './MetadataTable' const { id: MOCK_FILE_ENTITY_ID } = mockFileEntityData const { id: MOCK_PROJECT_ID, bundle: mockProjectEntityBundle } = diff --git a/packages/synapse-react-client/src/components/entity/page/CreatedByModifiedBy.integration.test.tsx b/packages/synapse-react-client/src/components/entity/page/CreatedByModifiedBy.integration.test.tsx index c18ad1b811..c4ed2069da 100644 --- a/packages/synapse-react-client/src/components/entity/page/CreatedByModifiedBy.integration.test.tsx +++ b/packages/synapse-react-client/src/components/entity/page/CreatedByModifiedBy.integration.test.tsx @@ -1,11 +1,7 @@ import React from 'react' -import { formatDate } from '../../../utils/functions/DateFormatter' import dayjs from 'dayjs' import { render, screen } from '@testing-library/react' -import { - CreatedByModifiedBy, - CreatedByModifiedByProps, -} from './CreatedByModifiedBy' +import { formatDate } from '../../../utils/functions/DateFormatter' import { createWrapper } from '../../../testutils/TestingLibraryUtils' import { server } from '../../../mocks/msw/server' import mockFileEntity from '../../../mocks/entity/mockFileEntity' @@ -16,6 +12,10 @@ import { import { mockTableEntity } from '../../../mocks/entity/mockTableEntity' import { getHandlersForTableQuery } from '../../../mocks/msw/handlers/tableQueryHandlers' import { mockDatasetEntity } from '../../../mocks/entity/mockDataset' +import { + CreatedByModifiedBy, + CreatedByModifiedByProps, +} from './CreatedByModifiedBy' function renderComponent(props: CreatedByModifiedByProps) { return render(, { diff --git a/packages/synapse-react-client/src/components/entity/page/CreatedByModifiedBy.tsx b/packages/synapse-react-client/src/components/entity/page/CreatedByModifiedBy.tsx index 8c78cc4907..ed14558a0a 100644 --- a/packages/synapse-react-client/src/components/entity/page/CreatedByModifiedBy.tsx +++ b/packages/synapse-react-client/src/components/entity/page/CreatedByModifiedBy.tsx @@ -7,6 +7,8 @@ import { Tooltip, Typography, } from '@mui/material' +import dayjs from 'dayjs' +import { InfoTwoTone } from '@mui/icons-material' import { BUNDLE_MASK_LAST_UPDATED_ON, SMALL_USER_CARD, @@ -24,8 +26,6 @@ import { import UserCard from '../../UserCard/UserCard' import { formatDate } from '../../../utils/functions/DateFormatter' import ConditionalWrapper from '../../utils/ConditionalWrapper' -import dayjs from 'dayjs' -import { InfoTwoTone } from '@mui/icons-material' export type CreatedByModifiedByProps = { entityId: string diff --git a/packages/synapse-react-client/src/components/entity/page/action_menu/EntityActionMenu.test.tsx b/packages/synapse-react-client/src/components/entity/page/action_menu/EntityActionMenu.test.tsx index e9f9a49a7f..4b61eccdca 100644 --- a/packages/synapse-react-client/src/components/entity/page/action_menu/EntityActionMenu.test.tsx +++ b/packages/synapse-react-client/src/components/entity/page/action_menu/EntityActionMenu.test.tsx @@ -1,4 +1,7 @@ import React from 'react' +import { render, screen } from '@testing-library/react' +import userEvent from '@testing-library/user-event' +import { createWrapper } from '../../../../testutils/TestingLibraryUtils' import EntityActionMenu, { ActionConfiguration, ActionConfigurationMap, @@ -8,9 +11,6 @@ import EntityActionMenu, { EXPORTED_FOR_UNIT_TESTING, MenuConfigurationMap, } from './EntityActionMenu' -import { createWrapper } from '../../../../testutils/TestingLibraryUtils' -import { render, screen } from '@testing-library/react' -import userEvent from '@testing-library/user-event' function renderComponent(props: EntityActionMenuProps) { return render(, { diff --git a/packages/synapse-react-client/src/components/entity/page/title_bar/EntityPageTitleBar.integration.test.tsx b/packages/synapse-react-client/src/components/entity/page/title_bar/EntityPageTitleBar.integration.test.tsx index d93d9a2f1b..628da7b493 100644 --- a/packages/synapse-react-client/src/components/entity/page/title_bar/EntityPageTitleBar.integration.test.tsx +++ b/packages/synapse-react-client/src/components/entity/page/title_bar/EntityPageTitleBar.integration.test.tsx @@ -1,16 +1,13 @@ import React from 'react' -import EntityPageTitleBar, { - EntityPageTitleBarProps, -} from './EntityPageTitleBar' import { render, screen } from '@testing-library/react' -import { createWrapper } from '../../../../testutils/TestingLibraryUtils' -import mockFileEntity from '../../../../mocks/entity/mockFileEntity' -import { EntityActionMenuProps } from '../action_menu/EntityActionMenu' import { DockerRepository, EntityBundle, EntityType, } from '@sage-bionetworks/synapse-types' +import { createWrapper } from '../../../../testutils/TestingLibraryUtils' +import mockFileEntity from '../../../../mocks/entity/mockFileEntity' +import { EntityActionMenuProps } from '../action_menu/EntityActionMenu' import { rest, server } from '../../../../mocks/msw/server' import { BackendDestinationEnum, @@ -19,6 +16,9 @@ import { import { ENTITY_BUNDLE_V2 } from '../../../../utils/APIConstants' import * as FavoriteButtonModule from '../../../favorites/FavoriteButton' import * as EntityActionMenuModule from '../action_menu/EntityActionMenu' +import EntityPageTitleBar, { + EntityPageTitleBarProps, +} from './EntityPageTitleBar' import * as TitleBarPropertiesModule from './TitleBarProperties' import * as TitleBarVersionInfoModule from './EntityTitleBarVersionInfo' diff --git a/packages/synapse-react-client/src/components/entity/page/title_bar/EntityPageTitleBar.stories.tsx b/packages/synapse-react-client/src/components/entity/page/title_bar/EntityPageTitleBar.stories.tsx index c2f35c660e..467b0c195f 100644 --- a/packages/synapse-react-client/src/components/entity/page/title_bar/EntityPageTitleBar.stories.tsx +++ b/packages/synapse-react-client/src/components/entity/page/title_bar/EntityPageTitleBar.stories.tsx @@ -1,9 +1,9 @@ import React from 'react' import { Meta, StoryObj } from '@storybook/react' +import { EntityActionMenuProps } from '../action_menu/EntityActionMenu' import EntityPageTitleBar, { EntityPageTitleBarProps, } from './EntityPageTitleBar' -import { EntityActionMenuProps } from '../action_menu/EntityActionMenu' const meta = { title: 'Synapse/EntityPage/TitleBar', diff --git a/packages/synapse-react-client/src/components/entity/page/title_bar/EntityPageTitleBar.tsx b/packages/synapse-react-client/src/components/entity/page/title_bar/EntityPageTitleBar.tsx index 2e648eaa9c..ed91509d1b 100644 --- a/packages/synapse-react-client/src/components/entity/page/title_bar/EntityPageTitleBar.tsx +++ b/packages/synapse-react-client/src/components/entity/page/title_bar/EntityPageTitleBar.tsx @@ -1,15 +1,15 @@ import React from 'react' -import IconSvg, { type2SvgIconName } from '../../../IconSvg/IconSvg' import { Avatar, Box, Skeleton, Stack, Typography } from '@mui/material' +import IconSvg, { type2SvgIconName } from '../../../IconSvg/IconSvg' import { useGetEntityBundle } from '../../../../synapse-queries' import FavoriteButton from '../../../favorites/FavoriteButton' import ConditionalWrapper from '../../../utils/ConditionalWrapper' import EntityActionMenu, { EntityActionMenuProps, } from '../action_menu/EntityActionMenu' +import { isDockerRepository } from '../../../../utils/types/IsType' import TitleBarProperties from './TitleBarProperties' import { EntityTitleBarVersionInfo } from './EntityTitleBarVersionInfo' -import { isDockerRepository } from '../../../../utils/types/IsType' export type EntityPageTitleBarProps = { entityId: string diff --git a/packages/synapse-react-client/src/components/entity/page/title_bar/EntityTitleBarVersionInfo.integration.test.tsx b/packages/synapse-react-client/src/components/entity/page/title_bar/EntityTitleBarVersionInfo.integration.test.tsx index 36bc110fa5..26efc37602 100644 --- a/packages/synapse-react-client/src/components/entity/page/title_bar/EntityTitleBarVersionInfo.integration.test.tsx +++ b/packages/synapse-react-client/src/components/entity/page/title_bar/EntityTitleBarVersionInfo.integration.test.tsx @@ -1,15 +1,10 @@ import React from 'react' -import { - EntityTitleBarVersionInfo, - EntityTitleBarVersionInfoProps, - EXPORTED_FOR_UNIT_TESTING, -} from './EntityTitleBarVersionInfo' +import { render, screen } from '@testing-library/react' +import userEvent from '@testing-library/user-event' import { mockFolderEntity } from '../../../../mocks/entity/mockEntity' import mockFileEntity from '../../../../mocks/entity/mockFileEntity' import { mockDatasetEntity } from '../../../../mocks/entity/mockDataset' -import { render, screen } from '@testing-library/react' import { createWrapper } from '../../../../testutils/TestingLibraryUtils' -import userEvent from '@testing-library/user-event' import { rest, server } from '../../../../mocks/msw/server' import { BackendDestinationEnum, @@ -17,6 +12,11 @@ import { } from '../../../../utils/functions/getEndpoint' import { ENTITY_BUNDLE_V2 } from '../../../../utils/APIConstants' import { mockTableEntity } from '../../../../mocks/entity/mockTableEntity' +import { + EntityTitleBarVersionInfo, + EntityTitleBarVersionInfoProps, + EXPORTED_FOR_UNIT_TESTING, +} from './EntityTitleBarVersionInfo' function renderComponent(props: EntityTitleBarVersionInfoProps) { return render(, { diff --git a/packages/synapse-react-client/src/components/entity/page/title_bar/EntityTitleBarVersionInfo.tsx b/packages/synapse-react-client/src/components/entity/page/title_bar/EntityTitleBarVersionInfo.tsx index 92d69955fb..8dcc44d392 100644 --- a/packages/synapse-react-client/src/components/entity/page/title_bar/EntityTitleBarVersionInfo.tsx +++ b/packages/synapse-react-client/src/components/entity/page/title_bar/EntityTitleBarVersionInfo.tsx @@ -1,3 +1,6 @@ +import { Box, Link, Tooltip, Typography } from '@mui/material' +import React from 'react' +import { Entity } from '@sage-bionetworks/synapse-types' import { useGetEntityBundle } from '../../../../synapse-queries' import { isEntityRefCollectionView, @@ -5,9 +8,6 @@ import { isVersionableEntity, } from '../../../../utils/functions/EntityTypeUtils' import { truncateString } from '../../../../utils/functions/StringUtils' -import { Box, Link, Tooltip, Typography } from '@mui/material' -import React from 'react' -import { Entity } from '@sage-bionetworks/synapse-types' import { ActionConfiguration } from '../action_menu/EntityActionMenu' const MAX_VERSION_LABEL_LENGTH = 50 diff --git a/packages/synapse-react-client/src/components/entity/page/title_bar/useGetEntityTitleBarProperties.tsx b/packages/synapse-react-client/src/components/entity/page/title_bar/useGetEntityTitleBarProperties.tsx index 1797e12475..9f1ca88cf6 100644 --- a/packages/synapse-react-client/src/components/entity/page/title_bar/useGetEntityTitleBarProperties.tsx +++ b/packages/synapse-react-client/src/components/entity/page/title_bar/useGetEntityTitleBarProperties.tsx @@ -1,12 +1,13 @@ import React from 'react' -import { - useGetEntityBundle, - useGetEntityChildren, -} from '../../../../synapse-queries' import { EntityRefCollectionView, EntityType, } from '@sage-bionetworks/synapse-types' +import { Box, Link } from '@mui/material' +import { + useGetEntityBundle, + useGetEntityChildren, +} from '../../../../synapse-queries' import { isContainerType, isEntityRefCollectionView, @@ -19,7 +20,6 @@ import { getUploadDestinationString, } from '../../../../utils/functions/FileHandleUtils' import { calculateFriendlyFileSize } from '../../../../utils/functions/calculateFriendlyFileSize' -import { Box, Link } from '@mui/material' import { HasAccessV2 } from '../../../HasAccess/HasAccessV2' import CopyToClipboardString from '../../../CopyToClipboardString/CopyToClipboardString' import { useGetDOIAssociation } from '../../../../synapse-queries/doi/useDOI' diff --git a/packages/synapse-react-client/src/components/error/ErrorBanner.stories.tsx b/packages/synapse-react-client/src/components/error/ErrorBanner.stories.tsx index c98dae2ea3..5f2089cf23 100644 --- a/packages/synapse-react-client/src/components/error/ErrorBanner.stories.tsx +++ b/packages/synapse-react-client/src/components/error/ErrorBanner.stories.tsx @@ -1,7 +1,7 @@ import React from 'react' import { Meta, StoryObj } from '@storybook/react' -import { ErrorBanner } from './ErrorBanner' import { SynapseClientError } from '../../utils/SynapseClientError' +import { ErrorBanner } from './ErrorBanner' const meta = { title: 'UI/ErrorBanner', diff --git a/packages/synapse-react-client/src/components/error/ErrorChip.stories.tsx b/packages/synapse-react-client/src/components/error/ErrorChip.stories.tsx index 56c897ddfb..8a3cadd319 100644 --- a/packages/synapse-react-client/src/components/error/ErrorChip.stories.tsx +++ b/packages/synapse-react-client/src/components/error/ErrorChip.stories.tsx @@ -1,9 +1,9 @@ import React from 'react' import { Meta, StoryObj } from '@storybook/react' -import ErrorChip, { ErrorChipProps } from './ErrorChip' import { SynapseClientError } from '../../utils/SynapseClientError' import { SynapseContextConsumer } from '../../utils/context/SynapseContext' import FullContextProvider from '../../utils/context/FullContextProvider' +import ErrorChip, { ErrorChipProps } from './ErrorChip' const meta = { title: 'Components/ErrorChip', diff --git a/packages/synapse-react-client/src/components/error/ErrorChip.tsx b/packages/synapse-react-client/src/components/error/ErrorChip.tsx index 94fa8c4346..175802022b 100644 --- a/packages/synapse-react-client/src/components/error/ErrorChip.tsx +++ b/packages/synapse-react-client/src/components/error/ErrorChip.tsx @@ -3,8 +3,8 @@ import { ErrorOutlined, LockOutlined } from '@mui/icons-material' import React from 'react' import { SynapseClientError } from '../../utils/SynapseClientError' import { useJiraIssueCollector } from '../JiraIssueCollector' -import { SignInPrompt, YOU_ARE_NOT_AUTHORIZED_MESSAGE } from './ErrorBanner' import { useSynapseContext } from '../../utils/context/SynapseContext' +import { SignInPrompt, YOU_ARE_NOT_AUTHORIZED_MESSAGE } from './ErrorBanner' export type ErrorChipProps = { chipText: string diff --git a/packages/synapse-react-client/src/components/favorites/FavoriteButton.integration.test.tsx b/packages/synapse-react-client/src/components/favorites/FavoriteButton.integration.test.tsx index 9a84e4358a..d4d39f9ca8 100644 --- a/packages/synapse-react-client/src/components/favorites/FavoriteButton.integration.test.tsx +++ b/packages/synapse-react-client/src/components/favorites/FavoriteButton.integration.test.tsx @@ -1,7 +1,8 @@ import React from 'react' import { render, screen, waitFor } from '@testing-library/react' -import { createWrapper } from '../../testutils/TestingLibraryUtils' -import FavoriteButton from './FavoriteButton' +import { EntityHeader, PaginatedResults } from '@sage-bionetworks/synapse-types' +import userEvent from '@testing-library/user-event' +import { DeferredPromise } from '@open-draft/deferred-promise' import { rest, server } from '../../mocks/msw/server' import mockFileEntityData from '../../mocks/entity/mockFileEntity' import { FAVORITES } from '../../utils/APIConstants' @@ -9,11 +10,10 @@ import { BackendDestinationEnum, getEndpoint, } from '../../utils/functions/getEndpoint' -import { EntityHeader, PaginatedResults } from '@sage-bionetworks/synapse-types' -import userEvent from '@testing-library/user-event' import { SynapseContextType } from '../../utils/context/SynapseContext' import { MOCK_CONTEXT_VALUE } from '../../mocks/MockSynapseContext' -import { DeferredPromise } from '@open-draft/deferred-promise' +import { createWrapper } from '../../testutils/TestingLibraryUtils' +import FavoriteButton from './FavoriteButton' function renderComponent(wrapperProps?: SynapseContextType) { return render(, { diff --git a/packages/synapse-react-client/src/components/favorites/FavoriteButton.tsx b/packages/synapse-react-client/src/components/favorites/FavoriteButton.tsx index 813765dfdc..caee4be235 100644 --- a/packages/synapse-react-client/src/components/favorites/FavoriteButton.tsx +++ b/packages/synapse-react-client/src/components/favorites/FavoriteButton.tsx @@ -1,6 +1,6 @@ import React from 'react' -import IconSvg from '../IconSvg/IconSvg' import { IconButton, Skeleton, Tooltip } from '@mui/material' +import IconSvg from '../IconSvg/IconSvg' import { useAddFavorite, useIsFavorite, diff --git a/packages/synapse-react-client/src/components/favorites/FavoritesPage.integration.test.tsx b/packages/synapse-react-client/src/components/favorites/FavoritesPage.integration.test.tsx index bbc13ba7c9..cc68b148b0 100644 --- a/packages/synapse-react-client/src/components/favorites/FavoritesPage.integration.test.tsx +++ b/packages/synapse-react-client/src/components/favorites/FavoritesPage.integration.test.tsx @@ -1,11 +1,11 @@ import { render, screen } from '@testing-library/react' import React from 'react' -import FavoritesPage from './FavoritesPage' import { createWrapper } from '../../testutils/TestingLibraryUtils' import { SynapseContextType } from '../../utils' import { mockFolderEntityHeader } from '../../mocks/entity/mockEntity' import mockFileEntityData from '../../mocks/entity/mockFileEntity' import { server } from '../../mocks/msw/server' +import FavoritesPage from './FavoritesPage' function renderComponent(wrapperProps?: SynapseContextType) { render(, { diff --git a/packages/synapse-react-client/src/components/favorites/FavoritesPage.tsx b/packages/synapse-react-client/src/components/favorites/FavoritesPage.tsx index 5099d9093d..72fb49bb37 100644 --- a/packages/synapse-react-client/src/components/favorites/FavoritesPage.tsx +++ b/packages/synapse-react-client/src/components/favorites/FavoritesPage.tsx @@ -1,7 +1,9 @@ import React, { useState, useEffect } from 'react' import * as ReactBootstrap from 'react-bootstrap' -import SortIcon from '../../assets/icons/Sort' import { Direction, EntityHeader } from '@sage-bionetworks/synapse-types' +import { Form } from 'react-bootstrap' +import { Tooltip } from '@mui/material' +import SortIcon from '../../assets/icons/Sort' import { useSynapseContext } from '../../utils/context/SynapseContext' import { SynapseSpinner } from '../LoadingScreen/LoadingScreen' import { @@ -15,9 +17,7 @@ import { } from '../../utils/functions/EntityTypeUtils' import { PRODUCTION_ENDPOINT_CONFIG } from '../../utils/functions/getEndpoint' import { EntityTypeIcon } from '../EntityIcon' -import { Form } from 'react-bootstrap' import { ErrorBanner } from '../error/ErrorBanner' -import { Tooltip } from '@mui/material' // Local types used for client-side sorting export type SortField = 'name' | 'type' diff --git a/packages/synapse-react-client/src/components/menu/ComplexMenu.test.tsx b/packages/synapse-react-client/src/components/menu/ComplexMenu.test.tsx index f3516a9539..5fa10b0bc7 100644 --- a/packages/synapse-react-client/src/components/menu/ComplexMenu.test.tsx +++ b/packages/synapse-react-client/src/components/menu/ComplexMenu.test.tsx @@ -1,7 +1,7 @@ import React from 'react' import { render, screen, waitFor } from '@testing-library/react' -import { createWrapper } from '../../testutils/TestingLibraryUtils' import userEvent from '@testing-library/user-event' +import { createWrapper } from '../../testutils/TestingLibraryUtils' import { ComplexMenu, ComplexMenuProps } from './ComplexMenu' const DROPDOWN_BUTTON_TEXT = 'Open Dropdown Menu' diff --git a/packages/synapse-react-client/src/components/menu/DropdownMenu.stories.tsx b/packages/synapse-react-client/src/components/menu/DropdownMenu.stories.tsx index bbe3cf5249..1797e06345 100644 --- a/packages/synapse-react-client/src/components/menu/DropdownMenu.stories.tsx +++ b/packages/synapse-react-client/src/components/menu/DropdownMenu.stories.tsx @@ -1,7 +1,7 @@ import React from 'react' import { Meta, StoryObj } from '@storybook/react' -import { DropdownMenu } from './DropdownMenu' import IconSvg from '../IconSvg/IconSvg' +import { DropdownMenu } from './DropdownMenu' const meta = { title: 'UI/DropdownMenu', diff --git a/packages/synapse-react-client/src/components/menu/DropdownMenu.test.tsx b/packages/synapse-react-client/src/components/menu/DropdownMenu.test.tsx index a85b05afb9..19bc5cddcc 100644 --- a/packages/synapse-react-client/src/components/menu/DropdownMenu.test.tsx +++ b/packages/synapse-react-client/src/components/menu/DropdownMenu.test.tsx @@ -1,8 +1,8 @@ import React from 'react' -import { DropdownMenu, DropdownMenuProps } from './DropdownMenu' import { render, screen, waitFor, within } from '@testing-library/react' -import { createWrapper } from '../../testutils/TestingLibraryUtils' import userEvent from '@testing-library/user-event' +import { createWrapper } from '../../testutils/TestingLibraryUtils' +import { DropdownMenu, DropdownMenuProps } from './DropdownMenu' const DROPDOWN_BUTTON_TEXT = 'Open Dropdown Menu' const onClickFn = jest.fn() diff --git a/packages/synapse-react-client/src/components/row_renderers/Dataset.tsx b/packages/synapse-react-client/src/components/row_renderers/Dataset.tsx index 3244db2d3c..9bef6da4ed 100644 --- a/packages/synapse-react-client/src/components/row_renderers/Dataset.tsx +++ b/packages/synapse-react-client/src/components/row_renderers/Dataset.tsx @@ -1,12 +1,12 @@ import React from 'react' -import { DATASET } from '../../utils/SynapseConstants' -import { calculateFriendlyFileSize } from '../../utils/functions/calculateFriendlyFileSize' -import * as Utils from './utils' -import { GenericCardSchema, getValueOrMultiValue } from '../GenericCard' import { SelectColumn, ColumnModel } from '@sage-bionetworks/synapse-types' import { Button } from '@mui/material' +import { GenericCardSchema, getValueOrMultiValue } from '../GenericCard' +import { calculateFriendlyFileSize } from '../../utils/functions/calculateFriendlyFileSize' +import { DATASET } from '../../utils/SynapseConstants' import { PRODUCTION_ENDPOINT_CONFIG } from '../../utils/functions/getEndpoint' import { QueryVisualizationContextType } from '../QueryVisualizationWrapper' +import * as Utils from './utils' export type DatasetProps = { data?: any diff --git a/packages/synapse-react-client/src/components/row_renderers/ObservationCard.tsx b/packages/synapse-react-client/src/components/row_renderers/ObservationCard.tsx index 6076ca162b..c812928119 100644 --- a/packages/synapse-react-client/src/components/row_renderers/ObservationCard.tsx +++ b/packages/synapse-react-client/src/components/row_renderers/ObservationCard.tsx @@ -1,10 +1,10 @@ import React from 'react' -import UserCard from '../UserCard/UserCard' -import IconSvg from '../IconSvg/IconSvg' -import { ShowMore } from './utils' import { UnitType } from 'dayjs' import { Skeleton } from '@mui/material' +import UserCard from '../UserCard/UserCard' +import IconSvg from '../IconSvg/IconSvg' import { SkeletonTable } from '../Skeleton/SkeletonTable' +import { ShowMore } from './utils' type ObservationCardSchema = { submitterName: string diff --git a/packages/synapse-react-client/src/components/row_renderers/utils/index.tsx b/packages/synapse-react-client/src/components/row_renderers/utils/index.tsx index c96633219f..40ab0bee7e 100644 --- a/packages/synapse-react-client/src/components/row_renderers/utils/index.tsx +++ b/packages/synapse-react-client/src/components/row_renderers/utils/index.tsx @@ -1,5 +1,5 @@ -import CardFooter from './CardFooter' -import ChipContainer from './ChipContainer' import Icon from '../../Icon/Icon' import ShowMore from '../../ShowMore/ShowMore' +import CardFooter from './CardFooter' +import ChipContainer from './ChipContainer' export { CardFooter, Icon, ShowMore, ChipContainer } diff --git a/packages/synapse-react-client/src/components/trash/TrashCanList.integration.test.tsx b/packages/synapse-react-client/src/components/trash/TrashCanList.integration.test.tsx index a77e74aa31..d8ef5b8297 100644 --- a/packages/synapse-react-client/src/components/trash/TrashCanList.integration.test.tsx +++ b/packages/synapse-react-client/src/components/trash/TrashCanList.integration.test.tsx @@ -1,7 +1,10 @@ import { render, screen, waitFor, within } from '@testing-library/react' import userEvent from '@testing-library/user-event' import React from 'react' -import { TrashCanList } from './TrashCanList' +import { + PaginatedResults, + TrashedEntity, +} from '@sage-bionetworks/synapse-types' import { createWrapper } from '../../testutils/TestingLibraryUtils' import { TRASHCAN_PURGE, @@ -12,14 +15,11 @@ import { BackendDestinationEnum, getEndpoint, } from '../../utils/functions/getEndpoint' -import { - PaginatedResults, - TrashedEntity, -} from '@sage-bionetworks/synapse-types' import mockDatasetData from '../../mocks/entity/mockDataset' import mockFileEntityData from '../../mocks/entity/mockFileEntity' import { rest, server } from '../../mocks/msw/server' import { MOCK_USER_ID } from '../../mocks/user/mock_user_profile' +import { TrashCanList } from './TrashCanList' function renderComponent() { return render(, { wrapper: createWrapper() }) diff --git a/packages/synapse-react-client/src/components/trash/TrashCanList.tsx b/packages/synapse-react-client/src/components/trash/TrashCanList.tsx index 523577e045..61fdf513bf 100644 --- a/packages/synapse-react-client/src/components/trash/TrashCanList.tsx +++ b/packages/synapse-react-client/src/components/trash/TrashCanList.tsx @@ -1,6 +1,8 @@ import dayjs from 'dayjs' import React, { useEffect, useRef, useState } from 'react' import { Table } from 'react-bootstrap' +import { TrashedEntity } from '@sage-bionetworks/synapse-types' +import { Alert, Button, Typography } from '@mui/material' import { formatDate } from '../../utils/functions/DateFormatter' import { useGetEntity } from '../../synapse-queries' import { @@ -9,8 +11,6 @@ import { useRestoreEntities, } from '../../synapse-queries/trash/useTrashCan' import { SynapseClientError } from '../../utils/SynapseClientError' -import { TrashedEntity } from '@sage-bionetworks/synapse-types' -import { Alert, Button, Typography } from '@mui/material' import { EntityLink } from '../EntityLink' import { BlockingLoader, SynapseSpinner } from '../LoadingScreen/LoadingScreen' import WarningDialog from '../SynapseForm/WarningDialog' diff --git a/packages/synapse-react-client/src/components/widgets/Checkbox.test.tsx b/packages/synapse-react-client/src/components/widgets/Checkbox.test.tsx index ead80ef173..5c1877cd95 100644 --- a/packages/synapse-react-client/src/components/widgets/Checkbox.test.tsx +++ b/packages/synapse-react-client/src/components/widgets/Checkbox.test.tsx @@ -1,7 +1,7 @@ import React from 'react' -import { Checkbox, CheckboxProps } from './Checkbox' import { render, screen } from '@testing-library/react' import userEvent from '@testing-library/user-event' +import { Checkbox, CheckboxProps } from './Checkbox' const mockCallback = jest.fn() diff --git a/packages/synapse-react-client/src/components/widgets/ElementWithTooltip.test.tsx b/packages/synapse-react-client/src/components/widgets/ElementWithTooltip.test.tsx index a8a26b5905..8eca148c65 100644 --- a/packages/synapse-react-client/src/components/widgets/ElementWithTooltip.test.tsx +++ b/packages/synapse-react-client/src/components/widgets/ElementWithTooltip.test.tsx @@ -1,7 +1,7 @@ import { act, cleanup, render, screen } from '@testing-library/react' import userEvent from '@testing-library/user-event' -import _ from 'lodash-es' import React from 'react' +import { noop } from 'lodash-es' import Columns from '../../assets/icons/columns' import { IconSvgProps } from '../IconSvg/IconSvg' import { ElementWithTooltip } from './ElementWithTooltip' @@ -85,7 +85,7 @@ describe('ElementWithTooltip', () => { const child = hello world init({ ...props, - callbackFn: _.noop, + callbackFn: noop, children: child, image: undefined, }) diff --git a/packages/synapse-react-client/src/components/widgets/ElementWithTooltip.tsx b/packages/synapse-react-client/src/components/widgets/ElementWithTooltip.tsx index 2801b37b71..4975e33b67 100644 --- a/packages/synapse-react-client/src/components/widgets/ElementWithTooltip.tsx +++ b/packages/synapse-react-client/src/components/widgets/ElementWithTooltip.tsx @@ -1,9 +1,9 @@ import React from 'react' -import { TOOLTIP_DELAY_SHOW } from '../SynapseTable/SynapseTableConstants' import { Dropdown } from 'react-bootstrap' +import { Tooltip } from '@mui/material' +import { TOOLTIP_DELAY_SHOW } from '../SynapseTable/SynapseTableConstants' import { Icon } from '../row_renderers/utils' import IconSvg, { IconSvgProps } from '../IconSvg/IconSvg' -import { Tooltip } from '@mui/material' type CustomImageProps = { svgImg: React.ComponentElement diff --git a/packages/synapse-react-client/src/components/widgets/ImageFileHandle.tsx b/packages/synapse-react-client/src/components/widgets/ImageFileHandle.tsx index 104636e861..a3f9399d01 100644 --- a/packages/synapse-react-client/src/components/widgets/ImageFileHandle.tsx +++ b/packages/synapse-react-client/src/components/widgets/ImageFileHandle.tsx @@ -1,7 +1,7 @@ import { FileHandleAssociation } from '@sage-bionetworks/synapse-types' import React, { useEffect, useState } from 'react' -import SynapseClient from '../../synapse-client' import { useInView } from 'react-intersection-observer' +import SynapseClient from '../../synapse-client' import { useSynapseContext } from '../../utils/context/SynapseContext' type ImageFileHandleProps = { diff --git a/packages/synapse-react-client/src/components/widgets/LoginAwareButton.stories.tsx b/packages/synapse-react-client/src/components/widgets/LoginAwareButton.stories.tsx index 715cfb884c..61b00ada34 100644 --- a/packages/synapse-react-client/src/components/widgets/LoginAwareButton.stories.tsx +++ b/packages/synapse-react-client/src/components/widgets/LoginAwareButton.stories.tsx @@ -1,11 +1,11 @@ import React from 'react' import { Meta, StoryObj } from '@storybook/react' import ExitToAppIcon from '@mui/icons-material/ExitToApp' -import { LoginAwareButton } from './LoginAwareButton' import { SynapseContextConsumer, SynapseContextProvider, } from '../../utils/context' +import { LoginAwareButton } from './LoginAwareButton' const meta: Meta = { title: 'UI/LoginAwareButton', diff --git a/packages/synapse-react-client/src/components/widgets/LoginAwareButton.test.tsx b/packages/synapse-react-client/src/components/widgets/LoginAwareButton.test.tsx index 6bf0268d3d..d80924d180 100644 --- a/packages/synapse-react-client/src/components/widgets/LoginAwareButton.test.tsx +++ b/packages/synapse-react-client/src/components/widgets/LoginAwareButton.test.tsx @@ -1,11 +1,11 @@ import * as React from 'react' import { render, screen, waitFor } from '@testing-library/react' -import { LoginAwareButton, LoginAwareButtonProps } from './LoginAwareButton' +import { MemoryRouter } from 'react-router-dom' import { SRC_SIGN_IN_CLASS } from '../../utils/SynapseConstants' import { ApplicationSessionManager } from '../../utils' -import { MemoryRouter } from 'react-router-dom' import SynapseClient from '../../synapse-client' import { MOCK_ACCESS_TOKEN } from '../../mocks/MockSynapseContext' +import { LoginAwareButton, LoginAwareButtonProps } from './LoginAwareButton' const defaultProps: LoginAwareButtonProps = { children: 'Register for this Challenge', diff --git a/packages/synapse-react-client/src/components/widgets/RadioGroup.test.tsx b/packages/synapse-react-client/src/components/widgets/RadioGroup.test.tsx index f08cb92725..ac6e9310ca 100644 --- a/packages/synapse-react-client/src/components/widgets/RadioGroup.test.tsx +++ b/packages/synapse-react-client/src/components/widgets/RadioGroup.test.tsx @@ -1,7 +1,7 @@ import React from 'react' -import { RadioGroup, RadioGroupProps } from './RadioGroup' import { render, screen } from '@testing-library/react' import userEvent from '@testing-library/user-event' +import { RadioGroup, RadioGroupProps } from './RadioGroup' const mockCallback = jest.fn() diff --git a/packages/synapse-react-client/src/components/widgets/RangeSlider/RangeSlider.stories.tsx b/packages/synapse-react-client/src/components/widgets/RangeSlider/RangeSlider.stories.tsx index 75f69f2e84..a7d7e4252c 100644 --- a/packages/synapse-react-client/src/components/widgets/RangeSlider/RangeSlider.stories.tsx +++ b/packages/synapse-react-client/src/components/widgets/RangeSlider/RangeSlider.stories.tsx @@ -1,7 +1,7 @@ import React from 'react' import { Meta, StoryObj } from '@storybook/react' -import { RangeSlider } from './RangeSlider' import { Paper } from '@mui/material' +import { RangeSlider } from './RangeSlider' const meta = { title: 'UI/RangeSlider', diff --git a/packages/synapse-react-client/src/components/widgets/RangeSlider/RangeSlider.tsx b/packages/synapse-react-client/src/components/widgets/RangeSlider/RangeSlider.tsx index fe0ee72c42..6aa4386a96 100644 --- a/packages/synapse-react-client/src/components/widgets/RangeSlider/RangeSlider.tsx +++ b/packages/synapse-react-client/src/components/widgets/RangeSlider/RangeSlider.tsx @@ -1,6 +1,4 @@ -import React from 'react' -import { RangeValues } from '../Range' -import { useState } from 'react' +import React, { useState } from 'react' import { Box, Button, @@ -9,6 +7,7 @@ import { Tooltip, Typography, } from '@mui/material' +import { RangeValues } from '../Range' export type RangeSliderProps = React.PropsWithChildren<{ domain: string[] diff --git a/packages/synapse-react-client/src/components/widgets/SynapseImage.test.tsx b/packages/synapse-react-client/src/components/widgets/SynapseImage.test.tsx index fba7222280..a73209f4d7 100644 --- a/packages/synapse-react-client/src/components/widgets/SynapseImage.test.tsx +++ b/packages/synapse-react-client/src/components/widgets/SynapseImage.test.tsx @@ -1,6 +1,6 @@ import React from 'react' -import SynapseImage from './SynapseImage' import { render } from '@testing-library/react' +import SynapseImage from './SynapseImage' it('renders without failing', () => { const { container } = render( diff --git a/packages/synapse-react-client/src/components/widgets/SynapseImage.tsx b/packages/synapse-react-client/src/components/widgets/SynapseImage.tsx index 850de38c01..83800381ea 100644 --- a/packages/synapse-react-client/src/components/widgets/SynapseImage.tsx +++ b/packages/synapse-react-client/src/components/widgets/SynapseImage.tsx @@ -1,6 +1,4 @@ import React from 'react' -import { getEntity, getFiles } from '../../synapse-client/SynapseClient' -import { SynapseContext } from '../../utils/context/SynapseContext' import { BatchFileRequest, BatchFileResult, @@ -9,6 +7,8 @@ import { FileHandleAssociateType, FileHandleAssociation, } from '@sage-bionetworks/synapse-types' +import { getEntity, getFiles } from '../../synapse-client/SynapseClient' +import { SynapseContext } from '../../utils/context/SynapseContext' export type SynapseImageProps = { wikiId?: string diff --git a/packages/synapse-react-client/src/components/widgets/SynapseVideo.tsx b/packages/synapse-react-client/src/components/widgets/SynapseVideo.tsx index 7c30464fae..3877e9e952 100644 --- a/packages/synapse-react-client/src/components/widgets/SynapseVideo.tsx +++ b/packages/synapse-react-client/src/components/widgets/SynapseVideo.tsx @@ -1,6 +1,4 @@ -import React from 'react' -import { useEffect, useState } from 'react' -import { getEntity, getFiles } from '../../synapse-client/SynapseClient' +import React, { useEffect, useState } from 'react' import { FileEntity, FileHandleAssociateType, @@ -8,6 +6,7 @@ import { BatchFileRequest, BatchFileResult, } from '@sage-bionetworks/synapse-types' +import { getEntity, getFiles } from '../../synapse-client/SynapseClient' import { SynapseConstants } from '../../utils' import { useSynapseContext } from '../../utils/context/SynapseContext' diff --git a/packages/synapse-react-client/src/components/widgets/facet-nav/FacetNav.integration.test.tsx b/packages/synapse-react-client/src/components/widgets/facet-nav/FacetNav.integration.test.tsx index 41468ff109..1ebabbc347 100644 --- a/packages/synapse-react-client/src/components/widgets/facet-nav/FacetNav.integration.test.tsx +++ b/packages/synapse-react-client/src/components/widgets/facet-nav/FacetNav.integration.test.tsx @@ -2,19 +2,19 @@ import { render, screen, waitFor, within } from '@testing-library/react' import userEvent from '@testing-library/user-event' import { cloneDeep } from 'lodash-es' import React from 'react' -import { QueryVisualizationWrapper } from '../../QueryVisualizationWrapper/QueryVisualizationWrapper' -import FacetNav, { FacetNavProps } from './FacetNav' +import { QueryBundleRequest } from '@sage-bionetworks/synapse-types' +import failOnConsole from 'jest-fail-on-console' import { createWrapper } from '../../../testutils/TestingLibraryUtils' import { SynapseConstants } from '../../../utils' -import { QueryBundleRequest } from '@sage-bionetworks/synapse-types' import testData from '../../../mocks/mockQueryResponseDataWithManyEnumFacets' import { server } from '../../../mocks/msw/server' -import failOnConsole from 'jest-fail-on-console' +import { QueryVisualizationWrapper } from '../../QueryVisualizationWrapper/QueryVisualizationWrapper' import { DEFAULT_PAGE_SIZE } from '../../../utils/SynapseConstants' import { CLOSE_BUTTON_LABEL } from '../../DialogBase' import { QueryWrapper } from '../../QueryWrapper' import { getHandlersForTableQuery } from '../../../mocks/msw/handlers/tableQueryHandlers' import { mockTableEntity } from '../../../mocks/entity/mockTableEntity' +import FacetNav, { FacetNavProps } from './FacetNav' const lastQueryRequest: QueryBundleRequest = { concreteType: 'org.sagebionetworks.repo.model.table.QueryBundleRequest', diff --git a/packages/synapse-react-client/src/components/widgets/facet-nav/FacetNav.tsx b/packages/synapse-react-client/src/components/widgets/facet-nav/FacetNav.tsx index e47ccebaf9..f69f628675 100644 --- a/packages/synapse-react-client/src/components/widgets/facet-nav/FacetNav.tsx +++ b/packages/synapse-react-client/src/components/widgets/facet-nav/FacetNav.tsx @@ -1,5 +1,4 @@ import React, { useEffect, useMemo, useState } from 'react' -import { isSingleNotSetValue } from '../../../utils/functions/queryUtils' import { FacetColumnRequest, FacetColumnResult, @@ -7,17 +6,18 @@ import { FacetColumnResultValues, QueryResultBundle, } from '@sage-bionetworks/synapse-types' +import { Box, Button } from '@mui/material' +import { useAtomValue } from 'jotai' +import { isSingleNotSetValue } from '../../../utils/functions/queryUtils' import { useQueryVisualizationContext } from '../../QueryVisualizationWrapper' import { useQueryContext } from '../../QueryContext/QueryContext' import { applyChangesToValuesColumn } from '../query-filter/FacetFilterControls' -import FacetNavPanel, { PlotType } from './FacetNavPanel' import TotalQueryResults from '../../TotalQueryResults' -import { Box, Button } from '@mui/material' -import { useAtomValue } from 'jotai' import { isLoadingNewBundleAtom, tableQueryDataAtom, } from '../../QueryWrapper/QueryWrapper' +import FacetNavPanel, { PlotType } from './FacetNavPanel' /* TODO: This component has a few bugs when its props are updated with new data, this should be handled diff --git a/packages/synapse-react-client/src/components/widgets/facet-nav/FacetNavPanel.integration.test.tsx b/packages/synapse-react-client/src/components/widgets/facet-nav/FacetNavPanel.integration.test.tsx index 007b0b7268..b716af0a31 100644 --- a/packages/synapse-react-client/src/components/widgets/facet-nav/FacetNavPanel.integration.test.tsx +++ b/packages/synapse-react-client/src/components/widgets/facet-nav/FacetNavPanel.integration.test.tsx @@ -1,5 +1,4 @@ import React from 'react' -import FacetNavPanel, { FacetNavPanelProps } from './FacetNavPanel' import { render, screen, within } from '@testing-library/react' import { FacetColumnResultValues, @@ -9,12 +8,13 @@ import testData from '../../../mocks/mockQueryResponseDataWithManyEnumFacets' import { SynapseConstants } from '../../../utils' import { QueryVisualizationWrapper } from '../../QueryVisualizationWrapper/QueryVisualizationWrapper' import { createWrapper } from '../../../testutils/TestingLibraryUtils' -import { truncate } from './FacetPlotLegendUtils' import { mockQueryBundleRequest } from '../../../mocks/mockFileViewQuery' import QueryWrapper from '../../QueryWrapper' import { server } from '../../../mocks/msw/server' import { getHandlersForTableQuery } from '../../../mocks/msw/handlers/tableQueryHandlers' import { mockTableEntity } from '../../../mocks/entity/mockTableEntity' +import { truncate } from './FacetPlotLegendUtils' +import FacetNavPanel, { FacetNavPanelProps } from './FacetNavPanel' const mockApplyCallback = jest.fn(() => null) const mockHideCallback = jest.fn(() => null) diff --git a/packages/synapse-react-client/src/components/widgets/facet-nav/FacetNavPanel.tsx b/packages/synapse-react-client/src/components/widgets/facet-nav/FacetNavPanel.tsx index 4feb46f73b..208e784354 100644 --- a/packages/synapse-react-client/src/components/widgets/facet-nav/FacetNavPanel.tsx +++ b/packages/synapse-react-client/src/components/widgets/facet-nav/FacetNavPanel.tsx @@ -4,31 +4,31 @@ import React, { useCallback, useState } from 'react' import { Dropdown } from 'react-bootstrap' import createPlotlyComponent from 'react-plotly.js/factory' import { SizeMe } from 'react-sizeme' -import { SkeletonInlineBlock } from '../../Skeleton/SkeletonInlineBlock' -import getColorPalette from '../../ColorGradient/ColorGradient' -import { SynapseConstants } from '../../../utils' -import SynapseClient from '../../../synapse-client' -import { useSynapseContext } from '../../../utils/context/SynapseContext' import { ColumnTypeEnum, FacetColumnRequest, FacetColumnResultValueCount, FacetColumnResultValues, } from '@sage-bionetworks/synapse-types' +import { Box, IconButton, Tooltip } from '@mui/material' +import { useQuery } from 'react-query' +import { useAtomValue } from 'jotai' +import { SkeletonInlineBlock } from '../../Skeleton/SkeletonInlineBlock' +import getColorPalette from '../../ColorGradient/ColorGradient' +import { SynapseConstants } from '../../../utils' +import SynapseClient from '../../../synapse-client' +import { useSynapseContext } from '../../../utils/context/SynapseContext' import loadingScreen from '../../LoadingScreen/LoadingScreen' import { useQueryVisualizationContext } from '../../QueryVisualizationWrapper' import { EnumFacetFilter } from '../query-filter/EnumFacetFilter' -import { Box, IconButton, Tooltip } from '@mui/material' -import { useQuery } from 'react-query' import { ConfirmationDialog } from '../../ConfirmationDialog/ConfirmationDialog' -import { FacetPlotLegendList } from './FacetPlotLegendList' -import { FacetWithLabel, truncate } from './FacetPlotLegendUtils' import IconSvg from '../../IconSvg' -import { useAtomValue } from 'jotai' import { isLoadingNewBundleAtom, tableQueryDataAtom, } from '../../QueryWrapper/QueryWrapper' +import { FacetPlotLegendList } from './FacetPlotLegendList' +import { FacetWithLabel, truncate } from './FacetPlotLegendUtils' const Plot = createPlotlyComponent(Plotly) diff --git a/packages/synapse-react-client/src/components/widgets/facet-nav/FacetPlotLegendList.tsx b/packages/synapse-react-client/src/components/widgets/facet-nav/FacetPlotLegendList.tsx index 58cf9064f0..2201fef728 100644 --- a/packages/synapse-react-client/src/components/widgets/facet-nav/FacetPlotLegendList.tsx +++ b/packages/synapse-react-client/src/components/widgets/facet-nav/FacetPlotLegendList.tsx @@ -1,7 +1,7 @@ import React from 'react' -import { FacetPlotLegendProps } from './FacetPlotLegendUtils' -import { ElementWithTooltip } from '../ElementWithTooltip' import { Box, Typography } from '@mui/material' +import { ElementWithTooltip } from '../ElementWithTooltip' +import { FacetPlotLegendProps } from './FacetPlotLegendUtils' export function FacetPlotLegendList(props: FacetPlotLegendProps) { const { labels, colors = [], isExpanded } = props diff --git a/packages/synapse-react-client/src/components/widgets/facet-nav/FacetPlotLegendTable.tsx b/packages/synapse-react-client/src/components/widgets/facet-nav/FacetPlotLegendTable.tsx index bb97179357..eb9a78b38e 100644 --- a/packages/synapse-react-client/src/components/widgets/facet-nav/FacetPlotLegendTable.tsx +++ b/packages/synapse-react-client/src/components/widgets/facet-nav/FacetPlotLegendTable.tsx @@ -1,11 +1,11 @@ import { Box, Link, Typography } from '@mui/material' import React from 'react' +import { useQueryVisualizationContext } from '../../QueryVisualizationWrapper' import { FacetPlotLegendProps, MAX_LEGEND_LENGTH, truncate, } from './FacetPlotLegendUtils' -import { useQueryVisualizationContext } from '../../QueryVisualizationWrapper' type FacetPlotLegendTableProps = FacetPlotLegendProps & { facetName?: string diff --git a/packages/synapse-react-client/src/components/widgets/facet-nav/SelectionCriteriaPills.tsx b/packages/synapse-react-client/src/components/widgets/facet-nav/SelectionCriteriaPills.tsx index 3a7043355a..c5ed77482e 100644 --- a/packages/synapse-react-client/src/components/widgets/facet-nav/SelectionCriteriaPills.tsx +++ b/packages/synapse-react-client/src/components/widgets/facet-nav/SelectionCriteriaPills.tsx @@ -1,24 +1,15 @@ import React from 'react' -import { - LockedColumn, - QueryContextType, - useQueryContext, -} from '../../QueryContext' import { ColumnMultiValueFunctionQueryFilter, ColumnSingleValueQueryFilter, FacetColumnRangeRequest, QueryFilter, TextMatchesQueryFilter, + FacetColumnRequest, } from '@sage-bionetworks/synapse-types' -import SelectionCriteriaPill, { - SelectionCriteriaPillProps, -} from './SelectionCriteriaPill' -import { FacetColumnRequest } from '@sage-bionetworks/synapse-types' -import { - QueryVisualizationContextType, - useQueryVisualizationContext, -} from '../../QueryVisualizationWrapper' +import pluralize from 'pluralize' +import { ReadonlyDeep } from 'type-fest' +import { useAtomValue } from 'jotai' import { isColumnMultiValueFunctionQueryFilter, isColumnSingleValueQueryFilter, @@ -26,10 +17,19 @@ import { isFacetColumnRangeRequest, isTextMatchesQueryFilter, } from '../../../utils/types/IsType' -import pluralize from 'pluralize' -import { ReadonlyDeep } from 'type-fest' -import { useAtomValue } from 'jotai' +import { + QueryVisualizationContextType, + useQueryVisualizationContext, +} from '../../QueryVisualizationWrapper' +import { + LockedColumn, + QueryContextType, + useQueryContext, +} from '../../QueryContext' import { lockedColumnAtom } from '../../QueryWrapper/QueryWrapper' +import SelectionCriteriaPill, { + SelectionCriteriaPillProps, +} from './SelectionCriteriaPill' const MAX_VALUES_IN_FILTER_FOR_INDIVIDUAL_PILLS = 4 diff --git a/packages/synapse-react-client/src/components/widgets/query-filter/CombinedRangeFacetFilter.test.tsx b/packages/synapse-react-client/src/components/widgets/query-filter/CombinedRangeFacetFilter.test.tsx index a243eb0b98..18d8a540ae 100644 --- a/packages/synapse-react-client/src/components/widgets/query-filter/CombinedRangeFacetFilter.test.tsx +++ b/packages/synapse-react-client/src/components/widgets/query-filter/CombinedRangeFacetFilter.test.tsx @@ -7,14 +7,14 @@ import { ColumnTypeEnum, FacetColumnResultRange, } from '@sage-bionetworks/synapse-types' -import { - CombinedRangeFacetFilter, - CombinedRangeFacetFilterProps, -} from './CombinedRangeFacetFilter' import { VALUE_NOT_SET } from '../../../utils/SynapseConstants' import { RangeSliderProps } from '../RangeSlider/RangeSlider' import { QueryVisualizationContextProvider } from '../../QueryVisualizationWrapper' import { Range, RangeProps } from '../Range' +import { + CombinedRangeFacetFilter, + CombinedRangeFacetFilterProps, +} from './CombinedRangeFacetFilter' let capturedOnChange: | ((range: { min: string | number; max: string | number }) => void) diff --git a/packages/synapse-react-client/src/components/widgets/query-filter/CombinedRangeFacetFilter.tsx b/packages/synapse-react-client/src/components/widgets/query-filter/CombinedRangeFacetFilter.tsx index c43bafa466..76b2ea1407 100644 --- a/packages/synapse-react-client/src/components/widgets/query-filter/CombinedRangeFacetFilter.tsx +++ b/packages/synapse-react-client/src/components/widgets/query-filter/CombinedRangeFacetFilter.tsx @@ -1,14 +1,15 @@ import { Collapse } from '@mui/material' -import React, { useEffect } from 'react' -import { useState } from 'react' -import { ColumnType } from '@sage-bionetworks/synapse-types' -import { FacetColumnResultRange } from '@sage-bionetworks/synapse-types' +import React, { useEffect, useState } from 'react' +import { + ColumnType, + FacetColumnResultRange, +} from '@sage-bionetworks/synapse-types' +import dayjs from 'dayjs' import { RadioGroup } from '../RadioGroup' import { Range, RangeValues } from '../Range' +import { RangeSlider } from '../RangeSlider/RangeSlider' import { FacetFilterHeader } from './FacetFilterHeader' import { RadioValuesEnum, getRadioValue, options } from './RangeFacetFilter' -import dayjs from 'dayjs' -import { RangeSlider } from '../RangeSlider/RangeSlider' export type CombinedRangeFacetFilterProps = { facetResults: FacetColumnResultRange[] diff --git a/packages/synapse-react-client/src/components/widgets/query-filter/EnumFacetFilter.stories.tsx b/packages/synapse-react-client/src/components/widgets/query-filter/EnumFacetFilter.stories.tsx index 75d655942e..a873a955ef 100644 --- a/packages/synapse-react-client/src/components/widgets/query-filter/EnumFacetFilter.stories.tsx +++ b/packages/synapse-react-client/src/components/widgets/query-filter/EnumFacetFilter.stories.tsx @@ -1,14 +1,14 @@ import React from 'react' import { Meta, StoryObj } from '@storybook/react' -import { EnumFacetFilter } from './EnumFacetFilter' import { ColumnTypeEnum, FacetColumnResultValueCount, } from '@sage-bionetworks/synapse-types' +import { cloneDeep } from 'lodash-es' import { QueryVisualizationWrapper } from '../../QueryVisualizationWrapper' import { QueryWrapper } from '../../QueryWrapper' import { VALUE_NOT_SET } from '../../../utils/SynapseConstants' -import { cloneDeep } from 'lodash-es' +import { EnumFacetFilter } from './EnumFacetFilter' const meta = { title: 'Explore/Components/Facets/EnumFacetFilter', diff --git a/packages/synapse-react-client/src/components/widgets/query-filter/EnumFacetFilter.tsx b/packages/synapse-react-client/src/components/widgets/query-filter/EnumFacetFilter.tsx index 5f8eb7e2f2..0854a19034 100644 --- a/packages/synapse-react-client/src/components/widgets/query-filter/EnumFacetFilter.tsx +++ b/packages/synapse-react-client/src/components/widgets/query-filter/EnumFacetFilter.tsx @@ -2,8 +2,6 @@ import { Collapse, Fade, IconButton, Menu, Tooltip } from '@mui/material' import React, { useMemo, useState } from 'react' import { Dropdown } from 'react-bootstrap' import useDeepCompareEffect from 'use-deep-compare-effect' -import { SynapseConstants } from '../../../utils' -import useGetInfoFromIds from '../../../utils/hooks/useGetInfoFromIds' import { ColumnTypeEnum, EntityHeader, @@ -14,13 +12,15 @@ import { SelectColumn, UserGroupHeader, } from '@sage-bionetworks/synapse-types' +import { ReadonlyDeep } from 'type-fest' +import { cloneDeep } from 'lodash-es' +import { SynapseConstants } from '../../../utils' +import useGetInfoFromIds from '../../../utils/hooks/useGetInfoFromIds' import IconSvg from '../../IconSvg/IconSvg' import { Checkbox } from '../Checkbox' -import { FacetFilterHeader } from './FacetFilterHeader' import { useQueryContext } from '../../QueryContext' -import { ReadonlyDeep } from 'type-fest' import { isFacetColumnValuesRequest } from '../../../utils/types/IsType' -import { cloneDeep } from 'lodash-es' +import { FacetFilterHeader } from './FacetFilterHeader' export type EnumFacetFilterProps = { facetValues: FacetColumnResultValueCount[] diff --git a/packages/synapse-react-client/src/components/widgets/query-filter/FacetFilterControls.integration.test.tsx b/packages/synapse-react-client/src/components/widgets/query-filter/FacetFilterControls.integration.test.tsx index 5894004312..d61558584e 100644 --- a/packages/synapse-react-client/src/components/widgets/query-filter/FacetFilterControls.integration.test.tsx +++ b/packages/synapse-react-client/src/components/widgets/query-filter/FacetFilterControls.integration.test.tsx @@ -1,16 +1,12 @@ import { act, render, screen, waitFor } from '@testing-library/react' import userEvent from '@testing-library/user-event' -import _ from 'lodash-es' import React from 'react' -import { QueryVisualizationWrapper } from '../../QueryVisualizationWrapper/QueryVisualizationWrapper' -import FacetFilterControls, { - FacetFilterControlsProps, - getDefaultShownFacetFilters, -} from './FacetFilterControls' import { FacetColumnRequest, QueryBundleRequest, } from '@sage-bionetworks/synapse-types' +import { cloneDeep } from 'lodash-es' +import { QueryVisualizationWrapper } from '../../QueryVisualizationWrapper/QueryVisualizationWrapper' import mockQueryResponseData from '../../../mocks/mockQueryResponseData' import { DEFAULT_PAGE_SIZE } from '../../../utils/SynapseConstants' import { createWrapper } from '../../../testutils/TestingLibraryUtils' @@ -19,6 +15,10 @@ import { server } from '../../../mocks/msw/server' import { getHandlersForTableQuery } from '../../../mocks/msw/handlers/tableQueryHandlers' import { MOCK_TABLE_ENTITY_ID } from '../../../mocks/entity/mockTableEntity' import { QueryContextConsumer, QueryContextType } from '../../QueryContext' +import FacetFilterControls, { + FacetFilterControlsProps, + getDefaultShownFacetFilters, +} from './FacetFilterControls' import { RangeFacetFilterProps } from './RangeFacetFilter' let capturedOnChange: RangeFacetFilterProps['onChange'] | undefined @@ -171,7 +171,7 @@ describe('FacetFilterControls tests', () => { act(() => { capturedOnChange!(['1997', '1998']) }) - const expected = _.cloneDeep(queryRequest) + const expected = cloneDeep(queryRequest) expected.query = { ...expected.query, selectedFacets: expectedResult } await waitFor(() => { expect(capturedQueryContext?.nextQueryRequest.query).toEqual( diff --git a/packages/synapse-react-client/src/components/widgets/query-filter/FacetFilterControls.tsx b/packages/synapse-react-client/src/components/widgets/query-filter/FacetFilterControls.tsx index 38bf6f193b..6c5c13186c 100644 --- a/packages/synapse-react-client/src/components/widgets/query-filter/FacetFilterControls.tsx +++ b/packages/synapse-react-client/src/components/widgets/query-filter/FacetFilterControls.tsx @@ -1,6 +1,5 @@ import React, { useCallback } from 'react' import { useDeepCompareEffectNoCheck } from 'use-deep-compare-effect' -import { isSingleNotSetValue } from '../../../utils/functions/queryUtils' import { FacetColumnRangeRequest, FacetColumnRequest, @@ -10,18 +9,19 @@ import { FacetColumnValuesRequest, QueryBundleRequest, } from '@sage-bionetworks/synapse-types' -import { useQueryContext } from '../../QueryContext/QueryContext' -import { EnumFacetFilter } from './EnumFacetFilter' -import { FacetChip } from './FacetChip' -import { RangeFacetFilter } from './RangeFacetFilter' import { Box, Skeleton, Stack } from '@mui/material' import { sortBy } from 'lodash-es' -import { CombinedRangeFacetFilter } from './CombinedRangeFacetFilter' import { useAtomValue } from 'jotai' +import { isSingleNotSetValue } from '../../../utils/functions/queryUtils' +import { useQueryContext } from '../../QueryContext/QueryContext' import { isLoadingNewBundleAtom, tableQueryDataAtom, } from '../../QueryWrapper/QueryWrapper' +import { EnumFacetFilter } from './EnumFacetFilter' +import { FacetChip } from './FacetChip' +import { RangeFacetFilter } from './RangeFacetFilter' +import { CombinedRangeFacetFilter } from './CombinedRangeFacetFilter' export type FacetFilterControlsProps = { /* The set of faceted column names that should be shown in the Facet controls. If undefined, all faceted columns with at least one non-null value will be shown. */ diff --git a/packages/synapse-react-client/src/components/widgets/query-filter/RangeFacetFilter.tsx b/packages/synapse-react-client/src/components/widgets/query-filter/RangeFacetFilter.tsx index eddf08cac8..5454a0e872 100644 --- a/packages/synapse-react-client/src/components/widgets/query-filter/RangeFacetFilter.tsx +++ b/packages/synapse-react-client/src/components/widgets/query-filter/RangeFacetFilter.tsx @@ -1,17 +1,18 @@ import { Collapse } from '@mui/material' -import React, { useEffect } from 'react' -import { useState } from 'react' +import React, { useEffect, useState } from 'react' +import { + ColumnType, + FacetColumnResultRange, +} from '@sage-bionetworks/synapse-types' +import dayjs from 'dayjs' import { FRIENDLY_VALUE_NOT_SET, VALUE_NOT_SET, } from '../../../utils/SynapseConstants' -import { ColumnType } from '@sage-bionetworks/synapse-types' -import { FacetColumnResultRange } from '@sage-bionetworks/synapse-types' import { RadioGroup } from '../RadioGroup' import { Range, RangeValues } from '../Range' import { RangeSlider } from '../RangeSlider/RangeSlider' import { FacetFilterHeader } from './FacetFilterHeader' -import dayjs from 'dayjs' export enum RadioValuesEnum { NOT_SET = 'org.sagebionetworks.UNDEFINED_NULL_NOTSET', diff --git a/packages/synapse-react-client/src/index.ts b/packages/synapse-react-client/src/index.ts index b2bbc8839f..229fd8948c 100644 --- a/packages/synapse-react-client/src/index.ts +++ b/packages/synapse-react-client/src/index.ts @@ -1,21 +1,19 @@ -import { displayToast } from './components/ToastMessage' import * as SynapseTheme from './theme' import Palettes from './theme/palette/Palettes' import { SynapseContextConsumer, SynapseContextProvider, useSynapseContext, -} from './utils/context/SynapseContext' -import FullContextProvider, { +} from './utils' +import { + FullContextProvider, defaultQueryClientConfig, } from './utils/context/FullContextProvider' import * as AppUtils from './utils/AppUtils' import * as RegularExpressions from './utils/functions/RegularExpressions' -import { SynapseClientError } from './utils/SynapseClientError' import * as SynapseComponents from './components' import SynapseClient, { HttpClient } from './synapse-client' import * as SynapseQueries from './synapse-queries' -import { SynapseConstants, SynapseUtilityFunctions } from './utils' export * from './components' export * from './utils' @@ -31,15 +29,11 @@ const SynapseContextUtils = { export { HttpClient, SynapseClient, - SynapseClientError, - SynapseConstants, SynapseComponents, SynapseContextUtils, SynapseTheme, SynapseQueries, - SynapseUtilityFunctions, Palettes, AppUtils, RegularExpressions, - displayToast, } diff --git a/packages/synapse-react-client/src/mocks/discussion/mock_discussion.ts b/packages/synapse-react-client/src/mocks/discussion/mock_discussion.ts index b56c1bb35c..eb537a0262 100644 --- a/packages/synapse-react-client/src/mocks/discussion/mock_discussion.ts +++ b/packages/synapse-react-client/src/mocks/discussion/mock_discussion.ts @@ -2,11 +2,11 @@ import { DiscussionReplyBundle, DiscussionThreadBundle, } from '@sage-bionetworks/synapse-types' +import { times } from 'lodash-es' import { mockUserProfileData, mockUserProfileData2, } from '../user/mock_user_profile' -import { times } from 'lodash-es' import { generateDiscussionThreadBundle, generateForum, diff --git a/packages/synapse-react-client/src/mocks/entity/MockEntityData.ts b/packages/synapse-react-client/src/mocks/entity/MockEntityData.ts index 3a49fd0c2f..480f81975d 100644 --- a/packages/synapse-react-client/src/mocks/entity/MockEntityData.ts +++ b/packages/synapse-react-client/src/mocks/entity/MockEntityData.ts @@ -5,8 +5,8 @@ import { EntityHeader, ProjectHeader, EntityPath, + VersionInfo, } from '@sage-bionetworks/synapse-types' -import { VersionInfo } from '@sage-bionetworks/synapse-types' /** * Defines the standard set of data that a mock entity should have. diff --git a/packages/synapse-react-client/src/mocks/entity/mockFileView.ts b/packages/synapse-react-client/src/mocks/entity/mockFileView.ts index 471ff9e2c1..4a68f9f7e9 100644 --- a/packages/synapse-react-client/src/mocks/entity/mockFileView.ts +++ b/packages/synapse-react-client/src/mocks/entity/mockFileView.ts @@ -1,9 +1,9 @@ -import { MOCK_USER_ID } from '../user/mock_user_profile' import { ENTITY_VIEW_TYPE_MASK_FILE, EntityHeader, EntityView, } from '@sage-bionetworks/synapse-types' +import { MOCK_USER_ID } from '../user/mock_user_profile' import mockProject from './mockProject' import { MockEntityData } from './MockEntityData' import { MOCK_TABLE_ENTITY_ID } from './mockTableEntity' diff --git a/packages/synapse-react-client/src/mocks/entity/mockProject.ts b/packages/synapse-react-client/src/mocks/entity/mockProject.ts index a0acdcbe00..bab1925ef6 100644 --- a/packages/synapse-react-client/src/mocks/entity/mockProject.ts +++ b/packages/synapse-react-client/src/mocks/entity/mockProject.ts @@ -10,10 +10,10 @@ import { ProjectHeader, RestrictionLevel, } from '@sage-bionetworks/synapse-types' +import { times } from 'lodash-es' import { MOCK_USER_ID } from '../user/mock_user_profile' -import { MockEntityData } from './MockEntityData' import { generateProject } from '../faker/generateFakeEntity' -import { times } from 'lodash-es' +import { MockEntityData } from './MockEntityData' export const mockProjectIds = times(20).map(i => i + 10000) diff --git a/packages/synapse-react-client/src/mocks/entity/mockProjectView.ts b/packages/synapse-react-client/src/mocks/entity/mockProjectView.ts index e6006cc379..38c38e27bd 100644 --- a/packages/synapse-react-client/src/mocks/entity/mockProjectView.ts +++ b/packages/synapse-react-client/src/mocks/entity/mockProjectView.ts @@ -1,9 +1,9 @@ -import { MOCK_USER_ID } from '../user/mock_user_profile' import { ENTITY_VIEW_TYPE_MASK_PROJECT, EntityHeader, EntityView, } from '@sage-bionetworks/synapse-types' +import { MOCK_USER_ID } from '../user/mock_user_profile' import mockProject from './mockProject' import { MockEntityData } from './MockEntityData' import { MOCK_TABLE_ENTITY_ID } from './mockTableEntity' diff --git a/packages/synapse-react-client/src/mocks/faker/fakerUtils.ts b/packages/synapse-react-client/src/mocks/faker/fakerUtils.ts index a1f78c4c69..dcca72ffad 100644 --- a/packages/synapse-react-client/src/mocks/faker/fakerUtils.ts +++ b/packages/synapse-react-client/src/mocks/faker/fakerUtils.ts @@ -1,5 +1,5 @@ -import { mockUserData } from '../user/mock_user_profile' import { faker } from '@faker-js/faker' +import { mockUserData } from '../user/mock_user_profile' /** * Use faker to pick a random mock user out of those that have already been created. diff --git a/packages/synapse-react-client/src/mocks/faker/generateDiscussion.ts b/packages/synapse-react-client/src/mocks/faker/generateDiscussion.ts index 275153bbd7..d4b64b468e 100644 --- a/packages/synapse-react-client/src/mocks/faker/generateDiscussion.ts +++ b/packages/synapse-react-client/src/mocks/faker/generateDiscussion.ts @@ -1,8 +1,8 @@ import { DiscussionThreadBundle, Forum } from '@sage-bionetworks/synapse-types' import { faker } from '@faker-js/faker' +import { SetRequired } from 'type-fest' import { mockUserData } from '../user/mock_user_profile' import { pickRandomMockUser } from './fakerUtils' -import { SetRequired } from 'type-fest' export function generateForum( overrides: SetRequired, 'projectId'>, diff --git a/packages/synapse-react-client/src/mocks/mockAccessRequest.ts b/packages/synapse-react-client/src/mocks/mockAccessRequest.ts index fb7f47b99b..3ed886949a 100644 --- a/packages/synapse-react-client/src/mocks/mockAccessRequest.ts +++ b/packages/synapse-react-client/src/mocks/mockAccessRequest.ts @@ -1,6 +1,9 @@ +import { + AccessType, + SubmissionState, + SubmissionSearchResponse, +} from '@sage-bionetworks/synapse-types' import { ACT_TEAM_ID } from '../utils/SynapseConstants' -import { AccessType, SubmissionState } from '@sage-bionetworks/synapse-types' -import { SubmissionSearchResponse } from '@sage-bionetworks/synapse-types' import { mockManagedACTAccessRequirement } from './mockAccessRequirements' import { MOCK_USER_ID, MOCK_USER_ID_2 } from './user/mock_user_profile' diff --git a/packages/synapse-react-client/src/mocks/mockAccessRequirements.ts b/packages/synapse-react-client/src/mocks/mockAccessRequirements.ts index cc2d40104d..ab9194b7b2 100644 --- a/packages/synapse-react-client/src/mocks/mockAccessRequirements.ts +++ b/packages/synapse-react-client/src/mocks/mockAccessRequirements.ts @@ -9,8 +9,8 @@ import { SelfSignAccessRequirement, TermsOfUseAccessRequirement, WikiPageKey, + AccessRequirementSearchResponse, } from '@sage-bionetworks/synapse-types' -import { AccessRequirementSearchResponse } from '@sage-bionetworks/synapse-types' import mockProjectData from './entity/mockProject' import { MOCK_USER_ID } from './user/mock_user_profile' import { diff --git a/packages/synapse-react-client/src/mocks/mockCertificationQuiz.ts b/packages/synapse-react-client/src/mocks/mockCertificationQuiz.ts index fd86809ed2..198fc8c10f 100644 --- a/packages/synapse-react-client/src/mocks/mockCertificationQuiz.ts +++ b/packages/synapse-react-client/src/mocks/mockCertificationQuiz.ts @@ -1,5 +1,8 @@ -import { ObjectType } from '@sage-bionetworks/synapse-types' -import { Quiz, PassingRecord } from '@sage-bionetworks/synapse-types' +import { + ObjectType, + Quiz, + PassingRecord, +} from '@sage-bionetworks/synapse-types' export const mockQuiz: Quiz = { id: 123, diff --git a/packages/synapse-react-client/src/mocks/mockSchema.ts b/packages/synapse-react-client/src/mocks/mockSchema.ts index 6e074d4a4e..87ce63758c 100644 --- a/packages/synapse-react-client/src/mocks/mockSchema.ts +++ b/packages/synapse-react-client/src/mocks/mockSchema.ts @@ -5,7 +5,7 @@ import { ValidationResults, } from '@sage-bionetworks/synapse-types' import mockFileEntityData from './entity/mockFileEntity' -import { JSONSchema7 } from 'json-schema' +import type { JSONSchema7 } from 'json-schema' const mockFileEntity = mockFileEntityData.entity diff --git a/packages/synapse-react-client/src/mocks/mock_drug_tool_data.ts b/packages/synapse-react-client/src/mocks/mock_drug_tool_data.ts index a85e9ae363..79da13077b 100644 --- a/packages/synapse-react-client/src/mocks/mock_drug_tool_data.ts +++ b/packages/synapse-react-client/src/mocks/mock_drug_tool_data.ts @@ -1,6 +1,9 @@ -import { FileEntity } from '@sage-bionetworks/synapse-types' +import { + FileEntity, + ListResponse, + StatusEnum, +} from '@sage-bionetworks/synapse-types' import { Step, StepStateEnum } from '../components/SynapseForm/types' -import { ListResponse, StatusEnum } from '@sage-bionetworks/synapse-types' import _mockFormData from './mockDrugToolFormData.json' import _mockNavSchema from './mockDrugToolFormNavSchema.json' import _mockFormSchema from './mockDrugToolFormSchema.json' diff --git a/packages/synapse-react-client/src/mocks/msw/handlers.ts b/packages/synapse-react-client/src/mocks/msw/handlers.ts index 106d516bef..5dddfb926a 100644 --- a/packages/synapse-react-client/src/mocks/msw/handlers.ts +++ b/packages/synapse-react-client/src/mocks/msw/handlers.ts @@ -1,13 +1,14 @@ import { rest } from 'msw' +import { + BackendDestinationEnum, + getEndpoint, +} from '../../utils/functions/getEndpoint' +import { SynapseError } from '../../utils/SynapseError' import { getEntityHandlers } from './handlers/entityHandlers' import { getCurrentUserCertifiedValidatedHandler, getUserProfileHandlers, } from './handlers/userProfileHandlers' -import { - BackendDestinationEnum, - getEndpoint, -} from '../../utils/functions/getEndpoint' import { getAccessRequirementEntityBindingHandlers, getAccessRequirementHandlers, @@ -17,7 +18,6 @@ import { getWikiHandlers } from './handlers/wikiHandlers' import { getDataAccessRequestHandlers } from './handlers/dataAccessRequestHandlers' import { getResearchProjectHandlers } from './handlers/researchProjectHandlers' import { getFileHandlers } from './handlers/fileHandlers' -import { SynapseError } from '../../utils/SynapseError' import { getDiscussionHandlers } from './handlers/discussionHandlers' import { getSubscriptionHandlers } from './handlers/subscriptionHandlers' diff --git a/packages/synapse-react-client/src/mocks/msw/handlers/accessRequirementHandlers.ts b/packages/synapse-react-client/src/mocks/msw/handlers/accessRequirementHandlers.ts index 51199ae094..b0b034e39e 100644 --- a/packages/synapse-react-client/src/mocks/msw/handlers/accessRequirementHandlers.ts +++ b/packages/synapse-react-client/src/mocks/msw/handlers/accessRequirementHandlers.ts @@ -1,11 +1,4 @@ import { rest } from 'msw' -import { - ACCESS_REQUIREMENT_BY_ID, - ACCESS_REQUIREMENT_STATUS, - ACCESS_REQUIREMENT_WIKI_PAGE_KEY, - ENTITY_ACCESS_REQUIREMENTS, -} from '../../../utils/APIConstants' -import { MOCK_REPO_ORIGIN } from '../../../utils/functions/getEndpoint' import { AccessRequirement, AccessRequirementStatus, @@ -14,6 +7,13 @@ import { SubmissionState, WikiPageKey, } from '@sage-bionetworks/synapse-types' +import { + ACCESS_REQUIREMENT_BY_ID, + ACCESS_REQUIREMENT_STATUS, + ACCESS_REQUIREMENT_WIKI_PAGE_KEY, + ENTITY_ACCESS_REQUIREMENTS, +} from '../../../utils/APIConstants' +import { MOCK_REPO_ORIGIN } from '../../../utils/functions/getEndpoint' import { SynapseApiResponse } from '../handlers' import { mockAccessRequirements, diff --git a/packages/synapse-react-client/src/mocks/msw/handlers/discussionHandlers.ts b/packages/synapse-react-client/src/mocks/msw/handlers/discussionHandlers.ts index d95b3c27dc..8d321761a8 100644 --- a/packages/synapse-react-client/src/mocks/msw/handlers/discussionHandlers.ts +++ b/packages/synapse-react-client/src/mocks/msw/handlers/discussionHandlers.ts @@ -1,6 +1,6 @@ import { rest } from 'msw' -import { FORUM, THREAD } from '../../../utils/APIConstants' import { Forum } from '@sage-bionetworks/synapse-types' +import { FORUM, THREAD } from '../../../utils/APIConstants' import { SynapseApiResponse } from '../handlers' import { mockDiscussionThreadBundles, diff --git a/packages/synapse-react-client/src/mocks/msw/handlers/entityHandlers.ts b/packages/synapse-react-client/src/mocks/msw/handlers/entityHandlers.ts index 8a079b27df..11faeb461c 100644 --- a/packages/synapse-react-client/src/mocks/msw/handlers/entityHandlers.ts +++ b/packages/synapse-react-client/src/mocks/msw/handlers/entityHandlers.ts @@ -1,4 +1,17 @@ import { rest } from 'msw' +import { + Entity, + EntityBundle, + EntityHeader, + EntityJson, + EntityPath, + PaginatedResults, + Reference, + VersionableEntity, + VersionInfo, + UploadDestination, + UploadType, +} from '@sage-bionetworks/synapse-types' import { ENTITY, ENTITY_BUNDLE_V2, @@ -13,22 +26,10 @@ import { BackendDestinationEnum, getEndpoint, } from '../../../utils/functions/getEndpoint' -import { - Entity, - EntityBundle, - EntityHeader, - EntityJson, - EntityPath, - PaginatedResults, - Reference, - VersionableEntity, -} from '@sage-bionetworks/synapse-types' -import { VersionInfo } from '@sage-bionetworks/synapse-types' import mockEntities from '../../entity' import { MOCK_INVALID_PROJECT_NAME } from '../../entity/mockEntity' import { mockSchemaBinding } from '../../mockSchema' import { SynapseApiResponse } from '../handlers' -import { UploadDestination, UploadType } from '@sage-bionetworks/synapse-types' export const getEntityHandlers = (backendOrigin: string) => [ /** diff --git a/packages/synapse-react-client/src/mocks/msw/handlers/researchProjectHandlers.ts b/packages/synapse-react-client/src/mocks/msw/handlers/researchProjectHandlers.ts index 15d135c1db..8c3dd54785 100644 --- a/packages/synapse-react-client/src/mocks/msw/handlers/researchProjectHandlers.ts +++ b/packages/synapse-react-client/src/mocks/msw/handlers/researchProjectHandlers.ts @@ -1,9 +1,9 @@ import { rest } from 'msw' +import { ResearchProject } from '@sage-bionetworks/synapse-types' import { ACCESS_REQUIREMENT_RESEARCH_PROJECT_FOR_UPDATE, RESEARCH_PROJECT, } from '../../../utils/APIConstants' -import { ResearchProject } from '@sage-bionetworks/synapse-types' import { MOCK_RESEARCH_PROJECT } from '../../dataaccess/MockResearchProject' export function getResearchProjectHandlers(backendOrigin: string) { diff --git a/packages/synapse-react-client/src/mocks/msw/handlers/tableQueryHandlers.ts b/packages/synapse-react-client/src/mocks/msw/handlers/tableQueryHandlers.ts index 5125a7691f..cc27d85cef 100644 --- a/packages/synapse-react-client/src/mocks/msw/handlers/tableQueryHandlers.ts +++ b/packages/synapse-react-client/src/mocks/msw/handlers/tableQueryHandlers.ts @@ -1,5 +1,11 @@ import { cloneDeep, uniqueId } from 'lodash-es' import { rest } from 'msw' +import { + AsynchronousJobStatus, + AsyncJobId, + QueryBundleRequest, + QueryResultBundle, +} from '@sage-bionetworks/synapse-types' import { ASYNCHRONOUS_JOB_TOKEN, TABLE_QUERY_ASYNC_GET, @@ -19,12 +25,6 @@ import { BUNDLE_MASK_QUERY_SELECT_COLUMNS, BUNDLE_MASK_SUM_FILES_SIZE_BYTES, } from '../../../utils/SynapseConstants' -import { - AsynchronousJobStatus, - AsyncJobId, - QueryBundleRequest, - QueryResultBundle, -} from '@sage-bionetworks/synapse-types' const BIT_TO_FIELD_MAP: Record = { [BUNDLE_MASK_QUERY_RESULTS]: 'queryResult', diff --git a/packages/synapse-react-client/src/mocks/msw/handlers/userProfileHandlers.ts b/packages/synapse-react-client/src/mocks/msw/handlers/userProfileHandlers.ts index b82cf68e63..27204a54fd 100644 --- a/packages/synapse-react-client/src/mocks/msw/handlers/userProfileHandlers.ts +++ b/packages/synapse-react-client/src/mocks/msw/handlers/userProfileHandlers.ts @@ -1,4 +1,11 @@ import { rest } from 'msw' +import { + TwoFactorAuthStatus, + TYPE_FILTER, + UserBundle, + UserGroupHeaderResponsePage, + UserProfile, +} from '@sage-bionetworks/synapse-types' import { FAVORITES, NOTIFICATION_EMAIL, @@ -14,13 +21,6 @@ import { BackendDestinationEnum, getEndpoint, } from '../../../utils/functions/getEndpoint' -import { - TwoFactorAuthStatus, - TYPE_FILTER, - UserBundle, - UserGroupHeaderResponsePage, - UserProfile, -} from '@sage-bionetworks/synapse-types' import { mockPaginatedEntityHeaders } from '../../entity/mockEntity' import { mockUserBundle, diff --git a/packages/synapse-react-client/src/mocks/msw/handlers/wikiHandlers.ts b/packages/synapse-react-client/src/mocks/msw/handlers/wikiHandlers.ts index bb76f6ba87..6c0fe6ef7c 100644 --- a/packages/synapse-react-client/src/mocks/msw/handlers/wikiHandlers.ts +++ b/packages/synapse-react-client/src/mocks/msw/handlers/wikiHandlers.ts @@ -1,6 +1,6 @@ import { rest } from 'msw' -import { ACCESS_REQUIREMENT_WIKI_PAGE } from '../../../utils/APIConstants' import { WikiPage } from '@sage-bionetworks/synapse-types' +import { ACCESS_REQUIREMENT_WIKI_PAGE } from '../../../utils/APIConstants' import { SynapseApiResponse } from '../handlers' import { mockWikiPages } from '../../mockWiki' diff --git a/packages/synapse-react-client/src/mocks/user/mock_user_profile.ts b/packages/synapse-react-client/src/mocks/user/mock_user_profile.ts index 6ab6146417..414c3b305c 100644 --- a/packages/synapse-react-client/src/mocks/user/mock_user_profile.ts +++ b/packages/synapse-react-client/src/mocks/user/mock_user_profile.ts @@ -1,13 +1,13 @@ -import { - ACT_TEAM_ID, - AUTHENTICATED_PRINCIPAL_ID, - PUBLIC_PRINCIPAL_ID, -} from '../../utils/SynapseConstants' import { UserBundle, UserGroupHeader, UserProfile, } from '@sage-bionetworks/synapse-types' +import { + ACT_TEAM_ID, + AUTHENTICATED_PRINCIPAL_ID, + PUBLIC_PRINCIPAL_ID, +} from '../../utils/SynapseConstants' export const MOCK_USER_ID = 999 export const MOCK_USER_NAME = 'myUserName' diff --git a/packages/synapse-react-client/src/synapse-client/SynapseClient.integration.test.ts b/packages/synapse-react-client/src/synapse-client/SynapseClient.integration.test.ts index 839eaf91ab..79663e5568 100644 --- a/packages/synapse-react-client/src/synapse-client/SynapseClient.integration.test.ts +++ b/packages/synapse-react-client/src/synapse-client/SynapseClient.integration.test.ts @@ -1,11 +1,11 @@ -import SynapseClient from './index' +import { AsynchronousJobStatus } from '@sage-bionetworks/synapse-types' import { ASYNCHRONOUS_JOB_TOKEN } from '../utils/APIConstants' import { BackendDestinationEnum, getEndpoint, } from '../utils/functions/getEndpoint' -import { AsynchronousJobStatus } from '@sage-bionetworks/synapse-types' import { rest, server } from '../mocks/msw/server' +import SynapseClient from './index' describe('SynapseClient integration tests', () => { beforeAll(() => server.listen()) diff --git a/packages/synapse-react-client/src/synapse-client/SynapseClient.test.ts b/packages/synapse-react-client/src/synapse-client/SynapseClient.test.ts index 92529e1c72..012c17d0d7 100644 --- a/packages/synapse-react-client/src/synapse-client/SynapseClient.test.ts +++ b/packages/synapse-react-client/src/synapse-client/SynapseClient.test.ts @@ -1,13 +1,13 @@ -import SynapseClient, { FunctionReturningPaginatedResults } from './index' +import { PaginatedResults } from '@sage-bionetworks/synapse-types' +import UniversalCookies from 'universal-cookie' import { SynapseClientError } from '../utils/SynapseClientError' import { ACCESS_TOKEN_COOKIE_KEY, NETWORK_UNAVAILABLE_MESSAGE, } from '../utils/SynapseConstants' -import { PaginatedResults } from '@sage-bionetworks/synapse-types' -import UniversalCookies from 'universal-cookie' import * as SynapseClientUtils from './SynapseClientUtils' import * as HttpClient from './HttpClient' +import SynapseClient, { FunctionReturningPaginatedResults } from './index' const isOutsideSynapseOrgSpy = jest.spyOn( SynapseClientUtils, diff --git a/packages/synapse-react-client/src/synapse-client/SynapseClient.ts b/packages/synapse-react-client/src/synapse-client/SynapseClient.ts index 0303f3adbb..4144f9d92a 100644 --- a/packages/synapse-react-client/src/synapse-client/SynapseClient.ts +++ b/packages/synapse-react-client/src/synapse-client/SynapseClient.ts @@ -1,89 +1,5 @@ -import { JSONSchema7 } from 'json-schema' import SparkMD5 from 'spark-md5' import UniversalCookies from 'universal-cookie' -import { ACCESS_TOKEN_COOKIE_KEY, SynapseConstants } from '../utils' -import { - ACCESS_APPROVAL, - ACCESS_APPROVAL_BY_ID, - ACCESS_REQUEST_SUBMISSION_SEARCH, - ACCESS_REQUIREMENT_ACL, - ACCESS_REQUIREMENT_BY_ID, - ACCESS_REQUIREMENT_DATA_ACCESS_REQUEST_FOR_UPDATE, - ACCESS_REQUIREMENT_RESEARCH_PROJECT_FOR_UPDATE, - ACCESS_REQUIREMENT_SEARCH, - ACCESS_REQUIREMENT_STATUS, - ACCESS_REQUIREMENT_WIKI_PAGE_KEY, - ACTIVITY_FOR_ENTITY, - ALIAS_AVAILABLE, - APPROVED_SUBMISSION_INFO, - ASYNCHRONOUS_JOB_TOKEN, - BIND_INVITATION_TO_AUTHENTICATED_USER, - DATA_ACCESS_REQUEST, - DATA_ACCESS_REQUEST_SUBMISSION, - DATA_ACCESS_SUBMISSION_BY_ID, - DOI_ASSOCIATION, - ENTITY, - ENTITY_ACCESS, - ENTITY_ACCESS_REQUIREMENTS, - ENTITY_ACL, - ENTITY_ACTIONS_REQUIRED, - ENTITY_ALIAS, - ENTITY_BUNDLE_V2, - ENTITY_EVALUATION, - ENTITY_HEADERS, - ENTITY_ID, - ENTITY_JSON, - ENTITY_PATH, - ENTITY_PERMISSIONS, - ENTITY_SCHEMA_BINDING, - ENTITY_SCHEMA_VALIDATION, - EVALUATION, - EVALUATION_BY_ID, - EVALUATIONS_BY_ID, - FAVORITES, - FILE_HANDLE_BATCH, - FORUM, - FORUM_THREAD, - INVITEE_VERIFICATION_SIGNED_TOKEN, - MEMBERSHIP_INVITATION, - NOTIFICATION_EMAIL, - PROFILE_IMAGE_PREVIEW, - PROJECTS, - REGISTER_ACCOUNT_STEP_1, - REGISTER_ACCOUNT_STEP_2, - REGISTERED_SCHEMA_ID, - REPO, - RESEARCH_PROJECT, - SCHEMA_VALIDATION_GET, - SCHEMA_VALIDATION_START, - SIGN_TERMS_OF_USE, - TABLE_QUERY_ASYNC_GET, - TABLE_QUERY_ASYNC_START, - TEAM, - TEAM_ID_MEMBER_ID, - TEAM_ID_MEMBER_ID_WITH_NOTIFICATION, - TEAM_MEMBER, - TEAM_MEMBERS, - THREAD, - THREAD_ID, - TRASHCAN_PURGE, - TRASHCAN_RESTORE, - TRASHCAN_VIEW, - USER_BUNDLE, - USER_GROUP_HEADERS, - USER_GROUP_HEADERS_BATCH, - USER_ID_BUNDLE, - USER_PROFILE, - USER_PROFILE_ID, - VERIFICATION_SUBMISSION, -} from '../utils/APIConstants' -import { dispatchDownloadListChangeEvent } from '../utils/functions/dispatchDownloadListChangeEvent' -import { - BackendDestinationEnum, - getEndpoint, -} from '../utils/functions/getEndpoint' -import { removeUndefined } from '../utils/functions/ObjectUtils' -import { DATETIME_UTC_COOKIE_KEY } from '../utils/SynapseConstants' import { ACCESS_TYPE, AccessApproval, @@ -281,6 +197,89 @@ import { WikiPage, WikiPageKey, } from '@sage-bionetworks/synapse-types' +import { ACCESS_TOKEN_COOKIE_KEY, SynapseConstants } from '../utils' +import { + ACCESS_APPROVAL, + ACCESS_APPROVAL_BY_ID, + ACCESS_REQUEST_SUBMISSION_SEARCH, + ACCESS_REQUIREMENT_ACL, + ACCESS_REQUIREMENT_BY_ID, + ACCESS_REQUIREMENT_DATA_ACCESS_REQUEST_FOR_UPDATE, + ACCESS_REQUIREMENT_RESEARCH_PROJECT_FOR_UPDATE, + ACCESS_REQUIREMENT_SEARCH, + ACCESS_REQUIREMENT_STATUS, + ACCESS_REQUIREMENT_WIKI_PAGE_KEY, + ACTIVITY_FOR_ENTITY, + ALIAS_AVAILABLE, + APPROVED_SUBMISSION_INFO, + ASYNCHRONOUS_JOB_TOKEN, + BIND_INVITATION_TO_AUTHENTICATED_USER, + DATA_ACCESS_REQUEST, + DATA_ACCESS_REQUEST_SUBMISSION, + DATA_ACCESS_SUBMISSION_BY_ID, + DOI_ASSOCIATION, + ENTITY, + ENTITY_ACCESS, + ENTITY_ACCESS_REQUIREMENTS, + ENTITY_ACL, + ENTITY_ACTIONS_REQUIRED, + ENTITY_ALIAS, + ENTITY_BUNDLE_V2, + ENTITY_EVALUATION, + ENTITY_HEADERS, + ENTITY_ID, + ENTITY_JSON, + ENTITY_PATH, + ENTITY_PERMISSIONS, + ENTITY_SCHEMA_BINDING, + ENTITY_SCHEMA_VALIDATION, + EVALUATION, + EVALUATION_BY_ID, + EVALUATIONS_BY_ID, + FAVORITES, + FILE_HANDLE_BATCH, + FORUM, + FORUM_THREAD, + INVITEE_VERIFICATION_SIGNED_TOKEN, + MEMBERSHIP_INVITATION, + NOTIFICATION_EMAIL, + PROFILE_IMAGE_PREVIEW, + PROJECTS, + REGISTER_ACCOUNT_STEP_1, + REGISTER_ACCOUNT_STEP_2, + REGISTERED_SCHEMA_ID, + REPO, + RESEARCH_PROJECT, + SCHEMA_VALIDATION_GET, + SCHEMA_VALIDATION_START, + SIGN_TERMS_OF_USE, + TABLE_QUERY_ASYNC_GET, + TABLE_QUERY_ASYNC_START, + TEAM, + TEAM_ID_MEMBER_ID, + TEAM_ID_MEMBER_ID_WITH_NOTIFICATION, + TEAM_MEMBER, + TEAM_MEMBERS, + THREAD, + THREAD_ID, + TRASHCAN_PURGE, + TRASHCAN_RESTORE, + TRASHCAN_VIEW, + USER_BUNDLE, + USER_GROUP_HEADERS, + USER_GROUP_HEADERS_BATCH, + USER_ID_BUNDLE, + USER_PROFILE, + USER_PROFILE_ID, + VERIFICATION_SUBMISSION, +} from '../utils/APIConstants' +import { dispatchDownloadListChangeEvent } from '../utils/functions/dispatchDownloadListChangeEvent' +import { + BackendDestinationEnum, + getEndpoint, +} from '../utils/functions/getEndpoint' +import { removeUndefined } from '../utils/functions/ObjectUtils' +import { DATETIME_UTC_COOKIE_KEY } from '../utils/SynapseConstants' import { calculateFriendlyFileSize } from '../utils/functions/calculateFriendlyFileSize' import { allowNotFoundError, @@ -288,6 +287,7 @@ import { returnIfTwoFactorAuthError, } from './SynapseClientUtils' import { delay, doDelete, doGet, doPost, doPut } from './HttpClient' +import type { JSONSchema7 } from 'json-schema' const cookies = new UniversalCookies() diff --git a/packages/synapse-react-client/src/synapse-client/SynapseClientUtils.test.ts b/packages/synapse-react-client/src/synapse-client/SynapseClientUtils.test.ts index 132d69a82e..944e9ad58c 100644 --- a/packages/synapse-react-client/src/synapse-client/SynapseClientUtils.test.ts +++ b/packages/synapse-react-client/src/synapse-client/SynapseClientUtils.test.ts @@ -1,12 +1,12 @@ -import { - returnIfTwoFactorAuthError, - allowNotFoundError, -} from './SynapseClientUtils' -import { SynapseClientError } from '../utils/SynapseClientError' import { ErrorResponseCode, TwoFactorAuthErrorResponse, } from '@sage-bionetworks/synapse-types' +import { SynapseClientError } from '../utils/SynapseClientError' +import { + returnIfTwoFactorAuthError, + allowNotFoundError, +} from './SynapseClientUtils' describe('SynapseClientUtils', () => { describe('allowNotFoundError', () => { diff --git a/packages/synapse-react-client/src/synapse-queries/dataaccess/useAccessApprovals.ts b/packages/synapse-react-client/src/synapse-queries/dataaccess/useAccessApprovals.ts index 028afd2f1c..b82408a53c 100644 --- a/packages/synapse-react-client/src/synapse-queries/dataaccess/useAccessApprovals.ts +++ b/packages/synapse-react-client/src/synapse-queries/dataaccess/useAccessApprovals.ts @@ -1,11 +1,11 @@ import { useInfiniteQuery, UseInfiniteQueryOptions } from 'react-query' -import SynapseClient from '../../synapse-client' -import { SynapseClientError } from '../../utils/SynapseClientError' -import { useSynapseContext } from '../../utils/context/SynapseContext' import { AccessApprovalSearchRequest, AccessApprovalSearchResponse, } from '@sage-bionetworks/synapse-types' +import SynapseClient from '../../synapse-client' +import { SynapseClientError } from '../../utils/SynapseClientError' +import { useSynapseContext } from '../../utils/context/SynapseContext' export function useSearchAccessApprovalsInfinite( params: AccessApprovalSearchRequest, diff --git a/packages/synapse-react-client/src/synapse-queries/dataaccess/useAccessRequirements.ts b/packages/synapse-react-client/src/synapse-queries/dataaccess/useAccessRequirements.ts index 5b610007c8..6a7d7c53fc 100644 --- a/packages/synapse-react-client/src/synapse-queries/dataaccess/useAccessRequirements.ts +++ b/packages/synapse-react-client/src/synapse-queries/dataaccess/useAccessRequirements.ts @@ -7,9 +7,6 @@ import { useQueryClient, UseQueryOptions, } from 'react-query' -import SynapseClient from '../../synapse-client' -import { SynapseClientError } from '../../utils/SynapseClientError' -import { useSynapseContext } from '../../utils/context/SynapseContext' import { AccessApproval, AccessControlList, @@ -22,12 +19,13 @@ import { RestrictionInformationRequest, RestrictionInformationResponse, WikiPageKey, -} from '@sage-bionetworks/synapse-types' -import { AccessRequirementSearchRequest, AccessRequirementSearchResponse, + ResearchProject, } from '@sage-bionetworks/synapse-types' -import { ResearchProject } from '@sage-bionetworks/synapse-types' +import SynapseClient from '../../synapse-client' +import { SynapseClientError } from '../../utils/SynapseClientError' +import { useSynapseContext } from '../../utils/context/SynapseContext' import { sortAccessRequirementsByCompletion } from '../../components/AccessRequirementList/AccessRequirementListUtils' export function useGetAccessRequirements( diff --git a/packages/synapse-react-client/src/synapse-queries/dataaccess/useDataAccessSubmission.ts b/packages/synapse-react-client/src/synapse-queries/dataaccess/useDataAccessSubmission.ts index 27989cfd7a..a6b14bda9d 100644 --- a/packages/synapse-react-client/src/synapse-queries/dataaccess/useDataAccessSubmission.ts +++ b/packages/synapse-react-client/src/synapse-queries/dataaccess/useDataAccessSubmission.ts @@ -7,19 +7,17 @@ import { useQueryClient, UseQueryOptions, } from 'react-query' -import SynapseClient from '../../synapse-client' -import { SynapseClientError } from '../../utils/SynapseClientError' -import { useSynapseContext } from '../../utils/context/SynapseContext' -import { Submission } from '@sage-bionetworks/synapse-types' -import { SubmissionStateChangeRequest } from '@sage-bionetworks/synapse-types' import { + Submission, + SubmissionStateChangeRequest, SubmissionSearchRequest, SubmissionSearchResponse, -} from '@sage-bionetworks/synapse-types' -import { ACTSubmissionStatus, CreateSubmissionRequest, } from '@sage-bionetworks/synapse-types' +import SynapseClient from '../../synapse-client' +import { SynapseClientError } from '../../utils/SynapseClientError' +import { useSynapseContext } from '../../utils/context/SynapseContext' export default function useGetDataAccessSubmission( submissionId: string | number, diff --git a/packages/synapse-react-client/src/synapse-queries/dataaccess/useGetApprovedSubmissionInfo.ts b/packages/synapse-react-client/src/synapse-queries/dataaccess/useGetApprovedSubmissionInfo.ts index ebc5ed6858..409c59babb 100644 --- a/packages/synapse-react-client/src/synapse-queries/dataaccess/useGetApprovedSubmissionInfo.ts +++ b/packages/synapse-react-client/src/synapse-queries/dataaccess/useGetApprovedSubmissionInfo.ts @@ -1,11 +1,11 @@ import { useInfiniteQuery, UseInfiniteQueryOptions } from 'react-query' -import SynapseClient from '../../synapse-client' -import { SynapseClientError } from '../../utils/SynapseClientError' -import { useSynapseContext } from '../../utils/context/SynapseContext' import { SubmissionInfoPage, SubmissionInfoPageRequest, } from '@sage-bionetworks/synapse-types' +import SynapseClient from '../../synapse-client' +import { SynapseClientError } from '../../utils/SynapseClientError' +import { useSynapseContext } from '../../utils/context/SynapseContext' export function useGetApprovedSubmissionInfoInfinite( accessRequirementId: string, diff --git a/packages/synapse-react-client/src/synapse-queries/docker/useGetDockerTag.ts b/packages/synapse-react-client/src/synapse-queries/docker/useGetDockerTag.ts index c2c34cc1ff..da015e4e12 100644 --- a/packages/synapse-react-client/src/synapse-queries/docker/useGetDockerTag.ts +++ b/packages/synapse-react-client/src/synapse-queries/docker/useGetDockerTag.ts @@ -1,12 +1,12 @@ import { useQuery, UseQueryOptions } from 'react-query' -import SynapseClient from '../../synapse-client' -import { SynapseClientError } from '../../utils/SynapseClientError' import { Direction, DockerCommit, PaginatedResults, SortBy, } from '@sage-bionetworks/synapse-types' +import SynapseClient from '../../synapse-client' +import { SynapseClientError } from '../../utils/SynapseClientError' import { useSynapseContext } from '../../utils' export function useGetDockerTags( diff --git a/packages/synapse-react-client/src/synapse-queries/download/useDownloadList.ts b/packages/synapse-react-client/src/synapse-queries/download/useDownloadList.ts index 5dad588cf9..db34c59b4b 100644 --- a/packages/synapse-react-client/src/synapse-queries/download/useDownloadList.ts +++ b/packages/synapse-react-client/src/synapse-queries/download/useDownloadList.ts @@ -5,6 +5,10 @@ import { AvailableFilesRequest, AvailableFilter, Sort, + ActionRequiredResponse, + AvailableFilesResponse, + FilesStatisticsResponse, + AddBatchOfFilesToDownloadListResponse, } from '@sage-bionetworks/synapse-types' import { useInfiniteQuery, @@ -15,15 +19,9 @@ import { useQueryClient, UseQueryOptions, } from 'react-query' -import { - ActionRequiredResponse, - AvailableFilesResponse, - FilesStatisticsResponse, -} from '@sage-bionetworks/synapse-types' import { SynapseClientError } from '../../utils/SynapseClientError' import { useSynapseContext } from '../../utils/context/SynapseContext' import SynapseClient from '../../synapse-client' -import { AddBatchOfFilesToDownloadListResponse } from '@sage-bionetworks/synapse-types' export function useGetAvailableFilesToDownload( request: AvailableFilesRequest, diff --git a/packages/synapse-react-client/src/synapse-queries/entity/useActionsRequiredForTableQuery.ts b/packages/synapse-react-client/src/synapse-queries/entity/useActionsRequiredForTableQuery.ts index 8f074e87d0..ec3febc3b5 100644 --- a/packages/synapse-react-client/src/synapse-queries/entity/useActionsRequiredForTableQuery.ts +++ b/packages/synapse-react-client/src/synapse-queries/entity/useActionsRequiredForTableQuery.ts @@ -7,11 +7,11 @@ import { } from '@sage-bionetworks/synapse-types' import { useMemo } from 'react' import { cloneDeep } from 'lodash-es' +import { UseQueryOptions } from 'react-query' import { getFileColumnModelId } from '../../components/SynapseTable/SynapseTableUtils' import { SynapseConstants } from '../../utils' -import { useGetQueryResultBundleWithAsyncStatus } from './useGetQueryResultBundle' -import { UseQueryOptions } from 'react-query' import { SynapseClientError } from '../../utils/SynapseClientError' +import { useGetQueryResultBundleWithAsyncStatus } from './useGetQueryResultBundle' export function useGetActionsRequiredForTableQuery( queryBundleRequest: QueryBundleRequest, diff --git a/packages/synapse-react-client/src/synapse-queries/entity/useEntity.ts b/packages/synapse-react-client/src/synapse-queries/entity/useEntity.ts index 437f1ccfbe..a6d0a2d4d1 100644 --- a/packages/synapse-react-client/src/synapse-queries/entity/useEntity.ts +++ b/packages/synapse-react-client/src/synapse-queries/entity/useEntity.ts @@ -16,10 +16,6 @@ import { useQueryClient, UseQueryOptions, } from 'react-query' -import SynapseClient from '../../synapse-client' -import { entityJsonKeys } from '../../utils/functions/EntityTypeUtils' -import { SynapseClientError } from '../../utils/SynapseClientError' -import { useSynapseContext } from '../../utils/context/SynapseContext' import { AccessControlList, Entity, @@ -33,6 +29,10 @@ import { UserEntityPermissions, VersionInfo, } from '@sage-bionetworks/synapse-types' +import SynapseClient from '../../synapse-client' +import { entityJsonKeys } from '../../utils/functions/EntityTypeUtils' +import { SynapseClientError } from '../../utils/SynapseClientError' +import { useSynapseContext } from '../../utils/context/SynapseContext' import { invalidateAllQueriesForEntity } from '../QueryClientUtils' export function useGetEntity( diff --git a/packages/synapse-react-client/src/synapse-queries/entity/useEntityBoundSchema.ts b/packages/synapse-react-client/src/synapse-queries/entity/useEntityBoundSchema.ts index 1824317e2d..ba0d88490c 100644 --- a/packages/synapse-react-client/src/synapse-queries/entity/useEntityBoundSchema.ts +++ b/packages/synapse-react-client/src/synapse-queries/entity/useEntityBoundSchema.ts @@ -1,9 +1,11 @@ import { UseQueryOptions, useQuery } from 'react-query' +import { + JsonSchemaObjectBinding, + ValidationResults, +} from '@sage-bionetworks/synapse-types' import SynapseClient from '../../synapse-client' import { SynapseClientError } from '../../utils/SynapseClientError' import { useSynapseContext } from '../../utils/context/SynapseContext' -import { JsonSchemaObjectBinding } from '@sage-bionetworks/synapse-types' -import { ValidationResults } from '@sage-bionetworks/synapse-types' export function useGetSchemaBinding( entityId: string, diff --git a/packages/synapse-react-client/src/synapse-queries/entity/useEntityBundle.test.tsx b/packages/synapse-react-client/src/synapse-queries/entity/useEntityBundle.test.tsx index e81488026c..302386875b 100644 --- a/packages/synapse-react-client/src/synapse-queries/entity/useEntityBundle.test.tsx +++ b/packages/synapse-react-client/src/synapse-queries/entity/useEntityBundle.test.tsx @@ -1,10 +1,10 @@ import { renderHook, waitFor } from '@testing-library/react' -import useGetEntityBundle from './useEntityBundle' import { EntityBundle } from '@sage-bionetworks/synapse-types' import { MOCK_CONTEXT_VALUE } from '../../mocks/MockSynapseContext' import { createWrapper } from '../../testutils/TestingLibraryUtils' import SynapseClient from '../../synapse-client' import mockFileEntity from '../../mocks/entity/mockFileEntity' +import useGetEntityBundle from './useEntityBundle' const expected: EntityBundle = mockFileEntity.bundle diff --git a/packages/synapse-react-client/src/synapse-queries/entity/useEntityBundle.ts b/packages/synapse-react-client/src/synapse-queries/entity/useEntityBundle.ts index 0af28327ce..464955dbee 100644 --- a/packages/synapse-react-client/src/synapse-queries/entity/useEntityBundle.ts +++ b/packages/synapse-react-client/src/synapse-queries/entity/useEntityBundle.ts @@ -1,12 +1,12 @@ import { useQuery, UseQueryOptions } from 'react-query' -import SynapseClient from '../../synapse-client' -import { SynapseClientError } from '../../utils/SynapseClientError' -import { useSynapseContext } from '../../utils/context/SynapseContext' import { ALL_ENTITY_BUNDLE_FIELDS, EntityBundle, EntityBundleRequest, } from '@sage-bionetworks/synapse-types' +import SynapseClient from '../../synapse-client' +import { SynapseClientError } from '../../utils/SynapseClientError' +import { useSynapseContext } from '../../utils/context/SynapseContext' export function useGetEntityBundle< T extends EntityBundleRequest = typeof ALL_ENTITY_BUNDLE_FIELDS, diff --git a/packages/synapse-react-client/src/synapse-queries/entity/useExportToCavatica.test.tsx b/packages/synapse-react-client/src/synapse-queries/entity/useExportToCavatica.test.tsx index 202c93e939..5248bd66e0 100644 --- a/packages/synapse-react-client/src/synapse-queries/entity/useExportToCavatica.test.tsx +++ b/packages/synapse-react-client/src/synapse-queries/entity/useExportToCavatica.test.tsx @@ -1,15 +1,15 @@ import { renderHook, waitFor } from '@testing-library/react' -import { useExportToCavatica } from './useExportToCavatica' -import { SynapseClient, SynapseConstants } from '../../index' import { ColumnTypeEnum, DownloadFromTableResult, QueryBundleRequest, SelectColumn, } from '@sage-bionetworks/synapse-types' +import { SynapseClient, SynapseConstants } from '../../index' import { DEFAULT_PAGE_SIZE } from '../../utils/SynapseConstants' import { SynapseError } from '../../utils/SynapseError' import * as ToastMessage from '../../components/ToastMessage/ToastMessage' +import { useExportToCavatica } from './useExportToCavatica' window.open = jest.fn() const mockToastFn = jest diff --git a/packages/synapse-react-client/src/synapse-queries/entity/useExportToCavatica.ts b/packages/synapse-react-client/src/synapse-queries/entity/useExportToCavatica.ts index 75164ee43f..b70f035cb4 100644 --- a/packages/synapse-react-client/src/synapse-queries/entity/useExportToCavatica.ts +++ b/packages/synapse-react-client/src/synapse-queries/entity/useExportToCavatica.ts @@ -1,12 +1,12 @@ -import SynapseClient from '../../synapse-client' -import { displayToast } from '../../components/ToastMessage/ToastMessage' -import { parseEntityIdFromSqlStatement } from '../../utils/functions/SqlFunctions' -import { useSynapseContext } from '../../utils/context/SynapseContext' import { DownloadFromTableRequest, QueryBundleRequest, SelectColumn, } from '@sage-bionetworks/synapse-types' +import SynapseClient from '../../synapse-client' +import { displayToast } from '../../components/ToastMessage/ToastMessage' +import { parseEntityIdFromSqlStatement } from '../../utils/functions/SqlFunctions' +import { useSynapseContext } from '../../utils/context/SynapseContext' export function useExportToCavatica( queryBundleRequest: QueryBundleRequest, diff --git a/packages/synapse-react-client/src/synapse-queries/entity/useGetEntityActionsRequired.ts b/packages/synapse-react-client/src/synapse-queries/entity/useGetEntityActionsRequired.ts index ccfafc7ea6..af70eaef02 100644 --- a/packages/synapse-react-client/src/synapse-queries/entity/useGetEntityActionsRequired.ts +++ b/packages/synapse-react-client/src/synapse-queries/entity/useGetEntityActionsRequired.ts @@ -1,8 +1,8 @@ import { useQuery, UseQueryOptions } from 'react-query' +import { ActionRequiredList } from '@sage-bionetworks/synapse-types' import SynapseClient from '../../synapse-client' import { SynapseClientError } from '../../utils/SynapseClientError' import { useSynapseContext } from '../../utils/context' -import { ActionRequiredList } from '@sage-bionetworks/synapse-types' export function useGetEntityActionsRequired( entityId: string, diff --git a/packages/synapse-react-client/src/synapse-queries/entity/useGetEntityChallenge.ts b/packages/synapse-react-client/src/synapse-queries/entity/useGetEntityChallenge.ts index a946b95b69..b8bbc72045 100644 --- a/packages/synapse-react-client/src/synapse-queries/entity/useGetEntityChallenge.ts +++ b/packages/synapse-react-client/src/synapse-queries/entity/useGetEntityChallenge.ts @@ -1,6 +1,6 @@ import { UseQueryOptions, useQuery } from 'react-query' -import SynapseClient from '../../synapse-client' import { Challenge } from '@sage-bionetworks/synapse-types' +import SynapseClient from '../../synapse-client' import { SynapseClientError } from '../../utils/SynapseClientError' import { useSynapseContext } from '../../utils' diff --git a/packages/synapse-react-client/src/synapse-queries/entity/useGetEntityChildren.test.ts b/packages/synapse-react-client/src/synapse-queries/entity/useGetEntityChildren.test.ts index cd2849f96f..356536526a 100644 --- a/packages/synapse-react-client/src/synapse-queries/entity/useGetEntityChildren.test.ts +++ b/packages/synapse-react-client/src/synapse-queries/entity/useGetEntityChildren.test.ts @@ -1,8 +1,4 @@ import { act, renderHook, waitFor } from '@testing-library/react' -import { - useGetEntityChildren, - useGetEntityChildrenInfinite, -} from './useGetEntityChildren' import { EntityChildrenRequest, EntityChildrenResponse, @@ -11,6 +7,10 @@ import { import { MOCK_CONTEXT_VALUE } from '../../mocks/MockSynapseContext' import { createWrapper } from '../../testutils/TestingLibraryUtils' import SynapseClient from '../../synapse-client' +import { + useGetEntityChildren, + useGetEntityChildrenInfinite, +} from './useGetEntityChildren' const request: EntityChildrenRequest = { parentId: 'syn123', diff --git a/packages/synapse-react-client/src/synapse-queries/entity/useGetEntityChildren.ts b/packages/synapse-react-client/src/synapse-queries/entity/useGetEntityChildren.ts index 0780b3cafe..4e392173fd 100644 --- a/packages/synapse-react-client/src/synapse-queries/entity/useGetEntityChildren.ts +++ b/packages/synapse-react-client/src/synapse-queries/entity/useGetEntityChildren.ts @@ -6,13 +6,13 @@ import { useQuery, UseQueryOptions, } from 'react-query' -import SynapseClient from '../../synapse-client' -import { SynapseClientError } from '../../utils/SynapseClientError' -import { useSynapseContext } from '../../utils/context/SynapseContext' import { EntityChildrenRequest, EntityChildrenResponse, } from '@sage-bionetworks/synapse-types' +import SynapseClient from '../../synapse-client' +import { SynapseClientError } from '../../utils/SynapseClientError' +import { useSynapseContext } from '../../utils/context/SynapseContext' export function useGetEntityChildren( request: EntityChildrenRequest, diff --git a/packages/synapse-react-client/src/synapse-queries/entity/useGetEntityForum.ts b/packages/synapse-react-client/src/synapse-queries/entity/useGetEntityForum.ts index 2ee538d40d..ca4648cf56 100644 --- a/packages/synapse-react-client/src/synapse-queries/entity/useGetEntityForum.ts +++ b/packages/synapse-react-client/src/synapse-queries/entity/useGetEntityForum.ts @@ -1,8 +1,8 @@ import { UseQueryOptions, useQuery } from 'react-query' +import { Forum } from '@sage-bionetworks/synapse-types' import SynapseClient from '../../synapse-client' import { SynapseClientError } from '../../utils/SynapseClientError' import { useSynapseContext } from '../../utils' -import { Forum } from '@sage-bionetworks/synapse-types' export function useGetEntityForum( entityId: string, diff --git a/packages/synapse-react-client/src/synapse-queries/entity/useGetEntityHeaders.test.tsx b/packages/synapse-react-client/src/synapse-queries/entity/useGetEntityHeaders.test.tsx index 64837fccef..71e6b4430b 100644 --- a/packages/synapse-react-client/src/synapse-queries/entity/useGetEntityHeaders.test.tsx +++ b/packages/synapse-react-client/src/synapse-queries/entity/useGetEntityHeaders.test.tsx @@ -1,5 +1,4 @@ import { renderHook, waitFor } from '@testing-library/react' -import { useGetEntityHeaders } from './useGetEntityHeaders' import { EntityHeader, PaginatedResults, @@ -8,6 +7,7 @@ import { import { MOCK_CONTEXT_VALUE } from '../../mocks/MockSynapseContext' import { createWrapper } from '../../testutils/TestingLibraryUtils' import SynapseClient from '../../synapse-client' +import { useGetEntityHeaders } from './useGetEntityHeaders' const expected: PaginatedResults = { results: [ diff --git a/packages/synapse-react-client/src/synapse-queries/entity/useGetEntityHeaders.ts b/packages/synapse-react-client/src/synapse-queries/entity/useGetEntityHeaders.ts index b4c72e45fb..e9c1df0bd7 100644 --- a/packages/synapse-react-client/src/synapse-queries/entity/useGetEntityHeaders.ts +++ b/packages/synapse-react-client/src/synapse-queries/entity/useGetEntityHeaders.ts @@ -1,13 +1,13 @@ import { useQuery, useQueryClient, UseQueryOptions } from 'react-query' -import SynapseClient from '../../synapse-client' -import { SynapseClientError } from '../../utils/SynapseClientError' -import { useSynapseContext } from '../../utils/context/SynapseContext' import { EntityHeader, PaginatedResults, Reference, ReferenceList, } from '@sage-bionetworks/synapse-types' +import SynapseClient from '../../synapse-client' +import { SynapseClientError } from '../../utils/SynapseClientError' +import { useSynapseContext } from '../../utils/context/SynapseContext' export function useGetEntityHeaders( references: ReferenceList, diff --git a/packages/synapse-react-client/src/synapse-queries/entity/useGetQueryResultBundle.test.tsx b/packages/synapse-react-client/src/synapse-queries/entity/useGetQueryResultBundle.test.tsx index d7bc5e3db2..1acee41335 100644 --- a/packages/synapse-react-client/src/synapse-queries/entity/useGetQueryResultBundle.test.tsx +++ b/packages/synapse-react-client/src/synapse-queries/entity/useGetQueryResultBundle.test.tsx @@ -1,14 +1,4 @@ import { renderHook, waitFor } from '@testing-library/react' -import SynapseClient from '../../synapse-client' -import { createWrapper } from '../../testutils/TestingLibraryUtils' -import useGetQueryResultBundle, { - useGetQueryResultBundleWithAsyncStatus, -} from './useGetQueryResultBundle' -import { SynapseClientError } from '../../utils/SynapseClientError' -import { - BUNDLE_MASK_QUERY_COUNT, - BUNDLE_MASK_QUERY_RESULTS, -} from '../../utils/SynapseConstants' import { AsynchJobState, AsynchronousJobStatus, @@ -16,8 +6,18 @@ import { QueryBundleRequest, QueryResultBundle, } from '@sage-bionetworks/synapse-types' +import SynapseClient from '../../synapse-client' +import { createWrapper } from '../../testutils/TestingLibraryUtils' +import { SynapseClientError } from '../../utils/SynapseClientError' +import { + BUNDLE_MASK_QUERY_COUNT, + BUNDLE_MASK_QUERY_RESULTS, +} from '../../utils/SynapseConstants' import { MOCK_CONTEXT_VALUE } from '../../mocks/MockSynapseContext' import { MOCK_USER_ID } from '../../mocks/user/mock_user_profile' +import useGetQueryResultBundle, { + useGetQueryResultBundleWithAsyncStatus, +} from './useGetQueryResultBundle' let request: QueryBundleRequest diff --git a/packages/synapse-react-client/src/synapse-queries/entity/useGetQueryResultBundle.ts b/packages/synapse-react-client/src/synapse-queries/entity/useGetQueryResultBundle.ts index 3df6f04b1b..c44d16ae66 100644 --- a/packages/synapse-react-client/src/synapse-queries/entity/useGetQueryResultBundle.ts +++ b/packages/synapse-react-client/src/synapse-queries/entity/useGetQueryResultBundle.ts @@ -9,6 +9,11 @@ import { UseQueryOptions, UseQueryResult, } from 'react-query' +import { + AsynchronousJobStatus, + QueryBundleRequest, + QueryResultBundle, +} from '@sage-bionetworks/synapse-types' import SynapseClient from '../../synapse-client' import { SynapseClientError } from '../../utils/SynapseClientError' import { @@ -16,11 +21,6 @@ import { DEFAULT_PAGE_SIZE, } from '../../utils/SynapseConstants' import { useSynapseContext } from '../../utils/context/SynapseContext' -import { - AsynchronousJobStatus, - QueryBundleRequest, - QueryResultBundle, -} from '@sage-bionetworks/synapse-types' const sharedQueryDefaults = { staleTime: 1000 * 60 * 30, // 30 minutes diff --git a/packages/synapse-react-client/src/synapse-queries/entity/useSchema.ts b/packages/synapse-react-client/src/synapse-queries/entity/useSchema.ts index c8ffeabd0e..06a3c95db5 100644 --- a/packages/synapse-react-client/src/synapse-queries/entity/useSchema.ts +++ b/packages/synapse-react-client/src/synapse-queries/entity/useSchema.ts @@ -2,11 +2,11 @@ * Hooks for accessing services related to JSON Schemas in the Synapse REST API */ -import { JSONSchema7 } from 'json-schema' import { useQuery, UseQueryOptions } from 'react-query' import SynapseClient from '../../synapse-client' import { SynapseClientError } from '../../utils/SynapseClientError' import { useSynapseContext } from '../../utils/context/SynapseContext' +import type { JSONSchema7 } from 'json-schema' export function useGetSchema( schema$id: string, diff --git a/packages/synapse-react-client/src/synapse-queries/file/useFiles.ts b/packages/synapse-react-client/src/synapse-queries/file/useFiles.ts index 906edb9161..c5facc58ab 100644 --- a/packages/synapse-react-client/src/synapse-queries/file/useFiles.ts +++ b/packages/synapse-react-client/src/synapse-queries/file/useFiles.ts @@ -1,7 +1,4 @@ import { UseQueryOptions, useQuery, useQueryClient } from 'react-query' -import SynapseClient from '../../synapse-client' -import { SynapseClientError } from '../../utils/SynapseClientError' -import { useSynapseContext } from '../../utils/context/SynapseContext' import { BatchFileRequest, BatchFileResult, @@ -9,6 +6,9 @@ import { FileHandleAssociation, } from '@sage-bionetworks/synapse-types' import { cloneDeep } from 'lodash-es' +import SynapseClient from '../../synapse-client' +import { SynapseClientError } from '../../utils/SynapseClientError' +import { useSynapseContext } from '../../utils/context/SynapseContext' export function useGetPresignedUrlContent( fileHandle: FileHandle, diff --git a/packages/synapse-react-client/src/synapse-queries/file/useUploadDestination.ts b/packages/synapse-react-client/src/synapse-queries/file/useUploadDestination.ts index 05d3679057..f89c78ce69 100644 --- a/packages/synapse-react-client/src/synapse-queries/file/useUploadDestination.ts +++ b/packages/synapse-react-client/src/synapse-queries/file/useUploadDestination.ts @@ -1,7 +1,7 @@ import { UseQueryOptions, useQuery } from 'react-query' +import { UploadDestination } from '@sage-bionetworks/synapse-types' import { SynapseClientError } from '../../utils/SynapseClientError' import { useSynapseContext } from '../../utils/context/SynapseContext' -import { UploadDestination } from '@sage-bionetworks/synapse-types' import { getDefaultUploadDestination } from '../../synapse-client/SynapseClient' export function useGetDefaultUploadDestination( diff --git a/packages/synapse-react-client/src/synapse-queries/forum/useForum.ts b/packages/synapse-react-client/src/synapse-queries/forum/useForum.ts index bcba6a0a48..27b718edc4 100644 --- a/packages/synapse-react-client/src/synapse-queries/forum/useForum.ts +++ b/packages/synapse-react-client/src/synapse-queries/forum/useForum.ts @@ -4,16 +4,17 @@ import { UseQueryOptions, useQuery, } from 'react-query' -import SynapseClient from '../../synapse-client' -import { SynapseClientError } from '../../utils/SynapseClientError' -import { useSynapseContext } from '../../utils' -import { Forum, PaginatedResults } from '@sage-bionetworks/synapse-types' import { + Forum, + PaginatedResults, DiscussionFilter, DiscussionThreadBundle, DiscussionThreadOrder, + PaginatedIds, } from '@sage-bionetworks/synapse-types' -import { PaginatedIds } from '@sage-bionetworks/synapse-types' +import SynapseClient from '../../synapse-client' +import { SynapseClientError } from '../../utils/SynapseClientError' +import { useSynapseContext } from '../../utils' export function useGetModerators( forumId: string, diff --git a/packages/synapse-react-client/src/synapse-queries/forum/useReply.ts b/packages/synapse-react-client/src/synapse-queries/forum/useReply.ts index 329b1fe49b..d958ba4fcd 100644 --- a/packages/synapse-react-client/src/synapse-queries/forum/useReply.ts +++ b/packages/synapse-react-client/src/synapse-queries/forum/useReply.ts @@ -7,18 +7,18 @@ import { UseQueryOptions, useQuery, } from 'react-query' -import SynapseClient from '../../synapse-client' -import { SynapseClientError } from '../../utils/SynapseClientError' -import { useSynapseContext } from '../../utils/context/SynapseContext' import { CreateDiscussionReply, DiscussionFilter, DiscussionReplyBundle, DiscussionReplyOrder, UpdateDiscussionReply, + PaginatedResults, + Match, } from '@sage-bionetworks/synapse-types' -import { PaginatedResults } from '@sage-bionetworks/synapse-types' -import { Match } from '@sage-bionetworks/synapse-types' +import SynapseClient from '../../synapse-client' +import { SynapseClientError } from '../../utils/SynapseClientError' +import { useSynapseContext } from '../../utils/context/SynapseContext' export function useGetRepliesInfinite( threadId: string, diff --git a/packages/synapse-react-client/src/synapse-queries/oauth/useOAuthClient.ts b/packages/synapse-react-client/src/synapse-queries/oauth/useOAuthClient.ts index 54eb8bf4f7..3415d2bd8c 100644 --- a/packages/synapse-react-client/src/synapse-queries/oauth/useOAuthClient.ts +++ b/packages/synapse-react-client/src/synapse-queries/oauth/useOAuthClient.ts @@ -5,10 +5,10 @@ import { UseMutationOptions, useQueryClient, } from 'react-query' +import { OAuthClient, OAuthClientList } from '@sage-bionetworks/synapse-types' import SynapseClient from '../../synapse-client' import { SynapseClientError } from '../../utils/SynapseClientError' import { useSynapseContext } from '../../utils/context/SynapseContext' -import { OAuthClient, OAuthClientList } from '@sage-bionetworks/synapse-types' export function useGetOAuthClientInfinite( options?: UseInfiniteQueryOptions, diff --git a/packages/synapse-react-client/src/synapse-queries/provenance/useGetActivityForEntity.ts b/packages/synapse-react-client/src/synapse-queries/provenance/useGetActivityForEntity.ts index d682e63fe4..50a01b96e5 100644 --- a/packages/synapse-react-client/src/synapse-queries/provenance/useGetActivityForEntity.ts +++ b/packages/synapse-react-client/src/synapse-queries/provenance/useGetActivityForEntity.ts @@ -1,8 +1,8 @@ import { useQuery, UseQueryOptions } from 'react-query' +import { Activity } from '@sage-bionetworks/synapse-types' import SynapseClient from '../../synapse-client' import { SynapseClientError } from '../../utils/SynapseClientError' import { useSynapseContext } from '../../utils/context/SynapseContext' -import { Activity } from '@sage-bionetworks/synapse-types' export function useGetActivityForEntity( entityId: string, diff --git a/packages/synapse-react-client/src/synapse-queries/search/useSearch.test.tsx b/packages/synapse-react-client/src/synapse-queries/search/useSearch.test.tsx index aa5f43c827..92941159b2 100644 --- a/packages/synapse-react-client/src/synapse-queries/search/useSearch.test.tsx +++ b/packages/synapse-react-client/src/synapse-queries/search/useSearch.test.tsx @@ -1,5 +1,4 @@ import { act, renderHook, waitFor } from '@testing-library/react' -import { useSearch, useSearchInfinite } from './useSearch' import { EntityType, SearchQuery, @@ -8,6 +7,7 @@ import { import { MOCK_CONTEXT_VALUE } from '../../mocks/MockSynapseContext' import { createWrapper } from '../../testutils/TestingLibraryUtils' import SynapseClient from '../../synapse-client' +import { useSearch, useSearchInfinite } from './useSearch' const request: SearchQuery = { queryTerm: ['search', 'terms'], diff --git a/packages/synapse-react-client/src/synapse-queries/search/useSearch.ts b/packages/synapse-react-client/src/synapse-queries/search/useSearch.ts index 058e3749a1..98c198710f 100644 --- a/packages/synapse-react-client/src/synapse-queries/search/useSearch.ts +++ b/packages/synapse-react-client/src/synapse-queries/search/useSearch.ts @@ -5,10 +5,10 @@ import { useQuery, UseQueryOptions, } from 'react-query' +import { SearchQuery, SearchResults } from '@sage-bionetworks/synapse-types' import SynapseClient from '../../synapse-client' import { SynapseClientError } from '../../utils/SynapseClientError' import { useSynapseContext } from '../../utils/context/SynapseContext' -import { SearchQuery, SearchResults } from '@sage-bionetworks/synapse-types' export function useSearch( query: SearchQuery, diff --git a/packages/synapse-react-client/src/synapse-queries/subscription/useSubscription.ts b/packages/synapse-react-client/src/synapse-queries/subscription/useSubscription.ts index 0ec0ac8194..584006bd01 100644 --- a/packages/synapse-react-client/src/synapse-queries/subscription/useSubscription.ts +++ b/packages/synapse-react-client/src/synapse-queries/subscription/useSubscription.ts @@ -20,10 +20,10 @@ import { useQueryClient, UseQueryOptions, } from 'react-query' +import { useCallback } from 'react' import { SynapseClientError } from '../../utils/SynapseClientError' import { useSynapseContext } from '../../utils' import SynapseClient from '../../synapse-client' -import { useCallback } from 'react' export function useGetSubscribers( topic: Topic, diff --git a/packages/synapse-react-client/src/synapse-queries/team/useTeam.ts b/packages/synapse-react-client/src/synapse-queries/team/useTeam.ts index 6a40e3d90b..24678c5893 100644 --- a/packages/synapse-react-client/src/synapse-queries/team/useTeam.ts +++ b/packages/synapse-react-client/src/synapse-queries/team/useTeam.ts @@ -1,8 +1,8 @@ import { useQuery, UseQueryOptions } from 'react-query' +import { Team } from '@sage-bionetworks/synapse-types' import SynapseClient from '../../synapse-client' import { SynapseClientError } from '../../utils/SynapseClientError' import { useSynapseContext } from '../../utils/context/SynapseContext' -import { Team } from '@sage-bionetworks/synapse-types' export function useGetTeam( teamId: string, diff --git a/packages/synapse-react-client/src/synapse-queries/team/useTeamList.ts b/packages/synapse-react-client/src/synapse-queries/team/useTeamList.ts index 4e39a1c1af..218434690b 100644 --- a/packages/synapse-react-client/src/synapse-queries/team/useTeamList.ts +++ b/packages/synapse-react-client/src/synapse-queries/team/useTeamList.ts @@ -1,12 +1,12 @@ import { useQuery, UseQueryOptions } from 'react-query' -import SynapseClient from '../../synapse-client' -import { SynapseClientError } from '../../utils/SynapseClientError' -import { useSynapseContext } from '../../utils/context/SynapseContext' import { ChallengeTeam, ListWrapper, Team, } from '@sage-bionetworks/synapse-types' +import SynapseClient from '../../synapse-client' +import { SynapseClientError } from '../../utils/SynapseClientError' +import { useSynapseContext } from '../../utils/context/SynapseContext' export function useGetTeamList( teamIds: string[] | number[], diff --git a/packages/synapse-react-client/src/synapse-queries/team/useTeamMembers.ts b/packages/synapse-react-client/src/synapse-queries/team/useTeamMembers.ts index a75d6316d8..dfe5e8a200 100644 --- a/packages/synapse-react-client/src/synapse-queries/team/useTeamMembers.ts +++ b/packages/synapse-react-client/src/synapse-queries/team/useTeamMembers.ts @@ -5,14 +5,14 @@ import { useQueryClient, UseQueryOptions, } from 'react-query' -import SynapseClient, { deleteMemberFromTeam } from '../../synapse-client' -import { SynapseClientError } from '../../utils/SynapseClientError' -import { useSynapseContext } from '../../utils/context/SynapseContext' import { PaginatedResults, TeamMembershipStatus, + TeamMember, } from '@sage-bionetworks/synapse-types' -import { TeamMember } from '@sage-bionetworks/synapse-types' +import SynapseClient, { deleteMemberFromTeam } from '../../synapse-client' +import { SynapseClientError } from '../../utils/SynapseClientError' +import { useSynapseContext } from '../../utils/context/SynapseContext' export function useGetTeamMembers( teamId: string | number, diff --git a/packages/synapse-react-client/src/synapse-queries/trash/useTrashCan.ts b/packages/synapse-react-client/src/synapse-queries/trash/useTrashCan.ts index 62c06f3d7a..4964de7212 100644 --- a/packages/synapse-react-client/src/synapse-queries/trash/useTrashCan.ts +++ b/packages/synapse-react-client/src/synapse-queries/trash/useTrashCan.ts @@ -5,13 +5,13 @@ import { UseMutationOptions, useQueryClient, } from 'react-query' -import SynapseClient from '../../synapse-client' -import { SynapseClientError } from '../../utils/SynapseClientError' -import { useSynapseContext } from '../../utils/context/SynapseContext' import { PaginatedResults, TrashedEntity, } from '@sage-bionetworks/synapse-types' +import SynapseClient from '../../synapse-client' +import { SynapseClientError } from '../../utils/SynapseClientError' +import { useSynapseContext } from '../../utils/context/SynapseContext' export function useGetItemsInTrashCanInfinite( options?: UseInfiniteQueryOptions< diff --git a/packages/synapse-react-client/src/synapse-queries/user/useFavorites.test.tsx b/packages/synapse-react-client/src/synapse-queries/user/useFavorites.test.tsx index c8d740b2e6..209965f447 100644 --- a/packages/synapse-react-client/src/synapse-queries/user/useFavorites.test.tsx +++ b/packages/synapse-react-client/src/synapse-queries/user/useFavorites.test.tsx @@ -1,9 +1,9 @@ import { renderHook, waitFor } from '@testing-library/react' -import { useGetFavorites } from './useFavorites' import { EntityHeader, PaginatedResults } from '@sage-bionetworks/synapse-types' import { MOCK_CONTEXT_VALUE } from '../../mocks/MockSynapseContext' import SynapseClient from '../../synapse-client' import { createWrapper } from '../../testutils/TestingLibraryUtils' +import { useGetFavorites } from './useFavorites' const expected: PaginatedResults = { results: [ diff --git a/packages/synapse-react-client/src/synapse-queries/user/useFavorites.ts b/packages/synapse-react-client/src/synapse-queries/user/useFavorites.ts index 71040851c3..b1ebc31a76 100644 --- a/packages/synapse-react-client/src/synapse-queries/user/useFavorites.ts +++ b/packages/synapse-react-client/src/synapse-queries/user/useFavorites.ts @@ -7,14 +7,15 @@ import { useQueryClient, UseMutationOptions, } from 'react-query' -import SynapseClient from '../../synapse-client' -import { SynapseClientError } from '../../utils/SynapseClientError' -import { useSynapseContext } from '../../utils/context/SynapseContext' -import { EntityHeader, PaginatedResults } from '@sage-bionetworks/synapse-types' import { + EntityHeader, + PaginatedResults, FavoriteSortBy, FavoriteSortDirection, } from '@sage-bionetworks/synapse-types' +import SynapseClient from '../../synapse-client' +import { SynapseClientError } from '../../utils/SynapseClientError' +import { useSynapseContext } from '../../utils/context/SynapseContext' export function useIsFavorite(entityId: string) { // TODO: Handle pagination - the default limit is 200 diff --git a/packages/synapse-react-client/src/synapse-queries/user/useGetUserChallenges.ts b/packages/synapse-react-client/src/synapse-queries/user/useGetUserChallenges.ts index badc6e44a8..6fdf6bc691 100644 --- a/packages/synapse-react-client/src/synapse-queries/user/useGetUserChallenges.ts +++ b/packages/synapse-react-client/src/synapse-queries/user/useGetUserChallenges.ts @@ -4,14 +4,14 @@ import { useQuery, UseQueryOptions, } from 'react-query' -import SynapseClient from '../../synapse-client' -import { SynapseClientError } from '../../utils/SynapseClientError' -import { useSynapseContext } from '../../utils/context/SynapseContext' import { Challenge, ChallengeWithProjectHeaderPagedResults, PaginatedResults, } from '@sage-bionetworks/synapse-types' +import SynapseClient from '../../synapse-client' +import { SynapseClientError } from '../../utils/SynapseClientError' +import { useSynapseContext } from '../../utils/context/SynapseContext' export function useGetUserChallenges( userId: string, diff --git a/packages/synapse-react-client/src/synapse-queries/user/useGetUserProjects.ts b/packages/synapse-react-client/src/synapse-queries/user/useGetUserProjects.ts index 1c09b8a06a..7148b7b378 100644 --- a/packages/synapse-react-client/src/synapse-queries/user/useGetUserProjects.ts +++ b/packages/synapse-react-client/src/synapse-queries/user/useGetUserProjects.ts @@ -1,9 +1,11 @@ import { useInfiniteQuery, UseInfiniteQueryOptions } from 'react-query' +import { + ProjectHeaderList, + GetProjectsParameters, +} from '@sage-bionetworks/synapse-types' import SynapseClient from '../../synapse-client' import { SynapseClientError } from '../../utils/SynapseClientError' import { useSynapseContext } from '../../utils/context/SynapseContext' -import { ProjectHeaderList } from '@sage-bionetworks/synapse-types' -import { GetProjectsParameters } from '@sage-bionetworks/synapse-types' export function useGetUserProjectsInfinite( userId: string, diff --git a/packages/synapse-react-client/src/synapse-queries/user/useGetUserTeams.ts b/packages/synapse-react-client/src/synapse-queries/user/useGetUserTeams.ts index 689faf8079..9f6a6b169c 100644 --- a/packages/synapse-react-client/src/synapse-queries/user/useGetUserTeams.ts +++ b/packages/synapse-react-client/src/synapse-queries/user/useGetUserTeams.ts @@ -4,11 +4,14 @@ import { useQuery, UseQueryOptions, } from 'react-query' +import { + PaginatedIds, + PaginatedResults, + Team, +} from '@sage-bionetworks/synapse-types' import SynapseClient from '../../synapse-client' import { SynapseClientError } from '../../utils/SynapseClientError' import { useSynapseContext } from '../../utils/context/SynapseContext' -import { PaginatedIds, PaginatedResults } from '@sage-bionetworks/synapse-types' -import { Team } from '@sage-bionetworks/synapse-types' export function useGetUserSubmissionTeamsInfinite( challengeId: string, diff --git a/packages/synapse-react-client/src/synapse-queries/user/usePersonalAccessToken.ts b/packages/synapse-react-client/src/synapse-queries/user/usePersonalAccessToken.ts index eb1ad2ecc0..116cc69082 100644 --- a/packages/synapse-react-client/src/synapse-queries/user/usePersonalAccessToken.ts +++ b/packages/synapse-react-client/src/synapse-queries/user/usePersonalAccessToken.ts @@ -4,10 +4,10 @@ import { QueryFunctionContext, QueryKey, } from 'react-query' +import { AccessTokenRecordList } from '@sage-bionetworks/synapse-types' import SynapseClient from '../../synapse-client' import { SynapseClientError } from '../../utils/SynapseClientError' import { useSynapseContext } from '../../utils/context/SynapseContext' -import { AccessTokenRecordList } from '@sage-bionetworks/synapse-types' export function useGetPersonalAccessTokensInfinite( options?: UseInfiniteQueryOptions, diff --git a/packages/synapse-react-client/src/synapse-queries/user/useProjects.test.tsx b/packages/synapse-react-client/src/synapse-queries/user/useProjects.test.tsx index 7a32b865fe..412a65a107 100644 --- a/packages/synapse-react-client/src/synapse-queries/user/useProjects.test.tsx +++ b/packages/synapse-react-client/src/synapse-queries/user/useProjects.test.tsx @@ -1,5 +1,4 @@ import { act, renderHook, waitFor } from '@testing-library/react' -import { useGetProjects, useGetProjectsInfinite } from './useProjects' import { EntityChildrenRequest, EntityType, @@ -8,6 +7,7 @@ import { import { MOCK_CONTEXT_VALUE } from '../../mocks/MockSynapseContext' import { createWrapper } from '../../testutils/TestingLibraryUtils' import SynapseClient from '../../synapse-client' +import { useGetProjects, useGetProjectsInfinite } from './useProjects' const request: EntityChildrenRequest = { parentId: 'syn123', diff --git a/packages/synapse-react-client/src/synapse-queries/user/useProjects.ts b/packages/synapse-react-client/src/synapse-queries/user/useProjects.ts index f9afb7a488..0aa78cc152 100644 --- a/packages/synapse-react-client/src/synapse-queries/user/useProjects.ts +++ b/packages/synapse-react-client/src/synapse-queries/user/useProjects.ts @@ -4,11 +4,13 @@ import { useQuery, UseQueryOptions, } from 'react-query' +import { + ProjectHeaderList, + GetProjectsParameters, +} from '@sage-bionetworks/synapse-types' import SynapseClient from '../../synapse-client' import { SynapseClientError } from '../../utils/SynapseClientError' import { useSynapseContext } from '../../utils/context/SynapseContext' -import { ProjectHeaderList } from '@sage-bionetworks/synapse-types' -import { GetProjectsParameters } from '@sage-bionetworks/synapse-types' export function useGetProjects( params?: GetProjectsParameters, diff --git a/packages/synapse-react-client/src/synapse-queries/user/useUserBundle.ts b/packages/synapse-react-client/src/synapse-queries/user/useUserBundle.ts index 3fdb0b014c..2ad24cf223 100644 --- a/packages/synapse-react-client/src/synapse-queries/user/useUserBundle.ts +++ b/packages/synapse-react-client/src/synapse-queries/user/useUserBundle.ts @@ -1,12 +1,14 @@ import { useQuery, UseQueryOptions } from 'react-query' -import SynapseClient from '../../synapse-client' -import { SynapseClientError } from '../../utils/SynapseClientError' -import { useSynapseContext } from '../../utils/context/SynapseContext' import { NotificationEmail, UserBundle, UserProfile, + PrincipalAliasRequest, + PrincipalAliasResponse, } from '@sage-bionetworks/synapse-types' +import SynapseClient from '../../synapse-client' +import { SynapseClientError } from '../../utils/SynapseClientError' +import { useSynapseContext } from '../../utils/context/SynapseContext' import { USER_BUNDLE_MASK_IS_ACT_MEMBER, USER_BUNDLE_MASK_IS_AR_REVIEWER, @@ -16,10 +18,6 @@ import { USER_BUNDLE_MASK_USER_PROFILE, USER_BUNDLE_MASK_VERIFICATION_SUBMISSION, } from '../../utils/SynapseConstants' -import { - PrincipalAliasRequest, - PrincipalAliasResponse, -} from '@sage-bionetworks/synapse-types' export function useGetNotificationEmail( options?: UseQueryOptions, diff --git a/packages/synapse-react-client/src/synapse-queries/user/useUserGroupHeader.ts b/packages/synapse-react-client/src/synapse-queries/user/useUserGroupHeader.ts index 1d734b3f6e..3ce4bfb6a7 100644 --- a/packages/synapse-react-client/src/synapse-queries/user/useUserGroupHeader.ts +++ b/packages/synapse-react-client/src/synapse-queries/user/useUserGroupHeader.ts @@ -1,8 +1,8 @@ import { useQuery, UseQueryOptions } from 'react-query' +import { TYPE_FILTER, UserGroupHeader } from '@sage-bionetworks/synapse-types' import SynapseClient from '../../synapse-client' import { SynapseClientError } from '../../utils/SynapseClientError' import { useSynapseContext } from '../../utils/context/SynapseContext' -import { TYPE_FILTER, UserGroupHeader } from '@sage-bionetworks/synapse-types' export function useGetUserGroupHeader( principalId: string, diff --git a/packages/synapse-react-client/src/theme/DefaultTheme.tsx b/packages/synapse-react-client/src/theme/DefaultTheme.tsx index 1b7d38e3d3..f8789750e8 100644 --- a/packages/synapse-react-client/src/theme/DefaultTheme.tsx +++ b/packages/synapse-react-client/src/theme/DefaultTheme.tsx @@ -5,9 +5,6 @@ import { lighten, ThemeOptions, } from '@mui/material' -import { typographyOptions } from './typography/Typography' -import { palette } from './palette/Palettes' -import linkTheme from './typography/Link' import React from 'react' import { CheckCircleTwoTone, @@ -15,6 +12,9 @@ import { HighlightOffTwoTone, InfoTwoTone, } from '@mui/icons-material' +import { typographyOptions } from './typography/Typography' +import { palette } from './palette/Palettes' +import linkTheme from './typography/Link' const DIALOG_INNER_PADDING = '2px' diff --git a/packages/synapse-react-client/src/utils/AppUtils/session/ApplicationSession.test.tsx b/packages/synapse-react-client/src/utils/AppUtils/session/ApplicationSession.test.tsx index bd60177480..2a4570883a 100644 --- a/packages/synapse-react-client/src/utils/AppUtils/session/ApplicationSession.test.tsx +++ b/packages/synapse-react-client/src/utils/AppUtils/session/ApplicationSession.test.tsx @@ -1,27 +1,27 @@ import React from 'react' import { renderHook, waitFor } from '@testing-library/react' -import ApplicationSessionManager, { - ApplicationSessionManagerProps, -} from './ApplicationSessionManager' +import { MemoryRouter } from 'react-router-dom' import { - ApplicationSessionContextType, - useApplicationSessionContext, -} from './ApplicationSessionContext' + ErrorResponseCode, + TwoFactorAuthErrorResponse, +} from '@sage-bionetworks/synapse-types' +import dayjs from 'dayjs' import { SynapseClient } from '../../../index' import { MOCK_USER_ID, mockUserProfileData, } from '../../../mocks/user/mock_user_profile' import { SynapseClientError } from '../../SynapseClientError' -import { MemoryRouter } from 'react-router-dom' import * as UseDetectSSOCodeModule from '../../hooks/useDetectSSOCode' import { UseDetectSSOCodeOptions } from '../../hooks/useDetectSSOCode' -import { - ErrorResponseCode, - TwoFactorAuthErrorResponse, -} from '@sage-bionetworks/synapse-types' -import dayjs from 'dayjs' import { MOCK_ACCESS_TOKEN } from '../../../mocks/MockSynapseContext' +import { + ApplicationSessionContextType, + useApplicationSessionContext, +} from './ApplicationSessionContext' +import ApplicationSessionManager, { + ApplicationSessionManagerProps, +} from './ApplicationSessionManager' function render(props?: ApplicationSessionManagerProps) { return renderHook(() => useApplicationSessionContext(), { diff --git a/packages/synapse-react-client/src/utils/AppUtils/session/ApplicationSessionContext.tsx b/packages/synapse-react-client/src/utils/AppUtils/session/ApplicationSessionContext.tsx index c62a69e17a..32b5ea598a 100644 --- a/packages/synapse-react-client/src/utils/AppUtils/session/ApplicationSessionContext.tsx +++ b/packages/synapse-react-client/src/utils/AppUtils/session/ApplicationSessionContext.tsx @@ -1,6 +1,6 @@ import React, { useContext } from 'react' -import { UseDetectSSOCodeReturnType } from '../../hooks' import { TwoFactorAuthErrorResponse } from '@sage-bionetworks/synapse-types' +import { UseDetectSSOCodeReturnType } from '../../hooks' export type ApplicationSessionContextType = { /* The Synapse Authentication token. If undefined, the user is not signed in. */ diff --git a/packages/synapse-react-client/src/utils/AppUtils/session/ApplicationSessionManager.tsx b/packages/synapse-react-client/src/utils/AppUtils/session/ApplicationSessionManager.tsx index f42c249e7f..2a89d24809 100644 --- a/packages/synapse-react-client/src/utils/AppUtils/session/ApplicationSessionManager.tsx +++ b/packages/synapse-react-client/src/utils/AppUtils/session/ApplicationSessionManager.tsx @@ -1,12 +1,12 @@ import React, { useCallback, useEffect, useState } from 'react' +import { useHistory } from 'react-router-dom' +import { TwoFactorAuthErrorResponse } from '@sage-bionetworks/synapse-types' +import dayjs from 'dayjs' import SynapseClient from '../../../synapse-client' import useDetectSSOCode from '../../hooks/useDetectSSOCode' import { redirectAfterSSO } from '../AppUtils' -import { useHistory } from 'react-router-dom' -import { TwoFactorAuthErrorResponse } from '@sage-bionetworks/synapse-types' -import { ApplicationSessionContextProvider } from './ApplicationSessionContext' import { SynapseContextProvider } from '../../context/SynapseContext' -import dayjs from 'dayjs' +import { ApplicationSessionContextProvider } from './ApplicationSessionContext' export type ApplicationSessionManagerProps = React.PropsWithChildren<{ downloadCartPageUrl?: string diff --git a/packages/synapse-react-client/src/utils/context/FullContextProvider.tsx b/packages/synapse-react-client/src/utils/context/FullContextProvider.tsx index 76bedd55ea..aa0d7258b7 100644 --- a/packages/synapse-react-client/src/utils/context/FullContextProvider.tsx +++ b/packages/synapse-react-client/src/utils/context/FullContextProvider.tsx @@ -4,8 +4,8 @@ import { QueryClientConfig, QueryClientProvider, } from 'react-query' -import { ThemeProvider } from '../../theme/useTheme' import { ThemeOptions } from '@mui/material' +import { ThemeProvider } from '../../theme/useTheme' import { SynapseContextProvider, SynapseContextType } from './SynapseContext' export const defaultQueryClientConfig: QueryClientConfig = { diff --git a/packages/synapse-react-client/src/utils/functions/DateFormatter.ts b/packages/synapse-react-client/src/utils/functions/DateFormatter.ts index 64c5164414..ca6737284e 100644 --- a/packages/synapse-react-client/src/utils/functions/DateFormatter.ts +++ b/packages/synapse-react-client/src/utils/functions/DateFormatter.ts @@ -1,6 +1,6 @@ -import SynapseClient from '../../synapse-client' import dayjs, { Dayjs } from 'dayjs' import utc from 'dayjs/plugin/utc' +import SynapseClient from '../../synapse-client' dayjs.extend(utc) diff --git a/packages/synapse-react-client/src/utils/functions/EntityTypeUtils.test.ts b/packages/synapse-react-client/src/utils/functions/EntityTypeUtils.test.ts index be3cebda11..d19271478f 100644 --- a/packages/synapse-react-client/src/utils/functions/EntityTypeUtils.test.ts +++ b/packages/synapse-react-client/src/utils/functions/EntityTypeUtils.test.ts @@ -1,10 +1,3 @@ -import { - convertToEntityType, - entityTypeToFriendlyName, - getVersionDisplay, - isContainerType, - isVersionableEntityType, -} from './EntityTypeUtils' import { Dataset, DATASET_CONCRETE_TYPE_VALUE, @@ -15,6 +8,13 @@ import { TABLE_ENTITY_CONCRETE_TYPE_VALUE, Entity, } from '@sage-bionetworks/synapse-types' +import { + convertToEntityType, + entityTypeToFriendlyName, + getVersionDisplay, + isContainerType, + isVersionableEntityType, +} from './EntityTypeUtils' const allEntityTypes = [ { diff --git a/packages/synapse-react-client/src/utils/functions/FileHandleUtils.ts b/packages/synapse-react-client/src/utils/functions/FileHandleUtils.ts index 9474161b46..c1baa59f2c 100644 --- a/packages/synapse-react-client/src/utils/functions/FileHandleUtils.ts +++ b/packages/synapse-react-client/src/utils/functions/FileHandleUtils.ts @@ -13,8 +13,6 @@ import { ProxyFileHandle, S3_FILE_HANDLE_CONCRETE_TYPE_VALUE, S3FileHandle, -} from '@sage-bionetworks/synapse-types' -import { ExternalGoogleCloudUploadDestination, ExternalObjectStoreUploadDestination, ExternalS3UploadDestination, diff --git a/packages/synapse-react-client/src/utils/functions/ResolveLinkEntity.test.ts b/packages/synapse-react-client/src/utils/functions/ResolveLinkEntity.test.ts index 345eeb4056..22f4d924b3 100644 --- a/packages/synapse-react-client/src/utils/functions/ResolveLinkEntity.test.ts +++ b/packages/synapse-react-client/src/utils/functions/ResolveLinkEntity.test.ts @@ -1,6 +1,6 @@ +import { Entity } from '@sage-bionetworks/synapse-types' import SynapseClient from '../../synapse-client' import { resolveLinkEntity } from './ResolveLinkEntity' -import { Entity } from '@sage-bionetworks/synapse-types' describe('ResolveLinkEntity tests', () => { const fileEntity = { diff --git a/packages/synapse-react-client/src/utils/functions/ResolveLinkEntity.ts b/packages/synapse-react-client/src/utils/functions/ResolveLinkEntity.ts index df2bea4277..1f7dda552f 100644 --- a/packages/synapse-react-client/src/utils/functions/ResolveLinkEntity.ts +++ b/packages/synapse-react-client/src/utils/functions/ResolveLinkEntity.ts @@ -1,7 +1,7 @@ import { QueryOptions, useQuery } from 'react-query' +import { Entity } from '@sage-bionetworks/synapse-types' import { getEntity } from '../../synapse-client/SynapseClient' import { useSynapseContext } from '../context/SynapseContext' -import { Entity } from '@sage-bionetworks/synapse-types' import { isLink } from '../types/IsType' /** diff --git a/packages/synapse-react-client/src/utils/functions/SqlFunctions.ts b/packages/synapse-react-client/src/utils/functions/SqlFunctions.ts index 61b06e5152..1e9cbad743 100644 --- a/packages/synapse-react-client/src/utils/functions/SqlFunctions.ts +++ b/packages/synapse-react-client/src/utils/functions/SqlFunctions.ts @@ -1,12 +1,13 @@ -import { Row, SelectColumn } from '@sage-bionetworks/synapse-types' -import { SYNAPSE_ENTITY_ID_REGEX } from './RegularExpressions' import { + Row, + SelectColumn, ColumnMultiValueFunction, ColumnMultiValueFunctionQueryFilter, ColumnSingleValueFilterOperator, ColumnSingleValueQueryFilter, QueryFilter, } from '@sage-bionetworks/synapse-types' +import { SYNAPSE_ENTITY_ID_REGEX } from './RegularExpressions' export type SQLOperator = | ColumnSingleValueFilterOperator diff --git a/packages/synapse-react-client/src/utils/functions/queryUtils.ts b/packages/synapse-react-client/src/utils/functions/queryUtils.ts index bbbb92253a..7b1e4f66ed 100644 --- a/packages/synapse-react-client/src/utils/functions/queryUtils.ts +++ b/packages/synapse-react-client/src/utils/functions/queryUtils.ts @@ -1,7 +1,4 @@ import { cloneDeep, isEqual, isEqualWith, isNil } from 'lodash-es' -import * as SynapseConstants from '../SynapseConstants' -import SynapseClient from '../../synapse-client' -import { LockedColumn } from '../../components/QueryContext/QueryContext' import { FacetColumnResult, Query, @@ -10,6 +7,9 @@ import { SelectColumn, Table, } from '@sage-bionetworks/synapse-types' +import * as SynapseConstants from '../SynapseConstants' +import SynapseClient from '../../synapse-client' +import { LockedColumn } from '../../components/QueryContext/QueryContext' import { isColumnMultiValueFunctionQueryFilter, diff --git a/packages/synapse-react-client/src/utils/functions/sqlFunctions.test.ts b/packages/synapse-react-client/src/utils/functions/sqlFunctions.test.ts index 25492e27fc..46061ff628 100644 --- a/packages/synapse-react-client/src/utils/functions/sqlFunctions.test.ts +++ b/packages/synapse-react-client/src/utils/functions/sqlFunctions.test.ts @@ -1,3 +1,9 @@ +import { + ColumnMultiValueFunction, + ColumnMultiValueFunctionQueryFilter, + ColumnSingleValueFilterOperator, + ColumnSingleValueQueryFilter, +} from '@sage-bionetworks/synapse-types' import { getAdditionalFilters, parseEntityIdAndVersionFromSqlStatement, @@ -5,12 +11,6 @@ import { QUERY_FILTERS_LOCAL_STORAGE_KEY, SQLOperator, } from './SqlFunctions' -import { - ColumnMultiValueFunction, - ColumnMultiValueFunctionQueryFilter, - ColumnSingleValueFilterOperator, - ColumnSingleValueQueryFilter, -} from '@sage-bionetworks/synapse-types' describe('parseEntityIdFromSqlStatement', () => { it('should get entityId correctly', () => { diff --git a/packages/synapse-react-client/src/utils/functions/stringUtils.test.ts b/packages/synapse-react-client/src/utils/functions/stringUtils.test.ts index cc9af7782a..6570cfef13 100644 --- a/packages/synapse-react-client/src/utils/functions/stringUtils.test.ts +++ b/packages/synapse-react-client/src/utils/functions/stringUtils.test.ts @@ -1,5 +1,5 @@ -import { hex2ascii } from './StringUtils' import { JoinTeamSignedToken } from '@sage-bionetworks/synapse-types' +import { hex2ascii } from './StringUtils' describe('StringUtils.hex2ascii', () => { it('should parse hex encoded string properly', () => { diff --git a/packages/synapse-react-client/src/utils/functions/testDownloadSpeed.ts b/packages/synapse-react-client/src/utils/functions/testDownloadSpeed.ts index 8b10966f75..79e7fa378b 100644 --- a/packages/synapse-react-client/src/utils/functions/testDownloadSpeed.ts +++ b/packages/synapse-react-client/src/utils/functions/testDownloadSpeed.ts @@ -1,17 +1,17 @@ +import { + FileEntity, + Entity, + BatchFileResult, + FileHandle, + BatchFileRequest, + FileHandleAssociation, + FileHandleAssociateType, +} from '@sage-bionetworks/synapse-types' import { getEntity, getFileHandleContent, getFiles, } from '../../synapse-client/SynapseClient' -import { FileEntity } from '@sage-bionetworks/synapse-types' -import { Entity } from '@sage-bionetworks/synapse-types' -import { BatchFileResult } from '@sage-bionetworks/synapse-types' -import { FileHandle } from '@sage-bionetworks/synapse-types' -import { BatchFileRequest } from '@sage-bionetworks/synapse-types' -import { - FileHandleAssociation, - FileHandleAssociateType, -} from '@sage-bionetworks/synapse-types' const ESTIMATED_CORS_TIME_MS: number = 200 const ESTIMATED_DOWNLOAD_SPEED_EXPIRE_TIME_KEY: string = diff --git a/packages/synapse-react-client/src/utils/hooks/index.ts b/packages/synapse-react-client/src/utils/hooks/index.ts index fc8c9c5c09..9932a8a88f 100644 --- a/packages/synapse-react-client/src/utils/hooks/index.ts +++ b/packages/synapse-react-client/src/utils/hooks/index.ts @@ -1,7 +1,7 @@ -export * from './useCompare' +export { default as useCompare } from './useCompare' export * from './useDebouncedEffect' export * from './useDetectSSOCode' -export * from './useFocus' +export { default as useFocus } from './useFocus' export * from './useGetInfoFromIds' export * from './useGetIsAllSelectedInfiniteList' export * from './useListState' @@ -9,7 +9,7 @@ export * from './useLogin' export * from './useMutuallyExclusiveState' export * from './useOverlay' export * from './usePreFetchResource' -export * from './usePrevious' +export { default as usePrevious } from './usePrevious' export * from './useSet' export * from './useShowDesktop' -export * from './useTraceUpdate' +export { default as useTraceUpdate } from './useTraceUpdate' diff --git a/packages/synapse-react-client/src/utils/hooks/useDetectSSOCode.test.ts b/packages/synapse-react-client/src/utils/hooks/useDetectSSOCode.test.ts index 101aa69eb4..018a43228a 100644 --- a/packages/synapse-react-client/src/utils/hooks/useDetectSSOCode.test.ts +++ b/packages/synapse-react-client/src/utils/hooks/useDetectSSOCode.test.ts @@ -1,15 +1,15 @@ import { renderHook, waitFor } from '@testing-library/react' -import useDetectSSOCode from './useDetectSSOCode' -import { SynapseClient } from '../../index' -import { LoginResponse } from '@sage-bionetworks/synapse-types' -import { BackendDestinationEnum } from '../functions/getEndpoint' -import { SynapseClientError } from '../SynapseClientError' import { + LoginResponse, ErrorResponseCode, TwoFactorAuthErrorResponse, } from '@sage-bionetworks/synapse-types' +import { SynapseClient } from '../../index' +import { BackendDestinationEnum } from '../functions/getEndpoint' +import { SynapseClientError } from '../SynapseClientError' import { OAUTH2_PROVIDERS } from '../SynapseConstants' +import useDetectSSOCode from './useDetectSSOCode' const authorizationCode = '12345' diff --git a/packages/synapse-react-client/src/utils/hooks/useDetectSSOCode.ts b/packages/synapse-react-client/src/utils/hooks/useDetectSSOCode.ts index f696a2da16..4f7f833a81 100644 --- a/packages/synapse-react-client/src/utils/hooks/useDetectSSOCode.ts +++ b/packages/synapse-react-client/src/utils/hooks/useDetectSSOCode.ts @@ -1,8 +1,12 @@ +import { + LoginResponse, + TwoFactorAuthErrorResponse, +} from '@sage-bionetworks/synapse-types' +import { useEffect, useState } from 'react' import { BackendDestinationEnum, PRODUCTION_ENDPOINT_CONFIG, } from '../functions/getEndpoint' -import { LoginResponse } from '@sage-bionetworks/synapse-types' import { SynapseClientError } from '../SynapseClientError' import { bindOAuthProviderToAccount, @@ -11,8 +15,6 @@ import { oAuthSessionRequest, setAccessTokenCookie, } from '../../synapse-client/SynapseClient' -import { useEffect, useState } from 'react' -import { TwoFactorAuthErrorResponse } from '@sage-bionetworks/synapse-types' import { OAUTH2_PROVIDERS } from '../SynapseConstants' diff --git a/packages/synapse-react-client/src/utils/hooks/useGetInfoFromIds.test.tsx b/packages/synapse-react-client/src/utils/hooks/useGetInfoFromIds.test.tsx index f92ad50a00..fd3767d2bd 100644 --- a/packages/synapse-react-client/src/utils/hooks/useGetInfoFromIds.test.tsx +++ b/packages/synapse-react-client/src/utils/hooks/useGetInfoFromIds.test.tsx @@ -1,11 +1,11 @@ import React from 'react' -import useGetInfoFromIds, { UseGetInfoFromIdsProps } from './useGetInfoFromIds' import { act } from 'react-dom/test-utils' import ReactDOM from 'react-dom' import { UserGroupHeader, UserProfile } from '@sage-bionetworks/synapse-types' +import { waitFor } from '@testing-library/react' import { SynapseTestContext } from '../../mocks/MockSynapseContext' import SynapseClient from '../../synapse-client' -import { waitFor } from '@testing-library/react' +import useGetInfoFromIds, { UseGetInfoFromIdsProps } from './useGetInfoFromIds' jest.mock('../../synapse-client', () => ({ getGroupHeadersBatch: jest.fn(), diff --git a/packages/synapse-react-client/src/utils/hooks/useGetInfoFromIds.ts b/packages/synapse-react-client/src/utils/hooks/useGetInfoFromIds.ts index f9706ca516..2a0af005ea 100644 --- a/packages/synapse-react-client/src/utils/hooks/useGetInfoFromIds.ts +++ b/packages/synapse-react-client/src/utils/hooks/useGetInfoFromIds.ts @@ -1,13 +1,6 @@ import { chunk, uniq, without } from 'lodash-es' import { useEffect, useState } from 'react' import useDeepCompareEffect from 'use-deep-compare-effect' -import { SynapseConstants } from '../index' -import { - getEntityHeaders, - getEvaluations, - getGroupHeadersBatch, -} from '../../synapse-client' -import { useSynapseContext } from '../context/SynapseContext' import { EntityHeader, Evaluation, @@ -15,6 +8,13 @@ import { ReferenceList, UserGroupHeader, } from '@sage-bionetworks/synapse-types' +import { SynapseConstants } from '../index' +import { + getEntityHeaders, + getEvaluations, + getGroupHeadersBatch, +} from '../../synapse-client' +import { useSynapseContext } from '../context/SynapseContext' export type UseGetInfoFromIdsProps< T extends EntityHeader | UserGroupHeader | Evaluation, diff --git a/packages/synapse-react-client/src/utils/hooks/useGetIsAllSelectedInfiniteList.test.ts b/packages/synapse-react-client/src/utils/hooks/useGetIsAllSelectedInfiniteList.test.ts index cf02eabc12..a06d7bc749 100644 --- a/packages/synapse-react-client/src/utils/hooks/useGetIsAllSelectedInfiniteList.test.ts +++ b/packages/synapse-react-client/src/utils/hooks/useGetIsAllSelectedInfiniteList.test.ts @@ -1,7 +1,7 @@ -import { getIsAllSelectedFromInfiniteList } from './useGetIsAllSelectedInfiniteList' import { Map } from 'immutable' import { EntityHeader, EntityType } from '@sage-bionetworks/synapse-types' import { getEntityTypeFromHeader } from '../functions/EntityTypeUtils' +import { getIsAllSelectedFromInfiniteList } from './useGetIsAllSelectedInfiniteList' const ALL_TYPES = Object.values(EntityType) const mockFetchNextPage = jest.fn() diff --git a/packages/synapse-react-client/src/utils/hooks/useImmutableTableQuery/useImmutableTableQuery.test.tsx b/packages/synapse-react-client/src/utils/hooks/useImmutableTableQuery/useImmutableTableQuery.test.tsx index 7cb9921ba6..785a4af900 100644 --- a/packages/synapse-react-client/src/utils/hooks/useImmutableTableQuery/useImmutableTableQuery.test.tsx +++ b/packages/synapse-react-client/src/utils/hooks/useImmutableTableQuery/useImmutableTableQuery.test.tsx @@ -1,14 +1,14 @@ import { act, renderHook } from '@testing-library/react' import { cloneDeep } from 'lodash-es' -import useImmutableTableQuery, { - DEBOUNCE_DELAY_MS, - UseImmutableTableQueryOptions, -} from './useImmutableTableQuery' -import * as DeepLinkingUtils from '../../functions/deepLinkingUtils' import { ColumnSingleValueFilterOperator, QueryBundleRequest, } from '@sage-bionetworks/synapse-types' +import * as DeepLinkingUtils from '../../functions/deepLinkingUtils' +import useImmutableTableQuery, { + DEBOUNCE_DELAY_MS, + UseImmutableTableQueryOptions, +} from './useImmutableTableQuery' const options: UseImmutableTableQueryOptions = { initQueryRequest: { diff --git a/packages/synapse-react-client/src/utils/hooks/useImmutableTableQuery/useImmutableTableQuery.ts b/packages/synapse-react-client/src/utils/hooks/useImmutableTableQuery/useImmutableTableQuery.ts index e4c955452f..b3a5f3128e 100644 --- a/packages/synapse-react-client/src/utils/hooks/useImmutableTableQuery/useImmutableTableQuery.ts +++ b/packages/synapse-react-client/src/utils/hooks/useImmutableTableQuery/useImmutableTableQuery.ts @@ -6,10 +6,12 @@ import { QueryFilter, } from '@sage-bionetworks/synapse-types' import { cloneDeep, isEqual } from 'lodash-es' +import useDeepCompareEffect from 'use-deep-compare-effect' +import { ReadonlyDeep } from 'type-fest' +import { useDebouncedEffect } from '@react-hookz/web' import * as DeepLinkingUtils from '../../functions/deepLinkingUtils' import { DEFAULT_PAGE_SIZE } from '../../SynapseConstants' import { parseEntityIdAndVersionFromSqlStatement } from '../../functions/SqlFunctions' -import useDeepCompareEffect from 'use-deep-compare-effect' import { isColumnMultiValueFunctionQueryFilter, isColumnSingleValueQueryFilter, @@ -19,9 +21,7 @@ import { queryRequestsHaveSameTotalResults, removeEmptyQueryParams, } from '../../functions/queryUtils' -import { ReadonlyDeep } from 'type-fest' import useCommittedState from '../useCommittedState' -import { useDebouncedEffect } from '@react-hookz/web' type QueryChangeCommitOptions = | { diff --git a/packages/synapse-react-client/src/utils/hooks/useListState.test.tsx b/packages/synapse-react-client/src/utils/hooks/useListState.test.tsx index 12ea3a48ab..a3eaf15d35 100644 --- a/packages/synapse-react-client/src/utils/hooks/useListState.test.tsx +++ b/packages/synapse-react-client/src/utils/hooks/useListState.test.tsx @@ -1,7 +1,7 @@ -import { useListState } from './useListState' import React from 'react' import { render, screen, waitFor } from '@testing-library/react' import userEvent from '@testing-library/user-event' +import { useListState } from './useListState' type UserListStateWrapperProps = { initialValue: string[] diff --git a/packages/synapse-react-client/src/utils/hooks/useLogin.test.tsx b/packages/synapse-react-client/src/utils/hooks/useLogin.test.tsx index 5b874ca0c4..36265d5d18 100644 --- a/packages/synapse-react-client/src/utils/hooks/useLogin.test.tsx +++ b/packages/synapse-react-client/src/utils/hooks/useLogin.test.tsx @@ -1,14 +1,14 @@ import { act, renderHook, waitFor } from '@testing-library/react' -import SynapseClient from '../../synapse-client' -import { LoginResponse } from '@sage-bionetworks/synapse-types' -import { SynapseClientError } from '../SynapseClientError' import { + LoginResponse, ErrorResponseCode, TwoFactorAuthErrorResponse, } from '@sage-bionetworks/synapse-types' -import useLogin from './useLogin' +import SynapseClient from '../../synapse-client' +import { SynapseClientError } from '../SynapseClientError' import { AUTHENTICATION_RECEIPT_LOCALSTORAGE_KEY } from '../SynapseConstants' import { createWrapper } from '../../testutils/TestingLibraryUtils' +import useLogin from './useLogin' const successfulLoginResponse: LoginResponse = { accessToken: 'abcd', diff --git a/packages/synapse-react-client/src/utils/hooks/useLogin.ts b/packages/synapse-react-client/src/utils/hooks/useLogin.ts index 0157b5e965..af4af323b3 100644 --- a/packages/synapse-react-client/src/utils/hooks/useLogin.ts +++ b/packages/synapse-react-client/src/utils/hooks/useLogin.ts @@ -1,12 +1,12 @@ import { Dispatch, SetStateAction, useEffect, useState } from 'react' -import { LoginResponse } from '@sage-bionetworks/synapse-types' import { + LoginResponse, TwoFactorAuthLoginRequest, TwoFactorAuthOtpType, + TwoFactorAuthErrorResponse, } from '@sage-bionetworks/synapse-types' -import { TwoFactorAuthErrorResponse } from '@sage-bionetworks/synapse-types' -import { AUTHENTICATION_RECEIPT_LOCALSTORAGE_KEY } from '../SynapseConstants' import { useMutation } from 'react-query' +import { AUTHENTICATION_RECEIPT_LOCALSTORAGE_KEY } from '../SynapseConstants' import { SynapseClientError } from '../SynapseClientError' import SynapseClient from '../../synapse-client' diff --git a/packages/synapse-react-client/src/utils/hooks/usePreFetchResource.integration.test.tsx b/packages/synapse-react-client/src/utils/hooks/usePreFetchResource.integration.test.tsx index 63917dcf8d..c15af61d62 100644 --- a/packages/synapse-react-client/src/utils/hooks/usePreFetchResource.integration.test.tsx +++ b/packages/synapse-react-client/src/utils/hooks/usePreFetchResource.integration.test.tsx @@ -1,7 +1,7 @@ import { cleanup, renderHook, waitFor } from '@testing-library/react' -import usePreFetchResource from './usePreFetchResource' import { rest, server } from '../../mocks/msw/server' import { createWrapper } from '../../testutils/TestingLibraryUtils' +import usePreFetchResource from './usePreFetchResource' const onReceivedRequest = jest.fn() diff --git a/packages/synapse-react-client/src/utils/hooks/useTheme.test.tsx b/packages/synapse-react-client/src/utils/hooks/useTheme.test.tsx index 2c0c95e21c..c069fcbde4 100644 --- a/packages/synapse-react-client/src/utils/hooks/useTheme.test.tsx +++ b/packages/synapse-react-client/src/utils/hooks/useTheme.test.tsx @@ -1,7 +1,7 @@ -import { mergeTheme } from '../../theme/useTheme' import { ThemeOptions } from '@mui/material' -import defaultMuiThemeOptions from '../../theme/DefaultTheme' import { PartialDeep } from 'type-fest' +import { mergeTheme } from '../../theme/useTheme' +import defaultMuiThemeOptions from '../../theme/DefaultTheme' describe('Synapse Theme tests', () => { it('properly merges a custom theme with the default theme', () => { diff --git a/packages/synapse-react-client/test/containers/EntityForm.test.tsx b/packages/synapse-react-client/test/containers/EntityForm.test.tsx index 45db7a47e4..249a75f47f 100644 --- a/packages/synapse-react-client/test/containers/EntityForm.test.tsx +++ b/packages/synapse-react-client/test/containers/EntityForm.test.tsx @@ -1,4 +1,4 @@ -import { render, screen } from '@testing-library/react' +import { render } from '@testing-library/react' import React from 'react' import EntityForm, { EntityFormProps, From a3c5561545489232ffd0acbdc47f151cee7309e8 Mon Sep 17 00:00:00 2001 From: Nick Grosenbacher Date: Wed, 30 Aug 2023 15:37:50 -0400 Subject: [PATCH 3/6] Run `eslint src --fix` on synapse-oauth-signin --- apps/synapse-oauth-signin/src/App.tsx | 6 +++--- apps/synapse-oauth-signin/src/AppInitializer.tsx | 2 +- apps/synapse-oauth-signin/src/URLUtils.tsx | 2 +- apps/synapse-oauth-signin/src/test/App.test.tsx | 4 ++-- apps/synapse-oauth-signin/src/test/setupTests.ts | 2 +- apps/synapse-oauth-signin/src/types.d.ts | 1 + 6 files changed, 9 insertions(+), 8 deletions(-) diff --git a/apps/synapse-oauth-signin/src/App.tsx b/apps/synapse-oauth-signin/src/App.tsx index 0f106df37a..9386bbdd0e 100644 --- a/apps/synapse-oauth-signin/src/App.tsx +++ b/apps/synapse-oauth-signin/src/App.tsx @@ -6,14 +6,14 @@ import { SynapseTheme, } from 'synapse-react-client' import './App.scss' +import { createTheme, StyledEngineProvider } from '@mui/material/styles' +import { QueryClient, QueryClientProvider } from 'react-query' +import { ThemeProvider } from '@mui/material' import AppInitializer from './AppInitializer' import { OAuth2Form } from './OAuth2Form' import { getURLParam } from './URLUtils' import Versions from './Versions' import generalTheme from './style/theme' -import { createTheme, StyledEngineProvider } from '@mui/material/styles' -import { QueryClient, QueryClientProvider } from 'react-query' -import { ThemeProvider } from '@mui/material' const queryClient = new QueryClient(defaultQueryClientConfig) const theme = createTheme(SynapseTheme.mergeTheme(generalTheme)) diff --git a/apps/synapse-oauth-signin/src/AppInitializer.tsx b/apps/synapse-oauth-signin/src/AppInitializer.tsx index 80361cf828..eb3f179c43 100644 --- a/apps/synapse-oauth-signin/src/AppInitializer.tsx +++ b/apps/synapse-oauth-signin/src/AppInitializer.tsx @@ -1,6 +1,6 @@ -import { OAuthClientError } from './OAuthClientError' import React, { useCallback, useEffect, useState } from 'react' import { ApplicationSessionManager, SynapseClient } from 'synapse-react-client' +import { OAuthClientError } from './OAuthClientError' import { handleErrorRedirect } from './URLUtils' function AppInitializer( diff --git a/apps/synapse-oauth-signin/src/URLUtils.tsx b/apps/synapse-oauth-signin/src/URLUtils.tsx index 66f46df06a..e589a3689b 100644 --- a/apps/synapse-oauth-signin/src/URLUtils.tsx +++ b/apps/synapse-oauth-signin/src/URLUtils.tsx @@ -1,5 +1,5 @@ -import { OAuthClientError } from 'OAuthClientError' import { SynapseClientError } from 'synapse-react-client' +import { OAuthClientError } from 'OAuthClientError' export const handleErrorRedirect = ( error: Error | OAuthClientError | SynapseClientError, diff --git a/apps/synapse-oauth-signin/src/test/App.test.tsx b/apps/synapse-oauth-signin/src/test/App.test.tsx index d7a6a6ffcf..c9ce7d4a6b 100644 --- a/apps/synapse-oauth-signin/src/test/App.test.tsx +++ b/apps/synapse-oauth-signin/src/test/App.test.tsx @@ -1,13 +1,13 @@ import { render, screen, waitFor } from '@testing-library/react' -import { server } from '../mocks/server' import { rest } from 'msw' import React from 'react' import { SynapseClient, SynapseConstants } from 'synapse-react-client' -import App from '../App' import userEvent from '@testing-library/user-event' import { LoginResponse } from '@sage-bionetworks/synapse-types' import { afterEach, describe, expect, test, vi } from 'vitest' import { waitForOptions } from '@testing-library/react' +import App from '../App' +import { server } from '../mocks/server' const overrideWaitForOptions: waitForOptions = { timeout: 5000, diff --git a/apps/synapse-oauth-signin/src/test/setupTests.ts b/apps/synapse-oauth-signin/src/test/setupTests.ts index f5507ad839..e5c79ca37a 100644 --- a/apps/synapse-oauth-signin/src/test/setupTests.ts +++ b/apps/synapse-oauth-signin/src/test/setupTests.ts @@ -1,7 +1,7 @@ import fetch from 'isomorphic-fetch' // polyfill for fetch -import { server } from '../mocks/server' import { cleanup } from '@testing-library/react' import { afterAll, afterEach, beforeAll, vi } from 'vitest' +import { server } from '../mocks/server' declare const global: any global.markdownit = require('markdown-it') diff --git a/apps/synapse-oauth-signin/src/types.d.ts b/apps/synapse-oauth-signin/src/types.d.ts index 515dcc5655..3f81559538 100644 --- a/apps/synapse-oauth-signin/src/types.d.ts +++ b/apps/synapse-oauth-signin/src/types.d.ts @@ -1 +1,2 @@ +// eslint-disable-next-line import/no-unresolved import 'synapse-react-client/src/theme/ThemeTypes' From 6f7f5f2d8025ed1a61cb7daeb5da560de29f1d68 Mon Sep 17 00:00:00 2001 From: Nick Grosenbacher Date: Wed, 30 Aug 2023 15:38:13 -0400 Subject: [PATCH 4/6] Run `eslint src --fix` on SageAccountWeb, fix existing lint issues, add lint job --- apps/SageAccountWeb/package.json | 1 + apps/SageAccountWeb/src/App.tsx | 20 +++++----- apps/SageAccountWeb/src/AppInitializer.tsx | 8 ++-- .../src/components/AccountCreatedPage.tsx | 10 ++--- .../src/components/AccountSettings.tsx | 2 +- .../src/components/AccountSettingsTopBar.tsx | 4 +- .../src/components/ConfigureEmail.tsx | 14 +++++-- .../src/components/CropImage.ts | 2 +- .../src/components/CurrentAffiliationPage.tsx | 6 +-- .../src/components/EmailConfirmationPage.tsx | 4 +- .../src/components/JoinTeamPage.tsx | 6 +-- .../src/components/LeftRightPanel.tsx | 2 +- .../components/OAuthClientManagementPage.tsx | 4 +- .../components/PersonalAccessTokensPage.tsx | 4 +- .../src/components/ProfileAvatar.tsx | 10 ++++- .../ProfileValidation/ORCiDButton.tsx | 2 +- .../ProfileValidation/ProfileFieldsEditor.tsx | 2 +- .../ProfileValidation/ProfileValidation.tsx | 40 +++++++++++-------- .../ProfileValidation/ReturnToAppButton.tsx | 8 ++-- .../TermsAndConditionsSignature.tsx | 2 +- .../TermsAndConditionsWrapped.tsx | 4 +- .../components/ProfileValidation/ThankYou.tsx | 4 +- .../ProfileValidation/UnbindORCiD.tsx | 4 +- .../ProfileValidation/VerifyIdentify.tsx | 2 +- .../src/components/RegisterAccount1.tsx | 12 ++++-- .../src/components/RegisterAccount2.tsx | 10 ++--- .../src/components/ResetPassword.tsx | 20 +++++++--- .../src/components/SageResourcesPage.tsx | 4 +- .../src/components/SourceApp.tsx | 7 ++-- .../src/components/TermsOfUsePage.tsx | 8 ++-- .../components/TermsOfUseRightPanelText.tsx | 8 +--- .../useMembershipInvitationTokenHandler.ts | 2 +- apps/SageAccountWeb/src/tests/App.test.tsx | 2 +- .../src/tests/AppInitialization.test.tsx | 4 +- apps/SageAccountWeb/src/types.d.ts | 1 + 35 files changed, 132 insertions(+), 111 deletions(-) diff --git a/apps/SageAccountWeb/package.json b/apps/SageAccountWeb/package.json index 5aac70cb52..040ab32db6 100644 --- a/apps/SageAccountWeb/package.json +++ b/apps/SageAccountWeb/package.json @@ -80,6 +80,7 @@ }, "scripts": { "clean": "rimraf build coverage", + "lint": "eslint src", "start": "vite", "build": "vite build", "test": "vitest", diff --git a/apps/SageAccountWeb/src/App.tsx b/apps/SageAccountWeb/src/App.tsx index a3a54b97db..c32a22a7e4 100644 --- a/apps/SageAccountWeb/src/App.tsx +++ b/apps/SageAccountWeb/src/App.tsx @@ -1,4 +1,14 @@ import { StyledEngineProvider } from '@mui/material/styles' +import React from 'react' +import { BrowserRouter as Router, Route, Switch } from 'react-router-dom' +import { + ApplicationSessionManager, + SynapseClient, + SynapseToastContainer, + SynapseContextType, + SynapseContextConsumer, +} from 'synapse-react-client' +import { QueryClient, QueryClientProvider } from 'react-query' import { AppContextConsumer } from './AppContext' import { SageResourcesPage } from './components/SageResourcesPage' import { AccountCreatedPage } from './components/AccountCreatedPage' @@ -12,20 +22,10 @@ import { RegisterAccount1 } from './components/RegisterAccount1' import { RegisterAccount2 } from './components/RegisterAccount2' import { ResetPassword } from './components/ResetPassword' import { TermsOfUsePage } from './components/TermsOfUsePage' -import React from 'react' -import { BrowserRouter as Router, Route, Switch } from 'react-router-dom' -import { - ApplicationSessionManager, - SynapseClient, - SynapseToastContainer, - SynapseContextType, - SynapseContextConsumer, -} from 'synapse-react-client' import { getSearchParam } from './URLUtils' import './App.scss' import AppInitializer from './AppInitializer' import LoginPage from './LoginPage' -import { QueryClient, QueryClientProvider } from 'react-query' import TwoFactorAuthEnrollmentPage from './components/TwoFactorAuth/TwoFactorAuthEnrollmentPage' import TwoFactorAuthBackupCodesPage from './components/TwoFactorAuth/TwoFactorAuthBackupCodesPage' import { PersonalAccessTokensPage } from './components/PersonalAccessTokensPage' diff --git a/apps/SageAccountWeb/src/AppInitializer.tsx b/apps/SageAccountWeb/src/AppInitializer.tsx index 71af84c9f8..db391ff2ff 100644 --- a/apps/SageAccountWeb/src/AppInitializer.tsx +++ b/apps/SageAccountWeb/src/AppInitializer.tsx @@ -1,11 +1,7 @@ import React, { useEffect, useState } from 'react' import { Redirect } from 'react-router-dom' -import { getSearchParam } from './URLUtils' -import useAnalytics from './useAnalytics' import { SignedTokenInterface } from '@sage-bionetworks/synapse-types' import { createTheme, ThemeProvider } from '@mui/material/styles' -import { useSourceApp } from './components/SourceApp.js' -import { sageAccountWebThemeOverrides } from './style/theme' import { Theme } from '@mui/material' import { useLastLoginInfoState, @@ -13,6 +9,10 @@ import { SynapseUtilityFunctions, useApplicationSessionContext, } from 'synapse-react-client' +import { getSearchParam } from './URLUtils' +import useAnalytics from './useAnalytics' +import { useSourceApp } from './components/SourceApp.js' +import { sageAccountWebThemeOverrides } from './style/theme' import { AppContextProvider } from './AppContext' function AppInitializer(props: { children?: React.ReactNode }) { diff --git a/apps/SageAccountWeb/src/components/AccountCreatedPage.tsx b/apps/SageAccountWeb/src/components/AccountCreatedPage.tsx index 5e9bcef8ab..0222c7e81c 100644 --- a/apps/SageAccountWeb/src/components/AccountCreatedPage.tsx +++ b/apps/SageAccountWeb/src/components/AccountCreatedPage.tsx @@ -1,14 +1,12 @@ import React from 'react' -import { SourceAppLogo, useSourceApp, useSourceAppConfigs } from './SourceApp' import { Button, Grid, Link, Typography } from '@mui/material' -import { AppContextConsumer } from '../AppContext' import { Link as RouterLink } from 'react-router-dom' -import { LeftRightPanel } from './LeftRightPanel' +import { AppContextConsumer } from '../AppContext' import useMembershipInvitationTokenHandler from '../hooks/useMembershipInvitationTokenHandler' +import { LeftRightPanel } from './LeftRightPanel' +import { SourceAppLogo, useSourceApp, useSourceAppConfigs } from './SourceApp' -export type AccountCreatedPageProps = {} - -export const AccountCreatedPage = (props: AccountCreatedPageProps) => { +export const AccountCreatedPage = () => { const membershipInvitation = useMembershipInvitationTokenHandler() const sourceApp = useSourceApp() const sourceAppConfigs = useSourceAppConfigs() diff --git a/apps/SageAccountWeb/src/components/AccountSettings.tsx b/apps/SageAccountWeb/src/components/AccountSettings.tsx index dcc249b1f3..d337eacda7 100644 --- a/apps/SageAccountWeb/src/components/AccountSettings.tsx +++ b/apps/SageAccountWeb/src/components/AccountSettings.tsx @@ -23,12 +23,12 @@ import { } from 'synapse-react-client' import { Link as RouterLink, useHistory, useLocation } from 'react-router-dom' import { Form } from 'react-bootstrap' +import UniversalCookies from 'universal-cookie' import { ChangePassword } from './ChangePassword' import { ORCiDButton } from './ProfileValidation/ORCiDButton' import AccountSettingsTopBar from './AccountSettingsTopBar' import { ConfigureEmail } from './ConfigureEmail' import { UnbindORCiDDialog } from './ProfileValidation/UnbindORCiD' -import UniversalCookies from 'universal-cookie' import { StyledFormControl } from './StyledComponents' import { ProfileAvatar } from './ProfileAvatar' import { useSourceAppConfigs } from './SourceApp' diff --git a/apps/SageAccountWeb/src/components/AccountSettingsTopBar.tsx b/apps/SageAccountWeb/src/components/AccountSettingsTopBar.tsx index 56ed56a71f..b0e789b613 100644 --- a/apps/SageAccountWeb/src/components/AccountSettingsTopBar.tsx +++ b/apps/SageAccountWeb/src/components/AccountSettingsTopBar.tsx @@ -1,12 +1,12 @@ import React from 'react' import { BadgeOutlined } from '@mui/icons-material' import { Box, Button, SxProps, Typography } from '@mui/material' -import { useSourceApp } from './SourceApp' -import { useAppContext } from '../AppContext' import { SynapseClient, useApplicationSessionContext, } from 'synapse-react-client' +import { useAppContext } from '../AppContext' +import { useSourceApp } from './SourceApp' const AccountSettingsTopBar: React.FunctionComponent = () => { const sourceApp = useSourceApp() diff --git a/apps/SageAccountWeb/src/components/ConfigureEmail.tsx b/apps/SageAccountWeb/src/components/ConfigureEmail.tsx index 1668bc18ed..86a22757ad 100644 --- a/apps/SageAccountWeb/src/components/ConfigureEmail.tsx +++ b/apps/SageAccountWeb/src/components/ConfigureEmail.tsx @@ -5,7 +5,6 @@ import { SynapseQueries, useSynapseContext, } from 'synapse-react-client' -import { getSearchParam, hexDecodeAndDeserialize } from '../URLUtils' import { Box, Button, @@ -20,6 +19,7 @@ import { } from '@mui/material' import DeleteIcon from '@mui/icons-material/DeleteTwoTone' import AddCircleTwoToneIcon from '@mui/icons-material/AddCircleTwoTone' +import { getSearchParam, hexDecodeAndDeserialize } from '../URLUtils' import { StyledFormControl } from './StyledComponents' export type ConfigureEmailProps = { @@ -158,13 +158,17 @@ export const ConfigureEmail = (props: ConfigureEmailProps) => { {email} deleteEmail(e, email)} + onClick={e => { + deleteEmail(e, email) + }} > @@ -202,7 +206,9 @@ export const ConfigureEmail = (props: ConfigureEmailProps) => { control={ updateEmailNotifications(!sendEmailNotifications)} + onChange={e => { + updateEmailNotifications(!sendEmailNotifications) + }} /> } label={ diff --git a/apps/SageAccountWeb/src/components/CropImage.ts b/apps/SageAccountWeb/src/components/CropImage.ts index e5ba6dd1c5..24893e8bab 100644 --- a/apps/SageAccountWeb/src/components/CropImage.ts +++ b/apps/SageAccountWeb/src/components/CropImage.ts @@ -1,4 +1,4 @@ -import { Area } from 'react-easy-crop/types' +import type { Area } from 'react-easy-crop/types' export const createImg = (url: string) => new Promise((res, rej) => { diff --git a/apps/SageAccountWeb/src/components/CurrentAffiliationPage.tsx b/apps/SageAccountWeb/src/components/CurrentAffiliationPage.tsx index 622015c25a..9791db189b 100644 --- a/apps/SageAccountWeb/src/components/CurrentAffiliationPage.tsx +++ b/apps/SageAccountWeb/src/components/CurrentAffiliationPage.tsx @@ -1,8 +1,5 @@ import React, { useEffect, useState } from 'react' -import { SourceAppLogo, useSourceApp } from './SourceApp' import { InputLabel, TextField, Typography } from '@mui/material' -import { LeftRightPanel } from './LeftRightPanel' -import { StyledFormControl } from './StyledComponents' import { displayToast, SynapseClient, @@ -10,6 +7,9 @@ import { useSynapseContext, } from 'synapse-react-client' import { Redirect } from 'react-router-dom' +import { SourceAppLogo, useSourceApp } from './SourceApp' +import { LeftRightPanel } from './LeftRightPanel' +import { StyledFormControl } from './StyledComponents' import { ContinueButton } from './ProfileValidation/ContinueButton' export const CurrentAffiliationPage = () => { diff --git a/apps/SageAccountWeb/src/components/EmailConfirmationPage.tsx b/apps/SageAccountWeb/src/components/EmailConfirmationPage.tsx index 64df6cc248..688885926f 100644 --- a/apps/SageAccountWeb/src/components/EmailConfirmationPage.tsx +++ b/apps/SageAccountWeb/src/components/EmailConfirmationPage.tsx @@ -36,7 +36,7 @@ export const EmailConfirmationPage: React.FunctionComponent<

Please check your email.

- We've sent an email to {email} + We've sent an email to {email}

Click the link in the message to verify your address, then continue @@ -49,7 +49,7 @@ export const EmailConfirmationPage: React.FunctionComponent< } target="_blank" > - I didn't receive an email + I didn't receive an email

)} diff --git a/apps/SageAccountWeb/src/components/ProfileValidation/ReturnToAppButton.tsx b/apps/SageAccountWeb/src/components/ProfileValidation/ReturnToAppButton.tsx index ce247457ad..9188b2c01d 100644 --- a/apps/SageAccountWeb/src/components/ProfileValidation/ReturnToAppButton.tsx +++ b/apps/SageAccountWeb/src/components/ProfileValidation/ReturnToAppButton.tsx @@ -11,9 +11,9 @@ import { useTheme, } from '@mui/material' import CloseIcon from '@mui/icons-material/Close' -import { useAppContext } from '../../AppContext' import React from 'react' import { NavLink } from 'react-router-dom' +import { useAppContext } from '../../AppContext' export const ReturnToAppButton: React.FC<{ children?: React.ReactNode }> = ({ children, @@ -52,9 +52,9 @@ export const ReturnToAppButton: React.FC<{ children?: React.ReactNode }> = ({ - If you cancel verification, you'll still be able to use portions of - the application which are available to registered users, but your - access will be restricted. + If you cancel verification, you'll still be able to use + portions of the application which are available to registered users, + but your access will be restricted. To resume your verification in the future, access the{' '} diff --git a/apps/SageAccountWeb/src/components/ProfileValidation/TermsAndConditionsSignature.tsx b/apps/SageAccountWeb/src/components/ProfileValidation/TermsAndConditionsSignature.tsx index f7e8dea079..a70d95878c 100644 --- a/apps/SageAccountWeb/src/components/ProfileValidation/TermsAndConditionsSignature.tsx +++ b/apps/SageAccountWeb/src/components/ProfileValidation/TermsAndConditionsSignature.tsx @@ -1,6 +1,6 @@ import { TextField, Typography } from '@mui/material' -import { StyledFormControl } from '../StyledComponents' import React from 'react' +import { StyledFormControl } from '../StyledComponents' export type TermsAndConditionsSignatureProps = { canSign: boolean diff --git a/apps/SageAccountWeb/src/components/ProfileValidation/TermsAndConditionsWrapped.tsx b/apps/SageAccountWeb/src/components/ProfileValidation/TermsAndConditionsWrapped.tsx index 3e5cb96e30..29e503b99a 100644 --- a/apps/SageAccountWeb/src/components/ProfileValidation/TermsAndConditionsWrapped.tsx +++ b/apps/SageAccountWeb/src/components/ProfileValidation/TermsAndConditionsWrapped.tsx @@ -1,10 +1,10 @@ import { Box } from '@mui/material' import { TermsAndConditions } from 'synapse-react-client' import React from 'react' -import { ContinueButton } from './ContinueButton' import { VerificationSubmission } from '@sage-bionetworks/synapse-types' -import { ReturnToAppButton } from './ReturnToAppButton' import { TermsAndConditionsLink } from '../TermsAndConditionsLink' +import { ContinueButton } from './ContinueButton' +import { ReturnToAppButton } from './ReturnToAppButton' // import { TermsAndConditionsSignature } from './TermsAndConditionsSignature' export type TermsAndConditionsWrappedProps = { diff --git a/apps/SageAccountWeb/src/components/ProfileValidation/ThankYou.tsx b/apps/SageAccountWeb/src/components/ProfileValidation/ThankYou.tsx index 607718cf08..81541835c6 100644 --- a/apps/SageAccountWeb/src/components/ProfileValidation/ThankYou.tsx +++ b/apps/SageAccountWeb/src/components/ProfileValidation/ThankYou.tsx @@ -29,14 +29,14 @@ const ThankYou: React.FC<{ children: React.ReactNode }> = ({ children }) => { - We're verifying your account. + We're verifying your account. - Here's what to expect next: + Here's what to expect next: Our Access and Compliance Team (ACT) will review your application. This diff --git a/apps/SageAccountWeb/src/components/ProfileValidation/UnbindORCiD.tsx b/apps/SageAccountWeb/src/components/ProfileValidation/UnbindORCiD.tsx index 45ac9e1c96..66f9e58d1f 100644 --- a/apps/SageAccountWeb/src/components/ProfileValidation/UnbindORCiD.tsx +++ b/apps/SageAccountWeb/src/components/ProfileValidation/UnbindORCiD.tsx @@ -58,7 +58,7 @@ export const UnbindORCiDDialog = (props: UnbindORCiDDialogProps) => { diff --git a/apps/SageAccountWeb/src/components/ProfileValidation/VerifyIdentify.tsx b/apps/SageAccountWeb/src/components/ProfileValidation/VerifyIdentify.tsx index 16b3106e0a..c1b41f24ee 100644 --- a/apps/SageAccountWeb/src/components/ProfileValidation/VerifyIdentify.tsx +++ b/apps/SageAccountWeb/src/components/ProfileValidation/VerifyIdentify.tsx @@ -1,10 +1,10 @@ -import { ORCiDButton } from './ORCiDButton' import React, { useEffect, useState } from 'react' import { VerificationSubmission } from '@sage-bionetworks/synapse-types' import CheckIcon from '@mui/icons-material/Check' //agendelTODO: mobe to sage account page //import { UnbindORCiDDialog } from 'components/ProfileValidation/UnbindORCiD' import { Box, Typography, useTheme } from '@mui/material' +import { ORCiDButton } from './ORCiDButton' import { ContinueButton } from './ContinueButton' import { ReturnToAppButton } from './ReturnToAppButton' diff --git a/apps/SageAccountWeb/src/components/RegisterAccount1.tsx b/apps/SageAccountWeb/src/components/RegisterAccount1.tsx index b76e9ec489..fd39e723a2 100644 --- a/apps/SageAccountWeb/src/components/RegisterAccount1.tsx +++ b/apps/SageAccountWeb/src/components/RegisterAccount1.tsx @@ -20,11 +20,11 @@ import { AliasType, isMembershipInvtnSignedToken, } from '@sage-bionetworks/synapse-types' -import { SourceAppLogo, useSourceApp } from './SourceApp' import { Link as RouterLink } from 'react-router-dom' -import { EmailConfirmationPage } from './EmailConfirmationPage' import GoogleLogo from '../assets/g-logo.png' import { useAppContext } from '../AppContext' +import { EmailConfirmationPage } from './EmailConfirmationPage' +import { SourceAppLogo, useSourceApp } from './SourceApp' import { BackButton } from './BackButton' import { StyledFormControl, @@ -256,7 +256,9 @@ export const RegisterAccount1 = () => {