-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2db0e3f
commit 2f6ce31
Showing
3 changed files
with
81 additions
and
3 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
73 changes: 73 additions & 0 deletions
73
packages/nextjs/app/nft-storage/_components/SpaceEnsurerCopy.tsx
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,73 @@ | ||
// import React, { ReactNode, useEffect, useState } from "react"; | ||
// import { Loader } from "./Loader"; | ||
// import { useW3 } from "@w3ui/react"; | ||
// import { v4 as uuidv4 } from "uuid"; | ||
|
||
// export function SpaceEnsurerCopy({ | ||
// did, | ||
// children, | ||
// }: { | ||
// did: `did:${string}:${string}`; | ||
// children: ReactNode; | ||
// }): ReactNode { | ||
// const [selectedDid, setSelectedDid] = useState<`did:${string}:${string}`>(); | ||
|
||
// const [{ client }] = useW3(); | ||
// useEffect( | ||
// function () { | ||
// async function ensureCurrentSpace(): Promise<void> { | ||
// if (client != null && client.currentSpace() == null) { | ||
// if (did) await client?.setCurrentSpace(did); | ||
// // const space = client.spaces().length > 0 ? client.spaces()[0] : await client.createSpace("example space"); | ||
// // if (space != null) { | ||
// // await client.setCurrentSpace(space.did()); | ||
// // } | ||
// } | ||
// } | ||
// void ensureCurrentSpace(); | ||
// }, | ||
// [client], | ||
// ); | ||
|
||
// let output; | ||
|
||
// if (client != null) { | ||
// if (client.currentSpace() == null) { | ||
// // output = ( | ||
// // <> | ||
// // <input | ||
// // type="text" | ||
// // id="first_name" | ||
// // className="bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500" | ||
// // placeholder="Scaffold NFT" | ||
// // required | ||
// // onChange={(event: any) => { | ||
// // // onChange(event.target.value); | ||
// // }} | ||
// // />{" "} | ||
// // <button | ||
// // type="submit" | ||
// // onClick={async () => { | ||
// // console.log(client.currentSpace()); | ||
// // if (client.currentSpace() === undefined) { | ||
// // const newSpace = await client?.createSpace(uuidv4()); | ||
// // console.log(newSpace); | ||
// // await client.setCurrentSpace(newSpace.did()); | ||
// // console.log(newSpace); | ||
// // } | ||
// // }} | ||
// // className="btn btn-primary m-1" | ||
// // > | ||
// // Upload | ||
// // </button> | ||
// // </> | ||
// // ); | ||
// } else { | ||
// output = children; | ||
// } | ||
// } else { | ||
// output = <Loader />; | ||
// } | ||
|
||
// return output; | ||
// } |
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