-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #153 from mgireesha/123-add-sorting-on-genres-page
Code cleanu and issue fixes
- Loading branch information
Showing
15 changed files
with
144 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
src/g-player-react/src/Components/screen/album/albumUtil.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { A_TO_Z_DESC, SORT_ARTIST, SORT_YEAR } from "../../redux/GPActionTypes"; | ||
|
||
export const filterAlbums = (globalFilterText, sortedAlbums, albumListKeys) => { | ||
let tempFilteredAlbums = []; | ||
let filteredAlbums = {}; | ||
albumListKeys.forEach(lKey =>{ | ||
tempFilteredAlbums = sortedAlbums[lKey]; | ||
tempFilteredAlbums = tempFilteredAlbums.filter(album => { | ||
return album.albumName.toLowerCase().includes(globalFilterText) | ||
|| album.year === globalFilterText | ||
|| album.genre.toLowerCase().includes(globalFilterText) | ||
|| album.albumArtist.toLowerCase().includes(globalFilterText) | ||
}); | ||
filteredAlbums[lKey] = tempFilteredAlbums; | ||
}) | ||
return filteredAlbums; | ||
} | ||
|
||
export const sortAlbumKeys = (sortBy, sortedAlbums) => { | ||
let tempAlbumListKeys = Object.keys(sortedAlbums); | ||
if (sortBy === SORT_YEAR || sortBy === A_TO_Z_DESC) { | ||
tempAlbumListKeys = tempAlbumListKeys.sort((a, b) => { return a > b ? -1 : 1 }); | ||
} | ||
if (sortBy === SORT_ARTIST) { | ||
tempAlbumListKeys = tempAlbumListKeys.sort((a, b) => { return a > b ? 1 : -1 }); | ||
} | ||
return tempAlbumListKeys; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.