diff --git a/src/g-player-react/src/Components/CommnPopup.js b/src/g-player-react/src/Components/CommnPopup.js index 2511e5c..6ebe5a5 100644 --- a/src/g-player-react/src/Components/CommnPopup.js +++ b/src/g-player-react/src/Components/CommnPopup.js @@ -1,7 +1,7 @@ import React, { useEffect, useState } from "react"; import { useDispatch, useSelector } from "react-redux"; import { setCommonPopupObj } from "./redux/library/LibraryActions"; -import { ALBUM, ARTIST, COMMON_POPUP_ERROR_MSG, COMPONENT, GENRE, INPUT, LANGUAGE, POPUP_PRIMARY_BTN, TEXT, TRACK } from "./redux/GPActionTypes"; +import { ALBUM, ARTIST, COMMON_POPUP_ERROR_MSG, COMPONENT, GENRE, INPUT, LANGUAGE, MULTIPLE_TRACKS, POPUP_PRIMARY_BTN, TEXT, TRACK } from "./redux/GPActionTypes"; import { PLAYLIST_ADD_TO_PLAYLIST_SUCCESS, PLAYLIST_CREATE_PLAYLIST_SUCCESS, PLAYLIST_DELETE_PLAYLIST_SUCCESS } from "./redux/playlist/PlaylistActionTypes"; import { addToPlaylist, setAddedNewPlaylistObj } from "./redux/playlist/PlaylistActions"; @@ -55,6 +55,8 @@ export const CommonPopup = () => { reqPLObj["genre"] = contextObj.obj; }else if(contextObj.type === ARTIST){ reqPLObj["artist"] = contextObj.obj; + }else if(contextObj.type === MULTIPLE_TRACKS){ + reqPLObj["songsIds"] = contextObj.obj?.join(","); } dispatch(addToPlaylist(reqPLObj)); } diff --git a/src/g-player-react/src/Components/Home.js b/src/g-player-react/src/Components/Home.js index b26ceb4..5aa45e6 100644 --- a/src/g-player-react/src/Components/Home.js +++ b/src/g-player-react/src/Components/Home.js @@ -3,11 +3,11 @@ import { Player } from "./player/Player"; import { Sidebar } from "./Sidebar"; import { Screen } from "./screen/Screen"; import { useDispatch, useSelector } from "react-redux"; -import { fetchAlbumTacks, fetchAllAlbums, fetchAllHistory, fetchAllSongs, fetchSongsByArtist, fetchSongsByGenre, fetchSongsByLanguage } from "./redux/library/LibraryActions"; +import { fetchAlbumTacks, fetchAllHistory, fetchAllSongs, fetchSongsByArtist, fetchSongsByGenre, fetchSongsByLanguage, setCheckedTrack, setCheckedTracks, setShowTrackCheckBox } from "./redux/library/LibraryActions"; import { fetchCurrentSontAndStatus, playASongSucc, setIsShuffle, setMediaVolumeSucc, setRepeat } from "./redux/player/PlayerActions"; -import { getCookieDetails, getCookieValue, setCookies } from "./utilities/util"; -import { ALBUM, ARTIST, GENRE, LANGUAGE, MAIN_CONTAINER, PLAYLIST, RECENT_PLAYS, TRACK_LIST } from "./redux/GPActionTypes"; -import { Route, Routes } from "react-router-dom"; +import { getCookieDetails, setCookies } from "./utilities/util"; +import { ALBUM, ARTIST, GENRE, LANGUAGE, MAIN_CONTAINER, PLAYLIST, RECENT_PLAYS, REMOVE_ALL, TRACK_LIST } from "./redux/GPActionTypes"; +import { Route, Routes, useLocation } from "react-router-dom"; import { Library } from "./library/LibraryV2"; import { Search } from "./search/Search"; import { RecentPlays } from "./history/RecentPlays"; @@ -23,6 +23,7 @@ import { useCookies } from "react-cookie"; export const Home = () => { const dispatch = useDispatch(); const [cookies] = useCookies(); + const showContextMenu = useSelector(state => state.library.showContextMenu); const showPlaylistSelector = useSelector(state => state.library.showPlaylistSelector); const showMetadataPopup = useSelector(state => state.library.metadataPopupObj.showMetadataPopup); @@ -82,7 +83,12 @@ export const Home = () => { } } + const locationL = useLocation(); + useEffect(()=>{ + dispatch(setCheckedTracks(undefined, REMOVE_ALL)); + dispatch(setShowTrackCheckBox(true)); + },[locationL]) return(
diff --git a/src/g-player-react/src/Components/library/BuildLibrary.js b/src/g-player-react/src/Components/library/BuildLibrary.js index 37c5898..79fbc89 100644 --- a/src/g-player-react/src/Components/library/BuildLibrary.js +++ b/src/g-player-react/src/Components/library/BuildLibrary.js @@ -41,7 +41,6 @@ export const BuildLibrary = () => { "value": RUNNING, "type": BUILD_STATUS }); - console.log("tempBuildStatus: ",tempBuildStatus) dispatch(fetchBuildStatusSucc(tempBuildStatus)); setCookies(LIBRARY_BUILD, INITIATED); } diff --git a/src/g-player-react/src/Components/library/BuildLibraryPopup.js b/src/g-player-react/src/Components/library/BuildLibraryPopup.js index 548087f..cd02cc7 100644 --- a/src/g-player-react/src/Components/library/BuildLibraryPopup.js +++ b/src/g-player-react/src/Components/library/BuildLibraryPopup.js @@ -15,8 +15,6 @@ export const BuildLibraryPopup = () => { const [isBuildCompleted, setIsBuildCompleted] = useState(false); const [isBuildInit, setIsBuildInit] = useState(false); - console.log("isBuildRunning:", isBuildRunning) - useEffect(()=>{ if(buildStatusList.length > 0){ const buildStatus = [...buildStatusList].find(bs=>bs.name===BUILD_STATUS); @@ -26,7 +24,6 @@ export const BuildLibraryPopup = () => { setIsBuildInit(buildStatus.value === INIT ? true : false); } } - console.log("buildStatusList: ",buildStatusList) },[buildStatusList]) useEffect(()=>{ diff --git a/src/g-player-react/src/Components/main.scss b/src/g-player-react/src/Components/main.scss index 02abf61..3f42ab2 100644 --- a/src/g-player-react/src/Components/main.scss +++ b/src/g-player-react/src/Components/main.scss @@ -149,6 +149,10 @@ body{ .FaPauseCircle{ font-size: 1.5em; } + + .song-is-playing{ + animation: rotate 2s normal linear infinite; + } } @@ -3820,6 +3824,7 @@ a.disabled-click{ svg{ font-size: 1em; } + } } } diff --git a/src/g-player-react/src/Components/player/Player.js b/src/g-player-react/src/Components/player/Player.js index ddbd0bc..6597576 100644 --- a/src/g-player-react/src/Components/player/Player.js +++ b/src/g-player-react/src/Components/player/Player.js @@ -293,8 +293,8 @@ export const Player = () => {
- {!isPlayingL && } - {isPlayingL && } + {!isPlayingL && } + {isPlayingL && }
diff --git a/src/g-player-react/src/Components/playlist/ImportExportPlaylistPopupBtns.js b/src/g-player-react/src/Components/playlist/ImportExportPlaylistPopupBtns.js index 599f8b1..9c795d0 100644 --- a/src/g-player-react/src/Components/playlist/ImportExportPlaylistPopupBtns.js +++ b/src/g-player-react/src/Components/playlist/ImportExportPlaylistPopupBtns.js @@ -62,10 +62,8 @@ export const ImportExportPlaylistPopupBtns = () => { setSelectedFiles(tempSelectedFiles); }else if(fileType === '.gp'){ tempSelectedFiles = getGPPLPayload(tempSelectedFiles); - console.log("65 tempSelectedFiles: ",tempSelectedFiles) } - console.log("tempSelectedFiles",tempSelectedFiles) /*console.log("tempSelectedFiles",tempSelectedFiles); const tempCommonPopupObj = {...commonPopupObj}; tempCommonPopupObj.payload = tempSelectedFiles; @@ -101,7 +99,6 @@ export const ImportExportPlaylistPopupBtns = () => { } const submitImportPlaylists = async () => { - //console.log("selectedFiles",{...selectedFiles}); let fileInput = document.getElementById(CSV_IMPORT_INPUT); const importInpIds = [CSV_IMPORT_INPUT, GP_IMPORT_INPUT]; for(let i=0; i { const tracks = document.getElementById(TRACK_LIST); if(tracks && tracks.childElementCount > 0){ if(isShuffle && playlistSongs && playlistSongs.length > 0){ - console.log(Math.floor(Math.random() * playlistSongs.length)-1) tracks.getElementsByClassName("track")[Math.floor(Math.random() * playlistSongs.length)-1].getElementsByClassName("title")[0].click() }else{ tracks.getElementsByClassName("track")[0].getElementsByClassName("title")[0].click(); diff --git a/src/g-player-react/src/Components/playlist/Playlists.js b/src/g-player-react/src/Components/playlist/Playlists.js index 167a926..019ed81 100644 --- a/src/g-player-react/src/Components/playlist/Playlists.js +++ b/src/g-player-react/src/Components/playlist/Playlists.js @@ -15,7 +15,6 @@ import { getShowDeletePlaylistPopup } from "./PlalistUtil"; export const Playlists = () => { const dispatch = useDispatch(); const playlists = useSelector(state => state.playlist.playlists); - console.log(playlists) const playlistAlbums = useSelector(state => state.playlist.playlistAlbums); const playlistSongsCount = useSelector(state => state.playlist.playlistSongsCount); diff --git a/src/g-player-react/src/Components/playlist/PlayllistSelectorV2.js b/src/g-player-react/src/Components/playlist/PlayllistSelectorV2.js index 4bdab8e..d3f87f6 100644 --- a/src/g-player-react/src/Components/playlist/PlayllistSelectorV2.js +++ b/src/g-player-react/src/Components/playlist/PlayllistSelectorV2.js @@ -1,6 +1,6 @@ import React, { useEffect, useState } from "react"; import { useDispatch, useSelector } from "react-redux"; -import { ADD_TO_NEW_PLAYLIST_LABEL, ALBUM, ARTIST, CREATE, CREATE_LABEL, GENRE, GP_CONTEXT_MENU, INPUT, LANGUAGE, MAIN_CONTAINER, NEW_PLAYLIST_BTN_LABEL, PLAYLIST_NAME, PLAYLIST_SELECTOR, TRACK } from "../redux/GPActionTypes"; +import { ADD_TO_NEW_PLAYLIST_LABEL, ALBUM, ARTIST, CREATE, CREATE_LABEL, GENRE, GP_CONTEXT_MENU, INPUT, LANGUAGE, MAIN_CONTAINER, MULTIPLE_TRACKS, NEW_PLAYLIST_BTN_LABEL, PLAYLIST_NAME, PLAYLIST_SELECTOR, TRACK } from "../redux/GPActionTypes"; import { addToPlaylist, createPlaylist, fetchAssignedPlaylists, fetchAssignedPlaylistsSucc, removeFromPlaylist } from "../redux/playlist/PlaylistActions"; import { PLAYLIST_ADD_TO_PLAYLIST_FAIL, PLAYLIST_ADD_TO_PLAYLIST_SUCCESS } from "../redux/playlist/PlaylistActionTypes"; import { setCommonPopupObj, setShowContextMenu, setShowPlaylistSelector } from "../redux/library/LibraryActions"; @@ -25,7 +25,6 @@ export const PlaylistSelector = () => { if(contextObj.type === TRACK){ dispatch(fetchAssignedPlaylists(contextObj.type, contextObj.obj.songId)); }else if(contextObj.type === ALBUM){ - // console.log(contextObj) dispatch(fetchAssignedPlaylistsSucc([])); } setobj(contextObj.obj); @@ -79,6 +78,8 @@ export const PlaylistSelector = () => { reqPLObj["genre"] = contextObj.obj; }else if(contextObj.type === ARTIST){ reqPLObj["artist"] = contextObj.obj; + }else if(contextObj.type === MULTIPLE_TRACKS){ + reqPLObj["songsIds"] = contextObj.obj?.join(","); } dispatch(addToPlaylist(reqPLObj)); } diff --git a/src/g-player-react/src/Components/redux/GPActionTypes.js b/src/g-player-react/src/Components/redux/GPActionTypes.js index 6c5ef10..feaf541 100644 --- a/src/g-player-react/src/Components/redux/GPActionTypes.js +++ b/src/g-player-react/src/Components/redux/GPActionTypes.js @@ -92,6 +92,7 @@ export const MULTI_GENRE = 'MULTI_GENRE'; export const MULTI_LINGUAL = 'MULTI_LINGUAL'; export const MULTI_LINGUAL_LABEL = 'Multi lingual'; export const MONO_LINGUAL = 'MONO_LINGUAL'; +export const MULTIPLE_TRACKS = 'MULTIPLE_TRACKS'; export const MUSIC = 'MUSIC'; export const MUSIC_LABEL = 'Music'; export const MUSIC_PATH = 'MUSIC_PATH'; @@ -122,6 +123,7 @@ export const RECENT_PLAYS = 'RECENT_PLAYS'; export const RECENT_PLAYS_LABEL = 'Recent Plays'; export const RECENTLY_PLAYED_LABEL = 'Recently Played'; export const REMOVE = "REMOVE"; +export const REMOVE_ALL = "REMOVE_ALL"; export const REMOVE_LABEL = "Remove"; export const RENAME = "RENAME"; export const RENAME_LABEL = "Rename"; @@ -134,6 +136,8 @@ export const RUNNING = 'RUNNING'; export const SAVE_LABEL = 'Save'; export const SEARCH_RESULTS_LABEL = 'Search Results'; +export const SELECT_TRACKS_LABEL = 'Select tracks'; +export const UNSELECT_TRACKS_LABEL = 'Unselect tracks'; export const SHOW_ASSIGNED_PLAYLISTS = 'SHOW_ASSIGNED_PLAYLISTS'; export const SOME_PAGE = 'SOME_PAGE'; export const SORT_A_TO_Z = 'SORT_A_TO_Z'; diff --git a/src/g-player-react/src/Components/redux/library/LibraryActionTypes.js b/src/g-player-react/src/Components/redux/library/LibraryActionTypes.js index 2f2485d..d9e8437 100644 --- a/src/g-player-react/src/Components/redux/library/LibraryActionTypes.js +++ b/src/g-player-react/src/Components/redux/library/LibraryActionTypes.js @@ -111,4 +111,6 @@ export const SET_PLAYER_TRACKS = 'SET_PLAYER_TRACKS'; export const SET_PLAYLIST_SONGS = 'SET_PLAYLIST_SONGS'; export const SET_METADATA_POPUP_OBJ = 'SET_METADATA_POPUP_OBJ'; export const SET_ARTIST_IMGAE_DOWNLOAD_SUMMARY = 'SET_ARTIST_IMGAE_DOWNLOAD_SUMMARY'; -export const SET_GLOBAL_FILTER_TEXT = 'SET_GLOBAL_FILTER_TEXT'; \ No newline at end of file +export const SET_GLOBAL_FILTER_TEXT = 'SET_GLOBAL_FILTER_TEXT'; +export const SET_SHOW_TRACK_CHECKBOX = 'SET_SHOW_TRACK_CHECKBOX'; +export const SET_CHECKED_TRACK = 'SET_CHECKED_TRACK'; \ No newline at end of file diff --git a/src/g-player-react/src/Components/redux/library/LibraryActions.js b/src/g-player-react/src/Components/redux/library/LibraryActions.js index d5a3754..3d0ff42 100644 --- a/src/g-player-react/src/Components/redux/library/LibraryActions.js +++ b/src/g-player-react/src/Components/redux/library/LibraryActions.js @@ -1,4 +1,4 @@ -import { SUCCESS } from "../GPActionTypes"; +import { ADD, REMOVE, REMOVE_ALL, SUCCESS } from "../GPActionTypes"; import { FETCH_SONGS_START, FETCH_SONGS_SUCCESS, HISTORY_FETCH_ALL_HISTORY_START, HISTORY_FETCH_ALL_HISTORY_SUCCESS, HISTORY_UPDATE_HISTORY_START, HISTORY_UPDATE_HISTORY_SUCCESS, @@ -38,9 +38,10 @@ import { FETCH_SONGS_START, FETCH_SONGS_SUCCESS, MESSAGE_FETCH_BY_TYPE_START, MESSAGE_FETCH_BY_TYPE_SUCCESS, SET_ARTIST_IMGAE_DOWNLOAD_SUMMARY, + SET_CHECKED_TRACK, SET_COMMON_POPUP_OBJ, SET_CONTEXT_OBJECT, SET_CURRENT_PAGE, SET_GLOBAL_FILTER_TEXT, SET_IS_CLICKED_ON_CONTEXT_MENU, SET_METADATA_POPUP_OBJ, - SET_PLAYER_TRACKS, SET_PLAYLIST_SONGS, SET_SHOW_CONTEXT_MENU, SET_SHOW_METADATA_POPUP, SET_SHOW_PLAY_LIST_SELECTOR, SET_STATUS_MESSAGE + SET_PLAYER_TRACKS, SET_PLAYLIST_SONGS, SET_SHOW_CONTEXT_MENU, SET_SHOW_METADATA_POPUP, SET_SHOW_PLAY_LIST_SELECTOR, SET_SHOW_TRACK_CHECKBOX, SET_STATUS_MESSAGE } from "./LibraryActionTypes"; export const fetchAllSongs = (isSetPlayerTracks) => ({ @@ -420,6 +421,17 @@ export const setGlobalFilterText = (globalFilterText) => ({ globalFilterText }) +export const setShowTrackCheckBox = (showTrackCheckBox) => ({ + type: SET_SHOW_TRACK_CHECKBOX, + showTrackCheckBox:!showTrackCheckBox +}) + +export const setCheckedTracks = (songId, action) => ({ + type: SET_CHECKED_TRACK, + songId, + action +}) + export const filterMusicPath = (response, musicPath,musicPaths) => { if(response.status===SUCCESS){ musicPaths = musicPaths.filter(mPath => {return mPath.messageId!==musicPath.messageId}); @@ -464,4 +476,13 @@ export const updateTracksPostEditTrack = (state, track, field) => { } }); return tracks; +} + +export const getCheckedTracks = (checkedTracks, songId, action) => { + if(action===ADD) + return [...checkedTracks, songId] + else if(action===REMOVE) + return checkedTracks.filter(ct=>ct!==songId); + else if(action===REMOVE_ALL)return [] + else return checkedTracks; } \ No newline at end of file diff --git a/src/g-player-react/src/Components/redux/library/LibraryReducer.js b/src/g-player-react/src/Components/redux/library/LibraryReducer.js index d360c9c..19ca8bd 100644 --- a/src/g-player-react/src/Components/redux/library/LibraryReducer.js +++ b/src/g-player-react/src/Components/redux/library/LibraryReducer.js @@ -1,6 +1,6 @@ import { INIT, LOADING, SUCCESS, TRACK_LIST } from "../GPActionTypes"; -import { filterMusicPath, getPlayerTracks, updateArtistsDetails, updateTracksPostEditTrack } from "./LibraryActions"; -import { FETCH_SONGS_START, FETCH_SONGS_SUCCESS, HISTORY_FETCH_ALL_HISTORY_START, HISTORY_FETCH_ALL_HISTORY_SUCCESS, LIBRARY_DELETE_MUSIC_PATH_START, LIBRARY_DELETE_MUSIC_PATH_SUCCESS, LIBRARY_EDIT_ALBUM_INFO_START, LIBRARY_EDIT_ALBUM_INFO_SUCCESS, LIBRARY_EDIT_TRACK_INFO_START, LIBRARY_EDIT_TRACK_INFO_SUCCESS, LIBRARY_FETCH_ALBUMS_BY_GENRE_START, LIBRARY_FETCH_ALBUMS_BY_GENRE_SUCCESS, LIBRARY_FETCH_ALBUMS_DETAILS_START, LIBRARY_FETCH_ALBUMS_DETAILS_SUCCESS, LIBRARY_FETCH_ALBUMS_START, LIBRARY_FETCH_ALBUMS_SUCCESS, LIBRARY_FETCH_ALBUM_ARTIST_LIST_START, LIBRARY_FETCH_ALBUM_ARTIST_LIST_SUCCESS, LIBRARY_FETCH_ALBUM_DETAILS_BY_ALBUM_ARTIST_START, LIBRARY_FETCH_ALBUM_DETAILS_BY_ALBUM_ARTIST_SUCCESS, LIBRARY_FETCH_ALBUM_IMGS_START, LIBRARY_FETCH_ALBUM_IMGS_SUCCESS, LIBRARY_FETCH_ALBUM_LIST_OF_AA_START, LIBRARY_FETCH_ALBUM_LIST_OF_AA_SUCCESS, LIBRARY_FETCH_ALBUM_START, LIBRARY_FETCH_ALBUM_SUCCESS, LIBRARY_FETCH_ALBUM_TRACKS_START, LIBRARY_FETCH_ALBUM_TRACKS_SUCCESS, LIBRARY_FETCH_ARTIST_LIST_START, LIBRARY_FETCH_ARTIST_LIST_SUCCESS, LIBRARY_FETCH_BUILD_STATUS_START, LIBRARY_FETCH_BUILD_STATUS_SUCCESS, LIBRARY_FETCH_GENRE_DETAILS_START, LIBRARY_FETCH_GENRE_DETAILS_SUCCESS, LIBRARY_FETCH_LANGUAGE_DETAILS_START, LIBRARY_FETCH_LANGUAGE_DETAILS_SUCCESS, LIBRARY_FETCH_MOST_PLAYED_DATA_START, LIBRARY_FETCH_MOST_PLAYED_DATA_SUCCESS, LIBRARY_FETCH_MUSIC_PATH_START, LIBRARY_FETCH_MUSIC_PATH_SUCCESS, LIBRARY_FETCH_SONGS_BY_ARTIST_START, LIBRARY_FETCH_SONGS_BY_ARTIST_SUCCESS, LIBRARY_FETCH_SONGS_BY_GENRE_START, LIBRARY_FETCH_SONGS_BY_GENRE_SUCCESS, LIBRARY_FETCH_SONGS_BY_LANGUAGE_START, LIBRARY_FETCH_SONGS_BY_LANGUAGE_SUCCESS, LIBRARY_INIT_BUILD_DELTA_LIBRARY_START, LIBRARY_INIT_BUILD_DELTA_LIBRARY_SUCESS, LIBRARY_INIT_BUILD_LIBRARY_START, LIBRARY_INIT_BUILD_LIBRARY_SUCESS, LIBRARY_SAVE_MUSIC_PATH_START, LIBRARY_SAVE_MUSIC_PATH_SUCCESS, LIBRARY_SEARCH_BY_KEY_START, LIBRARY_SEARCH_BY_KEY_SUCCESS, LIBRARY_UPLOAD_ARTIST_IMG_START, LIBRARY_UPLOAD_ARTIST_IMG_SUCCESS, SET_ARTIST_IMGAE_DOWNLOAD_SUMMARY, SET_COMMON_POPUP_OBJ, SET_CONTEXT_OBJECT, SET_CURRENT_PAGE, SET_GLOBAL_FILTER_TEXT, SET_GROUP_BAND, SET_IS_CLICKED_ON_CONTEXT_MENU, SET_METADATA_POPUP_OBJ, SET_PLAYER_TRACKS, SET_PLAYLIST_SONGS, SET_SHOW_COMMON_POPUP, SET_SHOW_CONTEXT_MENU, SET_SHOW_METADATA_POPUP, SET_SHOW_PLAY_LIST_SELECTOR, SET_STATUS_MESSAGE } from "./LibraryActionTypes"; +import { filterMusicPath, getCheckedTracks, getPlayerTracks, updateArtistsDetails, updateTracksPostEditTrack } from "./LibraryActions"; +import { FETCH_SONGS_START, FETCH_SONGS_SUCCESS, HISTORY_FETCH_ALL_HISTORY_START, HISTORY_FETCH_ALL_HISTORY_SUCCESS, LIBRARY_DELETE_MUSIC_PATH_START, LIBRARY_DELETE_MUSIC_PATH_SUCCESS, LIBRARY_EDIT_ALBUM_INFO_START, LIBRARY_EDIT_ALBUM_INFO_SUCCESS, LIBRARY_EDIT_TRACK_INFO_START, LIBRARY_EDIT_TRACK_INFO_SUCCESS, LIBRARY_FETCH_ALBUMS_BY_GENRE_START, LIBRARY_FETCH_ALBUMS_BY_GENRE_SUCCESS, LIBRARY_FETCH_ALBUMS_DETAILS_START, LIBRARY_FETCH_ALBUMS_DETAILS_SUCCESS, LIBRARY_FETCH_ALBUMS_START, LIBRARY_FETCH_ALBUMS_SUCCESS, LIBRARY_FETCH_ALBUM_ARTIST_LIST_START, LIBRARY_FETCH_ALBUM_ARTIST_LIST_SUCCESS, LIBRARY_FETCH_ALBUM_DETAILS_BY_ALBUM_ARTIST_START, LIBRARY_FETCH_ALBUM_DETAILS_BY_ALBUM_ARTIST_SUCCESS, LIBRARY_FETCH_ALBUM_IMGS_START, LIBRARY_FETCH_ALBUM_IMGS_SUCCESS, LIBRARY_FETCH_ALBUM_LIST_OF_AA_START, LIBRARY_FETCH_ALBUM_LIST_OF_AA_SUCCESS, LIBRARY_FETCH_ALBUM_START, LIBRARY_FETCH_ALBUM_SUCCESS, LIBRARY_FETCH_ALBUM_TRACKS_START, LIBRARY_FETCH_ALBUM_TRACKS_SUCCESS, LIBRARY_FETCH_ARTIST_LIST_START, LIBRARY_FETCH_ARTIST_LIST_SUCCESS, LIBRARY_FETCH_BUILD_STATUS_START, LIBRARY_FETCH_BUILD_STATUS_SUCCESS, LIBRARY_FETCH_GENRE_DETAILS_START, LIBRARY_FETCH_GENRE_DETAILS_SUCCESS, LIBRARY_FETCH_LANGUAGE_DETAILS_START, LIBRARY_FETCH_LANGUAGE_DETAILS_SUCCESS, LIBRARY_FETCH_MOST_PLAYED_DATA_START, LIBRARY_FETCH_MOST_PLAYED_DATA_SUCCESS, LIBRARY_FETCH_MUSIC_PATH_START, LIBRARY_FETCH_MUSIC_PATH_SUCCESS, LIBRARY_FETCH_SONGS_BY_ARTIST_START, LIBRARY_FETCH_SONGS_BY_ARTIST_SUCCESS, LIBRARY_FETCH_SONGS_BY_GENRE_START, LIBRARY_FETCH_SONGS_BY_GENRE_SUCCESS, LIBRARY_FETCH_SONGS_BY_LANGUAGE_START, LIBRARY_FETCH_SONGS_BY_LANGUAGE_SUCCESS, LIBRARY_INIT_BUILD_DELTA_LIBRARY_START, LIBRARY_INIT_BUILD_DELTA_LIBRARY_SUCESS, LIBRARY_INIT_BUILD_LIBRARY_START, LIBRARY_INIT_BUILD_LIBRARY_SUCESS, LIBRARY_SAVE_MUSIC_PATH_START, LIBRARY_SAVE_MUSIC_PATH_SUCCESS, LIBRARY_SEARCH_BY_KEY_START, LIBRARY_SEARCH_BY_KEY_SUCCESS, LIBRARY_UPLOAD_ARTIST_IMG_START, LIBRARY_UPLOAD_ARTIST_IMG_SUCCESS, SET_ARTIST_IMGAE_DOWNLOAD_SUMMARY, SET_CHECKED_TRACK, SET_COMMON_POPUP_OBJ, SET_CONTEXT_OBJECT, SET_CURRENT_PAGE, SET_GLOBAL_FILTER_TEXT, SET_GROUP_BAND, SET_IS_CLICKED_ON_CONTEXT_MENU, SET_METADATA_POPUP_OBJ, SET_PLAYER_TRACKS, SET_PLAYLIST_SONGS, SET_SHOW_COMMON_POPUP, SET_SHOW_CONTEXT_MENU, SET_SHOW_METADATA_POPUP, SET_SHOW_PLAY_LIST_SELECTOR, SET_SHOW_TRACK_CHECKBOX, SET_STATUS_MESSAGE } from "./LibraryActionTypes"; export const initialState = { tracks:[], @@ -37,6 +37,8 @@ export const initialState = { metadataPopupObj: {}, artistImageDownloadSummary:[], globalFilterText:"", + showTrackCheckBox:false, + checkedTracks:[], phase:INIT } @@ -413,6 +415,16 @@ const libraryReducer = (state = initialState, action) => { ...state, globalFilterText: action.globalFilterText } + case SET_SHOW_TRACK_CHECKBOX: + return{ + ...state, + showTrackCheckBox: action.showTrackCheckBox + } + case SET_CHECKED_TRACK: + return{ + ...state, + checkedTracks:getCheckedTracks([...state.checkedTracks],action.songId, action.action) + } default: return { ...state, diff --git a/src/g-player-react/src/Components/screen/GPContextMenu.js b/src/g-player-react/src/Components/screen/GPContextMenu.js index ae5f199..ce73757 100644 --- a/src/g-player-react/src/Components/screen/GPContextMenu.js +++ b/src/g-player-react/src/Components/screen/GPContextMenu.js @@ -1,7 +1,7 @@ import React, { useEffect, useState } from "react"; import { useDispatch, useSelector } from "react-redux"; import { setCommonPopupObj, setShowContextMenu, setShowPlaylistSelector } from "../redux/library/LibraryActions"; -import { ADD_TOPLAYLIST_LABEL, ADD_TO_NEW_PLAYLIST_LABEL, ALBUM, ARTIST, COMPONENT, GP_CONTEXT_MENU, GP_CONTEXT_MENU_ELEM_IDS, MAIN_CONTAINER, TRACK } from "../redux/GPActionTypes"; +import { ADD_TOPLAYLIST_LABEL, ALBUM, ARTIST, COMPONENT, GP_CONTEXT_MENU, GP_CONTEXT_MENU_ELEM_IDS, MAIN_CONTAINER, MULTIPLE_TRACKS, TRACK } from "../redux/GPActionTypes"; import { MdKeyboardArrowRight } from 'react-icons/md'; import { Link } from "react-router-dom"; import { checkIfActionAllowed } from "../utilities/util"; @@ -79,7 +79,7 @@ export const GPContexMenu = () => { },[]); const onSetShowPlaylistSelector = (showPlaylistSelector) => { - if(contextObj.type===TRACK){ + if(contextObj.type===TRACK || contextObj.type===MULTIPLE_TRACKS){ const commonPopupObj = { showPopup: true, title: ADD_TOPLAYLIST_LABEL, diff --git a/src/g-player-react/src/Components/screen/genre/GenrePage.js b/src/g-player-react/src/Components/screen/genre/GenrePage.js index 8ee687f..0d58cb1 100644 --- a/src/g-player-react/src/Components/screen/genre/GenrePage.js +++ b/src/g-player-react/src/Components/screen/genre/GenrePage.js @@ -79,7 +79,6 @@ export const GenrePage = () => { setGenreAlbums(genreDetails.ALBUMS_BY_GENRE); } } - //console.log("genreDetails",genreDetails) },[genreDetails]); useEffect(()=>{ diff --git a/src/g-player-react/src/Components/screen/lyrics/Lyrics.js b/src/g-player-react/src/Components/screen/lyrics/Lyrics.js index c1fc347..5bdc24b 100644 --- a/src/g-player-react/src/Components/screen/lyrics/Lyrics.js +++ b/src/g-player-react/src/Components/screen/lyrics/Lyrics.js @@ -88,7 +88,6 @@ export const Lyrics = () => { } }); } - console.log(tempLyricObj); setLyricsObjKeys(Object.keys(tempLyricObj)); setLyricsObj(tempLyricObj); } diff --git a/src/g-player-react/src/Components/screen/metadata/EditAlbumInfo.js b/src/g-player-react/src/Components/screen/metadata/EditAlbumInfo.js index 61aa2ca..4d5d1b7 100644 --- a/src/g-player-react/src/Components/screen/metadata/EditAlbumInfo.js +++ b/src/g-player-react/src/Components/screen/metadata/EditAlbumInfo.js @@ -93,7 +93,6 @@ export const EditAlbumInfo = () => { tempModifiedAlbum["albumImgAvl"] = true; document.getElementById(ALBM_ART_IMG_EDIT).src = fileB64; } - console.log("tempModifiedAlbum",tempModifiedAlbum); setModifiedAlbum(tempModifiedAlbum); } diff --git a/src/g-player-react/src/Components/screen/metadata/EditTrackInfo.js b/src/g-player-react/src/Components/screen/metadata/EditTrackInfo.js index 6090340..b0c18f6 100644 --- a/src/g-player-react/src/Components/screen/metadata/EditTrackInfo.js +++ b/src/g-player-react/src/Components/screen/metadata/EditTrackInfo.js @@ -29,7 +29,6 @@ export const EditTrackInfo = () => { const initTrackInfoUpdate = () => { const tempModifiedTrack = {...modifiedTrack}; if(Object.keys(tempModifiedTrack).length > 1){ - console.log(editTrackInfo(tempModifiedTrack, TRACK)) dispatch(editTrackInfo(tempModifiedTrack, TRACK)); } } diff --git a/src/g-player-react/src/Components/screen/track/Track.js b/src/g-player-react/src/Components/screen/track/Track.js index 320ce10..234f4d5 100644 --- a/src/g-player-react/src/Components/screen/track/Track.js +++ b/src/g-player-react/src/Components/screen/track/Track.js @@ -1,11 +1,11 @@ -import React, { useEffect, useState } from "react"; +import React, { useState } from "react"; import { useDispatch, useSelector } from "react-redux"; import { Link } from "react-router-dom"; -import { ALBUM, ARTIST, CURRENT_PAGE, EDIT_TRACK_INFO_LABEL, PLAYLIST, REMOVE_LABEL, TRACK, TRACK_MENU_BTN_CIRCLE } from "../../redux/GPActionTypes"; +import { ALBUM, ARTIST, UNSELECT_TRACKS_LABEL, CURRENT_PAGE, SELECT_TRACKS_LABEL, EDIT_TRACK_INFO_LABEL, PLAYLIST, REMOVE_LABEL, TRACK, TRACK_MENU_BTN_CIRCLE, MULTIPLE_TRACKS } from "../../redux/GPActionTypes"; import { playASong, playPause, setIsPlaying } from "../../redux/player/PlayerActions"; import { getCookieValue, getMins } from "../../utilities/util"; import { FaPlay } from "react-icons/fa"; -import { setContextObj, setMetadataPopupObj, setShowContextMenu } from "../../redux/library/LibraryActions"; +import { setCheckedTracks, setContextObj, setMetadataPopupObj, setShowContextMenu, setShowTrackCheckBox } from "../../redux/library/LibraryActions"; import { HiOutlineDotsVertical } from "react-icons/hi"; import { MdOutlineLyrics } from "react-icons/md"; import { fetchAssignedPlaylists, fetchAssignedPlaylistsSucc, removeFromPlaylist } from "../../redux/playlist/PlaylistActions"; @@ -21,6 +21,8 @@ export const Track = ({track, playedFrom, index, hideTrackNum}) => { const currentVolume = useSelector(state => state.player.currentVolume); const currentPage = useSelector(state => state.library.currentPage); const assignedPlaylists = useSelector(state => state.playlist.assignedPlaylists); + const showTrackCheckBox = useSelector(state => state.library.showTrackCheckBox); + const checkedTracks = useSelector(state => state.library.checkedTracks) const playSong = async(songId) => { if(songPlaying!==null && songId===songPlaying.songId){ @@ -35,14 +37,15 @@ export const Track = ({track, playedFrom, index, hideTrackNum}) => { const position = event.target.getBoundingClientRect(); event.preventDefault(); const options = []; - if(playedFrom.pfKey === PLAYLIST){ + if(playedFrom.pfKey === PLAYLIST){//this is to identify if current page is plalist page options.push({label:REMOVE_LABEL, callBackFunc: removeTrackFromPlaylist}); } options.push({label:EDIT_TRACK_INFO_LABEL, callBackFunc: onSetShowMetadataPopup}); + options.push({label:showTrackCheckBox?UNSELECT_TRACKS_LABEL:SELECT_TRACKS_LABEL, callBackFunc: ()=>dispatch(setShowTrackCheckBox(showTrackCheckBox))}); const contextObj = { position, - type: TRACK, - obj: track, + type: checkedTracks?.length>0?MULTIPLE_TRACKS:TRACK, + obj: checkedTracks?.length>0?checkedTracks:track, options, rowList:[ALBUM, ARTIST] } @@ -79,6 +82,11 @@ export const Track = ({track, playedFrom, index, hideTrackNum}) => { }, 300) setClearTime(tempClearTime) } + + const handleTrackCheckBoxChange = (event) => { + const checked = event.target.checked; + dispatch(setCheckedTracks(track.songId, checked?'ADD':'REMOVE')) + } return( <>
{ onMouseEnter={handleMouseEnter} onMouseLeave={()=>clearTimeout(clearTime)} > - {!hideTrackNum && } + {!hideTrackNum && !showTrackCheckBox && + + } + {showTrackCheckBox && + handleTrackCheckBoxChange(event)} /> + }