From a50824c1294586b57fd626adf6a9c5ba11db8196 Mon Sep 17 00:00:00 2001 From: robo <30987265+Robonau@users.noreply.github.com> Date: Sat, 5 Mar 2022 05:44:59 +0000 Subject: [PATCH] fix manga badges setting menu that turns the update/download badges on and off (#150) --- src/components/library/LibraryOptions.tsx | 91 +++++++++++++++++++++-- 1 file changed, 85 insertions(+), 6 deletions(-) diff --git a/src/components/library/LibraryOptions.tsx b/src/components/library/LibraryOptions.tsx index c9a4130a..332f02f2 100644 --- a/src/components/library/LibraryOptions.tsx +++ b/src/components/library/LibraryOptions.tsx @@ -6,26 +6,105 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -import React from 'react'; +import React, { useState } from 'react'; import FilterListIcon from '@mui/icons-material/FilterList'; import SortIcon from '@mui/icons-material/Sort'; import { - Drawer, FormControlLabel, IconButton, ListItem, ListItemButton, ListItemIcon, ListItemText, + Drawer, + FormControlLabel, + IconButton, + Tabs, + Tab, + Box, + Stack, + Checkbox, + ListItem, + ListItemButton, + ListItemIcon, + ListItemText, } from '@mui/material'; import useLibraryOptions from 'util/useLibraryOptions'; import ThreeStateCheckbox from 'components/util/ThreeStateCheckbox'; -import { Box } from '@mui/system'; import ArrowDownwardIcon from '@mui/icons-material/ArrowDownward'; import ArrowUpwardIcon from '@mui/icons-material/ArrowUpward'; +import TabPanel from 'components/util/TabPanel'; +import { useLibraryOptionsContext } from 'components/context/LibraryOptionsContext'; function Options() { const { downloaded, setDownloaded, unread, setUnread, } = useLibraryOptions(); + const [currentTab, setCurrentTab] = useState(0); + const { options, setOptions } = useLibraryOptionsContext(); + + function setContextOptions( + e: React.ChangeEvent, + checked: boolean, + ) { + setOptions((prev) => ({ ...prev, [e.target.name]: checked })); + } + return ( - - } label="Unread" /> - } label="Downloaded" /> + + setCurrentTab(newTab)} + indicatorColor="primary" + textColor="primary" + > + + + + + + + )} + label="Unread" + /> + + )} + label="Downloaded" + /> + + + + + + )} + /> + + )} + /> + + ); }