Skip to content

Commit

Permalink
import project without wallet
Browse files Browse the repository at this point in the history
  • Loading branch information
ankushKun committed May 24, 2024
1 parent cea84bd commit 63b07cf
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
3 changes: 3 additions & 0 deletions next_app/src/components/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
3 changes: 2 additions & 1 deletion next_app/src/components/settings-tab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down Expand Up @@ -78,7 +79,7 @@ export default function SettingsTab() {
}

useEffect(() => {
fetchProcesses();
fetchProcesses()
}, []);

async function setProcess() {
Expand Down
14 changes: 6 additions & 8 deletions next_app/src/pages/import.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit 63b07cf

Please sign in to comment.