From 2d72842166dce7076db944563e6722b6030ed892 Mon Sep 17 00:00:00 2001 From: Rishi Ghan Date: Sun, 22 Dec 2024 21:59:28 -0500 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A7=20Fixing=20autodownload=20function?= =?UTF-8?q?ality?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ComicDetail/AcquisitionPanel.tsx | 16 +++--- .../AsyncSelectPaginate.tsx | 17 +++--- .../ComicDetail/ComicVineDetails.tsx | 23 ++++---- .../components/ComicDetail/RawFileDetails.tsx | 57 +++++++++---------- .../ComicDetail/TorrentSearchPanel.tsx | 2 +- src/client/components/shared/T2Table.tsx | 26 ++++----- yarn.lock | 46 ++++++++------- 7 files changed, 96 insertions(+), 91 deletions(-) diff --git a/src/client/components/ComicDetail/AcquisitionPanel.tsx b/src/client/components/ComicDetail/AcquisitionPanel.tsx index 05bca6f..d592f30 100644 --- a/src/client/components/ComicDetail/AcquisitionPanel.tsx +++ b/src/client/components/ComicDetail/AcquisitionPanel.tsx @@ -170,7 +170,7 @@ export const AcquisitionPanel = ( size: Number, type: any, config: any, - ): void => { + ): Promise => { socketIOInstance.emit( "call", "socket.download", @@ -257,12 +257,14 @@ export const AcquisitionPanel = ( )} {/* configured hub */} - - - + {!isEmpty(hubs?.data) && ( + + + + + {hubs && hubs?.data[0].hub_url} - {hubs && hubs?.data[0].hub_url} - + )} {/* AirDC++ search instance details */} {!isNil(airDCPPSearchInstance) && @@ -273,7 +275,7 @@ export const AcquisitionPanel = (
- {hubs?.data.map((value, idx) => ( + {hubs?.data.map((value, idx: string) => ( {value.identity.name} diff --git a/src/client/components/ComicDetail/AsyncSelectPaginate/AsyncSelectPaginate.tsx b/src/client/components/ComicDetail/AsyncSelectPaginate/AsyncSelectPaginate.tsx index a75ae99..2d8835e 100644 --- a/src/client/components/ComicDetail/AsyncSelectPaginate/AsyncSelectPaginate.tsx +++ b/src/client/components/ComicDetail/AsyncSelectPaginate/AsyncSelectPaginate.tsx @@ -1,11 +1,17 @@ import React, { ReactElement, useCallback, useState } from "react"; -import PropTypes from "prop-types"; import { fetchMetronResource } from "../../../actions/metron.actions"; import Creatable from "react-select/creatable"; import { withAsyncPaginate } from "react-select-async-paginate"; const CreatableAsyncPaginate = withAsyncPaginate(Creatable); -export const AsyncSelectPaginate = (props): ReactElement => { +interface AsyncSelectPaginateProps { + metronResource: string; + placeholder?: string; + value?: object; + onChange?(...args: unknown[]): unknown; +} + +export const AsyncSelectPaginate = (props: AsyncSelectPaginateProps): ReactElement => { const [value, setValue] = useState(null); const [isAddingInProgress, setIsAddingInProgress] = useState(false); @@ -38,11 +44,4 @@ export const AsyncSelectPaginate = (props): ReactElement => { ); }; -AsyncSelectPaginate.propTypes = { - metronResource: PropTypes.string.isRequired, - placeholder: PropTypes.string, - value: PropTypes.object, - onChange: PropTypes.func, -}; - export default AsyncSelectPaginate; diff --git a/src/client/components/ComicDetail/ComicVineDetails.tsx b/src/client/components/ComicDetail/ComicVineDetails.tsx index 8ef6cd1..f4a48fa 100644 --- a/src/client/components/ComicDetail/ComicVineDetails.tsx +++ b/src/client/components/ComicDetail/ComicVineDetails.tsx @@ -1,12 +1,21 @@ import React, { ReactElement } from "react"; -import PropTypes from "prop-types"; import { detectIssueTypes } from "../../shared/utils/tradepaperback.utils"; import dayjs from "dayjs"; import { isEmpty, isUndefined } from "lodash"; import Card from "../shared/Carda"; import { convert } from "html-to-text"; -export const ComicVineDetails = (props): ReactElement => { +interface ComicVineDetailsProps { + updatedAt?: string; + data?: { + name?: string; + number?: string; + resource_type?: string; + id?: number; + }; +} + +export const ComicVineDetails = (props: ComicVineDetailsProps): ReactElement => { const { data, updatedAt } = props; return (
@@ -107,13 +116,3 @@ export const ComicVineDetails = (props): ReactElement => { }; export default ComicVineDetails; - -ComicVineDetails.propTypes = { - updatedAt: PropTypes.string, - data: PropTypes.shape({ - name: PropTypes.string, - number: PropTypes.string, - resource_type: PropTypes.string, - id: PropTypes.number, - }), -}; diff --git a/src/client/components/ComicDetail/RawFileDetails.tsx b/src/client/components/ComicDetail/RawFileDetails.tsx index 3811038..44acf6e 100644 --- a/src/client/components/ComicDetail/RawFileDetails.tsx +++ b/src/client/components/ComicDetail/RawFileDetails.tsx @@ -1,10 +1,36 @@ import React, { ReactElement } from "react"; -import PropTypes from "prop-types"; import prettyBytes from "pretty-bytes"; import { isEmpty } from "lodash"; import { format, parseISO } from "date-fns"; -export const RawFileDetails = (props): ReactElement => { +interface RawFileDetailsProps { + data?: { + rawFileDetails?: { + containedIn?: string; + name?: string; + fileSize?: number; + path?: string; + extension?: string; + mimeType?: string; + cover?: { + filePath?: string; + }; + }; + inferredMetadata?: { + issue?: { + year?: string; + name?: string; + number?: number; + subtitle?: string; + }; + }; + created_at?: string; + updated_at?: string; + }; + children?: any; +} + +export const RawFileDetails = (props: RawFileDetailsProps): ReactElement => { const { rawFileDetails, inferredMetadata, created_at, updated_at } = props.data; return ( @@ -98,30 +124,3 @@ export const RawFileDetails = (props): ReactElement => { }; export default RawFileDetails; - -RawFileDetails.propTypes = { - data: PropTypes.shape({ - rawFileDetails: PropTypes.shape({ - containedIn: PropTypes.string, - name: PropTypes.string, - fileSize: PropTypes.number, - path: PropTypes.string, - extension: PropTypes.string, - mimeType: PropTypes.string, - cover: PropTypes.shape({ - filePath: PropTypes.string, - }), - }), - inferredMetadata: PropTypes.shape({ - issue: PropTypes.shape({ - year: PropTypes.string, - name: PropTypes.string, - number: PropTypes.number, - subtitle: PropTypes.string, - }), - }), - created_at: PropTypes.string, - updated_at: PropTypes.string, - }), - children: PropTypes.any, -}; diff --git a/src/client/components/ComicDetail/TorrentSearchPanel.tsx b/src/client/components/ComicDetail/TorrentSearchPanel.tsx index 8e8a035..67e9642 100644 --- a/src/client/components/ComicDetail/TorrentSearchPanel.tsx +++ b/src/client/components/ComicDetail/TorrentSearchPanel.tsx @@ -25,7 +25,7 @@ export const TorrentSearchPanel = (props) => { data: { prowlarrQuery: { port: "9696", - apiKey: "c4f42e265fb044dc81f7e88bd41c3367", + apiKey: "38c2656e8f5d4790962037b8c4416a8f", offset: 0, categories: [7030], query: searchTerm.issueName, diff --git a/src/client/components/shared/T2Table.tsx b/src/client/components/shared/T2Table.tsx index 7472d7f..81da4a1 100644 --- a/src/client/components/shared/T2Table.tsx +++ b/src/client/components/shared/T2Table.tsx @@ -1,5 +1,4 @@ import React, { ReactElement, useMemo, useState } from "react"; -import PropTypes from "prop-types"; import { ColumnDef, flexRender, @@ -9,7 +8,19 @@ import { PaginationState, } from "@tanstack/react-table"; -export const T2Table = (tableOptions): ReactElement => { +interface T2TableProps { + sourceData?: unknown[]; + totalPages?: number; + columns?: unknown[]; + paginationHandlers?: { + nextPage?(...args: unknown[]): unknown; + previousPage?(...args: unknown[]): unknown; + }; + rowClickHandler?(...args: unknown[]): unknown; + children?: any; +} + +export const T2Table = (tableOptions: T2TableProps): ReactElement => { const { sourceData, columns, @@ -142,15 +153,4 @@ export const T2Table = (tableOptions): ReactElement => { ); }; -T2Table.propTypes = { - sourceData: PropTypes.array, - totalPages: PropTypes.number, - columns: PropTypes.array, - paginationHandlers: PropTypes.shape({ - nextPage: PropTypes.func, - previousPage: PropTypes.func, - }), - rowClickHandler: PropTypes.func, - children: PropTypes.any, -}; export default T2Table; diff --git a/yarn.lock b/yarn.lock index aba9abe..37065d7 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3427,11 +3427,9 @@ integrity sha512-hKormJbkJqzQGhziax5PItDUTMAM9uE2XXQmM37dyd4hVM+5aVl7oVxMVUiVQn2oCQFN/LKCZdvSM0pFRqbSmQ== "@types/react-dom@^18.0.11": - version "18.2.18" - resolved "https://registry.yarnpkg.com/@types/react-dom/-/react-dom-18.2.18.tgz#16946e6cd43971256d874bc3d0a72074bb8571dd" - integrity sha512-TJxDm6OfAX2KJWJdMEVTwWke5Sc/E/RlnPGvGfS0W7+6ocy2xhDVQVh/KvC2Uf7kACs+gDytdusDSdWfWkaNzw== - dependencies: - "@types/react" "*" + version "18.3.3" + resolved "https://registry.yarnpkg.com/@types/react-dom/-/react-dom-18.3.3.tgz#3654138d0da1b0c7916f6ed0dc1cc2b576d47650" + integrity sha512-uTYkxTLkYp41nq/ULXyXMtkNT1vu5fXJoqad6uTNCOGat5t9cLgF4vMNLBXsTOXpdOI44XzKPY1M5RRm0bQHuw== "@types/react-redux@^7.1.25": version "7.1.33" @@ -3467,7 +3465,7 @@ dependencies: "@types/react" "*" -"@types/react@*", "@types/react@>=16", "@types/react@^18.0.28": +"@types/react@*", "@types/react@>=16": version "18.2.48" resolved "https://registry.yarnpkg.com/@types/react/-/react-18.2.48.tgz#11df5664642d0bd879c1f58bc1d37205b064e8f1" integrity sha512-qboRCl6Ie70DQQG9hhNREz81jqC1cs9EVNcjQ1AU+jH6NFfSAhVVbrrY/+nSF+Bsk4AOwm9Qa61InvMCyV+H3w== @@ -3476,6 +3474,14 @@ "@types/scheduler" "*" csstype "^3.0.2" +"@types/react@^18.0.28": + version "18.3.14" + resolved "https://registry.yarnpkg.com/@types/react/-/react-18.3.14.tgz#7ce43bbca0e15e1c4f67ad33ea3f83d75aa6756b" + integrity sha512-NzahNKvjNhVjuPBQ+2G7WlxstQ+47kXZNHlUvFakDViuIEfGY926GqhMueQFZ7woG+sPiQKlF36XfrIUVSUfFg== + dependencies: + "@types/prop-types" "*" + csstype "^3.0.2" + "@types/resolve@1.20.2": version "1.20.2" resolved "https://registry.yarnpkg.com/@types/resolve/-/resolve-1.20.2.tgz#97d26e00cd4a0423b4af620abecf3e6f442b7975" @@ -3713,16 +3719,16 @@ aggregate-error@^3.0.0: clean-stack "^2.0.0" indent-string "^4.0.0" -airdcpp-apisocket@^2.5.0-beta.2: - version "2.5.0-beta.2" - resolved "https://registry.yarnpkg.com/airdcpp-apisocket/-/airdcpp-apisocket-2.5.0-beta.2.tgz#062541095de75775bfa92b5cb4e785674beb8986" - integrity sha512-N/+39wYrZc/2N5CaZPG8kUSMu9shGGmLqR/0WQbJ1NiHF5VHcifN27ioldijN10KGfssFvTZBjV93m+D8ADDkQ== +airdcpp-apisocket@^2.4.4: + version "2.4.4" + resolved "https://registry.yarnpkg.com/airdcpp-apisocket/-/airdcpp-apisocket-2.4.4.tgz#94c3b8082022982557b8cad2fc77a670709f0b2c" + integrity sha512-Xn0kWSVdLJwPpOoHcdI2wzzfzZW2jTpuyZR2wCNs2UIlZhO+FTwMf3QQfNCt5gYTOld9LaiCEulxFuXDA8qrLA== dependencies: chalk "^4.1.2" events "^3.3.0" invariant "^2.2.4" is-in-browser "^2.0.0" - promise "^8.3.0" + promise "^8.1.0" ajv@^6.12.4: version "6.12.6" @@ -8819,7 +8825,7 @@ progress@^2.0.1: resolved "https://registry.yarnpkg.com/progress/-/progress-2.0.3.tgz#7e8cf8d8f5b8f239c1bc68beb4eb78567d572ef8" integrity sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA== -promise@^8.3.0: +promise@^8.1.0: version "8.3.0" resolved "https://registry.yarnpkg.com/promise/-/promise-8.3.0.tgz#8cb333d1edeb61ef23869fbb8a4ea0279ab60e0a" integrity sha512-rZPNPKTOYVNEEKFaq1HqTgOwZD+4/YHS5ukLzQCypkj+OkYx7iv0mA91lJlpPPZ8vMau3IIGj5Qlwrx+8iiSmg== @@ -9024,12 +9030,12 @@ react-docgen@^7.0.0: strip-indent "^4.0.0" react-dom@^18.2.0: - version "18.2.0" - resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-18.2.0.tgz#22aaf38708db2674ed9ada224ca4aa708d821e3d" - integrity sha512-6IMTriUmvsjHUjNtEDudZfuDQUoWXVxKHhlEGSk81n4YFS+r/Kl99wXiwlVXtPBtJenozv2P+hxDsw9eA7Xo6g== + version "18.3.1" + resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-18.3.1.tgz#c2265d79511b57d479b3dd3fdfa51536494c5cb4" + integrity sha512-5m4nQKp+rZRb09LNH59GM4BxTh9251/ylbKIbpe7TpGxfJ+9kv6BLkLBXIjjspbgbnIBNqlI23tRnTWT0snUIw== dependencies: loose-envify "^1.1.0" - scheduler "^0.23.0" + scheduler "^0.23.2" react-element-to-jsx-string@^15.0.0: version "15.0.0" @@ -9586,10 +9592,10 @@ sass@^1.77.0: immutable "^4.0.0" source-map-js ">=0.6.2 <2.0.0" -scheduler@^0.23.0: - version "0.23.0" - resolved "https://registry.yarnpkg.com/scheduler/-/scheduler-0.23.0.tgz#ba8041afc3d30eb206a487b6b384002e4e61fdfe" - integrity sha512-CtuThmgHNg7zIZWAXi3AsyIzA3n4xx7aNyjwC2VJldO2LMVDhFK+63xGqq6CsJH4rTAt6/M+N4GhZiDYPx9eUw== +scheduler@^0.23.2: + version "0.23.2" + resolved "https://registry.yarnpkg.com/scheduler/-/scheduler-0.23.2.tgz#414ba64a3b282892e944cf2108ecc078d115cdc3" + integrity sha512-UOShsPwz7NrMUqhR6t0hWjFduvOzbtv7toDH1/hIrfRNIDBnnBWd0CwJTGvTpngVlmwGCdP9/Zl/tVrDqcuYzQ== dependencies: loose-envify "^1.1.0"