From d52c11c04c4b085e756e0ab9fae45ef6d4c03b43 Mon Sep 17 00:00:00 2001 From: Ethan Weber Date: Thu, 14 Jul 2022 11:33:56 -0700 Subject: [PATCH] using prettier for more files. also, client app is built on merge to master (#141) --- .github/workflows/prettier.yaml | 4 +-- .github/workflows/viewer_client_app.yml | 2 +- pyrad/viewer/app/package.json | 2 +- pyrad/viewer/app/public/index.html | 17 ++++----- pyrad/viewer/app/src/Viewer.jsx | 28 +++++++-------- pyrad/viewer/app/src/index.css | 47 +++++++++++++------------ 6 files changed, 52 insertions(+), 48 deletions(-) diff --git a/.github/workflows/prettier.yaml b/.github/workflows/prettier.yaml index 8ce119329..e54f97fd8 100644 --- a/.github/workflows/prettier.yaml +++ b/.github/workflows/prettier.yaml @@ -1,4 +1,4 @@ -name: Prettier +name: Run prettier for viewer client app. on: pull_request: @@ -18,4 +18,4 @@ jobs: uses: creyD/prettier_action@v4.2 with: # This part is also where you can pass other options, for example: - prettier_options: --write ./pyrad/**/*.js + prettier_options: --write ./pyrad/viewer/app/* diff --git a/.github/workflows/viewer_client_app.yml b/.github/workflows/viewer_client_app.yml index 5db18084c..d72bd3a3d 100644 --- a/.github/workflows/viewer_client_app.yml +++ b/.github/workflows/viewer_client_app.yml @@ -41,7 +41,7 @@ jobs: name: Deploy needs: build runs-on: ubuntu-latest - # if: github.ref == 'refs/heads/master' + if: github.ref == 'refs/heads/master' steps: - name: Download artifact diff --git a/pyrad/viewer/app/package.json b/pyrad/viewer/app/package.json index 9c9d878c4..7595759df 100644 --- a/pyrad/viewer/app/package.json +++ b/pyrad/viewer/app/package.json @@ -52,4 +52,4 @@ "typescript": "^4.7.3", "wait-on": "^6.0.1" } -} \ No newline at end of file +} diff --git a/pyrad/viewer/app/public/index.html b/pyrad/viewer/app/public/index.html index 6d833f9ff..096639aad 100644 --- a/pyrad/viewer/app/public/index.html +++ b/pyrad/viewer/app/public/index.html @@ -1,12 +1,14 @@ - - + - + PyRad Viewer - + - +
- - - \ No newline at end of file + + diff --git a/pyrad/viewer/app/src/Viewer.jsx b/pyrad/viewer/app/src/Viewer.jsx index 0ff3807e6..ba0f30415 100644 --- a/pyrad/viewer/app/src/Viewer.jsx +++ b/pyrad/viewer/app/src/Viewer.jsx @@ -115,7 +115,6 @@ export class Viewer extends Component { } set_object(path, object) { - if (!(object instanceof THREE.Camera)) { this.state.scene_tree.find(path.concat([""])).set_object(object); } @@ -164,17 +163,18 @@ export class Viewer extends Component { set_output_options(object) { if (this.created_controls === false) { - let output_options_control = new function () { - this.output_options = 'default'; - } + let output_options_control = new (function () { + this.output_options = "default"; + })(); // add controls - this.state.gui.add(output_options_control, 'output_options', object).listen().onChange( - (value) => { + this.state.gui + .add(output_options_control, "output_options", object) + .listen() + .onChange((value) => { this.send_output_type_over_websocket(value); - } - ) + }); } - this.created_controls = true + this.created_controls = true; } handle_command(cmd) { @@ -195,7 +195,7 @@ export class Viewer extends Component { } else if (cmd.type === "set_property") { let path = split_path(cmd.path); this.set_property(path, cmd.property, cmd.value); - } else if(cmd.type == 'set_output_options') { + } else if (cmd.type == "set_output_options") { this.set_output_options(cmd.output_options); } // web rtc commands @@ -366,8 +366,9 @@ export class Viewer extends Component { this.state.controls_main.update(); let path = ["Cameras", "Main Camera"]; - this.state.scene_tree.find(path.concat([""])).set_object(this.state.camera_main); - + this.state.scene_tree + .find(path.concat([""])) + .set_object(this.state.camera_main); // Axes display let axes = new THREE.AxesHelper(5); @@ -396,8 +397,7 @@ export class Viewer extends Component { return (
- +
diff --git a/pyrad/viewer/app/src/index.css b/pyrad/viewer/app/src/index.css index 8c40d46b5..80277e1f3 100644 --- a/pyrad/viewer/app/src/index.css +++ b/pyrad/viewer/app/src/index.css @@ -1,40 +1,43 @@ body { - margin: 0; - font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif; - -webkit-font-smoothing: antialiased; - -moz-osx-font-smoothing: grayscale; + margin: 0; + font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", + "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", + sans-serif; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; } code { - font-family: source-code-pro, Menlo, Monaco, Consolas, "Courier New", monospace; + font-family: source-code-pro, Menlo, Monaco, Consolas, "Courier New", + monospace; } .BackgroundDiv, .WebRTCVideo { - position: absolute; - top: 0px; - right: 0px; - bottom: 0px; - left: 0px; + position: absolute; + top: 0px; + right: 0px; + bottom: 0px; + left: 0px; } #BackgroundDiv-video, #WebRTCVideo-video { - width: 100%; - height: 100%; - object-fit: fill; + width: 100%; + height: 100%; + object-fit: fill; } #canvas-container-main { - position: absolute; - top: 0px; - right: 0px; - bottom: 0px; - left: 0px; + position: absolute; + top: 0px; + right: 0px; + bottom: 0px; + left: 0px; } #canvas-container-main canvas { - position: relative; - height: 100%; - width: 100%; -} \ No newline at end of file + position: relative; + height: 100%; + width: 100%; +}