Skip to content

Commit c92ae9c

Browse files
committed
Update 11ty
1 parent c5bce1b commit c92ae9c

6 files changed

Lines changed: 158 additions & 21 deletions

File tree

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
<!doctype html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8" />
5+
<link rel="icon" type="image/svg+xml" href="/favicon.png" />
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
7+
<title>Install Portable Z-Wave - ZWA2 - Device Toolbox</title>
8+
<script type="module" src="/src/components/app-header.ts"></script>
9+
<script type="module" src="/src/pages/zwa2-install-portable.ts"></script>
10+
<script
11+
type="module"
12+
src="/src/components/troubleshooting-portable.ts"
13+
></script>
14+
<script type="module" src="/src/utils/dark-mode.ts"></script>
15+
<link
16+
rel="stylesheet"
17+
href="https://early.webawesome.com/webawesome@3.0.0-beta.6/dist/styles/webawesome.css"
18+
/>
19+
<style>
20+
@import url('/src/styles/shoelace.css');
21+
@import url('/src/styles/theme.css');
22+
23+
body {
24+
margin: 0;
25+
font-family:
26+
-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
27+
--color-blue-600: #03a9f4;
28+
--color-blue-500: #0288d1;
29+
}
30+
.installer-wrapper {
31+
max-width: 1200px;
32+
margin: 0 auto;
33+
}
34+
35+
.installer-card {
36+
background: var(--app-bg-card);
37+
border-radius: 16px;
38+
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
39+
margin: 20px 0;
40+
}
41+
42+
.installer-card install-esphome-firmware {
43+
width: 100%;
44+
border: none;
45+
min-height: 600px;
46+
border-radius: 16px;
47+
}
48+
49+
warning-card::part(container) {
50+
margin: 10px 20px 20px;
51+
}
52+
53+
install-esphome-firmware .min-h-screen {
54+
min-height: auto !important;
55+
}
56+
57+
a {
58+
color: #03a9f4;
59+
text-decoration: none;
60+
}
61+
62+
a:hover {
63+
text-decoration: underline;
64+
}
65+
66+
@media (max-width: 1200px) {
67+
.installer-wrapper {
68+
padding: 0 20px;
69+
}
70+
}
71+
</style>
72+
</head>
73+
<body class="wa-palette-shoelace wa-theme-shoelace">
74+
<app-header></app-header>
75+
<zwa2-install-portable></zwa2-install-portable>
76+
<div class="installer-wrapper" id="installer-container">
77+
<div class="installer-card" id="installer">
78+
<install-esphome-firmware></install-esphome-firmware>
79+
</div>
80+
</div>
81+
<script type="module">
82+
import '/src/components/warning-card.js';
83+
import { isSerialUnavailable } from '/src/utils/const.ts';
84+
85+
// Wait for DOM to be ready before loading the installer
86+
document.addEventListener('DOMContentLoaded', () => {
87+
// Load the installer script dynamically
88+
const installerScript = document.createElement('script');
89+
installerScript.type = 'module';
90+
installerScript.src =
91+
'https://home-assistant.github.io/zwa2-toolbox/standalone/install-esphome-firmware.js';
92+
document.head.appendChild(installerScript);
93+
});
94+
95+
if (isSerialUnavailable) {
96+
const installerContainer = document.getElementById(
97+
'installer-container'
98+
);
99+
installerContainer.className = '';
100+
installerContainer.innerHTML = '';
101+
102+
const warningCard = document.createElement('warning-card');
103+
installerContainer.appendChild(warningCard);
104+
}
105+
</script>
106+
<troubleshooting-portable></troubleshooting-portable>
107+
</body>
108+
</html>

src-11ty/home-assistant-connect-zwa-2/install.html

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,6 @@
44
description: Install original firmware for Home Assistant Connect ZWA2
55
---
66

7-
<script
8-
type="module"
9-
src="https://home-assistant.github.io/zwa2-toolbox/standalone/install-esp-bridge-firmware.js"
10-
></script>
117
<script type="module" src="/src/components/app-header.ts"></script>
128
<script type="module" src="/src/pages/zwa2-install-original.ts"></script>
139
<script type="module" src="/src/utils/dark-mode.ts"></script>
@@ -75,6 +71,16 @@
7571
import '/src/components/warning-card.js';
7672
import { isSerialUnavailable } from '/src/utils/const.ts';
7773

