Skip to content

Commit f579c9b

Browse files
dbg
1 parent fd7a14e commit f579c9b

File tree

2 files changed

+59
-83
lines changed

2 files changed

+59
-83
lines changed

kernel/src/components/Dialog.ts

Lines changed: 11 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
import { Card } from './Card';
2-
import { FlashCard } from './FlashCard';
3-
// import { ConnectCard } from './ConnectCard';
1+
import { ConnectCard } from './ConnectCard';
42
import { ServiceContainer } from '../services/ServiceContainer';
53

64
export interface DialogProps {
@@ -10,9 +8,7 @@ export interface DialogProps {
108

119
export class Dialog {
1210
private element: HTMLDivElement;
13-
// private connectCard: ConnectCard;
14-
private flashCard: FlashCard;
15-
private resetCard: Card;
11+
private connectCard: ConnectCard;
1612

1713
constructor(props: DialogProps) {
1814
this.element = document.createElement('div');
@@ -27,38 +23,17 @@ export class Dialog {
2723
const header = this.createHeader();
2824
const optionsContainer = this.createOptionsContainer();
2925

30-
// this.connectCard = new ConnectCard(
31-
// {
32-
// action: 'connect',
33-
// icon: '🔌',
34-
// title: 'Connect Device',
35-
// description: 'Connect to RedBoard via serial',
36-
// color: 'var(--ui-navy)'
37-
// },
38-
// props.serviceContainer.deviceService);
39-
40-
this.flashCard = new FlashCard({
41-
action: 'flash',
42-
icon: '⚡️',
43-
title: 'Flash Device',
44-
description: 'Flash your device with the latest firmware',
45-
color: 'var(--ui-red)'
46-
},
47-
() => props.serviceContainer.flashService.flashDevice(),
48-
props.serviceContainer.firmwareService,
26+
this.connectCard = new ConnectCard(
27+
{
28+
action: 'connect',
29+
icon: '🔌',
30+
title: 'Connect Device',
31+
description: 'Connect to RedBoard via serial',
32+
color: 'var(--ui-navy)'
33+
},
4934
props.serviceContainer.deviceService);
5035

51-
this.resetCard = new Card({
52-
action: 'reset-esp',
53-
icon: '🔄',
54-
title: 'Hard reset Esp',
55-
description: 'Hard reset esp chip',
56-
color: 'var(--ui-red)'
57-
}, () => props.serviceContainer.deviceService.reset());
58-
59-
// optionsContainer.appendChild(this.connectCard.getElement());
60-
optionsContainer.appendChild(this.flashCard.getElement());
61-
optionsContainer.appendChild(this.resetCard.getElement());
36+
optionsContainer.appendChild(this.connectCard.getElement());
6237

6338
let content = document.createElement('div');
6439
content.className = 'welcome-dialog';

kernel/src/panel.ts

Lines changed: 48 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,42 @@
11
import { globalStyles, animations, overlayStyles, dialogStyles, minimizedStyles, cardStyles, buttonStyles, progressOverlayStyles } from './styles';
22
import { MinimizedButton } from './components/MinimizedButton';
3-
// import { Dialog } from './components/Dialog';
4-
//import { ServiceContainer } from './services/ServiceContainer';
5-
6-
// class DialogPanel {
7-
// private element: HTMLDivElement;
8-
9-
// constructor(dialog: Dialog) {
10-
// this.element = document.createElement('div');
11-
// this.element.id = 'dialog-widget-panel';
12-
// this.element.appendChild(dialog.getElement());
13-
// }
14-
15-
// show(): void {
16-
// this.element.style.display = 'block';
17-
// this.element.classList.remove('minimized');
18-
// this.element.classList.add('visible');
19-
20-
// this.element.style.transition = 'opacity 0.3s ease-in-out';
21-
// this.element.style.opacity = '1';
22-
// }
23-
24-
// hide(): void {
25-
// this.element.classList.add('minimizing');
26-
// this.element.classList.remove('visible');
27-
// this.element.style.opacity = '0';
28-
29-
// setTimeout(() => {
30-
// this.element.style.display = 'none';
31-
// this.element.classList.remove('minimizing');
32-
// this.element.classList.add('minimized');
33-
// }, 300);
34-
// }
35-
36-
// getElement(): HTMLDivElement {
37-
// return this.element;
38-
// }
39-
// }
3+
import { Dialog } from './components/Dialog';
4+
import { ServiceContainer } from './services/ServiceContainer';
5+
6+
class DialogPanel {
7+
private element: HTMLDivElement;
8+
9+
constructor(dialog: Dialog) {
10+
this.element = document.createElement('div');
11+
this.element.id = 'dialog-widget-panel';
12+
this.element.appendChild(dialog.getElement());
13+
}
14+
15+
show(): void {
16+
this.element.style.display = 'block';
17+
this.element.classList.remove('minimized');
18+
this.element.classList.add('visible');
19+
20+
this.element.style.transition = 'opacity 0.3s ease-in-out';
21+
this.element.style.opacity = '1';
22+
}
23+
24+
hide(): void {
25+
this.element.classList.add('minimizing');
26+
this.element.classList.remove('visible');
27+
this.element.style.opacity = '0';
28+
29+
setTimeout(() => {
30+
this.element.style.display = 'none';
31+
this.element.classList.remove('minimizing');
32+
this.element.classList.add('minimized');
33+
}, 300);
34+
}
35+
36+
getElement(): HTMLDivElement {
37+
return this.element;
38+
}
39+
}
4040

4141
class MinimizedPanel {
4242
private element: HTMLDivElement;
@@ -89,10 +89,10 @@ export default class WelcomePanel {
8989
private element: HTMLDivElement;
9090

9191
private minimizedPanel: MinimizedPanel;
92-
// private dialogPanel: DialogPanel;
92+
private dialogPanel: DialogPanel;
9393

94-
// constructor(private serviceContainer: ServiceContainer) {
95-
constructor() {
94+
constructor(private serviceContainer: ServiceContainer) {
95+
// constructor() {
9696

9797
this.element = document.createElement('div');
9898
this.element.id = 'jp-kernel-welcome-panel';
@@ -128,14 +128,14 @@ export default class WelcomePanel {
128128
const minimizedButton = new MinimizedButton(() => this.show());
129129
this.minimizedPanel = new MinimizedPanel(minimizedButton);
130130

131-
// const dialog = new Dialog({
132-
// closeDialog: () => this.hide(),
133-
// serviceContainer: this.serviceContainer,
134-
// });
135-
// this.dialogPanel = new DialogPanel(dialog);
131+
const dialog = new Dialog({
132+
closeDialog: () => this.hide(),
133+
serviceContainer: this.serviceContainer,
134+
});
135+
this.dialogPanel = new DialogPanel(dialog);
136136

137137
this.element.appendChild(this.minimizedPanel.getElement());
138-
// this.element.appendChild(this.dialogPanel.getElement());
138+
this.element.appendChild(this.dialogPanel.getElement());
139139

140140
document.addEventListener('deviceConnected', (event: Event) => {
141141
const customEvent = event as CustomEvent;
@@ -182,10 +182,11 @@ export default class WelcomePanel {
182182

183183
// this.dialogPanel.show();
184184
//this.minimizedPanel.hide();
185+
this.minimizedPanel.show();
185186
}
186187

187188
hide(): void {
188-
// this.dialogPanel.hide();
189+
this.dialogPanel.hide();
189190
this.minimizedPanel.show();
190191
}
191192
}

0 commit comments

Comments
 (0)