import { Stack, Grid, Accordion, Center, Group } from '@mantine/core'; import { SpotlightProvider } from '@mantine/spotlight'; import { AnimatePresence, motion } from 'framer-motion'; import { BsCollection } from 'react-icons/bs'; import { Button, TextInput } from '/@/renderer/components'; import { RiAlbumFill, RiAlbumLine, RiArrowDownSLine, RiArrowLeftSLine, RiArrowRightSLine, RiDatabaseFill, RiDatabaseLine, RiDiscLine, RiFlag2Line, RiFolder3Line, RiHome5Fill, RiHome5Line, RiMusicFill, RiMusicLine, RiPlayListLine, RiSearchLine, RiUserVoiceLine, } from 'react-icons/ri'; import { useNavigate, Link, useLocation } from 'react-router-dom'; import styled from 'styled-components'; import { SidebarItem } from '/@/renderer/features/sidebar/components/sidebar-item'; import { AppRoute } from '/@/renderer/router/routes'; import { useSidebarStore, useAppStoreActions, useCurrentSong } from '/@/renderer/store'; import { fadeIn } from '/@/renderer/styles'; const SidebarContainer = styled.div` height: 100%; max-height: calc(100vh - 85px); // Account for and playerbar user-select: none; `; const ImageContainer = styled(motion(Link))<{ height: string }>` position: relative; height: ${(props) => props.height}; ${fadeIn}; animation: fadein 0.2s ease-in-out; button { display: none; } &:hover button { display: block; } `; const SidebarImage = styled.img` width: 100%; height: 100%; object-fit: cover; background: var(--placeholder-bg); `; const ActionsContainer = styled(Grid)` -webkit-app-region: drag; `; export const Sidebar = () => { const navigate = useNavigate(); const location = useLocation(); const sidebar = useSidebarStore(); const { setSidebar } = useAppStoreActions(); const imageUrl = useCurrentSong()?.imageUrl; const showImage = sidebar.image; return ( } placeholder="Search" rightSectionWidth={90} // onClick={() => openSpotlight()} /> {location.pathname === AppRoute.HOME ? ( ) : ( )} Home setSidebar({ expanded: e })} > {location.pathname.includes('/library/') ? ( ) : ( )} Library {location.pathname === AppRoute.LIBRARY_ALBUMS ? ( ) : ( )} Albums {location.pathname === AppRoute.LIBRARY_SONGS ? ( ) : ( )} Tracks Album Artists Genres Folders Collections Playlists {showImage && ( {imageUrl ? ( ) : (
)}
)}
); };