Skip to content

Commit

Permalink
enable donation for none registerd projects
Browse files Browse the repository at this point in the history
  • Loading branch information
M-Rb3 committed Apr 8, 2024
1 parent 2f8f5e3 commit 8a0911c
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
14 changes: 10 additions & 4 deletions apps/potlock/widget/Project/Detail.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,16 @@ const BannerSkeleton = () => (
</SkeletonContainer>
);

if (registration === null) return <BannerSkeleton />;
if (registration == undefined) {
return <div style={{ marginTop: "1rem", fontSize: "1.5rem" }}>Project not found</div>;
}
const account = fetch("https://api3.nearblocks.io/v1/account/" + projectId);

if (registration === null || account === null) return <BannerSkeleton />;

const isObjectNotEmpty = (obj) => Object.keys(obj).length > 0;

const addressExist = account?.body?.account[0];

if (!isObjectNotEmpty(addressExist || {}))
return <div style={{ marginTop: "1rem", fontSize: "1.5rem" }}>Account does not exist.</div>;

const [directDonations, setDirectDonations] = useState(null);
// mapping of pot IDs to array of Round Matching Donations for the project
Expand Down
8 changes: 7 additions & 1 deletion apps/potlock/widget/Project/ProjectBanner.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,14 @@ const statuses = {
textColor: "#F6F5F3",
toggleColor: "#C7C7C7",
},
Unregistered: {
background: "#DD3345",
text: "UNREGISTERED: This account has not registered as a public good",
textColor: "#F6F5F3",
toggleColor: "#C7C7C7",
},
};
const registrationStatus = statuses[registration.status];
const registrationStatus = registration ? statuses[registration.status] : statuses.Unregistered;

const Banner = styled.div`
width: 100%;
Expand Down

0 comments on commit 8a0911c

Please sign in to comment.