🔧 Fixing the DC++ download bundles

This commit is contained in:
2024-10-18 13:18:59 -04:00
parent af130384f1
commit 5d430504ec
2 changed files with 118 additions and 123 deletions

View File

@@ -1,5 +1,4 @@
import React, { useCallback, ReactElement, useEffect, useState } from "react";
import { getBundlesForComic, sleep } from "../../actions/airdcpp.actions";
import { SearchQuery, PriorityEnum, SearchResponse } from "threetwo-ui-typings";
import { RootState, SearchInstance } from "threetwo-ui-typings";
import ellipsize from "ellipsize";
@@ -12,7 +11,6 @@ import { useQuery, useQueryClient } from "@tanstack/react-query";
import axios from "axios";
import { AIRDCPP_SERVICE_BASE_URI } from "../../constants/endpoints";
interface IAcquisitionPanelProps {
query: any;
comicObjectId: any;
@@ -112,10 +110,7 @@ export const AcquisitionPanel = (
*/
const search = async (searchData: any) => {
setAirDCPPSearchResults([]);
socketIOInstance.emit(
"call",
"socket.search",
{
socketIOInstance.emit("call", "socket.search", {
query: searchData,
config: {
protocol: `ws`,
@@ -123,15 +118,12 @@ export const AcquisitionPanel = (
username: `user`,
password: `pass`,
},
},
);
});
};
socketIOInstance.on("searchResultAdded", ({ result }: any) => {
setAirDCPPSearchResults((previousState) => {
const exists = previousState.some(
(item) => result.id === item.id,
);
const exists = previousState.some((item) => result.id === item.id);
if (!exists) {
return [...previousState, result];
}
@@ -334,7 +326,9 @@ export const AcquisitionPanel = (
</tr>
</thead>
<tbody className="divide-y divide-slate-100 dark:divide-gray-500">
{map(airDCPPSearchResults, ({ dupe, type, name, id, slots, users, size }, idx) => {
{map(
airDCPPSearchResults,
({ dupe, type, name, id, slots, users, size }, idx) => {
return (
<tr
key={idx}
@@ -445,7 +439,8 @@ export const AcquisitionPanel = (
</td>
</tr>
);
})}
},
)}
</tbody>
</table>
</div>

View File

@@ -83,7 +83,7 @@ const renderCard = (props: ICardProps): ReactElement => {
case "vertical-2":
return (
<div className="block rounded-md w-64 h-fit shadow-md shadow-white-400 bg-gray-200 dark:bg-slate-500">
<div className="block rounded-md max-w-64 h-fit shadow-md shadow-white-400 bg-gray-200 dark:bg-slate-500">
<img
alt="Home"
src={props.imageUrl}