Browse Source

hide non-working ui parts

master
gelaechter 3 years ago
committed by Jeff
parent
commit
bcb06f460d
  1. 33
      src/components/layout/Sidebar.tsx
  2. 38
      src/components/settings/Config.tsx

33
src/components/layout/Sidebar.tsx

@ -1,6 +1,7 @@
import React from 'react';
import { useHistory } from 'react-router-dom';
import { Sidenav, Nav, Icon } from 'rsuite';
import { useAppSelector } from '../../redux/hooks';
import { FixedSidebar, SidebarNavItem } from './styled';
const Sidebar = ({
@ -129,20 +130,24 @@ const Sidebar = ({
>
Genres
</SidebarNavItem>
<SidebarNavItem
tabIndex={0}
eventKey="folders"
icon={<Icon icon="folder-open" />}
onSelect={handleSidebarSelect}
disabled={disableSidebar}
onKeyDown={(e: any) => {
if (e.key === ' ' || e.key === 'Enter') {
history.push('/library/folder');
}
}}
>
Folders
</SidebarNavItem>
{useAppSelector((state) => state.config).serverType !== 'funkwhale' && (
<>
<SidebarNavItem
tabIndex={0}
eventKey="folders"
icon={<Icon icon="folder-open" />}
onSelect={handleSidebarSelect}
disabled={disableSidebar}
onKeyDown={(e: any) => {
if (e.key === ' ' || e.key === 'Enter') {
history.push('/library/folder');
}
}}
>
Folders
</SidebarNavItem>
</>
)}
</Nav>
<Nav>
<SidebarNavItem

38
src/components/settings/Config.tsx

@ -40,6 +40,9 @@ const Config = () => {
}, []);
useEffect(() => {
// skip scan status if server type is funkwhale
if (config.serverType === 'funkwhale') return setScanProgress(0);
// Check scan status on render
apiController({ serverType: config.serverType, endpoint: 'getScanStatus' })
.then((status) => {
@ -53,6 +56,9 @@ const Config = () => {
}, [config.serverType]);
useEffect(() => {
// skip scan status if server type is funkwhale
if (config.serverType === 'funkwhale') return setScanProgress(0);
// Reload scan status on interval during scan
if (isScanning) {
const interval = setInterval(() => {
@ -125,20 +131,24 @@ const Config = () => {
sidetitle={<DisconnectButton />}
subsidetitle={
<ButtonToolbar>
<StyledButton
size="sm"
onClick={async () => {
apiController({
serverType: config.serverType,
endpoint: 'startScan',
args: { musicFolderId: folder.musicFolder },
});
setIsScanning(true);
}}
disabled={isScanning}
>
{isScanning ? `${scanProgress}` : 'Scan'}
</StyledButton>
{useAppSelector((state) => state.config).serverType !== 'funkwhale' && (
<>
<StyledButton
size="sm"
onClick={async () => {
apiController({
serverType: config.serverType,
endpoint: 'startScan',
args: { musicFolderId: folder.musicFolder },
});
setIsScanning(true);
}}
disabled={isScanning}
>
{isScanning ? `${scanProgress}` : 'Scan'}
</StyledButton>
</>
)}
<Whisper
trigger="click"
placement="auto"

Loading…
Cancel
Save