Skip to content

Commit

Permalink
DYN-6628 Update sign in button tool tip on sign in/sign out (#50)
Browse files Browse the repository at this point in the history
  • Loading branch information
avidit authored Jan 23, 2024
1 parent e0006e1 commit 6a9a64d
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 15 deletions.
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": "1.0.16",
"version": "1.0.17",
"description": "Splash Screen maintained by Dynamo Team@Autodesk",
"author": "Autodesk Inc.",
"license": "MIT",
Expand Down
3 changes: 2 additions & 1 deletion src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class App extends React.Component {

handleCheckedChange = (checked) => {
this.setState({isChecked: checked});
}
};

setBackgroundImage() {
let backgroundImage = '#base64BackgroundImage';
Expand Down Expand Up @@ -139,4 +139,5 @@ class App extends React.Component {
}
}
}

export default App;
35 changes: 24 additions & 11 deletions src/Static.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class Static extends React.Component {
window.setTotalLoadingTime = this.setTotalLoadingTime.bind(this);
window.setEnableSignInButton = this.setEnableSignInButton.bind(this);
window.handleSignInStateChange = this.handleSignInStateChange.bind(this);
this.handleChange = this.handleChange.bind(this)
this.handleChange = this.handleChange.bind(this);
}

componentDidMount() {
Expand All @@ -45,7 +45,7 @@ class Static extends React.Component {
//Every time the checkbox is clicked, this method is called
handleChange() {
checked = !checked;
this.props.onCheckedChange(checked);
this.props.onCheckedChange(checked);
}

render() {
Expand Down Expand Up @@ -132,7 +132,8 @@ class Static extends React.Component {
let status = await chrome.webview.hostObjects.scriptObject.SignOut();
this.setState({
signInStatus: !status,
signInTitle: this.props.signInTitle
signInTitle: this.props.signInTitle,
signInTooltip: this.props.signInTooltip
});
}
else {
Expand All @@ -147,10 +148,16 @@ class Static extends React.Component {
btn.classList.remove('disableButton');
btn.disabled = false;
if (status) {
this.setState({ signInTitle: this.props.signOutTitle });
this.setState({
signInTitle: this.props.signOutTitle,
signInTooltip: this.props.signOutTooltip
});
}
else {
this.setState({ signInTitle: this.props.signInTitle });
this.setState({
signInTitle: this.props.signInTitle,
signInTooltip: this.props.signInTooltip
});
}
}
}
Expand Down Expand Up @@ -208,16 +215,21 @@ class Static extends React.Component {

//Handles changes to auth status on splash screen
handleSignInStateChange(auth) {
let btn = document.getElementById('btnSignIn');

this.setState({
signInStatus: auth.status === 'True'
});

if (auth.status === 'True') {
btn.innerHTML = this.props.signOutTitle;
} else {
btn.innerHTML = this.props.signInTitle;
this.setState({
signInTitle: this.props.signOutTitle,
signInTooltip: this.props.signOutTooltip
});
}
else {
this.setState({
signInTitle: this.props.signInTitle,
signInTooltip: this.props.signInTooltip
});
}
}

Expand Down Expand Up @@ -253,7 +265,8 @@ Static.propTypes = {
showScreenAgainLabel: PropTypes.string,
signInStatus: PropTypes.bool,
importSettingsTitle: PropTypes.string,
importSettingsTooltipDescription: PropTypes.string
importSettingsTooltipDescription: PropTypes.string,
onCheckedChange: PropTypes.func
};

export default Static;

0 comments on commit 6a9a64d

Please sign in to comment.