diff --git a/src/client/actions/airdcpp.actions.tsx b/src/client/actions/airdcpp.actions.tsx index 5811e62..0cbe54a 100644 --- a/src/client/actions/airdcpp.actions.tsx +++ b/src/client/actions/airdcpp.actions.tsx @@ -12,8 +12,9 @@ import { AIRDCPP_DOWNLOAD_PROGRESS_TICK, AIRDCPP_BUNDLES_FETCHED, AIRDCPP_SEARCH_IN_PROGRESS, + IMS_COMIC_BOOK_DB_OBJECT_FETCHED, } from "../constants/action-types"; -import { each, isNil, isUndefined } from "lodash"; +import { each, isNil, isUndefined, result } from "lodash"; import axios from "axios"; interface SearchData { @@ -32,7 +33,7 @@ export const search = (data: SearchData) => async (dispatch) => { await SocketService.connect("admin", "password", true); } const instance: SearchInstance = await SocketService.post("search"); - console.log(instance) + console.log(instance); dispatch({ type: AIRDCPP_SEARCH_IN_PROGRESS, }); @@ -145,6 +146,11 @@ export const downloadAirDCPPItem = downloadResult: downloadResult, bundleDBImportResult, }); + dispatch({ + type: IMS_COMIC_BOOK_DB_OBJECT_FETCHED, + comicBookDetail: bundleDBImportResult.data, + IMS_inProgress: false, + }); } } catch (error) { throw error; @@ -179,7 +185,7 @@ export const getBundlesForComic = if (!SocketService.isConnected()) { await SocketService.connect("admin", "password", true); } - const bundles = await SocketService.get("queue/bundles/0/500"); + // const bundles = await SocketService.get("queue/bundles/0/50"); const comicObject = await axios({ method: "POST", url: "http://localhost:3000/api/import/getComicBookById", @@ -191,18 +197,14 @@ export const getBundlesForComic = }, }); // get only the bundles applicable for the comic - const filteredBundles = []; - comicObject.data.acquisition.directconnect.map(({ bundleId }) => { - each(bundles, (bundle) => { - if (bundle.id === bundleId) { - filteredBundles.push(bundle); - } - }); - }); - + const filteredBundles = comicObject.data.acquisition.directconnect.map( + async ({ bundleId }) => { + return await SocketService.get(`queue/bundles/${bundleId}`); + }, + ); dispatch({ type: AIRDCPP_BUNDLES_FETCHED, - bundles: filteredBundles, + bundles: await Promise.all(filteredBundles), }); } catch (error) { throw error; diff --git a/src/client/assets/scss/App.scss b/src/client/assets/scss/App.scss index 519b4bd..d9deadb 100644 --- a/src/client/assets/scss/App.scss +++ b/src/client/assets/scss/App.scss @@ -183,6 +183,18 @@ $border-color: red; } } +// Comic Detail +.tabs { + .download-icon-labels { + .downloads-count { + margin: 0 1em 0 0.4em; + border: 1px solid #CCC; + } + } + .download-tab-name { + } +} + .comic-vine-match-drawer { // comic detail drawer .search-criteria-card { @@ -207,6 +219,9 @@ $border-color: red; .slide-pane__header { margin-top: 52px; } +.slide-pane__close { + display: none; +} .search-results-container { margin: 15px 0 0 0; overflow: hidden; diff --git a/src/client/components/AcquisitionPanel.tsx b/src/client/components/AcquisitionPanel.tsx index e87731b..dcc71b4 100644 --- a/src/client/components/AcquisitionPanel.tsx +++ b/src/client/components/AcquisitionPanel.tsx @@ -1,8 +1,13 @@ import React, { useCallback, ReactElement } from "react"; -import { search, downloadAirDCPPItem } from "../actions/airdcpp.actions"; +import { + search, + downloadAirDCPPItem, + getBundlesForComic, +} from "../actions/airdcpp.actions"; import { useDispatch, useSelector } from "react-redux"; import { RootState, SearchInstance } from "threetwo-ui-typings"; -import { isNil, map } from "lodash"; +import ellipsize from "ellipsize"; +import { isEmpty, isNil, map } from "lodash"; interface IAcquisitionPanelProps { comicBookMetadata: any; @@ -47,10 +52,12 @@ export const AcquisitionPanel = ( }; const downloadDCPPResult = useCallback( - (searchInstanceId, resultId, comicBookObjectId) => + (searchInstanceId, resultId, comicBookObjectId) => { dispatch( downloadAirDCPPItem(searchInstanceId, resultId, comicBookObjectId), - ), + ); + dispatch(getBundlesForComic(comicBookObjectId)); + }, [dispatch], ); return ( @@ -104,7 +111,7 @@ export const AcquisitionPanel = ( {/* AirDC++ results */}