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

Commit

Permalink
fix: remove npub from the form
Browse files Browse the repository at this point in the history
  • Loading branch information
abhiShandy committed Mar 23, 2023
1 parent 35f2d0e commit b719259
Showing 1 changed file with 1 addition and 47 deletions.
48 changes: 1 addition & 47 deletions client/src/lib/molecules/AddProductForm.tsx
@@ -1,7 +1,5 @@
import { ArrowUpTrayIcon } from "@heroicons/react/24/outline";
import { SubmitHandler, useForm } from "react-hook-form";
import { encodeBytes } from "../../routes/utils/nostr";
import { SecondaryButton } from "../atoms/Button";

export type AddProduct = {
title: string;
Expand All @@ -22,24 +20,7 @@ export default function AddProductForm({
onSubmit: SubmitHandler<AddProduct>;
isLoading: boolean;
}) {
const { register, handleSubmit, setValue } = useForm<AddProduct>();

const importNpub = async () => {
//@ts-ignore
if (!window.nostr) {
alert(
"NOSTR extension not found. If you use Alby, please setup NOSTR in the your account."
);
return;
}
try {
//@ts-ignore
const pubkey_hex = await window.nostr.getPublicKey();
setValue("npub", encodeBytes("npub", pubkey_hex));
} catch (error) {
console.log(error);
}
};
const { register, handleSubmit } = useForm<AddProduct>();

return (
<form
Expand Down Expand Up @@ -191,33 +172,6 @@ export default function AddProductForm({
Combine multiple files into a ZIP file.
</p>
</div>

<div className="sm:col-span-6">
<label
htmlFor="npub"
className="block text-sm font-medium leading-6 text-gray-900"
>
NOSTR public key
</label>
<div className="mt-2 flex rounded-md shadow-sm">
<input
type="text"
{...register("npub", {
required: true,
disabled: isLoading,
})}
id="npub"
autoComplete="npub"
className="block w-full rounded-md border-0 mr-2 text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-gray-600 sm:py-1.5 sm:text-sm sm:leading-6"
placeholder="npub..."
/>
<SecondaryButton onClick={importNpub}>Import</SecondaryButton>
</div>
<p className="mt-2 text-sm text-gray-500">
You can either paste your NOSTR public key or import it from a
browser extension.
</p>
</div>
</div>
</div>
</div>
Expand Down

0 comments on commit b719259

Please sign in to comment.