Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Localize import settings button label #15

Merged
merged 4 commits into from
Nov 3, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@dynamods/splash-screen",
"version": "0.3.0",
"version": "0.3.1",
"description": "Splash Screen maintained by Dynamo Team@Autodesk",
"author": "Autodesk Inc.",
"license": "MIT",
Expand Down
4 changes: 3 additions & 1 deletion src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ class App extends React.Component {
welcomeToDynamoTitle={this.state.welcomeToDynamoTitle}
launchTitle={this.state.launchTitle}
showScreenAgainLabel={this.state.showScreenAgainLabel}
importSettingsTitle={this.state.importSettingsTitle}
/> : <Dynamic />
}
</Col>
Expand All @@ -81,7 +82,8 @@ class App extends React.Component {
this.setState({
welcomeToDynamoTitle: labels.welcomeToDynamoTitle,
launchTitle: labels.launchTitle,
showScreenAgainLabel: labels.showScreenAgainLabel
showScreenAgainLabel: labels.showScreenAgainLabel,
importSettingsTitle: labels.importSettingsTitle
});
}

Expand Down
48 changes: 22 additions & 26 deletions src/Static.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ class Static extends React.Component {
importSettingsTitle: 'Import settings',
errorDescription: 'Something went wrong when importing your custom setting file. Please try again or proceed with default settings.',
signInTitle: this.props.signInTitle,
signInStatus: this.props.signInStatus
signInStatus: this.props.signInStatus,
importSettingsTitle: this.props.importSettingsTitle,
avidit marked this conversation as resolved.
Show resolved Hide resolved
};

window.setImportStatus = this.setImportStatus.bind(this);
Expand All @@ -44,7 +45,7 @@ class Static extends React.Component {

<Row className='mt-3'>
<button id="btnSignIn" className='primaryButton' onClick={this.signIn}>
{this.state.signInTitle}
{this.state.signInTitle}
</button>
</Row>

Expand All @@ -54,29 +55,24 @@ class Static extends React.Component {
overlay={
<Tooltip
hidden={this.state.importStatus !== importStatusEnum.error}
id='button-tooltip'
>
id='button-tooltip'>
{this.state.errorDescription}
</Tooltip>
}
>
}>
<label className='primaryButton px-1'>
<input
type='file'
className='primaryButton'
onChange={(e) => this.readFile(e)}
/>
onChange={(e) => this.readFile(e)} />
<div className='buttonLabel'>
<img
src={warningIcon}
alt=''
hidden={this.state.importStatus !== importStatusEnum.error}
></img>
hidden={this.state.importStatus !== importStatusEnum.error}></img>
<img
src={checkMarkIcon}
alt=''
hidden={this.state.importStatus !== importStatusEnum.success}
></img>
hidden={this.state.importStatus !== importStatusEnum.success}></img>
<div className='importSettingsText'>
<span>{this.state.importSettingsTitle}</span>
</div>
Expand All @@ -89,8 +85,7 @@ class Static extends React.Component {
<input
type='checkbox'
onChange={this.handleChange}
className='checkBoxStyle'
/>
className='checkBoxStyle' />
<span className='checkmark'>
{' '}
{this.props.showScreenAgainLabel}{' '}
Expand All @@ -104,29 +99,30 @@ class Static extends React.Component {
//Opens a page to signin
//TODO: Localize strings by setting text as per what Dynamo sends in.
signIn = async () => {
if (chrome.webview !== undefined ) {
if(this.state.signInStatus){
if (chrome.webview !== undefined) {
if (this.state.signInStatus) {
var ret = await chrome.webview.hostObjects.scriptObject.SignOut();
this.setState({signInStatus: !ret,
signInTitle: "Sign In"})
this.setState({
signInStatus: !ret,
signInTitle: "Sign In"
})
}
else
{
var btn=document.getElementById("btnSignIn");
else {
var btn = document.getElementById("btnSignIn");
btn.classList.add('disableButton');
btn.disabled = true;

this.setState({signInTitle: "Signing In"})
this.setState({ signInTitle: "Signing In" })
var ret = await chrome.webview.hostObjects.scriptObject.SignIn();
this.setState({ signInStatus: ret });

btn.classList.remove('disableButton');
btn.disabled = false;
if(ret){
this.setState({signInTitle: "Sign Out"})
if (ret) {
this.setState({ signInTitle: "Sign Out" })
}
else{
this.setState({signInTitle: "Sign In"})
else {
this.setState({ signInTitle: "Sign In" })
}
}
}
Expand Down