diff --git a/lib/plugins/loader/plugin.ts b/lib/plugins/loader/plugin.ts index b19f47b2..5043620e 100644 --- a/lib/plugins/loader/plugin.ts +++ b/lib/plugins/loader/plugin.ts @@ -22,18 +22,18 @@ export const loader = ({ export default function(_) { const loader = document.getElementById("__loader"); const rules = loader.sheet.rules[0]; - window.showLoader = () => { + globalThis.showLoader = () => { rules.style.display = "block"; rules.style.animation = "${ANIMATION}"; }; - window.hideLoader = () => { + globalThis.hideLoader = () => { rules.style.animationDuration = ".3s"; setTimeout(() => { rules.style.display = "none"; rules.style.animation = "none"; }, 300); }; - window.addEventListener('load', hideLoader); + globalThis.addEventListener('load', hideLoader); } `; return { diff --git a/lib/plugins/toolbar/islands/netzo-toolbar.tsx b/lib/plugins/toolbar/islands/netzo-toolbar.tsx index 13da3f0f..6deeb143 100644 --- a/lib/plugins/toolbar/islands/netzo-toolbar.tsx +++ b/lib/plugins/toolbar/islands/netzo-toolbar.tsx @@ -1,7 +1,6 @@ // @deno-types="npm:@types/react@18.2.60" import * as React from "react"; -import { useSignal } from "@preact/signals"; import type { ComponentChildren } from "preact"; // import { ButtonDarkMode } from "../../components/button-dark-mode.tsx"; import { Button } from "../../../components/button.tsx"; @@ -162,7 +161,7 @@ export type Issue = { }; export function DialogFeedbackNetzolabs(props: { state: NetzoState; children: ComponentChildren }) { - const open = useSignal(false); + const [open, setOpen] = React.useState(false); const { locale = "es" } = props.state?.toolbar ?? {}; @@ -192,7 +191,7 @@ export function DialogFeedbackNetzolabs(props: { state: NetzoState; children: Co body: JSON.stringify(data), }); form.reset(); - open.value = false; + setOpen(false); }; // NOTE: must manually invoke submit because submit button isteleported @@ -201,11 +200,11 @@ export function DialogFeedbackNetzolabs(props: { state: NetzoState; children: Co // it is important to have an uncontrolled input (i.e. without value prop). // see https://github.com/shadcn-ui/ui/discussions/2137#discussioncomment-7907793 return ( - !open.value && (open.value = value)}> + !open && setOpen(value)}> {props.children} - open.value = false}> + setOpen(false)}> {i18n.dialogFeedbackNetzolabs.title} diff --git a/lib/storage/mod.ts b/lib/storage/mod.ts index b81c9b95..61869771 100644 --- a/lib/storage/mod.ts +++ b/lib/storage/mod.ts @@ -17,7 +17,7 @@ export type StorageOptions = { */ export const storage = ({ apiKey = Deno.env.get("NETZO_API_KEY")!, - baseURL = IS_BROWSER ? window.location.origin : "https://api.netzo.io", + baseURL = IS_BROWSER ? globalThis.location.origin : "https://api.netzo.io", }: StorageOptions = {}) => { const api = netzo({ apiKey, baseURL });