diff options
| author | JP Dillingham <jp@dillingham.me> | 2022-06-02 07:58:48 -0500 |
|---|---|---|
| committer | JP Dillingham <jp@dillingham.me> | 2022-06-02 07:58:48 -0500 |
| commit | 14f2a4d076b96999f74979ae693ba36fb720f60c (patch) | |
| tree | fa2527f49c78421e658b65e483476e91c5f63643 /src | |
| parent | c3b6ad913e14e58d04d5efc16d4f2cc92a3a1b4d (diff) | |
| download | slskd-14f2a4d076b96999f74979ae693ba36fb720f60c.tar.gz | |
add visual cues when user adction is required
Diffstat (limited to 'src')
| -rw-r--r-- | src/web/src/components/App.js | 2 | ||||
| -rw-r--r-- | src/web/src/components/System/Info/index.js | 5 | ||||
| -rw-r--r-- | src/web/src/components/System/Shares/index.js | 18 | ||||
| -rw-r--r-- | src/web/src/components/System/System.js | 32 |
4 files changed, 35 insertions, 22 deletions
diff --git a/src/web/src/components/App.js b/src/web/src/components/App.js index fc3f856e..206cea34 100644 --- a/src/web/src/components/App.js +++ b/src/web/src/components/App.js @@ -203,7 +203,7 @@ class App extends Component { {server?.isConnected && <Menu.Item onClick={() => disconnect()} > - <Icon name='plug' color='green'/>Connected + <Icon name='plug' color={pendingReconnect ? 'yellow' : 'green'}/>Connected </Menu.Item>} {(!server?.isConnected) && <Menu.Item onClick={() => connect()} diff --git a/src/web/src/components/System/Info/index.js b/src/web/src/components/System/Info/index.js index 063303ac..7068e047 100644 --- a/src/web/src/components/System/Info/index.js +++ b/src/web/src/components/System/Info/index.js @@ -21,6 +21,8 @@ const Info = ({ state }) => { }, 250); }, [state]); + const { pendingRestart } = state; + return ( <> <div className='header-buttons'> @@ -57,7 +59,8 @@ const Info = ({ state }) => { <ShrinkableButton icon='redo' mediaQuery='(max-width: 516px)' - negative + negative={!pendingRestart} + color={pendingRestart ? 'yellow' : undefined} disabled={!contents} > Restart diff --git a/src/web/src/components/System/Shares/index.js b/src/web/src/components/System/Shares/index.js index 5fe59cb2..ceb5746c 100644 --- a/src/web/src/components/System/Shares/index.js +++ b/src/web/src/components/System/Shares/index.js @@ -22,17 +22,18 @@ const Index = ({ state = {} } = {}) => { const [shares, setShares] = useState([]); const [modal, setModal] = useState(false); - const { filling, filled, fillProgress } = state; + const { scanning, scanProgress, scanPending } = state; + const scanned = !scanning; useEffect(() => { getAll(); }, []); useEffect(() => { - if (filled) { + if (scanned) { getAll(); } - }, [filled]); + }, [scanned]); const getAll = async () => { try { @@ -53,17 +54,18 @@ const Index = ({ state = {} } = {}) => { <> <div className="header-buttons"> <ShrinkableButton - primary + primary={!scanPending} + color={scanPending ? 'yellow' : undefined} icon='refresh' - loading={filling} - disabled={filling || loading} + loading={scanning} + disabled={scanning || loading} mediaQuery={'(max-width: 516px)'} onClick={() => sharesLib.rescan()} - >{filling ? 'Scanning shares' : 'Rescan Shares'}</ShrinkableButton> + >{scanning ? 'Scanning shares' : 'Rescan Shares'}</ShrinkableButton> </div> <Divider/> <Switch - filling={(loading || filling) && <LoaderSegment caption={fillProgress}/>} + filling={(loading || scanning) && <LoaderSegment>{Math.round(scanProgress * 100)}%</LoaderSegment>} > <ShareTable shares={shared} onClick={setModal}/> <ExclusionTable exclusions={excluded}/> diff --git a/src/web/src/components/System/System.js b/src/web/src/components/System/System.js index 6c0229cf..2be10f81 100644 --- a/src/web/src/components/System/System.js +++ b/src/web/src/components/System/System.js @@ -1,7 +1,7 @@ import React from 'react'; import { useRouteMatch, useHistory, Redirect } from 'react-router-dom'; -import { Segment, Tab } from 'semantic-ui-react'; +import { Segment, Tab, Menu, Icon } from 'semantic-ui-react'; import './System.css'; @@ -9,6 +9,7 @@ import Info from './Info'; import Logs from './Logs'; import Options from './Options'; import Shares from './Shares'; +import { Switch } from '../Shared'; const System = ({ state = {}, options = {} }) => { const { params: { tab }, ...route } = useRouteMatch(); @@ -17,11 +18,15 @@ const System = ({ state = {}, options = {} }) => { const panes = [ { route: 'info', - menuItem: { - key: 'info', - icon: 'info', - content: 'Info', - }, + menuItem: (<Menu.Item key='info'> + <Switch + pending={((state?.pendingRestart ?? false) || (state?.pendingReconnect ?? false)) + && <Icon name='exclamation circle' color='yellow'/>} + > + <Icon name='info circle'/> + </Switch> + Info + </Menu.Item>), render: () => <Tab.Pane><Info state={state}/></Tab.Pane>, }, { @@ -35,12 +40,15 @@ const System = ({ state = {}, options = {} }) => { }, { route: 'shares', - menuItem: { - key: 'shares', - icon: 'share external', - content: 'Shares', - }, - render: () => <Tab.Pane><Shares state={state.sharedFileCache}/></Tab.Pane>, + menuItem: (<Menu.Item key='shares'> + <Switch + scanPending={(state?.shares?.scanPending ?? false) && <Icon name='exclamation circle' color='yellow'/>} + > + <Icon name='share external'/> + </Switch> + Shares + </Menu.Item>), + render: () => <Tab.Pane><Shares state={state.shares}/></Tab.Pane>, }, { route: 'logs', |
