Skip to content

Commit e71ee04

Browse files
zeusongitCopilot
andauthored
DYN-8498: Add message to restart Dynamo after setting Import (#96)
* Consolidate labels prop and add restart/reset UI message Replace many individual label props with a single labels object passed from App to Static. Update Static to read labels from props.labels, simplify setLabels in App, and update defaultProps/propTypes accordingly. Add UI and handlers for a restart message and a reset button shown after importing settings (showRestartMessage/hideRestartMessage/resetSettings) and clear the file input after import. Add related CSS for import row, reset button, and restart message, and tweak bottomMenu classes in App.css. * Apply suggestion from @Copilot Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Apply suggestion from @Copilot Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Add Toast component and debug-mode handling Introduce a reusable Toast notification (src/Toast.js + src/Toast.css) and unit tests (tests/Toast.test.js). Integrate the Toast into App (src/App.js) and add a debug-mode detection that auto-loads Static when WebView2 is not present and shows a small "Debug Mode" label. Update Static (src/Static.js, src/Static.css) to: use safer typeof checks for chrome.webview, remove the inline restart message UI/CSS in favor of showing toasts via window.showToast/window.hideToast, and mock import callbacks when running outside WebView2 for local development. Update package.json to include the new Toast test in test:unit. These changes enable in-app notifications and improve local dev/debug behavior without WebView2. * Update App.js * Update App.js * Update App.js --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent 4fa4b4b commit e71ee04

8 files changed

Lines changed: 306 additions & 65 deletions

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
"lic_direct": "npx @adsk/adsk-npm-license-puller --path . --app-name 'splash-screen' --verbose --about-box ./license_output/about-box_direct.html --about-box-type desktop --year $(date \"+%Y\") --paos ./license_output/paos_direct.csv",
3434
"lic_transitive": "npx @adsk/adsk-npm-license-puller --path . --app-name 'splash-screen' --verbose --about-box ./license_output/about-box_transitive.html --about-box-type desktop --transitive --year $(date \"+%Y\") --paos ./license_output/paos_transitive.csv",
3535
"generate_license": "npm run lic_direct && npm run lic_transitive",
36-
"test:unit": "NODE_ENV=test jest tests/App.test.js",
36+
"test:unit": "NODE_ENV=test jest tests/App.test.js tests/Toast.test.js",
3737
"test:e2e": "playwright test tests/e2e.test.js",
3838
"eject": "react-scripts eject"
3939
},

src/App.css

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,17 @@
99
}
1010

1111
.bottomMenu {
12+
height: auto;
13+
}
14+
15+
.bottomMenuHeader {
1216
height: 50%;
1317
}
1418

19+
.bottomMenuContent {
20+
height: auto;
21+
}
22+
1523
.welcomeRow {
1624
margin-top: 20px !important;
1725
}

src/App.js

Lines changed: 15 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import Col from 'react-bootstrap/Col';
55

66
import Dynamic from './Dynamic';
77
import Static from './Static';
8+
import Toast from './Toast';
89
import { base64DynamoLogo, base64DynamoBackground } from './encodedImages';
910

