mirror of
https://github.com/hydralauncher/hydra.git
synced 2025-02-09 03:37:45 +03:00
feat: refactor settings tabs
This commit is contained in:
parent
ba6d8dd6a4
commit
4e2427dbef
@ -23,14 +23,26 @@ export default function Settings() {
|
|||||||
|
|
||||||
const categories = useMemo(() => {
|
const categories = useMemo(() => {
|
||||||
const categories = [
|
const categories = [
|
||||||
t("general"),
|
{ tabLabel: t("general"), contentTitle: t("general") },
|
||||||
t("behavior"),
|
{ tabLabel: t("behavior"), contentTitle: t("behavior") },
|
||||||
t("download_sources"),
|
{ tabLabel: t("download_sources"), contentTitle: t("download_sources") },
|
||||||
"Torbox",
|
{
|
||||||
"Real-Debrid",
|
tabLabel: (
|
||||||
|
<>
|
||||||
|
<img src={torBoxLogo} alt="TorBox" style={{ width: 13 }} />
|
||||||
|
Torbox
|
||||||
|
</>
|
||||||
|
),
|
||||||
|
contentTitle: "TorBox",
|
||||||
|
},
|
||||||
|
{ tabLabel: "Real-Debrid", contentTitle: "Real-Debrid" },
|
||||||
];
|
];
|
||||||
|
|
||||||
if (userDetails) return [...categories, t("account")];
|
if (userDetails)
|
||||||
|
return [
|
||||||
|
...categories,
|
||||||
|
{ tabLabel: t("account"), contentTitle: t("account") },
|
||||||
|
];
|
||||||
return categories;
|
return categories;
|
||||||
}, [userDetails, t]);
|
}, [userDetails, t]);
|
||||||
|
|
||||||
@ -68,25 +80,18 @@ export default function Settings() {
|
|||||||
<section className={styles.settingsCategories}>
|
<section className={styles.settingsCategories}>
|
||||||
{categories.map((category, index) => (
|
{categories.map((category, index) => (
|
||||||
<Button
|
<Button
|
||||||
key={category}
|
key={index}
|
||||||
theme={
|
theme={
|
||||||
currentCategoryIndex === index ? "primary" : "outline"
|
currentCategoryIndex === index ? "primary" : "outline"
|
||||||
}
|
}
|
||||||
onClick={() => setCurrentCategoryIndex(index)}
|
onClick={() => setCurrentCategoryIndex(index)}
|
||||||
>
|
>
|
||||||
{index === 3 && (
|
{category.tabLabel}
|
||||||
<img
|
|
||||||
src={torBoxLogo}
|
|
||||||
alt="TorBox"
|
|
||||||
style={{ width: 13 }}
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
{category}
|
|
||||||
</Button>
|
</Button>
|
||||||
))}
|
))}
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<h2>{categories[currentCategoryIndex]}</h2>
|
<h2>{categories[currentCategoryIndex].contentTitle}</h2>
|
||||||
{renderCategory()}
|
{renderCategory()}
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
Loading…
Reference in New Issue
Block a user