From 1810cc7ac72fff75b95504d05c497182a4e2912f Mon Sep 17 00:00:00 2001 From: Deluan Date: Thu, 2 Apr 2020 18:18:52 -0400 Subject: [PATCH] Simplify album lists tabs handling --- ui/src/album/AlbumGridView.js | 37 ++++++++++++++++++++--------------- 1 file changed, 21 insertions(+), 16 deletions(-) diff --git a/ui/src/album/AlbumGridView.js b/ui/src/album/AlbumGridView.js index 1bf6e1e3..304ba5af 100644 --- a/ui/src/album/AlbumGridView.js +++ b/ui/src/album/AlbumGridView.js @@ -29,7 +29,7 @@ import { const useStyles = makeStyles((theme) => ({ root: { - margin: '5px' + margin: '20px' }, cover: { display: 'inline-block', @@ -58,22 +58,14 @@ const getColsForWidth = (width) => { return 7 } -const tabOrder = [ - ALBUM_LIST_ALL, - ALBUM_LIST_RANDOM, - ALBUM_LIST_NEWEST, - ALBUM_LIST_RECENT, - ALBUM_LIST_STARRED -] - const LoadedAlbumGrid = ({ ids, data, basePath, width }) => { const classes = useStyles() const dispatch = useDispatch() const albumView = useSelector((state) => state.albumView) - const tabSelected = tabOrder.indexOf(albumView.list) + const tabSelected = albumView.list const handleChange = (event, newValue) => { - dispatch(selectAlbumList(tabOrder[newValue])) + dispatch(selectAlbumList(newValue)) } return ( @@ -85,11 +77,24 @@ const LoadedAlbumGrid = ({ ids, data, basePath, width }) => { aria-label="disabled tabs example" onChange={handleChange} > - } /> - } /> - } /> - } /> - } disabled={true} /> + } /> + } /> + } + /> + } + /> + } + disabled={true} + />