mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-31 03:49:11 +00:00
refactor: allow redirecting to view
This commit is contained in:
committed by
Carlos Valente
parent
b8d7324be0
commit
21877e4bff
@@ -12,6 +12,7 @@ import {
|
|||||||
} from '@chakra-ui/react';
|
} from '@chakra-ui/react';
|
||||||
import { IoArrowForward } from '@react-icons/all-files/io5/IoArrowForward';
|
import { IoArrowForward } from '@react-icons/all-files/io5/IoArrowForward';
|
||||||
|
|
||||||
|
import { navigatorConstants } from '../../../viewerConfig';
|
||||||
import { setClientRemote } from '../../hooks/useSocket';
|
import { setClientRemote } from '../../hooks/useSocket';
|
||||||
import useUrlPresets from '../../hooks-query/useUrlPresets';
|
import useUrlPresets from '../../hooks-query/useUrlPresets';
|
||||||
import Info from '../info/Info';
|
import Info from '../info/Info';
|
||||||
@@ -39,6 +40,7 @@ export function RedirectClientModal(props: RedirectClientModalProps) {
|
|||||||
if (newPath === '/' || newPath === currentPath) {
|
if (newPath === '/' || newPath === currentPath) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
console.log('----> redirect to', newPath);
|
||||||
setRedirect({ target: id, redirect: newPath });
|
setRedirect({ target: id, redirect: newPath });
|
||||||
onClose();
|
onClose();
|
||||||
};
|
};
|
||||||
@@ -62,19 +64,26 @@ export function RedirectClientModal(props: RedirectClientModalProps) {
|
|||||||
</a>
|
</a>
|
||||||
</Info>
|
</Info>
|
||||||
<div>
|
<div>
|
||||||
<span className={style.label}>Select URL Preset</span>
|
<span className={style.label}>Select View or URL Preset</span>
|
||||||
<div className={style.textEntry}>
|
<div className={style.textEntry}>
|
||||||
<Select
|
<Select
|
||||||
size='md'
|
size='md'
|
||||||
variant='ontime'
|
variant='ontime'
|
||||||
isDisabled={enabledPresets.length === 0}
|
isDisabled={enabledPresets.length === 0}
|
||||||
onChange={(event) => setSelected(`/${event.target.value}`)}
|
onChange={(event) => setSelected(event.target.value)}
|
||||||
>
|
>
|
||||||
<option value=''>Select a preset</option>
|
<option value='/'>Select view or preset</option>
|
||||||
|
{navigatorConstants.map((view) => {
|
||||||
|
return (
|
||||||
|
<option key={view.url} value={`/${view.url}`}>
|
||||||
|
{view.label}
|
||||||
|
</option>
|
||||||
|
);
|
||||||
|
})}
|
||||||
{enabledPresets.map((preset) => {
|
{enabledPresets.map((preset) => {
|
||||||
return (
|
return (
|
||||||
<option key={preset.pathAndParams} value={preset.pathAndParams}>
|
<option key={preset.pathAndParams} value={preset.pathAndParams}>
|
||||||
{preset.alias}
|
{`Preset: ${preset.alias}`}
|
||||||
</option>
|
</option>
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
|
|||||||
Reference in New Issue
Block a user