From 6b97edbbadc632201a8a90f817514dac2534176b Mon Sep 17 00:00:00 2001 From: Matthew Tancik Date: Mon, 12 Sep 2022 10:15:46 -0700 Subject: [PATCH] Add additional help messages to modal (#400) --- nerfactory/viewer/app/src/index.scss | 9 +- .../src/modules/LandingModal/LandingModal.jsx | 137 +++++++++++++++++- .../SidePanel/StatusPanel/StatusPanel.jsx | 22 +-- 3 files changed, 145 insertions(+), 23 deletions(-) diff --git a/nerfactory/viewer/app/src/index.scss b/nerfactory/viewer/app/src/index.scss index f6ae3c53f..b218899e5 100644 --- a/nerfactory/viewer/app/src/index.scss +++ b/nerfactory/viewer/app/src/index.scss @@ -104,8 +104,8 @@ $sidebar-width: 100% !default; } .StatusPanel .StatusPanel-play-button { - width: 90%; - margin: 10px; + width: 100%; + padding: 10px; } .StatusPanel .StatusPanel-button-group { @@ -139,16 +139,13 @@ $sidebar-width: 100% !default; // ------------------------------------ // Landing Modal styling -// .LandingModal { -// display: block; -// } .LandingModal-box { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); - width: 400px; // 400 + width: 600px; // 400 background-color: $base-color2; border: 2px solid #000; // box-shadow: 24px 24px; diff --git a/nerfactory/viewer/app/src/modules/LandingModal/LandingModal.jsx b/nerfactory/viewer/app/src/modules/LandingModal/LandingModal.jsx index 3726daa55..56f1adbde 100644 --- a/nerfactory/viewer/app/src/modules/LandingModal/LandingModal.jsx +++ b/nerfactory/viewer/app/src/modules/LandingModal/LandingModal.jsx @@ -1,6 +1,17 @@ +/* eslint-disable react/jsx-props-no-spreading */ import * as React from 'react'; -import { Box, Button, Modal, Typography } from '@mui/material'; +import { + Box, + Button, + Modal, + Typography, + Tabs, + Tab, + Chip, + Link, +} from '@mui/material'; +import ContentCopyRoundedIcon from '@mui/icons-material/ContentCopyRounded'; import WebSocketUrlField from '../WebSocketUrlField'; @@ -8,14 +19,66 @@ interface LandingModalProps { initial_state: object; } +interface TabPanelProps { + children: React.ReactNode; + index: number; + value: number; +} + +function TabPanel(props: TabPanelProps) { + const { children, value, index, ...other } = props; + + return ( + + ); +} + +function a11yProps(index: number) { + return { + id: `simple-tab-${index}`, + 'aria-controls': `simple-tabpanel-${index}`, + }; +} + export default function LandingModel(props: LandingModalProps) { const [open, setOpen] = React.useState(props.initial_state); const handleOpen = () => setOpen(true); const handleClose = () => setOpen(false); - const text_1 = `At the top right is the Status Panel where you can connect to a WebSocket and see the train/eval status of your NeRF model. The WebSocket URL takes the form :.`; - const text_2 = - 'If the WebSocket is not connecting, make sure your port is being forwarded properly!'; + const text_intro = `At the top right is the Status Panel where you can connect to a WebSocket and see the train/eval status of your NeRF model. The WebSocket URL takes the form :.`; + + const command = `ssh -L localhost:7007:localhost:7007 USER@REMOTE.SERVER.IP`; + + const platform = window.navigator.platform.toLowerCase(); + let initial_tab = 0; + if (platform.includes('mac')) { + initial_tab = 0; + } else if (platform.includes('linux')) { + initial_tab = 1; + } else if (platform.includes('win')) { + initial_tab = 2; + } + + const [tabValue, setTabValue] = React.useState(initial_tab); + + const handleTabChange = (event: React.SyntheticEvent, newValue: number) => { + setTabValue(newValue); + }; + + const handleCopy = () => { + navigator.clipboard.writeText(command); + }; return (
@@ -47,13 +110,73 @@ export default function LandingModel(props: LandingModalProps) { sx={{ mt: 2 }} >
- Getting Started -

{text_1}

+

Getting Started

+

{text_intro}

You can enter your WebSocket URL in the Status Panel or here:

-

{text_2}

+

Remote Server

+

+ If you are using a remote server, make sure to forward the port. + This can be accomplished by running the following command on + this machine. +

+ + + + + + + + + +

+ SSH must be set up on the remote machine. Then run the + following on this machine: +

+ } + /> +
+ +

+ SSH must be set up on the remote machine. Then run the + following on this machine: +

+ } + /> +
+ +

+ SSH must be set up on the remote machine. Then run the + following on this machine in PowerShell: +

+ } + /> +

+ If OpenSSH is not installed, refer to this{' '} + + guide + + . +

+
diff --git a/nerfactory/viewer/app/src/modules/SidePanel/StatusPanel/StatusPanel.jsx b/nerfactory/viewer/app/src/modules/SidePanel/StatusPanel/StatusPanel.jsx index 77f9de17c..f721bf5be 100644 --- a/nerfactory/viewer/app/src/modules/SidePanel/StatusPanel/StatusPanel.jsx +++ b/nerfactory/viewer/app/src/modules/SidePanel/StatusPanel/StatusPanel.jsx @@ -73,16 +73,18 @@ export default function StatusPanel(props: StatusPanelProps) { return (
- +
+ +