1011
import './App.css';
@@ -14,6 +15,8 @@ class App extends React.Component {
1415
constructor() {
1516
super();
1617
this.setBackgroundImage();
18+
const noWebView = typeof chrome === 'undefined' || typeof chrome.webview === 'undefined';
19+
this.isDebugMode = noWebView && new URLSearchParams(window.location.search).has('debug');
1720
this.state = {
1821
isChecked: false,
1922
welcomeToDynamoTitle: 'Welcome to Dynamo!',
@@ -41,15 +44,20 @@ class App extends React.Component {
4144

4245
componentDidMount() {
4346
document.addEventListener('keydown', this.handleKeyDown);
44-
//TODO : As alternative we can receive the event from the Childs like the Static component
47+
48+
// Debug mode: auto-show Static when running outside Dynamo (no WebView2)
49+
if (this.isDebugMode) {
50+
console.log('[SplashScreen] Debug mode: no WebView2 detected, auto-loading Static');
51+
this.setLoadingDone();
52+
}
4553
}
4654

4755
render() {
4856
return (
4957
<Container fluid>
5058
<Row>
5159
<Col className='menuOptions px-4' >
52-
<Row className='bottomMenu'>
60+
<Row className='bottomMenu bottomMenuHeader'>
5361
<Col>
5462
<Row>
5563
<div>
@@ -61,24 +69,16 @@ class App extends React.Component {
6169
{this.state.welcomeToDynamoTitle}
6270
</div>
6371
</Row>
72+
6473
</Col>
6574
</Row>
66-
<Row className='bottomMenu'>
75+
<Row className='bottomMenu bottomMenuContent'>
6776
<Col>
6877
{
6978
this.state.loadingDone ?
7079
<Static
7180
signInStatus={this.state.signInStatus}
72-
signInTitle={this.state.signInTitle}
73-
signInTooltip={this.state.signInTooltip}
74-
signingInTitle={this.state.signingInTitle}
75-
signOutTitle={this.state.signOutTitle}
76-
signOutTooltip={this.state.signOutTooltip}
77-
welcomeToDynamoTitle={this.state.welcomeToDynamoTitle}
78-
launchTitle={this.state.launchTitle}
79-
showScreenAgainLabel={this.state.showScreenAgainLabel}
80-
importSettingsTitle={this.state.importSettingsTitle}
81-
importSettingsTooltipDescription={this.state.importSettingsTooltipDescription}
81+
labels={this.state.labels}
8282
onCheckedChange={this.handleCheckedChange}
8383
/> : <Dynamic />
8484
}
@@ -90,6 +90,7 @@ class App extends React.Component {
9090
<img className='screenBackground' alt='' src={base64DynamoBackground}></img>
9191
</Col>
9292
</Row>
93+
<Toast />
9394
</Container>
9495
);
9596
}
@@ -98,15 +99,7 @@ class App extends React.Component {
9899
setLabels(labels) {
99100
this.setState({
100101
welcomeToDynamoTitle: labels.welcomeToDynamoTitle,
101-
launchTitle: labels.launchTitle,
102-
showScreenAgainLabel: labels.showScreenAgainLabel,
103-
importSettingsTitle: labels.importSettingsTitle,
104-
importSettingsTooltipDescription: labels.importSettingsTooltipDescription,
105-
signInTitle: labels.signInTitle,
106-
signInTooltip: labels.signInTooltip,
107-
signingInTitle: labels.signingInTitle,
108-
signOutTitle: labels.signOutTitle,
109-
signOutTooltip: labels.signOutTooltip
102+
labels: labels
110103
});
111104
}
112105

src/Static.css

Lines changed: 56 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,4 +90,59 @@ input[type="file"] {
9090

9191
.loadingTimeFooter {
9292
font-size: 9px;
93-
}
93+
}
94+
95+
/* Import settings row */
96+
.importSettingsRow {
97+
display: grid !important;
98+
align-items: center;
99+
}
100+
101+
.importSettingsRow label {
102+
width: 100%;
103+
display: block;
104+
}
105+
106+
.importSettingsRowWithReset {
107+
grid-template-columns: 1fr 24px;
108+
column-gap: 8px;
109+
}
110+
111+
.importSettingsRowWithReset label {
112+
min-width: 0;
113+
width: 100%;
114+
}
115+
116+
/* Reset button next to import settings */
117+
.resetButtonNextToImport {
118+
position: static;
119+
width: 24px !important;
120+
height: 24px;
121+
padding: 0;
122+
box-sizing: border-box;
123+
line-height: 0;
124+
background: transparent;
125+
border: 1px solid rgba(255, 255, 255, 0.3);
126+
border-radius: 2px;
127+
cursor: pointer;
128+
display: grid;
129+
align-items: center;
130+
justify-content: center;
131+
color: white;
132+
transition: all 0.2s ease;
133+
}
134+
135+
.resetButtonNextToImport:hover {
136+
border-color: rgba(255, 255, 255, 0.6);
137+
box-shadow: 0px 0px 2px rgba(255, 255, 255, 0.5);
138+
}
139+
140+
.resetButtonNextToImport:active {
141+
box-shadow: 0px 0px 2px rgba(56, 171, 223, 0.65);
142+
}
143+
144+
.resetButtonNextToImport svg {
145+
width: 16px;
146+
height: 16px;
147+
display: block;
148+
}

0 commit comments

Comments
 (0)