Skip to content
This repository has been archived by the owner on Sep 22, 2024. It is now read-only.

Commit

Permalink
chore: minor updates
Browse files Browse the repository at this point in the history
  • Loading branch information
miguelrk committed Jul 9, 2024
1 parent 08493f2 commit 3434292
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
6 changes: 3 additions & 3 deletions lib/plugins/loader/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
9 changes: 4 additions & 5 deletions lib/plugins/toolbar/islands/netzo-toolbar.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// @deno-types="npm:@types/[email protected]"
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";
Expand Down Expand Up @@ -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 ?? {};

Expand Down Expand Up @@ -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
Expand All @@ -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 (
<Dialog open={open.value} onOpenChange={(value) => !open.value && (open.value = value)}>
<Dialog open={open} onOpenChange={(value) => !open && setOpen(value)}>
<DialogTrigger asChild>
{props.children}
</DialogTrigger>
<DialogContentControlled className="sm:max-w-[425px]" onClickClose={() => open.value = false}>
<DialogContentControlled className="sm:max-w-[425px]" onClickClose={() => setOpen(false)}>
<DialogHeader>
<DialogTitle>{i18n.dialogFeedbackNetzolabs.title}</DialogTitle>
<DialogDescription>
Expand Down
2 changes: 1 addition & 1 deletion lib/storage/mod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 });

Expand Down

0 comments on commit 3434292

Please sign in to comment.