From 33da9f103dcc2ff939563ec6a10e069ee400cb64 Mon Sep 17 00:00:00 2001 From: filipeotero <89042471+filipeotero@users.noreply.github.com> Date: Tue, 11 Oct 2022 17:24:31 -0300 Subject: [PATCH 1/5] Send XML content and display flex for the bar --- src/Dynamic.css | 4 +++- src/Dynamic.js | 1 + src/Static.js | 10 ++++++++-- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/Dynamic.css b/src/Dynamic.css index aa67f60..16b195f 100644 --- a/src/Dynamic.css +++ b/src/Dynamic.css @@ -8,9 +8,11 @@ .progress-bar-indicator { height: 100%; + max-width: 100%; + margin: 0; border-radius: 25px; -webkit-mask:linear-gradient(#fff 0 0); - mask:linear-gradient(#fff 0 0); + mask:linear-gradient(#fff 0 0) !important; } .progress-bar-indicator::before { content:""; diff --git a/src/Dynamic.js b/src/Dynamic.js index 731ab80..15a94cd 100644 --- a/src/Dynamic.js +++ b/src/Dynamic.js @@ -46,6 +46,7 @@ class Dynamic extends React.Component { loadDescription: loadDescription, loadingTime: loadingTime }) + document.getElementsByClassName('progress-bar-indicator')[0].style.display = 'flex' } } diff --git a/src/Static.js b/src/Static.js index 34b5475..d81ac34 100644 --- a/src/Static.js +++ b/src/Static.js @@ -85,9 +85,15 @@ class Static extends React.Component { readFile(event) { let file = event.target.files[0]; if (file) { - if (chrome.webview !== undefined) { - chrome.webview.hostObjects.scriptObject.ImportSettings(file); + var fr = new FileReader(); + fr.onload = function () { + console.log(fr.result) + if (chrome.webview !== undefined) { + chrome.webview.hostObjects.scriptObject.ImportSettings(fr.result); + } } + + fr.readAsText(file); } } From 1ddb129780b80419d7b14fe1c2eb7e9bfb153154 Mon Sep 17 00:00:00 2001 From: filipeotero <89042471+filipeotero@users.noreply.github.com> Date: Thu, 13 Oct 2022 10:41:59 -0300 Subject: [PATCH 2/5] remove console.log --- src/Static.js | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Static.js b/src/Static.js index d81ac34..013b261 100644 --- a/src/Static.js +++ b/src/Static.js @@ -87,7 +87,6 @@ class Static extends React.Component { if (file) { var fr = new FileReader(); fr.onload = function () { - console.log(fr.result) if (chrome.webview !== undefined) { chrome.webview.hostObjects.scriptObject.ImportSettings(fr.result); } From d362baa4785d469c802f8247aa0da05f581bf1f8 Mon Sep 17 00:00:00 2001 From: filipeotero <89042471+filipeotero@users.noreply.github.com> Date: Thu, 13 Oct 2022 15:45:54 -0300 Subject: [PATCH 3/5] adding mainJs as a keyword to be replaced at Dynamo --- public/index.html | 1 + 1 file changed, 1 insertion(+) diff --git a/public/index.html b/public/index.html index c3cb8de..a15cf5b 100644 --- a/public/index.html +++ b/public/index.html @@ -9,6 +9,7 @@ +
From 54f3c29cae7b2c9e6ef18fbf05a36176b212af1c Mon Sep 17 00:00:00 2001 From: filipeotero <89042471+filipeotero@users.noreply.github.com> Date: Thu, 13 Oct 2022 19:12:15 -0300 Subject: [PATCH 4/5] removing duplicated calling methods --- src/Dynamic.js | 20 -------------------- src/Static.js | 6 ------ 2 files changed, 26 deletions(-) diff --git a/src/Dynamic.js b/src/Dynamic.js index 7944aea..34eb895 100644 --- a/src/Dynamic.js +++ b/src/Dynamic.js @@ -16,26 +16,6 @@ class Dynamic extends React.Component { window.setBarProperties = this.setBarProperties.bind(this); } - render() { - return ( -
-
Dynamo core {this.state.dynamoVersion}
-
-
-
-
-
-
{this.state.loadDescription}
-
-
-
{this.state.loadingTime}
-
- ); - } - render() { return (
diff --git a/src/Static.js b/src/Static.js index 57aecdb..66524f0 100644 --- a/src/Static.js +++ b/src/Static.js @@ -126,12 +126,6 @@ class Static extends React.Component { } } - - //Opens a page to signin - signIn() { - window.open('https://accounts.autodesk.com/', '_blank'); - } - //This method calls another method from Dynamo to actually launch it launchDynamo() { if (chrome.webview !== undefined) { From 96dc5a329ffe5e4d195c37e4f37618328684a2fe Mon Sep 17 00:00:00 2001 From: filipeotero <89042471+filipeotero@users.noreply.github.com> Date: Fri, 14 Oct 2022 12:27:25 -0300 Subject: [PATCH 5/5] adjusting code to eslint --- src/App.css | 2 +- src/App.js | 3 +- src/Dynamic.css | 51 +++++----- src/Dynamic.js | 52 +++++----- src/Static.js | 258 ++++++++++++++++++++++-------------------------- 5 files changed, 175 insertions(+), 191 deletions(-) diff --git a/src/App.css b/src/App.css index c71fbfd..ca0ac23 100644 --- a/src/App.css +++ b/src/App.css @@ -19,4 +19,4 @@ .screenBackground { height: 377px; width: 320px; -} +} \ No newline at end of file diff --git a/src/App.js b/src/App.js index d4dd1ea..53a0217 100644 --- a/src/App.js +++ b/src/App.js @@ -26,8 +26,9 @@ class App extends React.Component { } setBackgroundImage() { - const backgroundImage = '#base64BackgroundImage'; + let backgroundImage = '#base64BackgroundImage'; if (!backgroundImage.includes('#')) + // eslint-disable-next-line no-import-assign base64DynamoBackground = backgroundImage; } diff --git a/src/Dynamic.css b/src/Dynamic.css index c385343..acb278f 100644 --- a/src/Dynamic.css +++ b/src/Dynamic.css @@ -1,28 +1,29 @@ .progress-bar-container { - height: 4px; - margin: 10px 0px; - background: rgba(255, 255, 255, 0.1); - border-radius: 25px; - position:relative; - } - - .progress-bar-indicator { - height: 100%; - max-width: 100%; - margin: 0; - border-radius: 25px; - -webkit-mask:linear-gradient(#fff 0 0); - mask:linear-gradient(#fff 0 0) !important; - } - .progress-bar-indicator::before { - content:""; - position:absolute; - top:0; - left:0; - right:0; - bottom:0; - background-image: linear-gradient(to right, rgba(255, 255, 255, 0.1), #38ABDF, #38ABDF); - } + height: 4px; + margin: 10px 0px; + background: rgba(255, 255, 255, 0.1); + border-radius: 25px; + position: relative; +} + +.progress-bar-indicator { + height: 100%; + max-width: 100%; + margin: 0; + border-radius: 25px; + -webkit-mask: linear-gradient(#fff 0 0); + mask: linear-gradient(#fff 0 0) !important; +} + +.progress-bar-indicator::before { + content: ""; + position: absolute; + top: 0; + left: 0; + right: 0; + bottom: 0; + background-image: linear-gradient(to right, rgba(255, 255, 255, 0.1), #38ABDF, #38ABDF); +} .progress-bar-indicator { height: 100%; @@ -47,4 +48,4 @@ .loadingTimeFooter { font-size: 9px; -} +} \ No newline at end of file diff --git a/src/Dynamic.js b/src/Dynamic.js index 34eb895..555f9d8 100644 --- a/src/Dynamic.js +++ b/src/Dynamic.js @@ -17,36 +17,36 @@ class Dynamic extends React.Component { } render() { - return ( -
-
- Dynamo core {this.state.dynamoVersion} -
-
-
-
-
-
-
- {this.state.loadDescription} -
-
-
-
- {this.state.loadingTime} -
+ return ( +
+
+ Dynamo core {this.state.dynamoVersion} +
+
+
+
- ); +
+
+ {this.state.loadDescription} +
+
+
+
+ {this.state.loadingTime} +
+
+ ); } setBarProperties(dynamoVersion, loadDescription, barSize, loadingTime) { - this.setState({ - barSize: barSize, - dynamoVersion: dynamoVersion, - loadDescription: loadDescription, - loadingTime: loadingTime - }) - document.getElementsByClassName('progress-bar-indicator')[0].style.display = 'flex' + this.setState({ + barSize: barSize, + dynamoVersion: dynamoVersion, + loadDescription: loadDescription, + loadingTime: loadingTime + }); + document.getElementsByClassName('progress-bar-indicator')[0].style.display = 'flex'; } } diff --git a/src/Static.js b/src/Static.js index 66524f0..fe3efa5 100644 --- a/src/Static.js +++ b/src/Static.js @@ -12,163 +12,145 @@ import './Static.css'; /*global chrome*/ const importStatusEnum = { - none: 1, - error: 2, - success: 3, + none: 1, + error: 2, + success: 3, }; let checked = false; class Static extends React.Component { - constructor() { - super(); + constructor() { + super(); - this.state = { - importStatus: importStatusEnum.none, - importSettingsTitle: 'Import settings', - errorDescription: + this.state = { + importStatus: importStatusEnum.none, + importSettingsTitle: 'Import settings', + errorDescription: 'Something went wrong when importing your custom setting file. Please try again or proceed with default settings.', - }; - - window.setImportStatus = this.setImportStatus.bind(this); - } - render() { - return ( - - - - - - - - - - - - - - - ); - } - - //Opens a page to signin - signIn() { - window.open("https://accounts.autodesk.com/", "_blank"); - } - - //This method calls another method from Dynamo to actually launch it - launchDynamo() { - if (chrome.webview !== undefined) { - //The 'checked' is a boolean that represents if the user don't want to show the Static screen again - chrome.webview.hostObjects.scriptObject.LaunchDynamo(checked); - } - } - - //Reads the file and send the string to a method inside Dynamo called 'ImportSettings' - readFile(event) { - let file = event.target.files[0]; - if (file) { - var fr = new FileReader(); - fr.onload = function () { - if (chrome.webview !== undefined) { - chrome.webview.hostObjects.scriptObject.ImportSettings(fr.result); - } + }; + + window.setImportStatus = this.setImportStatus.bind(this); + } + render() { + return ( + + + + + + + + + + + + + + + ); + } + + //Opens a page to signin + signIn() { + window.open('https://accounts.autodesk.com/', '_blank'); + } + + //This method calls another method from Dynamo to actually launch it + launchDynamo() { + if (chrome.webview !== undefined) { + //The 'checked' is a boolean that represents if the user don't want to show the Static screen again + chrome.webview.hostObjects.scriptObject.LaunchDynamo(checked); } - - //This method calls another method from Dynamo to actually launch it - launchDynamo() { + } + + //Reads the file and send the string to a method inside Dynamo called 'ImportSettings' + readFile(event) { + let file = event.target.files[0]; + if (file) { + var fr = new FileReader(); + fr.onload = function () { if (chrome.webview !== undefined) { - //The 'checked' is a boolean that represents if the user don't want to show the Static screen again - chrome.webview.hostObjects.scriptObject.LaunchDynamo(checked); - } - } - - //Reads the file and send the string to a method inside Dynamo called 'ImportSettings' - readFile(event) { - let file = event.target.files[0]; - if (file) { - if (chrome.webview !== undefined) { - chrome.webview.hostObjects.scriptObject.ImportSettings(file); - } + chrome.webview.hostObjects.scriptObject.ImportSettings(fr.result); } - } - - //Set the result of the file that was imported by Dynamo - setImportStatus(importStatus) { - this.setState({ - importStatus: importStatus.status, - importSettingsTitle: importStatus.importSettingsTitle, - errorDescription: importStatus.errorDescription, - }); - } + }; - //Every time the checkbox is clicked, this method is called - handleChange() { - checked = !checked; + fr.readAsText(file); } + } + + //Set the result of the file that was imported by Dynamo + setImportStatus(importStatus) { + this.setState({ + importStatus: importStatus.status, + importSettingsTitle: importStatus.importSettingsTitle, + errorDescription: importStatus.errorDescription, + }); + } + + //Every time the checkbox is clicked, this method is called + handleChange() { + checked = !checked; + } } Static.defaultProps = { - signInTitle: 'Sign in', - launchTitle: 'Launch Dynamo', - showScreenAgainLabel: 'Don’t show this screen again', + signInTitle: 'Sign in', + launchTitle: 'Launch Dynamo', + showScreenAgainLabel: 'Don’t show this screen again', }; Static.propTypes = { - signInTitle: PropTypes.string, - launchTitle: PropTypes.string, - showScreenAgainLabel: PropTypes.string, + signInTitle: PropTypes.string, + launchTitle: PropTypes.string, + showScreenAgainLabel: PropTypes.string, }; export default Static;