|
@ -1,4 +1,4 @@ |
|
|
import React, { useEffect, useState } from 'react'; |
|
|
import React, { useEffect, useRef, useState } from 'react'; |
|
|
import settings from 'electron-settings'; |
|
|
import settings from 'electron-settings'; |
|
|
import _ from 'lodash'; |
|
|
import _ from 'lodash'; |
|
|
import { useQuery, useQueryClient } from 'react-query'; |
|
|
import { useQuery, useQueryClient } from 'react-query'; |
|
@ -23,7 +23,7 @@ import { |
|
|
} from '../../redux/multiSelectSlice'; |
|
|
} from '../../redux/multiSelectSlice'; |
|
|
import GenericPage from '../layout/GenericPage'; |
|
|
import GenericPage from '../layout/GenericPage'; |
|
|
import GenericPageHeader from '../layout/GenericPageHeader'; |
|
|
import GenericPageHeader from '../layout/GenericPageHeader'; |
|
|
import { StyledButton, StyledInputPicker } from '../shared/styled'; |
|
|
import { StyledButton, StyledInputPicker, StyledInputPickerContainer } from '../shared/styled'; |
|
|
import { fixPlayer2Index, setPlayQueueByRowClick, setRate } from '../../redux/playQueueSlice'; |
|
|
import { fixPlayer2Index, setPlayQueueByRowClick, setRate } from '../../redux/playQueueSlice'; |
|
|
import { setStatus } from '../../redux/playerSlice'; |
|
|
import { setStatus } from '../../redux/playerSlice'; |
|
|
import useSearchQuery from '../../hooks/useSearchQuery'; |
|
|
import useSearchQuery from '../../hooks/useSearchQuery'; |
|
@ -37,6 +37,7 @@ const FolderList = () => { |
|
|
const queryClient = useQueryClient(); |
|
|
const queryClient = useQueryClient(); |
|
|
const folder = useAppSelector((state) => state.folder); |
|
|
const folder = useAppSelector((state) => state.folder); |
|
|
const [musicFolder, setMusicFolder] = useState(folder.musicFolder); |
|
|
const [musicFolder, setMusicFolder] = useState(folder.musicFolder); |
|
|
|
|
|
const folderPickerContainerRef = useRef(null); |
|
|
|
|
|
|
|
|
const { isLoading, isError, data: indexData, error }: any = useQuery( |
|
|
const { isLoading, isError, data: indexData, error }: any = useQuery( |
|
|
['indexes', musicFolder], |
|
|
['indexes', musicFolder], |
|
@ -163,8 +164,12 @@ const FolderList = () => { |
|
|
showTitleTooltip |
|
|
showTitleTooltip |
|
|
subtitle={ |
|
|
subtitle={ |
|
|
<> |
|
|
<> |
|
|
|
|
|
<StyledInputPickerContainer ref={folderPickerContainerRef}> |
|
|
<ButtonToolbar> |
|
|
<ButtonToolbar> |
|
|
<StyledInputPicker |
|
|
<StyledInputPicker |
|
|
|
|
|
container={() => folderPickerContainerRef.current} |
|
|
|
|
|
size="sm" |
|
|
|
|
|
width={180} |
|
|
data={musicFolders} |
|
|
data={musicFolders} |
|
|
defaultValue={musicFolder} |
|
|
defaultValue={musicFolder} |
|
|
valueKey="id" |
|
|
valueKey="id" |
|
@ -172,14 +177,15 @@ const FolderList = () => { |
|
|
onChange={(e: any) => { |
|
|
onChange={(e: any) => { |
|
|
setMusicFolder(e); |
|
|
setMusicFolder(e); |
|
|
}} |
|
|
}} |
|
|
style={{ width: '250px' }} |
|
|
|
|
|
/> |
|
|
/> |
|
|
|
|
|
|
|
|
<StyledButton |
|
|
<StyledButton |
|
|
size="sm" |
|
|
size="sm" |
|
|
onClick={() => { |
|
|
onClick={() => { |
|
|
history.push( |
|
|
history.push( |
|
|
`/library/folder?folderId=${folderData?.parent ? folderData.parent : ''}` |
|
|
`/library/folder?folderId=${ |
|
|
|
|
|
folderData?.parent ? folderData.parent : '' |
|
|
|
|
|
}` |
|
|
); |
|
|
); |
|
|
dispatch( |
|
|
dispatch( |
|
|
setCurrentViewedFolder(folderData?.parent ? folderData.parent : '') |
|
|
setCurrentViewedFolder(folderData?.parent ? folderData.parent : '') |
|
@ -190,6 +196,7 @@ const FolderList = () => { |
|
|
Go up |
|
|
Go up |
|
|
</StyledButton> |
|
|
</StyledButton> |
|
|
</ButtonToolbar> |
|
|
</ButtonToolbar> |
|
|
|
|
|
</StyledInputPickerContainer> |
|
|
</> |
|
|
</> |
|
|
} |
|
|
} |
|
|
/> |
|
|
/> |
|
|