* ↪️ Removed node-sass, added sass * 🏗️ Refactoring Navbar to read from zustand store * ⬆️ Bumped deps * 🏗️ Refactored AirDC++ session status indicator * 🏗️ Refactored Import page to read from global state * 🏗 Wired up the event emit correctly * 🏗️ Added import queue related state * 🏗 Implemented setQueueAction * 🏗️ Wired up job queue control methods * 🏗️ Added null check and removed useless deps * 🏗️ Refactored the Import page * ↪️ Added cache invalidation to job statistics query * 🏗️ Refactoring the Library page * 🏗️ Fixed pagination and disabled states * ✏️ Changed page to offset To better reflect what we are doing with the pagination controls * 🏗️ Refactoring ComicDetail page and its children * 🏗️ Refactored ComicDetailContainer with useQuery * 🔧 Fixed the error check on Library page * 🏗️ Refactoring AcquisitionPanel * 🏗️ Refactoring the AirDC++ Forms * 🦃 Thanksgiving Day bug fixes * ⬆️ Bumped up Vite to 5.0 * 🔧 Refactoring AcquisitionPanel * 🏗️ Wiring up the DC++ search method * 🏗️ Refactoring AirDC++ search method * 🔎 Added some validation to ADC++ Hubs settings form * 🏗️ Fixed the ADC++ search results * 🏗️ Cleanup of the search results pane
51 lines
1.5 KiB
TypeScript
51 lines
1.5 KiB
TypeScript
import React, { ReactElement, useEffect, useState } from "react";
|
|
import { isEmpty, isNil } from "lodash";
|
|
|
|
export const TabControls = (props): ReactElement => {
|
|
// const comicBookDetailData = useSelector(
|
|
// (state: RootState) => state.comicInfo.comicBookDetail,
|
|
// );
|
|
const { filteredTabs, acquisition } = props;
|
|
const [active, setActive] = useState(filteredTabs[0].id);
|
|
useEffect(() => {
|
|
setActive(filteredTabs[0].id);
|
|
}, [acquisition]);
|
|
|
|
console.log(filteredTabs);
|
|
return (
|
|
<>
|
|
<div className="tabs">
|
|
<ul>
|
|
{filteredTabs.map(({ id, name, icon }) => (
|
|
<li
|
|
key={id}
|
|
className={id === active ? "is-active" : ""}
|
|
onClick={() => setActive(id)}
|
|
>
|
|
{/* Downloads tab and count badge */}
|
|
<a>
|
|
{id === 6 && !isNil(acquisition.directconnect) ? (
|
|
<span className="download-icon-labels">
|
|
<i className="fa-solid fa-download"></i>
|
|
<span className="tag downloads-count is-info is-light">
|
|
{acquisition.directconnect.downloads.length}
|
|
</span>
|
|
</span>
|
|
) : (
|
|
<span className="icon is-small">{icon}</span>
|
|
)}
|
|
{name}
|
|
</a>
|
|
</li>
|
|
))}
|
|
</ul>
|
|
</div>
|
|
{filteredTabs.map(({ id, content }) => {
|
|
return active === id ? content : null;
|
|
})}
|
|
</>
|
|
);
|
|
};
|
|
|
|
export default TabControls;
|