* 🌊 qBittorrent settings scaffold * 🔧 Added scaffold for the qBittorrent connection form * 🔧 Some refactoring * 🔧 Cleaned up folder structure * 🔧 Fixed broken paths * 🔧 Cleaned up Search and Import component hierarchy * 🔧 More path fixes * 🔧 Tooling changes * 📝 Qbittorrent form scaffold * ⬆️ Bumped @dnd-kit deps * 🧑🏼🔧 Fixed the hostname regex * 🏗️ Adding fields to the settings form * 🔧 Formatting and more layout changes * 🔧 Added Prowlarr settings items in JSON * 📝 Purified Card Component * 📝 Abstracted connection form into a component * 🏗️ Reorganized tabs * Migrating from Redux to RTK-query * ⬇️ Fetched qBittorrent settings * 🏗️ Trying out react-query * 🧩 Added react-query query to qBittorrentSettings page * 📝 qbittorrent form RU actions first draft * 🏗️ Added loading state check * 🏗 Added error check state * 🏗️ Refactored AirDCPP context using react-query * 🏗️ Refactoring AirDCPP Settings Form with react-query * 🔧 Removed context * 🔧 Removing context from AirDCPP settings page * 🔧 Fixed early init error on the store * 🐛 Debugging AirDCPP Settings Form page * 🧸 Zustand-ified AirDCPP Form * ❌ AirDCPP code cleaned up from App.tsx * ➕ Re-added yarn.lock
114 lines
3.9 KiB
TypeScript
114 lines
3.9 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;
|