Skip to content

Commit 49713e8

Browse files
committed
Ui updates + scrolling to install added
1 parent 595c1c1 commit 49713e8

File tree

4 files changed

+74
-14
lines changed

4 files changed

+74
-14
lines changed

src/pages/zwa2-install-poe.ts

Lines changed: 46 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { LitElement, css, html } from 'lit';
22
import { customElement } from 'lit/decorators.js';
33

44
import '../components/details.js';
5+
import '../components/warning-card.js';
56

67
@customElement('zwa2-install-poe')
78
export class Zwa2InstallPoEPage extends LitElement {
@@ -21,6 +22,8 @@ export class Zwa2InstallPoEPage extends LitElement {
2122
}
2223

2324
render() {
25+
const isSerialUnavailable = !('serial' in navigator);
26+
2427
const config = {
2528
hero: {
2629
title: 'Use Portable Z-Wave with Power-over-Ethernet',
@@ -122,15 +125,49 @@ export class Zwa2InstallPoEPage extends LitElement {
122125
<li>
123126
Connect the Waveshare board to your computer via USB, click this
124127
button and follow the instructions to install:
125-
<div style="margin: 12px 0;">
126-
<esp-web-install-button
127-
manifest="https://firmware.esphome.io/ha-connect-zwa-2/home-assistant-zwa-2-poe/manifest.json"
128-
></esp-web-install-button>
129-
</div>
130-
<p style="font-style: italic;">
131-
Don’t worry about the error at the end. Our installer can no
132-
longer connect to the device because it now expects the ZWA-2.
133-
</p>
128+
${isSerialUnavailable
129+
? html`<div
130+
style="
131+
background:#fff3e0;
132+
border:1px solid #ffb74d;
133+
border-radius:8px;
134+
padding:24px;
135+
display:flex;
136+
gap:16px;
137+
align-items:flex-start;
138+
margin: 20px 0;
139+
"
140+
>
141+
<svg
142+
style="flex-shrink:0;width:24px;height:24px;color:#eb9136;margin-top:3px;"
143+
viewBox="0 0 24 24"
144+
fill="currentColor"
145+
>
146+
<path
147+
d="M1 21h22L12 2 1 21zm12-3h-2v-2h2v2zm0-4h-2v-4h2v4z"
148+
/>
149+
</svg>
150+
<div style="flex:1;">
151+
<h3
152+
style="margin:0 0 8px 0;font-size:1.1rem;font-weight:600;color:#e16725;"
153+
>
154+
Your browser does not support Web Serial
155+
</h3>
156+
<p style="margin:0;color:#5d4037;line-height:1.5;">
157+
Open this page in Google Chrome or Microsoft Edge instead.
158+
</p>
159+
</div>
160+
</div>`
161+
: html`<div style="margin: 12px 0;">
162+
<esp-web-install-button
163+
manifest="https://firmware.esphome.io/ha-connect-zwa-2/home-assistant-zwa-2-poe/manifest.json"
164+
></esp-web-install-button>
165+
</div>
166+
<p style="font-style: italic;">
167+
Don’t worry about the error at the end. Our installer can no
168+
longer connect to the device because it now expects the
169+
ZWA-2.
170+
</p>`}
134171
</li>
135172
<li>Disconnect the Waveshare board from your computer.</li>
136173
<li>

src/pages/zwa2-install-portable.ts

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,13 @@ export class Zwa2InstallPortablePage extends LitElement {
8282
</ol>
8383
</li>
8484
<li>
85-
Connect the Waveshare board to your computer via USB, click this
86-
button and follow the instructions to install:
85+
Connect the Waveshare board to your computer via USB and use the
86+
installer below to flash the firmware:
87+
<p>
88+
<a href="#installer" @click=${this._scrollToInstaller}
89+
>Go to Installer</a
90+
>
91+
</p>
8792
</li>
8893
</ol>
8994
@@ -129,6 +134,14 @@ export class Zwa2InstallPortablePage extends LitElement {
129134
></details-page>
130135
`;
131136
}
137+
138+
private _scrollToInstaller(e: Event) {
139+
e.preventDefault();
140+
window.scrollTo({
141+
top: document.body.scrollHeight,
142+
behavior: 'smooth',
143+
});
144+
}
132145
}
133146

134147
declare global {

zwa2/install-portable.html

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
.installer-wrapper {
3030
max-width: 1200px;
3131
margin: 0 auto;
32-
padding: 0 20px;
3332
}
3433

3534
.installer-card {
@@ -59,13 +58,19 @@
5958
a:hover {
6059
text-decoration: underline;
6160
}
61+
62+
@media (max-width: 1200px) {
63+
.installer-wrapper {
64+
padding: 0 20px;
65+
}
66+
}
6267
</style>
6368
</head>
6469
<body class="wa-palette-shoelace wa-theme-shoelace">
6570
<app-header></app-header>
6671
<zwa2-install-portable></zwa2-install-portable>
6772
<div class="installer-wrapper" id="installer-container">
68-
<div class="installer-card">
73+
<div class="installer-card" id="installer">
6974
<install-esphome-firmware></install-esphome-firmware>
7075
</div>
7176
</div>

zwa2/install.html

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
.installer-wrapper {
3131
max-width: 1200px;
3232
margin: 0 auto;
33-
padding: 0 20px;
3433
}
3534

3635
.installer-card {
@@ -60,6 +59,12 @@
6059
a:hover {
6160
text-decoration: underline;
6261
}
62+
63+
@media (max-width: 1200px) {
64+
.installer-wrapper {
65+
padding: 0 20px;
66+
}
67+
}
6368
</style>
6469
</head>
6570
<body class="wa-palette-shoelace wa-theme-shoelace">

0 commit comments

Comments
 (0)