Skip to content

Commit 4d2903a

Browse files
authored
Add adoption highlight to ESPHome Web (#188)
1 parent d976ab0 commit 4d2903a

File tree

1 file changed

+36
-4
lines changed

1 file changed

+36
-4
lines changed

web.esphome.io/src/dashboard/ew-dashboard.ts

Lines changed: 36 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,11 @@ class EWDashboard extends LitElement {
2020
protected render() {
2121
return html`
2222
<div class="container">
23-
${supportsWebSerial
24-
? html`<ew-connect-card></ew-connect-card>`
25-
: html`<ew-unsupported-card></ew-unsupported-card>`}
23+
${
24+
supportsWebSerial
25+
? html`<ew-connect-card></ew-connect-card>`
26+
: html`<ew-unsupported-card></ew-unsupported-card>`
27+
}
2628
2729
<div class="intro">
2830
${ARROW}
@@ -70,14 +72,33 @@ class EWDashboard extends LitElement {
7072
</p>
7173
</div>
7274
</div>
75+
76+
<div class="promote promote-adopt">
77+
</svg>
78+
<div class="text">
79+
<p><b>Make Adoptable</b>
80+
<svg width="48" height="48" viewBox="0 0 24 24"><path d="M21.5 9.5L20.09 10.92L17 7.83V13.5C17 17.09 14.09 20 10.5 20H4V18H10.5C13 18 15 16 15 13.5V7.83L11.91 10.91L10.5 9.5L16 4L21.5 9.5Z" /></svg>
81+
82+
</p>
83+
<p>
84+
This action will prepare your device to be adopted by your ESPHome
85+
dashboard. Once adopted, a device can be configured and updated
86+
wirelessly.
87+
</p>
88+
</div>
89+
</div>
7390
</div>
7491
`;
7592
}
7693

7794
protected firstUpdated(changedProps: PropertyValues): void {
7895
super.firstUpdated(changedProps);
7996
const highlight = location.search.substring(1);
80-
if (highlight === "dashboard_install" || highlight === "dashboard_logs") {
97+
if (
98+
highlight === "dashboard_install" ||
99+
highlight === "dashboard_logs" ||
100+
highlight === "dashboard_wizard"
101+
) {
81102
this.toggleAttribute(highlight);
82103
}
83104
}
@@ -128,6 +149,9 @@ class EWDashboard extends LitElement {
128149
:host([dashboard_install]) ew-connect-card[connected] ~ .promote-install {
129150
display: flex;
130151
}
152+
:host([dashboard_wizard]) ew-connect-card[connected] ~ .promote-adopt {
153+
display: flex;
154+
}
131155
.text {
132156
margin-left: 16px;
133157
padding-right: 8px;
@@ -137,6 +161,14 @@ class EWDashboard extends LitElement {
137161
position: relative;
138162
top: -13px;
139163
}
164+
.promote-adopt p:first-child {
165+
margin-top: 0;
166+
}
167+
.promote-adopt svg {
168+
position: relative;
169+
left: 32px;
170+
bottom: -5px;
171+
}
140172
@media only screen and (max-width: 550px) {
141173
:host {
142174
width: 100%;

0 commit comments

Comments
 (0)