-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Loading time info * Static screen * Static screen design * design and inputs * comments and utf8 * remove react command * reverting package.json * import settings tooltip * tooltip fix flickering * adding comments
- Loading branch information
1 parent
1b3c21e
commit 82f41e2
Showing
9 changed files
with
252 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,4 +38,4 @@ | |
"webpack": "^5.74.0", | ||
"webpack-cli": "^4.10.0" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,16 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
</head> | ||
|
||
<body> | ||
<script> | ||
document.querySelector('body').style.overflow='hidden' | ||
</script> | ||
<div id="root"></div> | ||
</body> | ||
|
||
|
||
|
||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,4 +24,7 @@ | |
|
||
.dynamicOptions{ | ||
margin-top: 50px; | ||
} | ||
.loadingTimeFooter{ | ||
font-size: 9px; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
.checkboxShowScreenAgain { | ||
vertical-align: middle; | ||
font-size: 11px; | ||
color: rgba(255, 255, 255, 0.5); | ||
display: grid; | ||
grid-template-columns: 1.2em auto; | ||
gap: 0.5em; | ||
} | ||
|
||
.primaryButton { | ||
color: white; | ||
border-color: white; | ||
border: 1px solid rgba(255, 255, 255, 0.5); | ||
border-radius: 2px; | ||
background-color: #363636; | ||
cursor: pointer; | ||
height: 24px; | ||
} | ||
|
||
.secondaryButton { | ||
color: white; | ||
border-radius: 2px; | ||
border: 2px solid #38ABDF; | ||
box-shadow: none; | ||
background-color: #38ABDF; | ||
padding: 1px 0px !important; | ||
font-size: 12px; | ||
} | ||
|
||
.buttonLabel { | ||
display: flex; | ||
align-items: center; | ||
height: 100%; | ||
} | ||
|
||
.importSettingsText { | ||
width: 100%; | ||
text-align: center; | ||
font-size: 12px; | ||
} | ||
|
||
input[type="file"] { | ||
display: none; | ||
} | ||
|
||
.tooltip>div.tooltip-inner { | ||
text-align: left; | ||
background-color: white !important; | ||
color: black !important; | ||
font-size: 11px; | ||
pointer-events: none !important; | ||
} | ||
|
||
.tooltip.show { | ||
opacity: 1 !important; | ||
} | ||
|
||
.tooltip-arrow { | ||
color: white !important; | ||
--bs-tooltip-bg: white !important; | ||
} | ||
|
||
.tooltip{ | ||
--bs-tooltip-border-radius: 2px !important; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,121 @@ | ||
|
||
import React from 'react'; | ||
import PropTypes from "prop-types"; | ||
import './Static.css' | ||
import Container from 'react-bootstrap/Container'; | ||
import Row from 'react-bootstrap/Row'; | ||
import { warningIcon, checkMarkIcon } from './encodedImages'; | ||
import OverlayTrigger from 'react-bootstrap/OverlayTrigger'; | ||
import Tooltip from 'react-bootstrap/Tooltip'; | ||
/*global chrome*/ | ||
|
||
const importStatusEnum = { | ||
none: 1, | ||
error: 2, | ||
success: 3 | ||
} | ||
|
||
let checked = false; | ||
|
||
class Static extends React.Component { | ||
|
||
constructor() { | ||
super(); | ||
|
||
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 ( | ||
<Container className='pr-3'> | ||
<Row className='mt-3'> | ||
<button className='primaryButton' onClick={this.signIn}>{this.props.signInTitle}</button> | ||
</Row> | ||
<Row className='mt-3'> | ||
<button className='secondaryButton' onClick={this.launchDynamo}>{this.props.launchTitle}</button> | ||
</Row> | ||
<Row className='mt-3'> | ||
<OverlayTrigger | ||
placement={'right'} | ||
overlay={ | ||
<Tooltip hidden={this.state.importStatus !== importStatusEnum.error} id='button-tooltip'> | ||
{this.state.errorDescription} | ||
</Tooltip> | ||
}> | ||
<label className='primaryButton px-1'> | ||
<input type="file" className='primaryButton' onChange={(e) => this.readFile(e)} /> | ||
<div className='buttonLabel'> | ||
<img src={warningIcon} alt='' hidden={this.state.importStatus !== importStatusEnum.error}></img> | ||
<img src={checkMarkIcon} alt='' hidden={this.state.importStatus !== importStatusEnum.success}></img> | ||
<div className='importSettingsText'><span >{this.state.importSettingsTitle}</span></div> | ||
</div> | ||
</label> | ||
</OverlayTrigger> | ||
</Row> | ||
<Row className='mt-3'> | ||
<label className='p-0 checkboxShowScreenAgain '> | ||
<input type="checkbox" onChange={this.handleChange} className='checkBoxStyle' /> | ||
<span className="checkmark"> {this.props.showScreenAgainLabel} </span> | ||
</label> | ||
</Row> | ||
</Container> | ||
) | ||
} | ||
|
||
//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) { | ||
if (chrome.webview !== undefined) { | ||
chrome.webview.hostObjects.scriptObject.ImportSettings(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" | ||
} | ||
|
||
Static.propTypes = { | ||
signInTitle: PropTypes.string, | ||
launchTitle: PropTypes.string, | ||
showScreenAgainLabel: PropTypes.string | ||
}; | ||
|
||
export default Static; |
Large diffs are not rendered by default.
Oops, something went wrong.