74+
// Wait for DOM to be ready before loading the installer
75+
document.addEventListener('DOMContentLoaded', () => {
76+
// Load the installer script dynamically
77+
const installerScript = document.createElement('script');
78+
installerScript.type = 'module';
79+
installerScript.src =
80+
'https://home-assistant.github.io/zwa2-toolbox/standalone/install-esp-bridge-firmware.js';
81+
document.head.appendChild(installerScript);
82+
});
83+
7884
if (isSerialUnavailable) {
7985
const installerContainer = document.getElementById('installer-container');
8086
installerContainer.className = '';

src-11ty/home-assistant-connect-zwa-2/use-poe.html

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,18 @@
77
<script type="module" src="/src/pages/zwa2-install-poe.js"></script>
88
<script type="module" src="/src/components/app-header.js"></script>
99
<script type="module" src="/src/utils/dark-mode.js"></script>
10-
<script
11-
type="module"
12-
src="https://home-assistant.github.io/zwa2-toolbox/standalone/install-esp-bridge-firmware.js"
13-
></script>
10+
11+
<script type="module">
12+
// Wait for DOM to be ready before loading the installer
13+
document.addEventListener('DOMContentLoaded', () => {
14+
// Load the installer script dynamically
15+
const installerScript = document.createElement('script');
16+
installerScript.type = 'module';
17+
installerScript.src =
18+
'https://home-assistant.github.io/zwa2-toolbox/standalone/install-esp-bridge-firmware.js';
19+
document.head.appendChild(installerScript);
20+
});
21+
</script>
1422

1523
<style>
1624
body {

src-11ty/vpe/install.html

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,18 @@
77
<script type="module" src="/src/pages/vpe-install.ts"></script>
88
<script type="module" src="/src/components/app-header.ts"></script>
99
<script type="module" src="/src/utils/dark-mode.ts"></script>
10-
<script
11-
type="module"
12-
src="https://unpkg.com/esp-web-tools@10/dist/web/install-button.js?module"
13-
></script>
10+
11+
<script type="module">
12+
// Wait for DOM to be ready before loading the installer
13+
document.addEventListener('DOMContentLoaded', () => {
14+
// Load the installer script dynamically
15+
const installerScript = document.createElement('script');
16+
installerScript.type = 'module';
17+
installerScript.src =
18+
'https://unpkg.com/esp-web-tools@10/dist/web/install-button.js?module';
19+
document.head.appendChild(installerScript);
20+
});
21+
</script>
1422

1523
<app-header></app-header>
1624
<vpe-install></vpe-install>

src-11ty/zbt1/install.html

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,6 @@
44
description: Install firmware for ZBT-1 device
55
---
66

7-
<script
8-
type="module"
9-
src="https://home-assistant.github.io/zwa2-toolbox/standalone/install-esp-bridge-firmware.js"
10-
></script>
117
<script type="module" src="/src/components/app-header.ts"></script>
128
<script type="module" src="/src/pages/zbt1-install.ts"></script>
139
<script type="module" src="/src/utils/dark-mode.ts"></script>

vite.config.ts

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,20 @@ export default defineConfig({
2121
configureServer(server) {
2222
server.middlewares.use((req, res, next) => {
2323
if (req.url && !req.url.includes('.') && !req.url.endsWith('/')) {
24+
// Try to find the HTML file in nested directories
2425
const htmlPath = path.join(server.config.root, req.url + '.html');
2526
if (fs.existsSync(htmlPath)) {
2627
req.url = req.url + '.html';
28+
} else {
29+
// Try to find index.html in a subdirectory
30+
const indexPath = path.join(
31+
server.config.root,
32+
req.url,
33+
'index.html'
34+
);
35+
if (fs.existsSync(indexPath)) {
36+
req.url = req.url + '/index.html';
37+
}
2738
}
2839
}
2940
next();
@@ -44,25 +55,25 @@ export default defineConfig({
4455
input: {
4556
main: resolve(__dirname, 'dist/index.html'),
4657
vpe: resolve(__dirname, 'dist/vpe/index.html'),
47-
vpeInstall: resolve(__dirname, 'dist/vpe/install.html'),
58+
vpeInstall: resolve(__dirname, 'dist/vpe/install/index.html'),
4859
homeAssistantConnectZwa2: resolve(
4960
__dirname,
5061
'dist/home-assistant-connect-zwa-2/index.html'
5162
),
5263
homeAssistantConnectZwa2Install: resolve(
5364
__dirname,
54-
'dist/home-assistant-connect-zwa-2/install.html'
65+
'dist/home-assistant-connect-zwa-2/install/index.html'
5566
),
5667
homeAssistantConnectZwa2InstallPortable: resolve(
5768
__dirname,
58-
'dist/home-assistant-connect-zwa-2/install-portable.html'
69+
'dist/home-assistant-connect-zwa-2/install-portable/index.html'
5970
),
6071
homeAssistantConnectZwa2UsePoe: resolve(
6172
__dirname,
62-
'dist/home-assistant-connect-zwa-2/use-poe.html'
73+
'dist/home-assistant-connect-zwa-2/use-poe/index.html'
6374
),
6475
zbt1: resolve(__dirname, 'dist/zbt1/index.html'),
65-
zbt1Install: resolve(__dirname, 'dist/zbt1/install.html'),
76+
zbt1Install: resolve(__dirname, 'dist/zbt1/install/index.html'),
6677
improv: resolve(__dirname, 'dist/improv.html'),
6778
},
6879
},

0 commit comments

Comments
 (0)