* ↪️ 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
122 lines
4.0 KiB
TypeScript
122 lines
4.0 KiB
TypeScript
import React, { useState, ReactElement } from "react";
|
|
import { AirDCPPSettingsForm } from "./AirDCPPSettings/AirDCPPSettingsForm";
|
|
import { AirDCPPHubsForm } from "./AirDCPPSettings/AirDCPPHubsForm";
|
|
import { QbittorrentConnectionForm } from "./QbittorrentSettings/QbittorrentConnectionForm";
|
|
import { SystemSettingsForm } from "./SystemSettings/SystemSettingsForm";
|
|
import { ServiceStatuses } from "../ServiceStatuses/ServiceStatuses";
|
|
import settingsObject from "../../constants/settings/settingsMenu.json";
|
|
import { isUndefined, map } from "lodash";
|
|
|
|
interface ISettingsProps {}
|
|
|
|
export const Settings = (props: ISettingsProps): ReactElement => {
|
|
const [active, setActive] = useState("gen-db");
|
|
const settingsContent = [
|
|
{
|
|
id: "adc-hubs",
|
|
content: (
|
|
<div key="adc-hubs">
|
|
<AirDCPPHubsForm />
|
|
</div>
|
|
),
|
|
},
|
|
{
|
|
id: "adc-connection",
|
|
content: (
|
|
<div key="adc-connection">
|
|
<AirDCPPSettingsForm />
|
|
</div>
|
|
),
|
|
},
|
|
{
|
|
id: "qbt-connection",
|
|
content: (
|
|
<div key="qbt-connection">
|
|
<QbittorrentConnectionForm />
|
|
</div>
|
|
),
|
|
},
|
|
{
|
|
id: "core-service",
|
|
content: <>a</>,
|
|
},
|
|
{
|
|
id: "flushdb",
|
|
content: (
|
|
<div key="flushdb">
|
|
<SystemSettingsForm />
|
|
</div>
|
|
),
|
|
},
|
|
];
|
|
return (
|
|
<section className="container">
|
|
<div className="columns">
|
|
<div className="section column is-one-quarter">
|
|
<h1 className="title">Settings</h1>
|
|
<aside className="menu">
|
|
{map(settingsObject, (settingObject, idx) => {
|
|
return (
|
|
<div key={idx}>
|
|
<p className="menu-label">{settingObject.category}</p>
|
|
{/* First level children */}
|
|
{!isUndefined(settingObject.children) ? (
|
|
<ul className="menu-list" key={settingObject.id}>
|
|
{map(settingObject.children, (item, idx) => {
|
|
return (
|
|
<li key={idx}>
|
|
<a
|
|
className={
|
|
item.id.toString() === active ? "is-active" : ""
|
|
}
|
|
onClick={() => setActive(item.id.toString())}
|
|
>
|
|
{item.displayName}
|
|
</a>
|
|
{/* Second level children */}
|
|
{!isUndefined(item.children) ? (
|
|
<ul>
|
|
{map(item.children, (item, idx) => (
|
|
<li key={item.id}>
|
|
<a
|
|
className={
|
|
item.id.toString() === active
|
|
? "is-active"
|
|
: ""
|
|
}
|
|
onClick={() =>
|
|
setActive(item.id.toString())
|
|
}
|
|
>
|
|
{item.displayName}
|
|
</a>
|
|
</li>
|
|
))}
|
|
</ul>
|
|
) : null}
|
|
</li>
|
|
);
|
|
})}
|
|
</ul>
|
|
) : null}
|
|
</div>
|
|
);
|
|
})}
|
|
</aside>
|
|
</div>
|
|
|
|
{/* content for settings */}
|
|
<div className="section column is-half mt-6">
|
|
<div className="content">
|
|
{map(settingsContent, ({ id, content }) =>
|
|
active === id ? content : null,
|
|
)}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</section>
|
|
);
|
|
};
|
|
|
|
export default Settings;
|