diff options
Diffstat (limited to 'src/web')
| -rw-r--r-- | src/web/src/components/App.css | 20 | ||||
| -rw-r--r-- | src/web/src/components/App.js | 27 | ||||
| -rw-r--r-- | src/web/src/components/Browse/Browse.css | 24 | ||||
| -rw-r--r-- | src/web/src/components/Browse/DirectoryTree.js | 9 | ||||
| -rw-r--r-- | src/web/src/components/Shared/CodeEditor.js | 13 | ||||
| -rw-r--r-- | src/web/src/components/System/Info/index.js | 3 | ||||
| -rw-r--r-- | src/web/src/components/System/Options/DebugModal.js | 3 | ||||
| -rw-r--r-- | src/web/src/components/System/Options/EditModal.js | 3 | ||||
| -rw-r--r-- | src/web/src/components/System/Options/index.js | 5 | ||||
| -rw-r--r-- | src/web/src/components/System/Shares/ContentsModal.js | 3 | ||||
| -rw-r--r-- | src/web/src/components/System/System.js | 10 | ||||
| -rw-r--r-- | src/web/src/semantic-ui/site/collections/table.overrides | 22 | ||||
| -rw-r--r-- | src/web/src/semantic-ui/site/collections/table.variables | 15 |
13 files changed, 122 insertions, 35 deletions
diff --git a/src/web/src/components/App.css b/src/web/src/components/App.css index 26575c0a..3c613dd7 100644 --- a/src/web/src/components/App.css +++ b/src/web/src/components/App.css @@ -1,9 +1,10 @@ :root { - --background-color: #c8c8c8 !important + --background-color: #c8c8c8 !important; + --slskd-browse-folderlist-header-color: black; + --slskd-browse-folderlist-header-selected-color: #0E6EB8; } -@media (prefers-color-scheme: dark) { -:root { +:root.dark { --slskd-primary-background: #0d1116; --slskd-secondary-background: #161b21; --slskd-overlay-background: #161b22; @@ -24,6 +25,9 @@ --smui-site-link-color: #58a6ff; --smui-site-link-hover-underline: underline; + --slskd-browse-folderlist-header-color: var(--slskd-color); + --slskd-browse-folderlist-header-selected-color: var(--smui-site-link-color); + /* element/button */ --smui-button-background-color: var(--slskd-tertiary-background); --smui-button-text-color: var(--smui-site-body-text-color); @@ -66,6 +70,15 @@ --smui-table-footer-background: var(--slskd-secondary-background); --smui-table-footer-color: var(--smui-site-body-text-color); --smui-table-selectable-background-color: var(--slskd-subtle-background); + --smui-table-row-disabled-color: var(--slskd-color-subtle); + --smui-table-row-negative-color: var(--smui-site-body-text-color); + --smui-table-row-negative-background-color: rgba(248,81,73,0.15); + --smui-table-row-negative-border-color:rgba(248,81,73,0.4); + --smui-table-row-negative-background-hover-color:#da3633; + --smui-table-row-warning-color: var(--smui-site-body-text-color); + --smui-table-row-warning-background-color:rgba(187,128,9,0.15); + --smui-table-row-warning-border-color: rgba(187,128,9,0.4); + --smui-table-row-warning-background-hover-color: #9e6a03; /* modules/modal */ --smui-modal-background: var(--slskd-overlay-background); @@ -83,7 +96,6 @@ --smui-menu-hovered-item-color: var(--slskd-color); } -} body { background-color: var(--background-color); diff --git a/src/web/src/components/App.js b/src/web/src/components/App.js index 70d154af..c1f06114 100644 --- a/src/web/src/components/App.js +++ b/src/web/src/components/App.js @@ -51,6 +51,10 @@ class App extends Component { state = initialState; componentDidMount = () => { + window.matchMedia('(prefers-color-scheme: dark)') + .addEventListener('change', (e) => e.matches && this.setState({theme: 'dark'})); + window.matchMedia('(prefers-color-scheme: light)') + .addEventListener('change', (e) => e.matches && this.setState({theme:'light'})); this.init(); }; @@ -116,7 +120,15 @@ class App extends Component { }; render = () => { - const { login, applicationState = {}, applicationOptions = {}, error, initialized, retriesExhausted } = this.state; + const { + login, + applicationState = {}, + applicationOptions = {}, + error, + initialized, + retriesExhausted, + theme = window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light', + } = this.state; const { version = {}, relay = {}, @@ -204,6 +216,12 @@ class App extends Component { const isAgent = mode === 'Agent'; + if (theme === 'dark') { + document.documentElement.classList.add(theme); + } else { + document.documentElement.classList.remove('dark'); + } + return ( <> <Sidebar.Pushable as={Segment} className='app'> @@ -261,6 +279,9 @@ class App extends Component { </Link> </>} <Menu className='right' inverted> + <Menu.Item onClick={() => this.setState({'theme': theme === 'dark' ? 'light' : 'dark'})}> + <Icon name='theme'/>Theme + </Menu.Item> <ModeSpecificConnectButton mode={mode} server={server} controller={controller} /> {(pendingReconnect || pendingRestart || pendingShareRescan) && <Menu.Item position='right'> <Icon.Group className='menu-icon-group'> @@ -319,7 +340,7 @@ class App extends Component { {isAgent ? <> <Route path={`${urlBase}/system/:tab?`} render={ (props) => this.withTokenCheck( - <System {...props} state={applicationState} options={applicationOptions} /> + <System {...props} theme={theme} state={applicationState} options={applicationOptions} /> ) }/> <Redirect from='*' to={`${urlBase}/system`}/> @@ -353,7 +374,7 @@ class App extends Component { }/> <Route path={`${urlBase}/system/:tab?`} render={ (props) => this.withTokenCheck( - <System {...props} state={applicationState} options={applicationOptions} /> + <System {...props} theme={theme} state={applicationState} options={applicationOptions} /> ) }/> <Redirect from='*' to={`${urlBase}/searches`}/> diff --git a/src/web/src/components/Browse/Browse.css b/src/web/src/components/Browse/Browse.css index 51e7aa84..d7d4ef8e 100644 --- a/src/web/src/components/Browse/Browse.css +++ b/src/web/src/components/Browse/Browse.css @@ -76,4 +76,28 @@ .browse-meta { margin-top: 5px; +} + +.browse-folderlist-header { + color: var(--slskd-browse-folderlist-header-color) !important; + font-weight: 400 !important; + opacity: 1 !important; +} + +.browse-folderlist-header.selected { + color: var(--slskd-browse-folderlist-header-selected-color) !important; + font-weight: 700 !important; +} + +.browse-folderlist-header.locked, +.browse-folderlist-icon.locked { + opacity: 0.5 !important; +} + +.browse-folderlist-icon { + color: var(--slskd-browse-folderlist-header-color) !important; +} + +.browse-folderlist-icon.selected { + color: var(--slskd-browse-folderlist-header-selected-color) !important; }
\ No newline at end of file diff --git a/src/web/src/components/Browse/DirectoryTree.js b/src/web/src/components/Browse/DirectoryTree.js index 765c1bac..4cd10d1e 100644 --- a/src/web/src/components/Browse/DirectoryTree.js +++ b/src/web/src/components/Browse/DirectoryTree.js @@ -7,22 +7,19 @@ import { const subtree = (root, selectedDirectoryName, onSelect) => { return (root || []).map((d, index) => { const selected = d.name === selectedDirectoryName; - const dimIfLocked = { opacity: d.locked ? 0.5 : 1 }; + // const dimIfLocked = { opacity: d.locked ? 0.5 : 1 }; return ( <List key={index} className='browse-folderlist-list'> <List.Item> <List.Icon - className='browse-folderlist-icon' + className={'browse-folderlist-icon' + (selected ? ' selected' : '') + (d.locked ? ' locked' : '')} name={d.locked === true ? 'lock' : selected ? 'folder open' : 'folder'} - color={selected ? 'blue' : 'black'} - style={dimIfLocked} /> <List.Content> <List.Header - className='browse-folderlist-header' + className={'browse-folderlist-header' + (selected ? ' selected' : '') + (d.locked ? ' locked' : '')} onClick={(event) => onSelect(event, d)} - style={{ color: selected ? '#0E6EB8' : 'black', fontWeight: selected ? 700 : 400, ...dimIfLocked }} > {d.name.split('\\').pop().split('/').pop()} </List.Header> diff --git a/src/web/src/components/Shared/CodeEditor.js b/src/web/src/components/Shared/CodeEditor.js index a64d164d..d4211c78 100644 --- a/src/web/src/components/Shared/CodeEditor.js +++ b/src/web/src/components/Shared/CodeEditor.js @@ -1,20 +1,11 @@ -import React, {useEffect, useState} from 'react'; +import React from 'react'; import CodeMirror from '@uiw/react-codemirror'; import { StreamLanguage, syntaxHighlighting, defaultHighlightStyle } from '@codemirror/language'; import { yaml } from '@codemirror/legacy-modes/mode/yaml'; -const CodeEditor = ({ value, onChange = () => {}, ...rest}) => { +const CodeEditor = ({ value, theme, onChange = () => {}, ...rest}) => { console.log(defaultHighlightStyle); - const prefersDark = window.matchMedia('(prefers-color-scheme: dark)').matches; - const initialTheme = prefersDark ? 'dark' : 'light'; - const [theme, setTheme] = useState(initialTheme); - useEffect(() => { - window.matchMedia('(prefers-color-scheme: dark)') - .addEventListener('change', (e) => e.matches && setTheme('dark')); - window.matchMedia('(prefers-color-scheme: light)') - .addEventListener('change', (e) => e.matches && setTheme('light')); - }, []); return ( <CodeMirror diff --git a/src/web/src/components/System/Info/index.js b/src/web/src/components/System/Info/index.js index a703d4bc..2793ee0d 100644 --- a/src/web/src/components/System/Info/index.js +++ b/src/web/src/components/System/Info/index.js @@ -12,7 +12,7 @@ import { Switch, } from '../../Shared'; -const Info = ({ state }) => { +const Info = ({ state, theme }) => { const [contents, setContents] = useState(); useEffect(() => { @@ -91,6 +91,7 @@ const Info = ({ state }) => { value={contents} basicSetup={false} editable={false} + theme={theme} /> </Switch> </> diff --git a/src/web/src/components/System/Options/DebugModal.js b/src/web/src/components/System/Options/DebugModal.js index 21514c57..02551f1b 100644 --- a/src/web/src/components/System/Options/DebugModal.js +++ b/src/web/src/components/System/Options/DebugModal.js @@ -10,7 +10,7 @@ import { import { getCurrentDebugView } from '../../../lib/options'; import { CodeEditor, PlaceholderSegment, Switch } from '../../Shared'; -const DebugModal = ({ open, onClose }) => { +const DebugModal = ({ open, theme, onClose }) => { const [loading, setLoading] = useState(true); const [debugView, setDebugView] = useState(); @@ -52,6 +52,7 @@ const DebugModal = ({ open, onClose }) => { value={debugView} basicSetup={false} editable={false} + theme={theme} /> </Switch> </Modal.Content> diff --git a/src/web/src/components/System/Options/EditModal.js b/src/web/src/components/System/Options/EditModal.js index d435bfd8..c3f54114 100644 --- a/src/web/src/components/System/Options/EditModal.js +++ b/src/web/src/components/System/Options/EditModal.js @@ -10,7 +10,7 @@ import { Div, } from '../../Shared'; -const EditModal = ({ open, onClose }) => { +const EditModal = ({ open, theme, onClose }) => { const [{ loading, error }, setLoading] = useState({ loading: true, error: false }); const [{ location, yaml, isDirty }, setYaml] = useState({ location: undefined, yaml: undefined, isDirty: false }); const [yamlError, setYamlError] = useState(); @@ -86,6 +86,7 @@ const EditModal = ({ open, onClose }) => { style={{minHeight: 500}} value={yaml} onChange={(value) => update(value)} + theme={theme} /> </div> </Switch> diff --git a/src/web/src/components/System/Options/index.js b/src/web/src/components/System/Options/index.js index 53364447..cf6f49ab 100644 --- a/src/web/src/components/System/Options/index.js +++ b/src/web/src/components/System/Options/index.js @@ -12,7 +12,7 @@ import { Switch, } from '../../Shared'; -const Index = ({ options }) => { +const Index = ({ options, theme }) => { const [debugModal, setDebugModal] = useState(false); const [editModal, setEditModal] = useState(false); const [contents, setContents] = useState(); @@ -70,14 +70,17 @@ const Index = ({ options }) => { value={contents} basicSetup={false} editable={false} + theme={theme} /> </Switch> <DebugModal open={debugModal} + theme={theme} onClose={() => setDebugModal(false)} /> <EditModal open={editModal} + theme={theme} onClose={() => setEditModal(false)} /> </> diff --git a/src/web/src/components/System/Shares/ContentsModal.js b/src/web/src/components/System/Shares/ContentsModal.js index b9f0d86d..f0642ef8 100644 --- a/src/web/src/components/System/Shares/ContentsModal.js +++ b/src/web/src/components/System/Shares/ContentsModal.js @@ -13,7 +13,7 @@ import { CodeEditor, LoaderSegment, Switch, } from '../../Shared'; -const ContentsModal = ({ share, onClose }) => { +const ContentsModal = ({ share, onClose, theme }) => { const [loading, setLoading] = useState(true); const [contents, setContents] = useState(); @@ -65,6 +65,7 @@ const ContentsModal = ({ share, onClose }) => { value={contents || ''} basicSetup={false} editable={false} + theme={theme} /> </Switch> </Modal.Content> diff --git a/src/web/src/components/System/System.js b/src/web/src/components/System/System.js index 52fc1188..df77ded2 100644 --- a/src/web/src/components/System/System.js +++ b/src/web/src/components/System/System.js @@ -12,7 +12,7 @@ import Shares from './Shares'; import { Switch } from '../Shared'; import Data from './Data'; -const System = ({ state = {}, options = {} }) => { +const System = ({ state = {}, theme, options = {} }) => { const { params: { tab }, ...route } = useRouteMatch(); const history = useHistory(); @@ -28,7 +28,7 @@ const System = ({ state = {}, options = {} }) => { </Switch> Info </Menu.Item>), - render: () => <Tab.Pane><Info state={state}/></Tab.Pane>, + render: () => <Tab.Pane><Info state={state} theme={theme}/></Tab.Pane>, }, { route: 'options', @@ -37,7 +37,7 @@ const System = ({ state = {}, options = {} }) => { icon: 'options', content: 'Options', }, - render: () => <Tab.Pane className='full-height'><Options options={options} /></Tab.Pane>, + render: () => <Tab.Pane className='full-height'><Options options={options} theme={theme}/></Tab.Pane>, }, { route: 'shares', @@ -49,7 +49,7 @@ const System = ({ state = {}, options = {} }) => { </Switch> Shares </Menu.Item>), - render: () => <Tab.Pane><Shares state={state.shares}/></Tab.Pane>, + render: () => <Tab.Pane><Shares state={state.shares} theme={theme}/></Tab.Pane>, }, { route: 'data', @@ -58,7 +58,7 @@ const System = ({ state = {}, options = {} }) => { icon: 'database', content: 'Data', }, - render: () => <Tab.Pane className='full-height'><Data/></Tab.Pane>, + render: () => <Tab.Pane className='full-height'><Data theme={theme}/></Tab.Pane>, }, { route: 'logs', diff --git a/src/web/src/semantic-ui/site/collections/table.overrides b/src/web/src/semantic-ui/site/collections/table.overrides index d3596bcb..53e29457 100644 --- a/src/web/src/semantic-ui/site/collections/table.overrides +++ b/src/web/src/semantic-ui/site/collections/table.overrides @@ -4,4 +4,26 @@ .ui.table tfoot th button { color: var(--smui-site-body-text-color); +} + +/*-------------- + Negative +---------------*/ + +.ui.table tr.negative, +.ui.table td.negative { + background: var(--smui-table-row-negative-background-color, @negativeBackgroundColor) !important; + color: var(--smui-table-row-negative-color, @negativeColor) !important; +} + + +/*-------------- + Warning +---------------*/ + +.ui.table tr.warning, +.ui.table td.warning { + background: var(--smui-table-row-warning-background-color, @warningBackgroundColor) !important; + color: var(--smui-table-row-warning-color, @warningColor) !important; + }
\ No newline at end of file diff --git a/src/web/src/semantic-ui/site/collections/table.variables b/src/web/src/semantic-ui/site/collections/table.variables index 8955f613..6a6de3fa 100644 --- a/src/web/src/semantic-ui/site/collections/table.variables +++ b/src/web/src/semantic-ui/site/collections/table.variables @@ -13,4 +13,17 @@ @footerColor: var(--smui-table-footer-color,@textColor); @selectableTextColor: var(--smui-table-color, @textColor); -@selectableBackgroundColor: var(--smui-table-selectable-background-color, @textColor);
\ No newline at end of file +@selectableBackgroundColor: var(--smui-table-selectable-background-color, @textColor); + +/* Disabled */ +@disabledTextColor: var(--smui-table-row-disabled-color, rgba(0, 0, 0, 0.2)); + +/* Negative */ +@negativeBoxShadow: @stateMarkerWidth 0px 0px var(--smui-table-row-negative-border-color, @negativeBorderColor) inset; +@negativeBackgroundHover: var(--smui-table-row-negative-background-hover-color, darken(@negativeBackgroundColor, 3)); +@negativeColorHover: var(--smui-table-row-negative-hover-color, darken(@negativeTextColor, 3)); + +/* Warning */ +@warningBoxShadow: @stateMarkerWidth 0px 0px var(--smui-table-row-warning-border-color, @warningBorderColor) inset; +@warningBackgroundHover: var(--smui-table-row-warning-background-hover-color, darken(@warningBackgroundColor, 3)); +@warningColorHover: var(--smui-table-row-warning-hover-color, darken(@warningColor, 3));
\ No newline at end of file |
