feat: add toggle to display remote control
This commit is contained in:
parent
23245dd549
commit
e09d42ecf6
@ -4,6 +4,7 @@ import {
|
|||||||
createResource,
|
createResource,
|
||||||
createSignal,
|
createSignal,
|
||||||
onCleanup,
|
onCleanup,
|
||||||
|
Show,
|
||||||
} from "solid-js";
|
} from "solid-js";
|
||||||
import WebRTCService from "../../services/webrtc-service";
|
import WebRTCService from "../../services/webrtc-service";
|
||||||
import Integration from "../../data/integration";
|
import Integration from "../../data/integration";
|
||||||
@ -37,8 +38,15 @@ function IntegrationView(props) {
|
|||||||
initialValue: [],
|
initialValue: [],
|
||||||
});
|
});
|
||||||
const [selectedRemote, setSelectedRemote] = createSignal();
|
const [selectedRemote, setSelectedRemote] = createSignal();
|
||||||
|
const [remoteControlVisible, setRemoteControlVisible] = createSignal(false);
|
||||||
|
|
||||||
createEffect(() => handleRemoteSelected(availableRemotes().shift()?.getId()));
|
createEffect(() =>
|
||||||
|
handleRemoteSelected(
|
||||||
|
availableRemotes()
|
||||||
|
.find(() => true)
|
||||||
|
?.getId()
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
createEffect(() => {
|
createEffect(() => {
|
||||||
let url = UrlUtils.getUrl();
|
let url = UrlUtils.getUrl();
|
||||||
@ -90,6 +98,10 @@ function IntegrationView(props) {
|
|||||||
RemoteService.sendCommand(command);
|
RemoteService.sendCommand(command);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function toggleRemoteControl() {
|
||||||
|
setRemoteControlVisible(!remoteControlVisible());
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
class={
|
class={
|
||||||
@ -125,13 +137,24 @@ function IntegrationView(props) {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex-fill d-flex flex-row overflow-hidden">
|
<div class="flex-fill d-flex flex-row overflow-hidden">
|
||||||
<div class="flex-fill rounded overflow-hidden">
|
<div
|
||||||
|
class="flex-fill rounded overflow-hidden"
|
||||||
|
style="position:relative;"
|
||||||
|
>
|
||||||
<video
|
<video
|
||||||
ref={videoElement}
|
ref={videoElement}
|
||||||
class="w-100 h-100"
|
class="w-100 h-100"
|
||||||
style="background-color: #000"
|
style="background-color: #000"
|
||||||
></video>
|
></video>
|
||||||
|
<button
|
||||||
|
class="btn btn-dark mt-2 me-2"
|
||||||
|
style="transform: rotate(180deg);position:absolute;top:0;right:0;z-index:1000;"
|
||||||
|
onClick={toggleRemoteControl}
|
||||||
|
>
|
||||||
|
<i class="bi bi-building"></i>
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
<Show when={remoteControlVisible()}>
|
||||||
<div class="d-flex flex-column ps-3">
|
<div class="d-flex flex-column ps-3">
|
||||||
<select
|
<select
|
||||||
class="form-select mb-3"
|
class="form-select mb-3"
|
||||||
@ -148,6 +171,7 @@ function IntegrationView(props) {
|
|||||||
remote={selectedRemote()}
|
remote={selectedRemote()}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
</Show>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user