From 63b07cf4cec601d97f47c55d501d92e12a62bb06 Mon Sep 17 00:00:00 2001 From: ankushKun Date: Sat, 25 May 2024 04:06:22 +0530 Subject: [PATCH] import project without wallet --- next_app/src/components/layout.tsx | 3 +++ next_app/src/components/settings-tab.tsx | 3 ++- next_app/src/pages/import.tsx | 14 ++++++-------- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/next_app/src/components/layout.tsx b/next_app/src/components/layout.tsx index dd2aec7..e1ea366 100644 --- a/next_app/src/components/layout.tsx +++ b/next_app/src/components/layout.tsx @@ -562,6 +562,9 @@ export default function Layout() { const files = p.files; globalState.setActiveProject(open as string); if (Object.keys(files).length > 0) globalState.setActiveFile(files[Object.keys(files)[0]].name); + // reset query params + router.push({ query: {} }) + // globalState.setActiveProject(open as string) // const files = projectManager.projects[open as string].files // console.log(files) diff --git a/next_app/src/components/settings-tab.tsx b/next_app/src/components/settings-tab.tsx index 6126f58..85ac6c5 100644 --- a/next_app/src/components/settings-tab.tsx +++ b/next_app/src/components/settings-tab.tsx @@ -44,6 +44,7 @@ export default function SettingsTab() { async function fetchProcesses() { + if (!window.arweaveWallet) return const client = new GraphQLClient("https://arweave.net/graphql"); const address = await window.arweaveWallet.getActiveAddress(); @@ -78,7 +79,7 @@ export default function SettingsTab() { } useEffect(() => { - fetchProcesses(); + fetchProcesses() }, []); async function setProcess() { diff --git a/next_app/src/pages/import.tsx b/next_app/src/pages/import.tsx index 2b979f8..f37b029 100644 --- a/next_app/src/pages/import.tsx +++ b/next_app/src/pages/import.tsx @@ -31,20 +31,18 @@ export default function Import() { const data = JSON.parse(`${decodeURIComponent(r.Messages[0].Data)}`) console.log(data) + let owner = "" try { if (!window.arweaveWallet) - return toast({ - title: "No Arweave wallet found", - description: "You might want to install ArConnect extension to import the project", - }); - - await window.arweaveWallet.getActiveAddress() + owner = "" + else + owner = window.arweaveWallet.getActiveAddress() } catch (e) { await window.arweaveWallet.connect(["ACCESS_ADDRESS", "SIGN_TRANSACTION"]) + owner = await window.arweaveWallet.getActiveAddress() } - const ownerWallet = await window.arweaveWallet.getActiveAddress() - data.ownerWallet = ownerWallet + data.ownerWallet = owner projectManager.newProject(data) window.location.href = "/?open=" + data.name }