Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugs fix #521

Merged
merged 7 commits into from
Apr 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions apps/potlock/widget/ModalDonation/Form.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@ const { AmountInput } = VM.require(`potlock.near/widget/ModalDonation.AmountInpu
AmountInput: () => {},
};
const { Checks } = VM.require(`potlock.near/widget/ModalDonation.Checks`) || {
CheckBox: () => {},
Checks: () => {},
};
const { Nadabot, Alert } = VM.require(`potlock.near/widget/ModalDonation.Banners`) || {
CheckBox: () => {},
Nadabot: () => {},
Alert: () => {},
};

const PotSDK = VM.require("potlock.near/widget/SDK.pot") || {
Expand Down
4 changes: 2 additions & 2 deletions apps/potlock/widget/ModalDonation/FormPot.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const { ownerId, NADABOT_HUMAN_METHOD } = VM.require("potlock.near/widget/consta
const { nearToUsd } = VM.require("potlock.near/widget/utils");

const { Checks } = VM.require(`potlock.near/widget/ModalDonation.Checks`) || {
CheckBox: () => {},
Checks: () => {},
};

const { AmountInput } = VM.require(`potlock.near/widget/ModalDonation.AmountInput`) || {
Expand All @@ -18,7 +18,7 @@ const { _address } = VM.require(`potlock.near/widget/Components.DonorsUtils`) ||
};

const { Alert } = VM.require(`potlock.near/widget/ModalDonation.Banners`) || {
CheckBox: () => {},
Alert: () => {},
};

const Form = styled.div`
Expand Down
15 changes: 15 additions & 0 deletions apps/potlock/widget/Pots/Card.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ const applicationNotStarted = now < application_start_ms;
const applicationOpen = now >= application_start_ms && now < application_end_ms;
const publicRoundNotStarted = now < public_round_start_ms;
const publicRoundOpen = now >= public_round_start_ms && now < public_round_end_ms;
const cooldownPending = public_round_end_ms && now >= public_round_end_ms && !cooldown_end_ms;
const cooldownOpen = now >= public_round_end_ms && now < cooldown_end_ms;
const payoutsPending = cooldown_end_ms && now >= cooldown_end_ms && !all_paid_out;
const payoutsCompleted = all_paid_out;
Expand Down Expand Up @@ -166,6 +167,20 @@ const tags = [
},
visibility: publicRoundOpen,
},
/* Cooldown pending tag */
{
backgroundColor: "#F5F3FF",
borderColor: "#A68AFB",
textColor: "#2E0F66",
text: "Cooldown pending",
textStyle: { fontWeight: 500, marginLeft: "8px" },
preElementsProps: {
colorOuter: "#EDE9FE",
colorInner: "#A68AFB",
animate: true,
},
visibility: cooldownPending,
},
/* Matching round cooldown tag */
{
backgroundColor: "#F5F3FF",
Expand Down
4 changes: 3 additions & 1 deletion apps/potlock/widget/Pots/HeaderStatus.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ const {
cooldown_end_ms,
all_paid_out,
} = potDetail;
console.log(potDetail);

const now = Date.now();

Expand Down Expand Up @@ -233,7 +234,8 @@ return (
<ProgressBar progress={progress} started={started} completed={completed} />
<div>
{label}
{started && !completed && (
{!daysLeft && started && <span>pending </span>}
{started && !completed && daysLeft && (
<span>
ends in
<Widget
Expand Down
31 changes: 19 additions & 12 deletions apps/potlock/widget/Pots/Payouts.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ const MobileAmount = styled.div`
font-weight: 600;
}
@media screen and (max-width: 768px) {
order: 2;
display: block;
}
`;
Expand All @@ -151,10 +152,10 @@ const Row = styled.div`
opacity: 0;
display: none;
}
.toggle-check:checked + svg {
.toggle-check:checked ~ svg {
rotate: 0deg;
}
.toggle-check:checked + svg + ${MobileAmount} {
.toggle-check:checked + ${MobileAmount} {
max-height: 100px;
}
@media screen and (max-width: 768px) {
Expand Down Expand Up @@ -212,8 +213,14 @@ const RowText = styled.div`
color: #7b7b7b;
font-weight: 600;
display: none;
@media screen and (max-width: 768px) {
display: inline-block;
}
@media screen and (max-width: 768px) {
span {
display: inline;
}
&:last-of-type {
display: flex;
gap: 4px;
}
}
`;
Expand Down Expand Up @@ -353,7 +360,7 @@ const searchPayouts = (searchTerm) => {
return filteredPayouts;
};

const MAX_ACCOUNT_ID_DISPLAY_LENGTH = 20;
const MAX_ACCOUNT_ID_DISPLAY_LENGTH = 10;

const ProfileImage = ({ projectId }) => (
<Widget
Expand Down Expand Up @@ -459,13 +466,10 @@ return (
</a>
</RowItem>
{/* Total Raised */}
<RowItem>
<RowText>
{yoctosToNear(matchingAmount, true)} <span>Allocated</span>{" "}
</RowText>
<RowItem className="amount">
<RowText>{yoctosToNear(totalAmount, true)}</RowText>
</RowItem>
<input type="checkbox" className="toggle-check" />
<ArrowDown />
<MobileAmount>
<span>{yoctosToNear(totalAmount, true)}</span> raised from
<span>{donorCount}</span> unique donors
Expand All @@ -475,9 +479,12 @@ return (
<RowText>{donorCount}</RowText>
</RowItem>
{/* Matching Pool Allocation */}
<RowItem className="amount">
<RowText>{yoctosToNear(matchingAmount, true)}</RowText>
<RowItem>
<RowText>
{yoctosToNear(matchingAmount, true)} <span>Allocated</span>
</RowText>
</RowItem>
<ArrowDown />
</Row>
);
})
Expand Down
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 || {}) && !registration)
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
26 changes: 23 additions & 3 deletions apps/potlock/widget/Project/ExternalFunding.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,17 @@ const Container = styled.div`
justify-content: right;
}
}
.investor {
display: flex;
flex-direction: column;
div:first-of-type {
font-weight: 600;
}
}
.mobile-date {
display: none;
color: #7b7b7b;
}
.amount {
font-weight: 600;
display: flex;
Expand Down Expand Up @@ -87,8 +98,14 @@ const Container = styled.div`
}
@media screen and (max-width: 920px) {
gap: 8px;
div {
max-width: initial;
}
.date {
order: 2;
display: none;
}
.mobile-date {
display: block;
}
.description {
flex-basis: 100%;
Expand All @@ -109,7 +126,7 @@ const Container = styled.div`
.toggle-check:checked + .description {
max-height: 200px;
}
.toggle-check:checked + .description + .amount svg {
.toggle-check:checked ~ div svg {
rotate: 0deg;
}
}
Expand Down Expand Up @@ -179,7 +196,10 @@ return (
</div>
{externalFunding.map(({ investorName, description, date, amountReceived, denomination }) => (
<div className="funding-row">
<div style={{ fontWeight: 600 }}>{investorName}</div>
<div className="investor">
<div>{investorName}</div>
{date && <div className="date-mobile">{date}</div>}
</div>
<input type="checkbox" className="toggle-check" />
<div className="description">{description}</div>
<div className="date">{date ?? "No specified date"}</div>
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
Loading