mirror of
https://github.com/nerfstudio-project/nerfstudio.git
synced 2026-11-21 07:05:44 +08:00
Improve the web viewer UI [WIP] (#333)
* functional but style is bad * banner. sidebar. tabs for controls/scene/camera_path/logs. websocket text field * moved window. toggle scene button. next step: lint/clean code * websocket and webrtc reconnection on url change * reconnection on websocket change seems robust * cleaned up errors and organized code * fixing lint
This commit is contained in:
1 parent
32517f4587
commit
4c77c4e7c0
28 files changed
+1136
-294
No files matched your search
@@ -0,0 +1,77 @@
|
||||
import * as React from 'react';
|
||||
|
||||
import Button from '@mui/material/Button';
|
||||
import { useSelector } from 'react-redux';
|
||||
import WebSocketUrlField from '../../WebSocketUrlField';
|
||||
|
||||
|
||||
interface StatusPanelProps {
|
||||
sceneTree: object
|
||||
}
|
||||
|
||||
export default function StatusPanel(props: StatusPanelProps) {
|
||||
|
||||
const sceneTree = props.sceneTree;
|
||||
|
||||
const isWebsocketConnected = useSelector(
|
||||
(state) => state.websocketState.isConnected,
|
||||
);
|
||||
const isWebrtcConnected = useSelector(
|
||||
(state) => state.webrtcState.isConnected,
|
||||
);
|
||||
const eval_fps = useSelector((state) => state.renderingState.eval_fps);
|
||||
const train_eta = useSelector((state) => state.renderingState.train_eta);
|
||||
const vis_train_ratio = useSelector(
|
||||
(state) => state.renderingState.vis_train_ratio,
|
||||
);
|
||||
|
||||
// simple toggle button
|
||||
const [value, setValue] = React.useState(1);
|
||||
const handleChange = () => {
|
||||
setValue(!value);
|
||||
};
|
||||
const scene_button = value ? "Hide Scene" : "Show Scene";
|
||||
sceneTree.object.visible = value;
|
||||
|
||||
return (
|
||||
<div className="StatusPanel">
|
||||
<div className="StatusPanel-title">Status Panel</div>
|
||||
<Button
|
||||
className="StatusPanel-button"
|
||||
variant="contained"
|
||||
disabled={!isWebsocketConnected}
|
||||
style={{ textTransform: 'none' }}
|
||||
>
|
||||
Websocket Connected
|
||||
</Button>
|
||||
<Button
|
||||
className="StatusPanel-button"
|
||||
variant="contained"
|
||||
disabled={!isWebrtcConnected}
|
||||
style={{ textTransform: 'none' }}
|
||||
>
|
||||
WebRTC Connected
|
||||
</Button>
|
||||
<Button
|
||||
className="StatusPanel-button"
|
||||
variant="outlined"
|
||||
onClick={handleChange}
|
||||
style={{ textTransform: 'none' }}
|
||||
>
|
||||
{scene_button}
|
||||
</Button>
|
||||
<WebSocketUrlField />
|
||||
<div className="StatusPanel-metrics">
|
||||
<div>
|
||||
<b>Eval FPS:</b> {eval_fps}
|
||||
</div>
|
||||
<div>
|
||||
<b>Train ETA:</b> {train_eta}
|
||||
</div>
|
||||
<div>
|
||||
<b>Time Allocation:</b> {vis_train_ratio}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user