feat(Settings): add button to copy remote url to clipboard

This commit is contained in:
Tim 2023-12-17 23:52:04 +01:00
parent 5df432c220
commit 7ede08f11f
2 changed files with 14 additions and 1 deletions

View file

@ -121,6 +121,16 @@ const Settings = () => {
}
});
}, []);
const onCopyRemoteUrlClick = React.useCallback(() => {
if (streamingServer.remoteUrl) {
navigator.clipboard.writeText(streamingServer.remoteUrl);
toast.show({
type: 'success',
title: 'Successfully copied remote url to clipboard',
timeout: 2500,
});
}
}, [streamingServer.remoteUrl]);
const sectionsContainerRef = React.useRef(null);
const generalSectionRef = React.useRef(null);
const playerSectionRef = React.useRef(null);
@ -552,6 +562,9 @@ const Settings = () => {
</div>
<div className={classnames(styles['option-input-container'], styles['configure-input-container'])}>
<div className={styles['label']} title={streamingServerRemoteUrlInput.value}>{streamingServerRemoteUrlInput.value}</div>
<Button className={styles['configure-button-container']} title={'Copy remote url'} onClick={onCopyRemoteUrlClick}>
<Icon className={styles['icon']} name={'link'} />
</Button>
</div>
</div>
:

View file

@ -59,7 +59,7 @@ const useStreamingServerSettingsInputs = (streamingServer) => {
value: streamingServer.remoteUrl,
}), [streamingServer.remoteUrl]);
const remoteEndpointSelect= React.useMemo(() => {
const remoteEndpointSelect = React.useMemo(() => {
if (streamingServer.settings?.type !== 'Ready' || streamingServer.networkInfo?.type !== 'Ready') {
return null;
}