-
-
Notifications
You must be signed in to change notification settings - Fork 167
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Replace ESP install component (#618)
* Remove the ESP install component code * Add esp-web-tools NPM package * Remove esp-web-tools NPM package * Add js script to Docusaurus * Refactor component code * Small refactor on global declare * Rename the file and component
- Loading branch information
1 parent
98c8188
commit d58ccab
Showing
4 changed files
with
41 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -170,7 +170,7 @@ const config: Config = { | |
indexPages: true, | ||
}, | ||
] | ||
] | ||
], | ||
}; | ||
|
||
export default config; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import Head from "@docusaurus/Head"; | ||
import React from "react"; | ||
import useBaseUrl from "@docusaurus/useBaseUrl"; | ||
|
||
/** | ||
* Extend JSX.IntrinsicElements to include the custom element | ||
*/ | ||
declare global { | ||
namespace JSX { | ||
interface IntrinsicElements { | ||
"esp-web-install-button": React.DetailedHTMLProps< | ||
React.HTMLAttributes<HTMLElement>, | ||
HTMLElement | ||
> & { manifest: string }; | ||
} | ||
} | ||
} | ||
|
||
/** | ||
* Load the ESP Web Tools script and handle potential errors during loading | ||
*/ | ||
const loadEspWebToolsScript = () => ( | ||
<script | ||
type="module" | ||
src="https://unpkg.com/esp-web-tools@10/dist/web/install-button.js?module" | ||
onError={(e) => console.error("Failed to load esp-web-tools script", e)} | ||
/> | ||
); | ||
|
||
export default function ESPHomeButton() { | ||
const manifestUrl = useBaseUrl("/home-assistant-glow/manifest.json"); | ||
return ( | ||
<> | ||
<Head>{loadEspWebToolsScript()}</Head> | ||
<esp-web-install-button manifest={manifestUrl}></esp-web-install-button> | ||
</> | ||
); | ||
} |
This file was deleted.
Oops, something went wrong.