Skip to content

Commit 5782339

Browse files
committed
feat(search): introduce random sort option for search results
1 parent cd218df commit 5782339

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

apps/frontend/src/modules/song-search/SearchSongPage.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import {
66
faArrowDownZA,
77
faEllipsis,
88
faFilter,
9+
faShuffle,
910
} from '@fortawesome/free-solid-svg-icons';
1011
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
1112
import Image from 'next/image';
@@ -504,6 +505,9 @@ export const SearchSongPage = () => {
504505

505506
/* Use 19/91 button if sorting by a numeric value, otherwise use AZ/ZA */
506507
const orderIcon = useMemo(() => {
508+
if (sort === SongSortType.RANDOM) {
509+
return faShuffle;
510+
}
507511
if (sort === SongSortType.TITLE) {
508512
return order === SongOrderType.ASC ? faArrowDownAZ : faArrowDownZA;
509513
} else {
@@ -566,6 +570,7 @@ export const SearchSongPage = () => {
566570
>
567571
<option value={SongSortType.RECENT}>Recent</option>
568572
<option value={SongSortType.PLAY_COUNT}>Popular</option>
573+
<option value={SongSortType.RANDOM}>Random</option>
569574
<option value={SongSortType.TITLE}>Title</option>
570575
<option value={SongSortType.DURATION}>Duration</option>
571576
<option value={SongSortType.NOTE_COUNT}>Note count</option>

0 commit comments

Comments
 (0)