2021-10-29 20:11:23 +02:00
|
|
|
/*
|
|
|
|
|
* Copyright (C) Contributors to the Suwayomi project
|
|
|
|
|
*
|
|
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
import React from 'react';
|
|
|
|
|
import FilterListIcon from '@mui/icons-material/FilterList';
|
|
|
|
|
import { Drawer, FormControlLabel, IconButton } from '@mui/material';
|
2021-10-30 16:10:34 +03:30
|
|
|
import useLibraryOptions from 'util/useLibraryOptions';
|
|
|
|
|
import ThreeStateCheckbox from 'components/util/ThreeStateCheckbox';
|
2021-10-29 20:11:23 +02:00
|
|
|
|
|
|
|
|
function Options() {
|
2021-11-07 15:59:48 +05:30
|
|
|
const {
|
|
|
|
|
downloaded, setDownloaded, unread, setUnread,
|
|
|
|
|
} = useLibraryOptions();
|
2021-10-29 20:11:23 +02:00
|
|
|
return (
|
2021-11-07 15:59:48 +05:30
|
|
|
<div style={{ display: 'flex', flexDirection: 'column' }}>
|
2021-10-29 20:11:23 +02:00
|
|
|
<FormControlLabel control={<ThreeStateCheckbox name="Unread" checked={unread} onChange={setUnread} />} label="Unread" />
|
2021-11-07 15:59:48 +05:30
|
|
|
<FormControlLabel control={<ThreeStateCheckbox name="Downloaded" checked={downloaded} onChange={setDownloaded} />} label="Downloaded" />
|
2021-10-29 20:11:23 +02:00
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export default function LibraryOptions() {
|
|
|
|
|
const [filtersOpen, setFiltersOpen] = React.useState(false);
|
|
|
|
|
const { active } = useLibraryOptions();
|
|
|
|
|
return (
|
|
|
|
|
<>
|
|
|
|
|
<IconButton
|
|
|
|
|
onClick={() => setFiltersOpen(!filtersOpen)}
|
|
|
|
|
color={active ? 'warning' : 'default'}
|
|
|
|
|
>
|
|
|
|
|
<FilterListIcon />
|
|
|
|
|
</IconButton>
|
|
|
|
|
|
|
|
|
|
<Drawer
|
|
|
|
|
anchor="bottom"
|
|
|
|
|
open={filtersOpen}
|
|
|
|
|
onClose={() => setFiltersOpen(false)}
|
|
|
|
|
PaperProps={{
|
|
|
|
|
style: {
|
|
|
|
|
maxWidth: 600, padding: '1em', marginLeft: 'auto', marginRight: 'auto',
|
|
|
|
|
},
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
<Options />
|
|
|
|
|
</Drawer>
|
|
|
|
|
|
|
|
|
|
</>
|
|
|
|
|
);
|
|
|
|
|
}
|