diff --git a/.github/workflows/on-pull-req.yaml b/.github/workflows/on-pull-req.yaml index d3fc3ea4..153f40b7 100644 --- a/.github/workflows/on-pull-req.yaml +++ b/.github/workflows/on-pull-req.yaml @@ -7,7 +7,17 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: actions/setup-node@v3 + # ubuntu-latest provides node & rust installed by default + # checkout the image for version specifics + # > https://github.com/actions/runner-images#available-images - run: npm install - run: npm run prettier:check - run: npm run build + - name: install dependencies for tauri + run: | + sudo apt-get update + sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.0-dev libappindicator3-dev librsvg2-dev patchelf + - working-directory: ./src-tauri + run: cargo check + - working-directory: ./src-tauri + run: cargo fmt --check diff --git a/package-lock.json b/package-lock.json index f003dfe1..bf4114d7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,15 +1,15 @@ { "name": "prem-app", - "version": "0.1.1", + "version": "0.1.2", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "prem-app", - "version": "0.1.1", + "version": "0.1.2", "dependencies": { "@microsoft/fetch-event-source": "^2.0.1", - "@tanstack/react-query": "^4.29.5", + "@tanstack/react-query": "^5.4.3", "@tauri-apps/api": "^1.5.1", "axios": "^1.4.0", "clsx": "^1.2.1", @@ -42,7 +42,7 @@ "zustand": "^4.3.7" }, "devDependencies": { - "@tanstack/react-query-devtools": "^4.36.1", + "@tanstack/react-query-devtools": "^5.4.3", "@tauri-apps/cli": "^1.5.6", "@types/lodash": "^4.14.194", "@types/node": "^18.7.10", @@ -2599,9 +2599,9 @@ } }, "node_modules/@eslint-community/regexpp": { - "version": "4.9.1", - "resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.9.1.tgz", - "integrity": "sha512-Y27x+MBLjXa+0JWDhykM3+JE+il3kHKAEqabfEWq3SDhZjLYb6/BHL/JKFnH3fe207JaXkyDo685Oc2Glt6ifA==", + "version": "4.10.0", + "resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.10.0.tgz", + "integrity": "sha512-Cu96Sd2By9mCNTx2iyKOmq10v22jUVQv0lQnlGNy16oE9589yE+QADPbrMGCkA51cKZSg3Pu/aTJVTGfL/qjUA==", "dev": true, "engines": { "node": "^12.0.0 || ^14.0.0 || >=16.0.0" @@ -2875,46 +2875,39 @@ "integrity": "sha512-6i/8UoL0P5y4leBIGzvkZdS85RDMG9y1ihZzmTZQ5LdHUYmZ7pKFoj8X0236s3lusPs1Fa5HTQUpwI+UfTcmeA==", "dev": true }, - "node_modules/@tanstack/match-sorter-utils": { - "version": "8.8.4", - "resolved": "https://registry.npmjs.org/@tanstack/match-sorter-utils/-/match-sorter-utils-8.8.4.tgz", - "integrity": "sha512-rKH8LjZiszWEvmi01NR72QWZ8m4xmXre0OOwlRGnjU01Eqz/QnN+cqpty2PJ0efHblq09+KilvyR7lsbzmXVEw==", - "dev": true, - "dependencies": { - "remove-accents": "0.4.2" - }, - "engines": { - "node": ">=12" - }, + "node_modules/@tanstack/query-core": { + "version": "5.4.3", + "resolved": "https://registry.npmjs.org/@tanstack/query-core/-/query-core-5.4.3.tgz", + "integrity": "sha512-fnI9ORjcuLGm1sNrKatKIosRQUpuqcD4SV7RqRSVmj8JSicX2aoMyKryHEBpVQvf6N4PaBVgBxQomjsbsGPssQ==", "funding": { "type": "github", - "url": "https://github.com/sponsors/kentcdodds" + "url": "https://github.com/sponsors/tannerlinsley" } }, - "node_modules/@tanstack/query-core": { - "version": "4.36.1", - "resolved": "https://registry.npmjs.org/@tanstack/query-core/-/query-core-4.36.1.tgz", - "integrity": "sha512-DJSilV5+ytBP1FbFcEJovv4rnnm/CokuVvrBEtW/Va9DvuJ3HksbXUJEpI0aV1KtuL4ZoO9AVE6PyNLzF7tLeA==", + "node_modules/@tanstack/query-devtools": { + "version": "5.4.2", + "resolved": "https://registry.npmjs.org/@tanstack/query-devtools/-/query-devtools-5.4.2.tgz", + "integrity": "sha512-EXdaMXi8CxZuMp97J5mq6wy1RduOfoWFv5vtA1U+hyqb8Wst6M8kkkjDSdFvGZIRpYY4K8mKLlEFHNUZDG5dtw==", + "dev": true, "funding": { "type": "github", "url": "https://github.com/sponsors/tannerlinsley" } }, "node_modules/@tanstack/react-query": { - "version": "4.36.1", - "resolved": "https://registry.npmjs.org/@tanstack/react-query/-/react-query-4.36.1.tgz", - "integrity": "sha512-y7ySVHFyyQblPl3J3eQBWpXZkliroki3ARnBKsdJchlgt7yJLRDUcf4B8soufgiYt3pEQIkBWBx1N9/ZPIeUWw==", + "version": "5.4.3", + "resolved": "https://registry.npmjs.org/@tanstack/react-query/-/react-query-5.4.3.tgz", + "integrity": "sha512-4aSOrRNa6yEmf7mws5QPTVMn8Lp7L38tFoTZ0c1ZmhIvbr8GIA0WT7X5N3yz/nuK8hUtjw9cAzBr4BPDZZ+tzA==", "dependencies": { - "@tanstack/query-core": "4.36.1", - "use-sync-external-store": "^1.2.0" + "@tanstack/query-core": "5.4.3" }, "funding": { "type": "github", "url": "https://github.com/sponsors/tannerlinsley" }, "peerDependencies": { - "react": "^16.8.0 || ^17.0.0 || ^18.0.0", - "react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0", + "react": "^18.0.0", + "react-dom": "^18.0.0", "react-native": "*" }, "peerDependenciesMeta": { @@ -2927,23 +2920,21 @@ } }, "node_modules/@tanstack/react-query-devtools": { - "version": "4.36.1", - "resolved": "https://registry.npmjs.org/@tanstack/react-query-devtools/-/react-query-devtools-4.36.1.tgz", - "integrity": "sha512-WYku83CKP3OevnYSG8Y/QO9g0rT75v1om5IvcWUwiUZJ4LanYGLVCZ8TdFG5jfsq4Ej/lu2wwDAULEUnRIMBSw==", + "version": "5.4.3", + "resolved": "https://registry.npmjs.org/@tanstack/react-query-devtools/-/react-query-devtools-5.4.3.tgz", + "integrity": "sha512-J9EB50vpK5yvQ5W+AOp9jIQa+1mld+Wwc2GF3VLr2SEDhOyiTiHOjrFGKKL1Cal5Wg8UuS3vexf8trElrtg05A==", "dev": true, "dependencies": { - "@tanstack/match-sorter-utils": "^8.7.0", - "superjson": "^1.10.0", - "use-sync-external-store": "^1.2.0" + "@tanstack/query-devtools": "5.4.2" }, "funding": { "type": "github", "url": "https://github.com/sponsors/tannerlinsley" }, "peerDependencies": { - "@tanstack/react-query": "^4.36.1", - "react": "^16.8.0 || ^17.0.0 || ^18.0.0", - "react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0" + "@tanstack/react-query": "^5.4.3", + "react": "^18.0.0", + "react-dom": "^18.0.0" } }, "node_modules/@tauri-apps/api": { @@ -3212,10 +3203,13 @@ "integrity": "sha512-AuHIyzR5Hea7ij0P9q7vx7xu4z0C28ucwjAZC0ja7JhINyCnOw8/DnvAPQQ9TfOlCtZAmCERKQX9+o1mgQhuOQ==" }, "node_modules/@types/node": { - "version": "18.18.6", - "resolved": "https://registry.npmjs.org/@types/node/-/node-18.18.6.tgz", - "integrity": "sha512-wf3Vz+jCmOQ2HV1YUJuCWdL64adYxumkrxtc+H1VUQlnQI04+5HtH+qZCOE21lBE7gIrt+CwX2Wv8Acrw5Ak6w==", - "dev": true + "version": "18.18.7", + "resolved": "https://registry.npmjs.org/@types/node/-/node-18.18.7.tgz", + "integrity": "sha512-bw+lEsxis6eqJYW8Ql6+yTqkE6RuFtsQPSe5JxXbqYRFQEER5aJA9a5UH9igqDWm3X4iLHIKOHlnAXLM4mi7uQ==", + "dev": true, + "dependencies": { + "undici-types": "~5.26.4" + } }, "node_modules/@types/parse-json": { "version": "4.0.1", @@ -3239,9 +3233,9 @@ "integrity": "sha512-n1yyPsugYNSmHgxDFjicaI2+gCNjsBck8UX9kuofAKlc0h1bL+20oSF72KeNaW2DUlesbEVCFgyV2dPGTiY42g==" }, "node_modules/@types/react": { - "version": "18.2.31", - "resolved": "https://registry.npmjs.org/@types/react/-/react-18.2.31.tgz", - "integrity": "sha512-c2UnPv548q+5DFh03y8lEDeMfDwBn9G3dRwfkrxQMo/dOtRHUUO57k6pHvBIfH/VF4Nh+98mZ5aaSe+2echD5g==", + "version": "18.2.33", + "resolved": "https://registry.npmjs.org/@types/react/-/react-18.2.33.tgz", + "integrity": "sha512-v+I7S+hu3PIBoVkKGpSYYpiBT1ijqEzWpzQD62/jm4K74hPpSP7FF9BnKG6+fg2+62weJYkkBWDJlZt5JO/9hg==", "dependencies": { "@types/prop-types": "*", "@types/scheduler": "*", @@ -3668,9 +3662,9 @@ } }, "node_modules/acorn": { - "version": "8.10.0", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.10.0.tgz", - "integrity": "sha512-F0SAmZ8iUtS//m8DmCTA0jlh6TDKkHQyK6xc6V4KDTyZKA9dnvX9/3sRTVQrWm79glUAZbnmmNcdYwUIHWVybw==", + "version": "8.11.2", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.11.2.tgz", + "integrity": "sha512-nc0Axzp/0FILLEVsm4fNwLCwMttvhEI263QtVPQcbpfZZ3ts0hLsZGOpE6czNlid7CJ9MlyH8reXkpsf3YUY4w==", "dev": true, "bin": { "acorn": "bin/acorn" @@ -3993,9 +3987,9 @@ } }, "node_modules/axios": { - "version": "1.5.1", - "resolved": "https://registry.npmjs.org/axios/-/axios-1.5.1.tgz", - "integrity": "sha512-Q28iYCWzNHjAm+yEAot5QaAMxhMghWLFVf7rRdwhUI+c2jix2DUXjAHXVi+s1ibs3mjPO/cCgbA++3BjD0vP/A==", + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.6.0.tgz", + "integrity": "sha512-EZ1DYihju9pwVB+jg67ogm+Tmqc6JmhamRN6I4Zt8DfZu5lbcQGw3ozH9lFejSJgs/ibaef3A9PMXPLeefFGJg==", "dependencies": { "follow-redirects": "^1.15.0", "form-data": "^4.0.0", @@ -4251,9 +4245,9 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001554", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001554.tgz", - "integrity": "sha512-A2E3U//MBwbJVzebddm1YfNp7Nud5Ip+IPn4BozBmn4KqVX7AvluoIDFWjsv5OkGnKUXQVmMSoMKLa3ScCblcQ==", + "version": "1.0.30001558", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001558.tgz", + "integrity": "sha512-/Et7DwLqpjS47JPEcz6VnxU9PwcIdVi0ciLXRWBQdj1XFye68pSQYpV0QtPTfUKWuOaEig+/Vez2l74eDc1tPQ==", "dev": true, "funding": [ { @@ -4445,21 +4439,6 @@ "integrity": "sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==", "dev": true }, - "node_modules/copy-anything": { - "version": "3.0.5", - "resolved": "https://registry.npmjs.org/copy-anything/-/copy-anything-3.0.5.tgz", - "integrity": "sha512-yCEafptTtb4bk7GLEQoM8KVJpxAfdBJYaXyzQEgQQQgYrZiDp8SJmGKlYza6CYjEDNstAdNdKA3UuoULlEbS6w==", - "dev": true, - "dependencies": { - "is-what": "^4.1.8" - }, - "engines": { - "node": ">=12.13" - }, - "funding": { - "url": "https://github.com/sponsors/mesqueeb" - } - }, "node_modules/copy-to-clipboard": { "version": "3.3.3", "resolved": "https://registry.npmjs.org/copy-to-clipboard/-/copy-to-clipboard-3.3.3.tgz", @@ -4761,9 +4740,9 @@ } }, "node_modules/electron-to-chromium": { - "version": "1.4.566", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.566.tgz", - "integrity": "sha512-mv+fAy27uOmTVlUULy15U3DVJ+jg+8iyKH1bpwboCRhtDC69GKf1PPTZvEIhCyDr81RFqfxZJYrbgp933a1vtg==", + "version": "1.4.569", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.569.tgz", + "integrity": "sha512-LsrJjZ0IbVy12ApW3gpYpcmHS3iRxH4bkKOW98y1/D+3cvDUWGcbzbsFinfUS8knpcZk/PG/2p/RnkMCYN7PVg==", "dev": true }, "node_modules/emoji-regex": { @@ -6837,18 +6816,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/is-what": { - "version": "4.1.15", - "resolved": "https://registry.npmjs.org/is-what/-/is-what-4.1.15.tgz", - "integrity": "sha512-uKua1wfy3Yt+YqsD6mTUEa2zSi3G1oPlqTflgaPJ7z63vUGN5pxFpnQfeSLMFnJDEsdvOtkp1rUWkYjB4YfhgA==", - "dev": true, - "engines": { - "node": ">=12.13" - }, - "funding": { - "url": "https://github.com/sponsors/mesqueeb" - } - }, "node_modules/is-wsl": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-2.2.0.tgz", @@ -9291,12 +9258,6 @@ "url": "https://opencollective.com/unified" } }, - "node_modules/remove-accents": { - "version": "0.4.2", - "resolved": "https://registry.npmjs.org/remove-accents/-/remove-accents-0.4.2.tgz", - "integrity": "sha512-7pXIJqJOq5tFgG1A2Zxti3Ht8jJF337m4sowbuHsW30ZnkQFnDzy9qBNhgzX8ZLW4+UBcXiiR7SwR6pokHsxiA==", - "dev": true - }, "node_modules/resolve": { "version": "1.22.8", "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.8.tgz", @@ -9850,18 +9811,6 @@ "url": "https://github.com/sponsors/isaacs" } }, - "node_modules/superjson": { - "version": "1.13.3", - "resolved": "https://registry.npmjs.org/superjson/-/superjson-1.13.3.tgz", - "integrity": "sha512-mJiVjfd2vokfDxsQPOwJ/PtanO87LhpYY88ubI5dUB1Ab58Txbyje3+jpm+/83R/fevaq/107NNhtYBLuoTrFg==", - "dev": true, - "dependencies": { - "copy-anything": "^3.0.2" - }, - "engines": { - "node": ">=10" - } - }, "node_modules/supports-color": { "version": "5.5.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", @@ -9901,9 +9850,9 @@ } }, "node_modules/tailwindcss": { - "version": "3.3.4", - "resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-3.3.4.tgz", - "integrity": "sha512-JXZNOkggUAc9T5E7nCrimoXHcSf9h3NWFe5sh36CGD/3M5TRLuQeFnQoDsit2uVTqgoOZHLx5rTykLUu16vsMQ==", + "version": "3.3.5", + "resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-3.3.5.tgz", + "integrity": "sha512-5SEZU4J7pxZgSkv7FP1zY8i2TIAOooNZ1e/OGtxIEv6GltpoiXUqWvLy89+a10qYTB1N5Ifkuw9lqQkN9sscvA==", "dev": true, "dependencies": { "@alloc/quick-lru": "^5.2.0", @@ -10212,6 +10161,12 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/undici-types": { + "version": "5.26.5", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz", + "integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==", + "dev": true + }, "node_modules/unicode-canonical-property-names-ecmascript": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/unicode-canonical-property-names-ecmascript/-/unicode-canonical-property-names-ecmascript-2.0.0.tgz", @@ -11242,8 +11197,7 @@ "version": "7.21.0-placeholder-for-preset-env.2", "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-private-property-in-object/-/plugin-proposal-private-property-in-object-7.21.0-placeholder-for-preset-env.2.tgz", "integrity": "sha512-SOSkfJDddaM7mak6cPEpswyTRnuRltl429hMraQEglW+OkovnCzsiszTmsrlY//qLFjCpQDFRvjdm2wA5pPm9w==", - "dev": true, - "requires": {} + "dev": true }, "@babel/plugin-syntax-async-generators": { "version": "7.8.4", @@ -12294,8 +12248,7 @@ "@emotion/use-insertion-effect-with-fallbacks": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/@emotion/use-insertion-effect-with-fallbacks/-/use-insertion-effect-with-fallbacks-1.0.1.tgz", - "integrity": "sha512-jT/qyKZ9rzLErtrjGgdkMBn2OP8wl0G3sQlBb3YPryvKHsjvINUhVaPFfP+fpBcOkmrVOVEEHQFJ7nbj2TH2gw==", - "requires": {} + "integrity": "sha512-jT/qyKZ9rzLErtrjGgdkMBn2OP8wl0G3sQlBb3YPryvKHsjvINUhVaPFfP+fpBcOkmrVOVEEHQFJ7nbj2TH2gw==" }, "@emotion/utils": { "version": "1.2.1", @@ -12471,9 +12424,9 @@ } }, "@eslint-community/regexpp": { - "version": "4.9.1", - "resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.9.1.tgz", - "integrity": "sha512-Y27x+MBLjXa+0JWDhykM3+JE+il3kHKAEqabfEWq3SDhZjLYb6/BHL/JKFnH3fe207JaXkyDo685Oc2Glt6ifA==", + "version": "4.10.0", + "resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.10.0.tgz", + "integrity": "sha512-Cu96Sd2By9mCNTx2iyKOmq10v22jUVQv0lQnlGNy16oE9589yE+QADPbrMGCkA51cKZSg3Pu/aTJVTGfL/qjUA==", "dev": true }, "@eslint/eslintrc": { @@ -12687,38 +12640,32 @@ "integrity": "sha512-6i/8UoL0P5y4leBIGzvkZdS85RDMG9y1ihZzmTZQ5LdHUYmZ7pKFoj8X0236s3lusPs1Fa5HTQUpwI+UfTcmeA==", "dev": true }, - "@tanstack/match-sorter-utils": { - "version": "8.8.4", - "resolved": "https://registry.npmjs.org/@tanstack/match-sorter-utils/-/match-sorter-utils-8.8.4.tgz", - "integrity": "sha512-rKH8LjZiszWEvmi01NR72QWZ8m4xmXre0OOwlRGnjU01Eqz/QnN+cqpty2PJ0efHblq09+KilvyR7lsbzmXVEw==", - "dev": true, - "requires": { - "remove-accents": "0.4.2" - } - }, "@tanstack/query-core": { - "version": "4.36.1", - "resolved": "https://registry.npmjs.org/@tanstack/query-core/-/query-core-4.36.1.tgz", - "integrity": "sha512-DJSilV5+ytBP1FbFcEJovv4rnnm/CokuVvrBEtW/Va9DvuJ3HksbXUJEpI0aV1KtuL4ZoO9AVE6PyNLzF7tLeA==" + "version": "5.4.3", + "resolved": "https://registry.npmjs.org/@tanstack/query-core/-/query-core-5.4.3.tgz", + "integrity": "sha512-fnI9ORjcuLGm1sNrKatKIosRQUpuqcD4SV7RqRSVmj8JSicX2aoMyKryHEBpVQvf6N4PaBVgBxQomjsbsGPssQ==" + }, + "@tanstack/query-devtools": { + "version": "5.4.2", + "resolved": "https://registry.npmjs.org/@tanstack/query-devtools/-/query-devtools-5.4.2.tgz", + "integrity": "sha512-EXdaMXi8CxZuMp97J5mq6wy1RduOfoWFv5vtA1U+hyqb8Wst6M8kkkjDSdFvGZIRpYY4K8mKLlEFHNUZDG5dtw==", + "dev": true }, "@tanstack/react-query": { - "version": "4.36.1", - "resolved": "https://registry.npmjs.org/@tanstack/react-query/-/react-query-4.36.1.tgz", - "integrity": "sha512-y7ySVHFyyQblPl3J3eQBWpXZkliroki3ARnBKsdJchlgt7yJLRDUcf4B8soufgiYt3pEQIkBWBx1N9/ZPIeUWw==", + "version": "5.4.3", + "resolved": "https://registry.npmjs.org/@tanstack/react-query/-/react-query-5.4.3.tgz", + "integrity": "sha512-4aSOrRNa6yEmf7mws5QPTVMn8Lp7L38tFoTZ0c1ZmhIvbr8GIA0WT7X5N3yz/nuK8hUtjw9cAzBr4BPDZZ+tzA==", "requires": { - "@tanstack/query-core": "4.36.1", - "use-sync-external-store": "^1.2.0" + "@tanstack/query-core": "5.4.3" } }, "@tanstack/react-query-devtools": { - "version": "4.36.1", - "resolved": "https://registry.npmjs.org/@tanstack/react-query-devtools/-/react-query-devtools-4.36.1.tgz", - "integrity": "sha512-WYku83CKP3OevnYSG8Y/QO9g0rT75v1om5IvcWUwiUZJ4LanYGLVCZ8TdFG5jfsq4Ej/lu2wwDAULEUnRIMBSw==", + "version": "5.4.3", + "resolved": "https://registry.npmjs.org/@tanstack/react-query-devtools/-/react-query-devtools-5.4.3.tgz", + "integrity": "sha512-J9EB50vpK5yvQ5W+AOp9jIQa+1mld+Wwc2GF3VLr2SEDhOyiTiHOjrFGKKL1Cal5Wg8UuS3vexf8trElrtg05A==", "dev": true, "requires": { - "@tanstack/match-sorter-utils": "^8.7.0", - "superjson": "^1.10.0", - "use-sync-external-store": "^1.2.0" + "@tanstack/query-devtools": "5.4.2" } }, "@tauri-apps/api": { @@ -12878,10 +12825,13 @@ "integrity": "sha512-AuHIyzR5Hea7ij0P9q7vx7xu4z0C28ucwjAZC0ja7JhINyCnOw8/DnvAPQQ9TfOlCtZAmCERKQX9+o1mgQhuOQ==" }, "@types/node": { - "version": "18.18.6", - "resolved": "https://registry.npmjs.org/@types/node/-/node-18.18.6.tgz", - "integrity": "sha512-wf3Vz+jCmOQ2HV1YUJuCWdL64adYxumkrxtc+H1VUQlnQI04+5HtH+qZCOE21lBE7gIrt+CwX2Wv8Acrw5Ak6w==", - "dev": true + "version": "18.18.7", + "resolved": "https://registry.npmjs.org/@types/node/-/node-18.18.7.tgz", + "integrity": "sha512-bw+lEsxis6eqJYW8Ql6+yTqkE6RuFtsQPSe5JxXbqYRFQEER5aJA9a5UH9igqDWm3X4iLHIKOHlnAXLM4mi7uQ==", + "dev": true, + "requires": { + "undici-types": "~5.26.4" + } }, "@types/parse-json": { "version": "4.0.1", @@ -12905,9 +12855,9 @@ "integrity": "sha512-n1yyPsugYNSmHgxDFjicaI2+gCNjsBck8UX9kuofAKlc0h1bL+20oSF72KeNaW2DUlesbEVCFgyV2dPGTiY42g==" }, "@types/react": { - "version": "18.2.31", - "resolved": "https://registry.npmjs.org/@types/react/-/react-18.2.31.tgz", - "integrity": "sha512-c2UnPv548q+5DFh03y8lEDeMfDwBn9G3dRwfkrxQMo/dOtRHUUO57k6pHvBIfH/VF4Nh+98mZ5aaSe+2echD5g==", + "version": "18.2.33", + "resolved": "https://registry.npmjs.org/@types/react/-/react-18.2.33.tgz", + "integrity": "sha512-v+I7S+hu3PIBoVkKGpSYYpiBT1ijqEzWpzQD62/jm4K74hPpSP7FF9BnKG6+fg2+62weJYkkBWDJlZt5JO/9hg==", "requires": { "@types/prop-types": "*", "@types/scheduler": "*", @@ -13202,17 +13152,16 @@ } }, "acorn": { - "version": "8.10.0", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.10.0.tgz", - "integrity": "sha512-F0SAmZ8iUtS//m8DmCTA0jlh6TDKkHQyK6xc6V4KDTyZKA9dnvX9/3sRTVQrWm79glUAZbnmmNcdYwUIHWVybw==", + "version": "8.11.2", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.11.2.tgz", + "integrity": "sha512-nc0Axzp/0FILLEVsm4fNwLCwMttvhEI263QtVPQcbpfZZ3ts0hLsZGOpE6czNlid7CJ9MlyH8reXkpsf3YUY4w==", "dev": true }, "acorn-jsx": { "version": "5.3.2", "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz", "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==", - "dev": true, - "requires": {} + "dev": true }, "ajv": { "version": "6.12.6", @@ -13432,9 +13381,9 @@ "dev": true }, "axios": { - "version": "1.5.1", - "resolved": "https://registry.npmjs.org/axios/-/axios-1.5.1.tgz", - "integrity": "sha512-Q28iYCWzNHjAm+yEAot5QaAMxhMghWLFVf7rRdwhUI+c2jix2DUXjAHXVi+s1ibs3mjPO/cCgbA++3BjD0vP/A==", + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.6.0.tgz", + "integrity": "sha512-EZ1DYihju9pwVB+jg67ogm+Tmqc6JmhamRN6I4Zt8DfZu5lbcQGw3ozH9lFejSJgs/ibaef3A9PMXPLeefFGJg==", "requires": { "follow-redirects": "^1.15.0", "form-data": "^4.0.0", @@ -13626,9 +13575,9 @@ "dev": true }, "caniuse-lite": { - "version": "1.0.30001554", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001554.tgz", - "integrity": "sha512-A2E3U//MBwbJVzebddm1YfNp7Nud5Ip+IPn4BozBmn4KqVX7AvluoIDFWjsv5OkGnKUXQVmMSoMKLa3ScCblcQ==", + "version": "1.0.30001558", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001558.tgz", + "integrity": "sha512-/Et7DwLqpjS47JPEcz6VnxU9PwcIdVi0ciLXRWBQdj1XFye68pSQYpV0QtPTfUKWuOaEig+/Vez2l74eDc1tPQ==", "dev": true }, "ccount": { @@ -13759,15 +13708,6 @@ "integrity": "sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==", "dev": true }, - "copy-anything": { - "version": "3.0.5", - "resolved": "https://registry.npmjs.org/copy-anything/-/copy-anything-3.0.5.tgz", - "integrity": "sha512-yCEafptTtb4bk7GLEQoM8KVJpxAfdBJYaXyzQEgQQQgYrZiDp8SJmGKlYza6CYjEDNstAdNdKA3UuoULlEbS6w==", - "dev": true, - "requires": { - "is-what": "^4.1.8" - } - }, "copy-to-clipboard": { "version": "3.3.3", "resolved": "https://registry.npmjs.org/copy-to-clipboard/-/copy-to-clipboard-3.3.3.tgz", @@ -13982,9 +13922,9 @@ } }, "electron-to-chromium": { - "version": "1.4.566", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.566.tgz", - "integrity": "sha512-mv+fAy27uOmTVlUULy15U3DVJ+jg+8iyKH1bpwboCRhtDC69GKf1PPTZvEIhCyDr81RFqfxZJYrbgp933a1vtg==", + "version": "1.4.569", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.569.tgz", + "integrity": "sha512-LsrJjZ0IbVy12ApW3gpYpcmHS3iRxH4bkKOW98y1/D+3cvDUWGcbzbsFinfUS8knpcZk/PG/2p/RnkMCYN7PVg==", "dev": true }, "emoji-regex": { @@ -14258,8 +14198,7 @@ "version": "8.10.0", "resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-8.10.0.tgz", "integrity": "sha512-SM8AMJdeQqRYT9O9zguiruQZaN7+z+E4eAP9oiLNGKMtomwaB1E9dcgUD6ZAn/eQAb52USbvezbiljfZUhbJcg==", - "dev": true, - "requires": {} + "dev": true }, "eslint-config-react-app": { "version": "7.0.1", @@ -14473,8 +14412,7 @@ "version": "4.6.0", "resolved": "https://registry.npmjs.org/eslint-plugin-react-hooks/-/eslint-plugin-react-hooks-4.6.0.tgz", "integrity": "sha512-oFc7Itz9Qxh2x4gNHStv3BqJq54ExXmfC+a1NjAta66IAN87Wu0R/QArgIS9qKzX3dXKPI9H5crl9QchNMY9+g==", - "dev": true, - "requires": {} + "dev": true }, "eslint-plugin-testing-library": { "version": "5.11.1", @@ -15461,12 +15399,6 @@ "get-intrinsic": "^1.1.1" } }, - "is-what": { - "version": "4.1.15", - "resolved": "https://registry.npmjs.org/is-what/-/is-what-4.1.15.tgz", - "integrity": "sha512-uKua1wfy3Yt+YqsD6mTUEa2zSi3G1oPlqTflgaPJ7z63vUGN5pxFpnQfeSLMFnJDEsdvOtkp1rUWkYjB4YfhgA==", - "dev": true - }, "is-wsl": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-2.2.0.tgz", @@ -16744,8 +16676,7 @@ "react-aptor": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/react-aptor/-/react-aptor-2.0.0.tgz", - "integrity": "sha512-YnCayokuhAwmBBP4Oc0bbT2l6ApfsjbY3DEEVUddIKZEBlGl1npzjHHzWnSqWuboSbMZvRqUM01Io9yiIp1wcg==", - "requires": {} + "integrity": "sha512-YnCayokuhAwmBBP4Oc0bbT2l6ApfsjbY3DEEVUddIKZEBlGl1npzjHHzWnSqWuboSbMZvRqUM01Io9yiIp1wcg==" }, "react-copy-to-clipboard": { "version": "5.1.0", @@ -16885,8 +16816,7 @@ "react-simple-code-editor": { "version": "0.13.1", "resolved": "https://registry.npmjs.org/react-simple-code-editor/-/react-simple-code-editor-0.13.1.tgz", - "integrity": "sha512-XYeVwRZwgyKtjNIYcAEgg2FaQcCZwhbarnkJIV20U2wkCU9q/CPFBo8nRXrK4GXUz3AvbqZFsZRrpUTkqqEYyQ==", - "requires": {} + "integrity": "sha512-XYeVwRZwgyKtjNIYcAEgg2FaQcCZwhbarnkJIV20U2wkCU9q/CPFBo8nRXrK4GXUz3AvbqZFsZRrpUTkqqEYyQ==" }, "react-syntax-highlighter": { "version": "15.5.0", @@ -17147,12 +17077,6 @@ "unified": "^10.0.0" } }, - "remove-accents": { - "version": "0.4.2", - "resolved": "https://registry.npmjs.org/remove-accents/-/remove-accents-0.4.2.tgz", - "integrity": "sha512-7pXIJqJOq5tFgG1A2Zxti3Ht8jJF337m4sowbuHsW30ZnkQFnDzy9qBNhgzX8ZLW4+UBcXiiR7SwR6pokHsxiA==", - "dev": true - }, "resolve": { "version": "1.22.8", "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.8.tgz", @@ -17545,15 +17469,6 @@ } } }, - "superjson": { - "version": "1.13.3", - "resolved": "https://registry.npmjs.org/superjson/-/superjson-1.13.3.tgz", - "integrity": "sha512-mJiVjfd2vokfDxsQPOwJ/PtanO87LhpYY88ubI5dUB1Ab58Txbyje3+jpm+/83R/fevaq/107NNhtYBLuoTrFg==", - "dev": true, - "requires": { - "copy-anything": "^3.0.2" - } - }, "supports-color": { "version": "5.5.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", @@ -17578,9 +17493,9 @@ } }, "tailwindcss": { - "version": "3.3.4", - "resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-3.3.4.tgz", - "integrity": "sha512-JXZNOkggUAc9T5E7nCrimoXHcSf9h3NWFe5sh36CGD/3M5TRLuQeFnQoDsit2uVTqgoOZHLx5rTykLUu16vsMQ==", + "version": "3.3.5", + "resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-3.3.5.tgz", + "integrity": "sha512-5SEZU4J7pxZgSkv7FP1zY8i2TIAOooNZ1e/OGtxIEv6GltpoiXUqWvLy89+a10qYTB1N5Ifkuw9lqQkN9sscvA==", "dev": true, "requires": { "@alloc/quick-lru": "^5.2.0", @@ -17676,8 +17591,7 @@ "version": "2.1.2", "resolved": "https://registry.npmjs.org/tsconfck/-/tsconfck-2.1.2.tgz", "integrity": "sha512-ghqN1b0puy3MhhviwO2kGF8SeMDNhEbnKxjK7h6+fvY9JAxqvXi8y5NAHSQv687OVboS2uZIByzGd45/YxrRHg==", - "dev": true, - "requires": {} + "dev": true }, "tsconfig-paths": { "version": "3.14.2", @@ -17804,6 +17718,12 @@ "which-boxed-primitive": "^1.0.2" } }, + "undici-types": { + "version": "5.26.5", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz", + "integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==", + "dev": true + }, "unicode-canonical-property-names-ecmascript": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/unicode-canonical-property-names-ecmascript/-/unicode-canonical-property-names-ecmascript-2.0.0.tgz", @@ -17927,20 +17847,17 @@ "use-isomorphic-layout-effect": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/use-isomorphic-layout-effect/-/use-isomorphic-layout-effect-1.1.2.tgz", - "integrity": "sha512-49L8yCO3iGT/ZF9QttjwLF/ZD9Iwto5LnH5LmEdk/6cFmXddqi2ulF0edxTwjj+7mqvpVVGQWvbXZdn32wRSHA==", - "requires": {} + "integrity": "sha512-49L8yCO3iGT/ZF9QttjwLF/ZD9Iwto5LnH5LmEdk/6cFmXddqi2ulF0edxTwjj+7mqvpVVGQWvbXZdn32wRSHA==" }, "use-sync-external-store": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/use-sync-external-store/-/use-sync-external-store-1.2.0.tgz", - "integrity": "sha512-eEgnFxGQ1Ife9bzYs6VLi8/4X6CObHMw9Qr9tPY43iKwsPw8xE8+EFsf/2cFZ5S3esXgpWgtSCtLNS41F+sKPA==", - "requires": {} + "integrity": "sha512-eEgnFxGQ1Ife9bzYs6VLi8/4X6CObHMw9Qr9tPY43iKwsPw8xE8+EFsf/2cFZ5S3esXgpWgtSCtLNS41F+sKPA==" }, "usehooks-ts": { "version": "2.9.1", "resolved": "https://registry.npmjs.org/usehooks-ts/-/usehooks-ts-2.9.1.tgz", - "integrity": "sha512-2FAuSIGHlY+apM9FVlj8/oNhd+1y+Uwv5QNkMQz1oSfdHk4PXo1qoCw9I5M7j0vpH8CSWFJwXbVPeYDjLCx9PA==", - "requires": {} + "integrity": "sha512-2FAuSIGHlY+apM9FVlj8/oNhd+1y+Uwv5QNkMQz1oSfdHk4PXo1qoCw9I5M7j0vpH8CSWFJwXbVPeYDjLCx9PA==" }, "util-deprecate": { "version": "1.0.2", @@ -18154,8 +18071,7 @@ "yet-another-react-lightbox": { "version": "3.14.0", "resolved": "https://registry.npmjs.org/yet-another-react-lightbox/-/yet-another-react-lightbox-3.14.0.tgz", - "integrity": "sha512-UbkxGre2TzzIuRL9bQp6Spbc/9Hgn8JYofs0DJL1cyCc6+ir5I5djJKLs9UpyH61Ak/y81QYF5MA6ve//ggJrw==", - "requires": {} + "integrity": "sha512-UbkxGre2TzzIuRL9bQp6Spbc/9Hgn8JYofs0DJL1cyCc6+ir5I5djJKLs9UpyH61Ak/y81QYF5MA6ve//ggJrw==" }, "yocto-queue": { "version": "0.1.0", diff --git a/package.json b/package.json index 614cb012..266216f0 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "dependencies": { "@microsoft/fetch-event-source": "^2.0.1", - "@tanstack/react-query": "^4.29.5", + "@tanstack/react-query": "^5.4.3", "@tauri-apps/api": "^1.5.1", "axios": "^1.4.0", "clsx": "^1.2.1", @@ -34,7 +34,7 @@ "zustand": "^4.3.7" }, "devDependencies": { - "@tanstack/react-query-devtools": "^4.36.1", + "@tanstack/react-query-devtools": "^5.4.3", "@tauri-apps/cli": "^1.5.6", "@types/lodash": "^4.14.194", "@types/node": "^18.7.10", diff --git a/src-tauri/build.rs b/src-tauri/build.rs index 795b9b7c..d860e1e6 100644 --- a/src-tauri/build.rs +++ b/src-tauri/build.rs @@ -1,3 +1,3 @@ fn main() { - tauri_build::build() + tauri_build::build() } diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs index 0a508dd9..4cd47121 100644 --- a/src-tauri/src/main.rs +++ b/src-tauri/src/main.rs @@ -9,10 +9,10 @@ mod utils; use sentry_tauri::sentry; use serde::{Deserialize, Serialize}; -use std::{env, collections::HashMap, str}; +use std::{collections::HashMap, env, str}; use tauri::{ - AboutMetadata, CustomMenuItem, Manager, Menu, MenuItem, RunEvent, - Submenu, SystemTray, SystemTrayEvent, SystemTrayMenu, SystemTrayMenuItem, WindowEvent, + AboutMetadata, CustomMenuItem, Manager, Menu, MenuItem, RunEvent, Submenu, SystemTray, + SystemTrayEvent, SystemTrayMenu, SystemTrayMenuItem, WindowEvent, }; use tokio::{process::Child, sync::Mutex}; diff --git a/src-tauri/src/swarm.rs b/src-tauri/src/swarm.rs index 2d26d271..d6080d42 100644 --- a/src-tauri/src/swarm.rs +++ b/src-tauri/src/swarm.rs @@ -1,7 +1,7 @@ use reqwest::get; use serde::Deserialize; +use std::{collections::HashMap, env, str}; use tauri::api::process::Command; -use std::{env, collections::HashMap, str}; #[derive(Deserialize)] struct PetalsModelInfo { @@ -14,7 +14,7 @@ pub fn is_swarm_supported() -> bool { match env::consts::OS { "macos" => true, "linux" => true, - _ => false + _ => false, } } @@ -23,9 +23,7 @@ pub fn get_username() -> String { let output = Command::new("whoami").output(); match output { - Ok(output) => { - output.stdout.trim().to_string() - }, + Ok(output) => output.stdout.trim().to_string(), Err(_) => "prem-app".to_string(), } } @@ -58,8 +56,6 @@ pub async fn get_petals_models() -> Result, String> { } } - - #[tauri::command] pub fn is_swarm_mode_running() -> bool { let output_value = get_swarm_processes(); @@ -77,14 +73,14 @@ pub fn is_swarm_mode_running() -> bool { pub fn create_environment(handle: tauri::AppHandle) -> (String, HashMap) { // Get the application data directory let app_data_dir = tauri::api::path::home_dir().expect("🙈 Failed to get app data directory"); - let app_data_dir = app_data_dir - .join(".config/prem"); + let app_data_dir = app_data_dir.join(".config/prem"); let app_data_dir = app_data_dir .to_str() .expect("🙈 Failed to convert app data dir path to str"); // Get create env path - let binding = handle.path_resolver() + let binding = handle + .path_resolver() .resolve_resource("petals") .expect("🙈 Failed to find `create_env.sh`"); let petals_path = binding @@ -108,7 +104,12 @@ pub fn create_environment(handle: tauri::AppHandle) -> (String, HashMap String { output_value } - #[tauri::command] pub fn stop_swarm_mode() { println!("🛑 Stopping the Swarm..."); @@ -175,4 +175,4 @@ pub fn stop_swarm_mode() { }); } println!("🛑 Stopped all the Swarm Processes."); -} \ No newline at end of file +} diff --git a/src-tauri/src/utils.rs b/src-tauri/src/utils.rs index 8af30fa4..55fee848 100644 --- a/src-tauri/src/utils.rs +++ b/src-tauri/src/utils.rs @@ -32,15 +32,20 @@ pub fn get_binary_url(binaries_url: &HashMap>) -> Result< .get("aarch64-apple-darwin") .unwrap() .clone() - .unwrap() + .unwrap_or_else(|| "Unsupported architecture".to_string()) } else if is_x86_64() { binary_url = binaries_url .get("x86_64-apple-darwin") .unwrap() .clone() + .unwrap_or_else(|| "Unsupported architecture".to_string()) + } + if binary_url == "Unsupported architecture" { + binary_url = binaries_url + .get("universal-apple-darwin") .unwrap() - } else { - Err("Unsupported architecture").unwrap() + .clone() + .unwrap_or_else(|| Err("Unsupported architecture").unwrap()) } Ok(binary_url) } diff --git a/src/main.tsx b/src/main.tsx index 9cbd31f5..5c3aae60 100644 --- a/src/main.tsx +++ b/src/main.tsx @@ -19,7 +19,7 @@ ReactDOM.createRoot(document.getElementById("root") as HTMLElement).render( - + , ); diff --git a/src/modules/prem-audio/components/PremAudioBox.tsx b/src/modules/prem-audio/components/PremAudioBox.tsx index f1899772..3566ff5e 100644 --- a/src/modules/prem-audio/components/PremAudioBox.tsx +++ b/src/modules/prem-audio/components/PremAudioBox.tsx @@ -13,7 +13,7 @@ import PremRecordTab from "./PremRecordTab"; const PremAudioBox = ({ serviceId, serviceType, historyId }: Partial) => { const navigate = useNavigate(); - const { isLoading, onSubmit, file, setFile, currentHistory } = usePremAudio( + const { isPending, onSubmit, file, setFile, currentHistory } = usePremAudio( serviceId!, serviceType!, historyId, @@ -59,11 +59,11 @@ const PremAudioBox = ({ serviceId, serviceType, historyId }: Partial Clear @@ -72,11 +72,11 @@ const PremAudioBox = ({ serviceId, serviceType, historyId }: Partial Submit diff --git a/src/modules/prem-audio/types.ts b/src/modules/prem-audio/types.ts index 3343c84a..d916dbeb 100644 --- a/src/modules/prem-audio/types.ts +++ b/src/modules/prem-audio/types.ts @@ -11,7 +11,7 @@ export type PremAudioHook = { currentHistory: PremAudioHistory | undefined; file: File | null; setFile: (file: File | null) => void; - isLoading: boolean; + isPending: boolean; isError: boolean; onSubmit: () => void; deleteHistory: (id: string) => void; diff --git a/src/modules/prem-chat/components/PremChatSidebar.tsx b/src/modules/prem-chat/components/PremChatSidebar.tsx index 6e2514b1..a816c36d 100644 --- a/src/modules/prem-chat/components/PremChatSidebar.tsx +++ b/src/modules/prem-chat/components/PremChatSidebar.tsx @@ -99,7 +99,7 @@ const PremChatSidebar = ({ setHamburgerMenu }: HamburgerMenuProps) => { key={item.id} className={clsx({ "bg-grey-900": chatId === item.id })} > - + msg {item.title} diff --git a/src/modules/prem-image/components/PremImageContainer.tsx b/src/modules/prem-image/components/PremImageContainer.tsx index e2be2c77..441e0b94 100644 --- a/src/modules/prem-image/components/PremImageContainer.tsx +++ b/src/modules/prem-image/components/PremImageContainer.tsx @@ -32,7 +32,7 @@ const PremImageContainer = ({ const navigate = useNavigate(); const { - isLoading, + isPending, onSubmit, prompt, setPrompt, @@ -84,7 +84,7 @@ const PremImageContainer = ({ setPrompt={setPrompt} negativePrompt={negativePrompt} setNegativePrompt={setNegativePrompt} - isLoading={isLoading} + isPending={isPending} generateImages={generateImages} setFile={setFile} file={file} @@ -133,7 +133,7 @@ const PremImageContainer = ({
{rightSidebar && ( - + )}
diff --git a/src/modules/prem-image/components/PremImagePromptBox.tsx b/src/modules/prem-image/components/PremImagePromptBox.tsx index 4cf3b3a1..5d15faeb 100644 --- a/src/modules/prem-image/components/PremImagePromptBox.tsx +++ b/src/modules/prem-image/components/PremImagePromptBox.tsx @@ -11,7 +11,7 @@ import type { PremImageResponse } from "../types"; type PromptProps = Pick< PremImageResponse, - "prompt" | "setPrompt" | "negativePrompt" | "setNegativePrompt" | "isLoading" | "setFile" | "file" + "prompt" | "setPrompt" | "negativePrompt" | "setNegativePrompt" | "isPending" | "setFile" | "file" >; const PremImagePromptBox = ({ @@ -19,7 +19,7 @@ const PremImagePromptBox = ({ setPrompt, negativePrompt, setNegativePrompt, - isLoading, + isPending, generateImages, file, setFile, @@ -100,12 +100,12 @@ const PremImagePromptBox = ({ - {isLoading ? `Generating ${n} Images` : `Generate Image`} + {isPending ? `Generating ${n} Images` : `Generate Image`} diff --git a/src/modules/prem-image/types.ts b/src/modules/prem-image/types.ts index 37b8a800..f71eaf0a 100644 --- a/src/modules/prem-image/types.ts +++ b/src/modules/prem-image/types.ts @@ -23,7 +23,7 @@ export type PremImageResponse = { onSubmit: () => void; prompt: string; setPrompt: (question: string) => void; - isLoading: boolean; + isPending: boolean; isError: boolean; currentHistory: PremImageHistory | undefined; n: number; diff --git a/src/modules/prem-text-audio/components/PremTextAudioBox.tsx b/src/modules/prem-text-audio/components/PremTextAudioBox.tsx index 19c62dc5..ecbe1889 100644 --- a/src/modules/prem-text-audio/components/PremTextAudioBox.tsx +++ b/src/modules/prem-text-audio/components/PremTextAudioBox.tsx @@ -14,7 +14,7 @@ const PremTextAudioBox = ({ historyId, }: Partial) => { const navigate = useNavigate(); - const { isLoading, onSubmit, prompt, setPrompt, currentHistory } = usePremTextAudio( + const { isPending, onSubmit, prompt, setPrompt, currentHistory } = usePremTextAudio( serviceId!, serviceType!, historyId, @@ -62,11 +62,11 @@ const PremTextAudioBox = ({ className={clsx( "!rounded-md !h-[40px] text-white items-center flex border border-[#EC898A] !px-12 !text-sm max-sm:w-1/2 max-sm:justify-center", { - "opacity-50": isLoading, + "opacity-50": isPending, }, )} onClick={onClear} - disabled={isLoading} + disabled={isPending} > Clear @@ -75,11 +75,11 @@ const PremTextAudioBox = ({ "!px-12 flex items-center !py-2 !h-[38px] !text-sm max-sm:w-1/2 max-sm:justify-center", { "opacity-50": !prompt, - "animate-fill-effect": isLoading, + "animate-fill-effect": isPending, }, )} onClick={generateAudio} - disabled={isLoading || !prompt} + disabled={isPending || !prompt} > Create diff --git a/src/modules/prem-text-audio/types.ts b/src/modules/prem-text-audio/types.ts index 65893e74..f766628d 100644 --- a/src/modules/prem-text-audio/types.ts +++ b/src/modules/prem-text-audio/types.ts @@ -17,7 +17,7 @@ export type PremTextAudioHook = { currentHistory: PremTextAudioHistory | undefined; prompt: string; setPrompt: (prompt: string) => void; - isLoading: boolean; + isPending: boolean; isError: boolean; onSubmit: () => void; deleteHistory: (id: string) => void; diff --git a/src/modules/prem-upscaler/components/PremUpscalerBox.tsx b/src/modules/prem-upscaler/components/PremUpscalerBox.tsx index a7540184..f1e6ac80 100644 --- a/src/modules/prem-upscaler/components/PremUpscalerBox.tsx +++ b/src/modules/prem-upscaler/components/PremUpscalerBox.tsx @@ -16,7 +16,7 @@ const PremUpscalerBox = ({ }: Partial) => { const navigate = useNavigate(); - const { isLoading, onSubmit, file, setFile } = usePremUpscaler( + const { isPending, onSubmit, file, setFile } = usePremUpscaler( serviceId!, serviceType!, historyId, @@ -50,7 +50,7 @@ const PremUpscalerBox = ({ return (
-
+

Pick an image to increase resolution

Clear @@ -88,11 +88,11 @@ const PremUpscalerBox = ({ "!px-12 flex items-center !py-2 !h-[38px] !text-sm max-sm:w-1/2 max-sm:justify-center max-sm:!h-10", { "opacity-50": !file, - "animate-fill-effect": isLoading, + "animate-fill-effect": isPending, }, )} onClick={generateImages} - disabled={isLoading || !file} + disabled={isPending || !file} > Submit diff --git a/src/modules/prem-upscaler/types.ts b/src/modules/prem-upscaler/types.ts index 28eacdb8..bc4a0305 100644 --- a/src/modules/prem-upscaler/types.ts +++ b/src/modules/prem-upscaler/types.ts @@ -15,7 +15,7 @@ export type PremUpscalerHook = { currentHistory: PremUpscalerHistory | undefined; file: File | null; setFile: (file: File | null) => void; - isLoading: boolean; + isPending: boolean; isError: boolean; onSubmit: () => void; deleteHistory: (id: string) => void; diff --git a/src/modules/service-detail/components/ServiceDetail.tsx b/src/modules/service-detail/components/ServiceDetail.tsx index ed0e7f84..e5e29647 100644 --- a/src/modules/service-detail/components/ServiceDetail.tsx +++ b/src/modules/service-detail/components/ServiceDetail.tsx @@ -32,7 +32,7 @@ const ServiceDetail = () => { const refetchServices = useCallback(() => { refetch(); - queryClient.refetchQueries([SERVICES_KEY]); + queryClient.refetchQueries({ queryKey: [SERVICES_KEY] }); }, [queryClient, refetch]); const back = () => { diff --git a/src/modules/service/components/CustomServiceModal.tsx b/src/modules/service/components/CustomServiceModal.tsx index 025cb9ac..6630f330 100644 --- a/src/modules/service/components/CustomServiceModal.tsx +++ b/src/modules/service/components/CustomServiceModal.tsx @@ -36,7 +36,7 @@ const CustomServiceModal = ({ isOpen, closeModal }: CustomServiceModalProps) => }`, ); - const { mutate: addService, isLoading } = useAddService(); + const { mutate: addService, isPending } = useAddService(); const { refetch } = useGetServices(); const onCancel = () => { @@ -109,8 +109,8 @@ const CustomServiceModal = ({ isOpen, closeModal }: CustomServiceModalProps) => > Cancel - - {isLoading ? "Adding ..." : "OK"} + + {isPending ? "Adding ..." : "OK"}
diff --git a/src/modules/service/components/SearchFilter.tsx b/src/modules/service/components/SearchFilter.tsx index 83b5095a..b3d4759d 100644 --- a/src/modules/service/components/SearchFilter.tsx +++ b/src/modules/service/components/SearchFilter.tsx @@ -10,7 +10,7 @@ import type { Option, SearchFilterProps } from "../types"; import MultiValueRemove from "./MultiValueRemove"; -const SearchFilter = ({ apps, onFilterChange, appId }: SearchFilterProps) => { +const SearchFilter = ({ apps, onFilterChange }: SearchFilterProps) => { const [search, setSearch] = useState(new Map()); const [icons, setIcons] = useState>({}); @@ -40,9 +40,9 @@ const SearchFilter = ({ apps, onFilterChange, appId }: SearchFilterProps) => { }, []); useEffect(() => { - const newSearch = new Map(apps.map((app) => [app.id, app.id === appId])); + const newSearch = new Map(apps.map((app) => [app.id, false])); setSearch(newSearch); - }, [appId, apps]); + }, [apps]); useEffect(() => { onFilterChange(search); @@ -78,8 +78,8 @@ const SearchFilter = ({ apps, onFilterChange, appId }: SearchFilterProps) => { if (search.size === 0) return null; return ( -
-
+
+
search { }} />
-
+
{apps.map((app) => (
{ - const { appId } = useParams(); - const { data: services, isLoading: isServicesLoading, refetch: refetchServices, } = useGetServices(); const { data: apps } = useInterfaces(); + const [appsAugmented, setAppsAugmented] = useState([]); const progresses = useSettingStore((state) => state.serviceDownloadsInProgress); const { mutate: download } = useDownloadServiceStream(); const downloadingServices = useSettingStore.getState().downloadingServices; const [filter, setFilter] = useState(new Map()); + useEffect(() => { + const _apps = apps?.concat({ + id: "available", + name: "Available", + playground: false, + documentation: "", + icon: "https://raw.githubusercontent.com/astrit/css.gg/master/icons/svg/smile-mouth-open.svg", + }); + setAppsAugmented(_apps ?? []); + }, [apps]); + const filteredApps = useMemo(() => { - if (filter.size === 0) return apps; - if (![...filter.values()].includes(true)) return apps; - return apps?.filter((app) => filter.get(app.id) as boolean); - }, [apps, filter]); + if (filter.size === 0) return appsAugmented; + if (![...filter.values()].includes(true)) return appsAugmented; + return appsAugmented?.filter((app) => filter.get(app.id) as boolean); + }, [appsAugmented, filter]); // Resume service download if in progress useEffect(() => { @@ -71,7 +80,13 @@ const Service = () => { const ServicesComponents = useMemo(() => { return filteredApps?.map((app) => { const filteredServices = - services?.filter((service) => service?.interfaces?.includes(app.id)) ?? []; + services?.filter((service) => { + if (app.id === "available") { + return checkIfAccessible(getServiceStatus(service)); + } else { + return service?.interfaces?.includes(app.id); + } + }) ?? []; return (

@@ -112,8 +127,8 @@ const Service = () => {

Dashboard

- {apps && apps.length > 0 && ( - + {appsAugmented && appsAugmented.length > 0 && ( + )} {ServicesComponents} diff --git a/src/modules/service/components/ServiceActions.tsx b/src/modules/service/components/ServiceActions.tsx index d45f87d3..2b5aaa59 100644 --- a/src/modules/service/components/ServiceActions.tsx +++ b/src/modules/service/components/ServiceActions.tsx @@ -50,11 +50,11 @@ const ServiceActions = ({ const [dropdownOpen, setDropdownOpen] = useState(false); const { mutate: download } = useDownloadServiceStream(); const progresses = useSettingStore((state) => state.serviceDownloadsInProgress); - const { mutate: stopService, isLoading: isStopServiceLoading } = useStopService(); + const { mutate: stopService, isPending: isStopServicePending } = useStopService(); const { mutate: restartService, mutateAsync: restartServiceAsync, - isLoading: isRestartServiceLoading, + isPending: isRestartServicePending, } = useRestartService(); const dropdownRef = useRef(null); useOnClickOutside(dropdownRef, () => setDropdownOpen(false)); @@ -139,7 +139,7 @@ const ServiceActions = ({ const isAccessible = checkIfAccessible(status); - if (isStopServiceLoading) { + if (isStopServicePending) { return (
@@ -149,8 +149,8 @@ const ServiceActions = ({ if ( progresses[service.id]?.progress !== undefined || - isStopServiceLoading || - isRestartServiceLoading + isStopServicePending || + isRestartServicePending ) { return (
diff --git a/src/modules/service/components/ServiceCard.tsx b/src/modules/service/components/ServiceCard.tsx index 8b02f310..8613e344 100644 --- a/src/modules/service/components/ServiceCard.tsx +++ b/src/modules/service/components/ServiceCard.tsx @@ -24,8 +24,8 @@ const ServiceCard = ({ className, service }: ServiceCardProps) => { const { openWarningModal, closeWarningModal, isWarningModalOpen } = useWarningModal(); const refetch = useCallback(() => { - queryClient.refetchQueries([SERVICES_KEY]); - queryClient.invalidateQueries([SERVICE_KEY, serviceId]); + queryClient.refetchQueries({ queryKey: [SERVICES_KEY] }); + queryClient.invalidateQueries({ queryKey: [SERVICE_KEY, serviceId] }); // eslint-disable-next-line react-hooks/exhaustive-deps }, []); diff --git a/src/modules/service/components/StoppedServiceState.tsx b/src/modules/service/components/StoppedServiceState.tsx index 5987d420..47d29b5b 100644 --- a/src/modules/service/components/StoppedServiceState.tsx +++ b/src/modules/service/components/StoppedServiceState.tsx @@ -22,8 +22,8 @@ const StoppedServiceState = ({ openDeleteModal, setOpenDeleteModal, }: ServiceStateProps & DeleteModalProps) => { - const { mutate: deleteMutate, isLoading: deleteLoading } = useDeleteService(); - const { mutateAsync: startMutateAsync, isLoading: startLoading } = useStartService(); + const { mutate: deleteMutate, isPending: isDeletePending } = useDeleteService(); + const { mutateAsync: startMutateAsync, isPending: isStartPending } = useStartService(); const onStart = async (e: React.MouseEvent) => { e.preventDefault(); @@ -60,7 +60,7 @@ const StoppedServiceState = ({ //setBodyLocked(false); }; - if (deleteLoading || startLoading) { + if (isDeletePending || isStartPending) { return (
diff --git a/src/modules/service/types.ts b/src/modules/service/types.ts index 87ed509b..0d219885 100644 --- a/src/modules/service/types.ts +++ b/src/modules/service/types.ts @@ -64,7 +64,6 @@ export type Service = ServiceDocker | ServiceBinary; export type SearchFilterProps = { apps: App[]; onFilterChange: (e: Map) => void; - appId: string; }; export type Option = { diff --git a/src/modules/settings/components/BackendUrl.tsx b/src/modules/settings/components/BackendUrl.tsx index 9d93ff84..f4385012 100644 --- a/src/modules/settings/components/BackendUrl.tsx +++ b/src/modules/settings/components/BackendUrl.tsx @@ -12,7 +12,7 @@ import checkHealth from "../api/checkHealth"; const BackendUrl = () => { const queryClient = useQueryClient(); - const { mutate: checkHealthRequest, isLoading } = useMutation(checkHealth); + const { mutate: checkHealthRequest, isPending } = useMutation({ mutationFn: checkHealth }); const backendUrlFromStore = useSettingStore((state) => state.backendUrl); const setBackendUrlToStore = useSettingStore((state) => state.setBackendUrl); @@ -66,8 +66,8 @@ const BackendUrl = () => {
- - {isLoading ? "Updating..." : "Update"} + + {isPending ? "Updating..." : "Update"}
diff --git a/src/modules/settings/components/Registries.tsx b/src/modules/settings/components/Registries.tsx index cf383e23..22b7a084 100644 --- a/src/modules/settings/components/Registries.tsx +++ b/src/modules/settings/components/Registries.tsx @@ -14,10 +14,16 @@ import fetchRegistries from "../api/fetchRegistries"; const Registries = () => { const [registryUrl, setRegistryUrl] = useState(""); - const { isLoading, data: response, refetch } = useQuery(["registries"], fetchRegistries); + const { + isLoading, + data: response, + refetch, + } = useQuery({ queryKey: ["registries"], queryFn: fetchRegistries }); - const { mutate: mutateAddRegistry, isLoading: isLoadingAddRegistry } = useMutation(addRegistry); - const { mutate: mutateDeleteRegistry } = useMutation(deleteRegistry); + const { mutate: mutateAddRegistry, isPending: isPendingAddRegistry } = useMutation({ + mutationFn: addRegistry, + }); + const { mutate: mutateDeleteRegistry } = useMutation({ mutationFn: deleteRegistry }); const registries = response?.data || []; @@ -100,8 +106,8 @@ const Registries = () => {

- - {isLoadingAddRegistry ? "Updating..." : "Add Registry"} + + {isPendingAddRegistry ? "Updating..." : "Add Registry"}
diff --git a/src/shared/hooks/useAddService.ts b/src/shared/hooks/useAddService.ts index 11b6d09f..014efece 100644 --- a/src/shared/hooks/useAddService.ts +++ b/src/shared/hooks/useAddService.ts @@ -5,8 +5,8 @@ import type { Service } from "../../modules/service/types"; const useAddService = () => { const controller = ServiceController.getInstance(); - return useMutation(({ service }: { service: Service }) => { - return controller.addService(service); + return useMutation({ + mutationFn: ({ service }: { service: Service }) => controller.addService(service), }); }; diff --git a/src/shared/hooks/useDeleteService.ts b/src/shared/hooks/useDeleteService.ts index 612b2e11..77da2477 100644 --- a/src/shared/hooks/useDeleteService.ts +++ b/src/shared/hooks/useDeleteService.ts @@ -5,11 +5,17 @@ import type { Service } from "../../modules/service/types"; const useDeleteService = () => { const controller = ServiceController.getInstance(); - return useMutation( - ({ serviceId, serviceType }: { serviceId: string; serviceType: Service["serviceType"] }) => { + return useMutation({ + mutationFn: ({ + serviceId, + serviceType, + }: { + serviceId: string; + serviceType: Service["serviceType"]; + }) => { return controller.delete(serviceId, serviceType); }, - ); + }); }; export default useDeleteService; diff --git a/src/shared/hooks/useDownloadServiceStream.ts b/src/shared/hooks/useDownloadServiceStream.ts index eaf03896..6df2c86b 100644 --- a/src/shared/hooks/useDownloadServiceStream.ts +++ b/src/shared/hooks/useDownloadServiceStream.ts @@ -5,8 +5,8 @@ import ServiceController from "../../controller/serviceController"; const useDownloadServiceStream = () => { const controller = ServiceController.getInstance(); - return useMutation( - ({ + return useMutation({ + mutationFn: ({ serviceId, binariesUrl, weightsDirectoryUrl, @@ -22,7 +22,7 @@ const useDownloadServiceStream = () => { serviceType, afterSuccess, }), - ); + }); }; export default useDownloadServiceStream; diff --git a/src/shared/hooks/useGPUStats.ts b/src/shared/hooks/useGPUStats.ts index a05d37ce..1d27c04d 100644 --- a/src/shared/hooks/useGPUStats.ts +++ b/src/shared/hooks/useGPUStats.ts @@ -14,6 +14,9 @@ const useGPUStats = () => { } else { serviceType = "docker"; } - return useQuery(["getGPUStats"], () => controller.getGPUStats(serviceType)); + return useQuery({ + queryKey: ["getGPUStats"], + queryFn: () => controller.getGPUStats(serviceType), + }); }; export default useGPUStats; diff --git a/src/shared/hooks/useGetService.ts b/src/shared/hooks/useGetService.ts index ea4d145b..f3cf65df 100644 --- a/src/shared/hooks/useGetService.ts +++ b/src/shared/hooks/useGetService.ts @@ -7,7 +7,10 @@ export const SERVICE_KEY = "getService"; const useGetService = (serviceId: string, serviceType: Service["serviceType"]) => { const controller = ServiceController.getInstance(); - return useQuery([SERVICE_KEY, serviceId], () => controller.getService(serviceId, serviceType)); + return useQuery({ + queryKey: [SERVICE_KEY, serviceId], + queryFn: () => controller.getService(serviceId, serviceType), + }); }; export default useGetService; diff --git a/src/shared/hooks/useGetServices.ts b/src/shared/hooks/useGetServices.ts index 7bcbf012..bee04a93 100644 --- a/src/shared/hooks/useGetServices.ts +++ b/src/shared/hooks/useGetServices.ts @@ -17,7 +17,9 @@ const useGetServices = () => { } else { serviceType = "docker"; } - return useQuery([SERVICES_KEY], () => controller.getServices(serviceType), { + return useQuery({ + queryKey: [SERVICES_KEY], + queryFn: () => controller.getServices(serviceType), refetchInterval: SERVICE_CHECK_REFETCH_INTERVAL, }); }; diff --git a/src/shared/hooks/useInterfaces.ts b/src/shared/hooks/useInterfaces.ts index 9b596a29..66b817ba 100644 --- a/src/shared/hooks/useInterfaces.ts +++ b/src/shared/hooks/useInterfaces.ts @@ -14,7 +14,7 @@ const useInterfaces = () => { } else { serviceType = "docker"; } - return useQuery(["getApps"], () => controller.getInterfaces(serviceType)); + return useQuery({ queryKey: ["getApps"], queryFn: () => controller.getInterfaces(serviceType) }); }; export default useInterfaces; diff --git a/src/shared/hooks/usePremAudio.ts b/src/shared/hooks/usePremAudio.ts index a9ff0438..848d30c3 100644 --- a/src/shared/hooks/usePremAudio.ts +++ b/src/shared/hooks/usePremAudio.ts @@ -32,28 +32,26 @@ const usePremAudio = ( shallow, ); - const { isLoading, isError, mutate } = useMutation( - () => + const { isPending, isError, mutate } = useMutation({ + mutationFn: () => generateTranscriptions(service!, { file: file!, model, }), - { - onSuccess: (response) => { - const id = uuid(); - addHistory({ - id, - file: file?.name || "", - transcriptions: response.data.text, - timestamp: new Date().toISOString(), - }); - navigate(`/prem-audio/${serviceId}/${serviceType}/${id}`); - }, - onError: () => { - toast.error("Something went wrong while generating the transcriptions"); - }, + onSuccess: (response) => { + const id = uuid(); + addHistory({ + id, + file: file?.name || "", + transcriptions: response.data.text, + timestamp: new Date().toISOString(), + }); + navigate(`/prem-audio/${serviceId}/${serviceType}/${id}`); }, - ); + onError: () => { + toast.error("Something went wrong while generating the transcriptions"); + }, + }); const currentHistory = history.find((_history) => _history.id === historyId); @@ -61,7 +59,7 @@ const usePremAudio = ( currentHistory, file, setFile, - isLoading, + isPending, isError, onSubmit: mutate, deleteHistory, diff --git a/src/shared/hooks/usePremImage.ts b/src/shared/hooks/usePremImage.ts index be37a732..a5b4aed6 100644 --- a/src/shared/hooks/usePremImage.ts +++ b/src/shared/hooks/usePremImage.ts @@ -47,28 +47,26 @@ const usePremImage = ( seed, }; - const { isLoading, isError, mutate } = useMutation( - () => + const { isPending, isError, mutate } = useMutation({ + mutationFn: () => file ? generateImageViaBaseImage(service!, file, payload) : generateImage(service!, payload), - { - onSuccess: (response) => { - setFile(undefined); - const id = uuid(); - addHistory({ - id, - prompt, - images: (response.data.data || []).map( - (image: B64JsonResponse) => `data:image/png;base64, ${image.b64_json}`, - ), - timestamp: new Date().toISOString(), - }); - navigate(`/prem-image/${serviceId}/${serviceType}/${id}`); - }, - onError: () => { - toast.error("Something went wrong while generating the image"); - }, + onSuccess: (response) => { + setFile(undefined); + const id = uuid(); + addHistory({ + id, + prompt, + images: (response.data.data || []).map( + (image: B64JsonResponse) => `data:image/png;base64, ${image.b64_json}`, + ), + timestamp: new Date().toISOString(), + }); + navigate(`/prem-image/${serviceId}/${serviceType}/${id}`); }, - ); + onError: () => { + toast.error("Something went wrong while generating the image"); + }, + }); const currentHistory = history.find((_history) => _history.id === historyId); @@ -80,7 +78,7 @@ const usePremImage = ( currentHistory, prompt: prompt, setPrompt, - isLoading, + isPending, isError, onSubmit: mutate, n, diff --git a/src/shared/hooks/usePremTextAudio.ts b/src/shared/hooks/usePremTextAudio.ts index 5c25a332..3bda7c61 100644 --- a/src/shared/hooks/usePremTextAudio.ts +++ b/src/shared/hooks/usePremTextAudio.ts @@ -31,29 +31,27 @@ const usePremTextAudio = ( shallow, ); - const { isLoading, isError, mutate } = useMutation( - () => + const { isPending, isError, mutate } = useMutation({ + mutationFn: () => generateAudio(service!, { prompt, }), - { - onSuccess: (response) => { - const id = uuid(); - const file = response.data.url || ""; - addHistory({ - id, - file, - prompt, - timestamp: new Date().toISOString(), - fileUrl: `${service!.baseUrl}/files/${file}`, - }); - navigate(`/prem-text-audio/${serviceId}/${serviceType}/${id}`); - }, - onError: () => { - toast.error("Something went wrong while generating the transcriptions"); - }, + onSuccess: (response) => { + const id = uuid(); + const file = response.data.url || ""; + addHistory({ + id, + file, + prompt, + timestamp: new Date().toISOString(), + fileUrl: `${service!.baseUrl}/files/${file}`, + }); + navigate(`/prem-text-audio/${serviceId}/${serviceType}/${id}`); }, - ); + onError: () => { + toast.error("Something went wrong while generating the transcriptions"); + }, + }); const currentHistory = history.find((_history) => _history.id === historyId); @@ -69,7 +67,7 @@ const usePremTextAudio = ( currentHistory, prompt, setPrompt, - isLoading, + isPending, isError, onSubmit: mutate, deleteHistory, diff --git a/src/shared/hooks/usePremUpscaler.ts b/src/shared/hooks/usePremUpscaler.ts index d3492e34..6d8d7034 100644 --- a/src/shared/hooks/usePremUpscaler.ts +++ b/src/shared/hooks/usePremUpscaler.ts @@ -45,8 +45,8 @@ const usePremUpscaler = ( shallow, ); - const { isLoading, isError, mutate } = useMutation( - () => + const { isPending, isError, mutate } = useMutation({ + mutationFn: () => generateUpscalerImage(service!, { image: file!, prompt, @@ -55,22 +55,20 @@ const usePremUpscaler = ( guidance_scale, num_inference_steps, }), - { - onSuccess: (response) => { - const id = uuid(); - addHistory({ - id, - file: `data:image/png;base64, ${response.data?.data[0]?.b64_json || ""}`, - name: file?.name || "File.jpg", - timestamp: new Date().toISOString(), - }); - navigate(`/prem-upscaler/${serviceId}/${serviceType}/${id}`); - }, - onError: () => { - toast.error("Something went wrong while generating the upscaler image"); - }, + onSuccess: (response) => { + const id = uuid(); + addHistory({ + id, + file: `data:image/png;base64, ${response.data?.data[0]?.b64_json || ""}`, + name: file?.name || "File.jpg", + timestamp: new Date().toISOString(), + }); + navigate(`/prem-upscaler/${serviceId}/${serviceType}/${id}`); }, - ); + onError: () => { + toast.error("Something went wrong while generating the upscaler image"); + }, + }); const currentHistory = history.find((_history) => _history.id === historyId); @@ -78,7 +76,7 @@ const usePremUpscaler = ( currentHistory, file, setFile, - isLoading, + isPending, isError, onSubmit: mutate, deleteHistory, diff --git a/src/shared/hooks/useRestartService.ts b/src/shared/hooks/useRestartService.ts index 9dacf849..94a76fbb 100644 --- a/src/shared/hooks/useRestartService.ts +++ b/src/shared/hooks/useRestartService.ts @@ -4,9 +4,10 @@ import ServiceController from "../../controller/serviceController"; const useRestartService = () => { const controller = ServiceController.getInstance(); - return useMutation(({ serviceId, serviceType }: { serviceId: string; serviceType: string }) => - controller.restart(serviceId, serviceType), - ); + return useMutation({ + mutationFn: ({ serviceId, serviceType }: { serviceId: string; serviceType: string }) => + controller.restart(serviceId, serviceType), + }); }; export default useRestartService; diff --git a/src/shared/hooks/useServiceStats.ts b/src/shared/hooks/useServiceStats.ts index 20b3726a..b26989e6 100644 --- a/src/shared/hooks/useServiceStats.ts +++ b/src/shared/hooks/useServiceStats.ts @@ -5,9 +5,10 @@ import type { Service } from "../../modules/service/types"; const useServiceStats = (serviceId: string, serviceType: Service["serviceType"]) => { const controller = ServiceController.getInstance(); - return useQuery(["getServiceStats", serviceId], () => - controller.getServiceStats(serviceId, serviceType), - ); + return useQuery({ + queryKey: ["getServiceStats", serviceId], + queryFn: () => controller.getServiceStats(serviceId, serviceType), + }); }; export default useServiceStats; diff --git a/src/shared/hooks/useStartService.ts b/src/shared/hooks/useStartService.ts index b39aafdd..ef9fca2b 100644 --- a/src/shared/hooks/useStartService.ts +++ b/src/shared/hooks/useStartService.ts @@ -5,10 +5,15 @@ import type { Service } from "../../modules/service/types"; const useStartService = () => { const controller = ServiceController.getInstance(); - return useMutation( - ({ serviceId, serviceType }: { serviceId: string; serviceType: Service["serviceType"] }) => - controller.start(serviceId, serviceType), - ); + return useMutation({ + mutationFn: ({ + serviceId, + serviceType, + }: { + serviceId: string; + serviceType: Service["serviceType"]; + }) => controller.start(serviceId, serviceType), + }); }; export default useStartService; diff --git a/src/shared/hooks/useStopService.ts b/src/shared/hooks/useStopService.ts index cc28ebe2..cec9407c 100644 --- a/src/shared/hooks/useStopService.ts +++ b/src/shared/hooks/useStopService.ts @@ -4,9 +4,10 @@ import ServiceController from "../../controller/serviceController"; const useStopService = () => { const controller = ServiceController.getInstance(); - return useMutation(({ serviceId, serviceType }: { serviceId: string; serviceType: string }) => - controller.stop(serviceId, serviceType), - ); + return useMutation({ + mutationFn: ({ serviceId, serviceType }: { serviceId: string; serviceType: string }) => + controller.stop(serviceId, serviceType), + }); }; export default useStopService; diff --git a/src/shared/hooks/useSystemStats.ts b/src/shared/hooks/useSystemStats.ts index 48826b71..11684d52 100644 --- a/src/shared/hooks/useSystemStats.ts +++ b/src/shared/hooks/useSystemStats.ts @@ -15,6 +15,9 @@ const useSystemStats = () => { } else { serviceType = "docker"; } - return useQuery(["getSystemStats"], () => controller.getSystemStats(serviceType)); + return useQuery({ + queryKey: ["getSystemStats"], + queryFn: () => controller.getSystemStats(serviceType), + }); }; export default useSystemStats;