diff --git a/src/routes/library/index.jsx b/src/routes/library/index.jsx index f74bb5f..8252b3a 100644 --- a/src/routes/library/index.jsx +++ b/src/routes/library/index.jsx @@ -64,6 +64,7 @@ import { MdiMusic } from "../../components/icons/mdiMusic"; import { MdiHeart } from "../../components/icons/mdiHeart"; import { MdiHeartOutline } from "../../components/icons/mdiHeartOutline"; import { useBackdropStore } from "../../utils/store/backdrop"; +import { AnimatePresence } from "framer-motion"; const LibraryView = () => { const navigate = useNavigate(); @@ -83,13 +84,17 @@ const LibraryView = () => { }); const [sortAscending, setSortAscending] = useState(true); - const [sortBy, setSortBy] = useState(); - const [sortByData, setSortByData] = useState(); + const [sortBy, setSortBy] = useState("SortName"); + + /** + * @typedef {{title: string, value: string}} SortObject + */ + + /** + * @type {[SortObject[], Function]} + */ + const [sortByData, setSortByData] = useState([]); - const handleSortChange = (e) => { - setSortAscending(e.target.checked); - console.log(e.target.checked); - }; const handleSortBy = (e) => { setSortBy(e.target.value); }; @@ -236,6 +241,7 @@ const LibraryView = () => { }, ]); } else { + // currentViewType cant be "" or null or undefined since it is converted to Boolean to enable fetchItems query setCurrentViewType("none"); setViewType([]); } @@ -405,10 +411,6 @@ const LibraryView = () => { networkMode: "always", }); - const handleCurrentViewType = (e) => { - setCurrentViewType(e.target.value); - }; - const disabledSortViews = [ "MusicArtist", "Person", @@ -429,10 +431,7 @@ const LibraryView = () => { setFilterButtonAnchorEl(null); }; - const trigger = useScrollTrigger({ - disableHysteresis: true, - threshold: 1, - }); + console.log(sortBy == "Random"); const handleLiking = async (item) => { let result; @@ -507,16 +506,38 @@ const LibraryView = () => { /> -