293 tiny gui improvement (#296)
* clicking on the speed dial will open download dialog * refactor: prevent multiple slashes
This commit is contained in:
@@ -119,21 +119,28 @@ export const appTitleState = atomWithStorage(
|
|||||||
)
|
)
|
||||||
|
|
||||||
export const serverAddressAndPortState = atom((get) => {
|
export const serverAddressAndPortState = atom((get) => {
|
||||||
|
let retval = ''
|
||||||
|
|
||||||
if (get(servedFromReverseProxySubDirState)) {
|
if (get(servedFromReverseProxySubDirState)) {
|
||||||
return `${get(serverAddressState)}/${get(servedFromReverseProxySubDirState)}/`
|
retval = `${get(serverAddressState)}/${get(servedFromReverseProxySubDirState)}/`
|
||||||
.replaceAll('"', '') // TODO: atomWithStorage put extra double quotes on strings
|
.replaceAll('"', '') // TODO: atomWithStorage put extra double quotes on strings
|
||||||
}
|
}
|
||||||
if (get(servedFromReverseProxyState)) {
|
if (get(servedFromReverseProxyState)) {
|
||||||
return `${get(serverAddressState)}`
|
retval = `${get(serverAddressState)}`
|
||||||
.replaceAll('"', '')
|
.replaceAll('"', '')
|
||||||
}
|
}
|
||||||
return `${get(serverAddressState)}:${get(serverPortState)}`
|
retval = `${get(serverAddressState)}:${get(serverPortState)}`
|
||||||
.replaceAll('"', '')
|
.replaceAll('"', '')
|
||||||
|
|
||||||
|
return retval.endsWith('/') ? retval.slice(0, -1) : retval
|
||||||
})
|
})
|
||||||
|
|
||||||
export const serverURL = atom((get) =>
|
export const serverURL = atom((get) => {
|
||||||
`${window.location.protocol}//${get(serverAddressAndPortState)}`
|
const _serverURL = `${window.location.protocol}//${get(serverAddressAndPortState)}`
|
||||||
)
|
return _serverURL.endsWith('/')
|
||||||
|
? _serverURL.slice(0, -1)
|
||||||
|
: _serverURL
|
||||||
|
})
|
||||||
|
|
||||||
export const rpcWebSocketEndpoint = atom((get) => {
|
export const rpcWebSocketEndpoint = atom((get) => {
|
||||||
const proto = window.location.protocol === 'https:' ? 'wss:' : 'ws:'
|
const proto = window.location.protocol === 'https:' ? 'wss:' : 'ws:'
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ const HomeSpeedDial: React.FC<Props> = ({ onDownloadOpen, onEditorOpen }) => {
|
|||||||
ariaLabel="Home speed dial"
|
ariaLabel="Home speed dial"
|
||||||
sx={{ position: 'absolute', bottom: 64, right: 24 }}
|
sx={{ position: 'absolute', bottom: 64, right: 24 }}
|
||||||
icon={<SpeedDialIcon />}
|
icon={<SpeedDialIcon />}
|
||||||
|
onClick={onDownloadOpen}
|
||||||
>
|
>
|
||||||
<SpeedDialAction
|
<SpeedDialAction
|
||||||
icon={listView ? <ViewAgendaIcon /> : <FormatListBulleted />}
|
icon={listView ? <ViewAgendaIcon /> : <FormatListBulleted />}
|
||||||
|
|||||||
Reference in New Issue
Block a user