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 #551

Merged
merged 10 commits into from
Apr 30, 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
1 change: 1 addition & 0 deletions apps/potlock/widget/Components/Banner.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ const Container = styled.div`
display: flex;
justify-content: center;
align-items: center;
overflow: hidden;
.text {
font-size: 22px;
font-weight: 500;
Expand Down
2 changes: 1 addition & 1 deletion apps/potlock/widget/Components/Nav.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const Nav = styled.div`
// left: 0;
width: 100%;
display: flex;
padding: 0 64px 0 64px;
padding: 0 40px;
justify-content: start;
align-items: center;
align-self: stretch;
Expand Down
92 changes: 64 additions & 28 deletions apps/potlock/widget/Components/NewHero.jsx
Original file line number Diff line number Diff line change
@@ -1,25 +1,32 @@
const Container = styled.div`
display: flex;
flex-direction: column;
`;

const HeroContainer = styled.div`
display: flex;
flex-direction: column;
position: relative;
width: 100%;
justify-content: center;
min-height: 400px;
border: 1px solid #f8d3b0;
border-radius: 12px;
overflow: hidden;
.background {
position: absolute;
pointer-events: none;
height: 100%;
left: 0;
top: 0;
left: 0px;
width: 100%;
top: 0px;
min-height: 600px;
}
.content {
position: relative;
z-index: 1;
display: flex;
flex-direction: column;
justify-content: center;
padding: 64px;
padding: 64px 40px;
}
.sub-title {
color: #dd3345;
Expand Down Expand Up @@ -70,7 +77,7 @@ const HeroContainer = styled.div`

@media only screen and (max-width: 768px) {
.content {
padding: 64px 20px;
padding: 48px 20px;
}
.title {
font-size: 36px;
Expand All @@ -93,26 +100,55 @@ const HeroContainer = styled.div`
}
`;

return (
<HeroContainer>
<HomeBannerBackground className="background" />
<div className="content">
<h3 className="sub-title">Transforming Funding for Public Goods</h3>
<h1 className="title">
Discover impact projects, donate directly, & <br className="line-break" /> participate in
funding rounds.
</h1>
<div className="btns">
<button onClick={donateRandomly} className="donate-btn">
Donate Randomly
</button>
const Line = styled.div`
width: 100%;
height: 1px;
background: #ebebeb;
margin-top: 1rem;
`;

const { HomeBannerStyle } = VM.require("potlock.near/widget/Pots.HomeBannerBackground") || {
HomeBannerStyle: {},
};
const { DonationStats } = VM.require("potlock.near/widget/Project.DonationStats") || {
DonationStats: () => {},
};

const NewHero = ({ isRegisteredProject, accountId, donateRandomly }) => {
return (
<Container>
<HeroContainer
style={{
...HomeBannerStyle,
}}
>
<div className="content">
<h3 className="sub-title">Transforming Funding for Public Goods</h3>
<h1 className="title">
Discover impact projects, donate directly, & <br className="line-break" /> participate
in funding rounds.
</h1>
<div className="btns">
<button onClick={donateRandomly} className="donate-btn">
Donate Randomly
</button>

<a
href={
isRegisteredProject ? `?tab=project&projectId=${accountId}` : "?tab=createproject"
}
>
{isRegisteredProject ? "View Your Project" : "Register Your Project"}
</a>
</div>
</div>
</HeroContainer>
<DonationStats />
<Line />
</Container>
);
};

<a
href={isRegisteredProject ? `?tab=project&projectId=${accountId}` : "?tab=createproject"}
>
{isRegisteredProject ? "View Your Project" : "Register Your Project"}
</a>
</div>
</div>
</HeroContainer>
);
return {
NewHero,
};
2 changes: 1 addition & 1 deletion apps/potlock/widget/ModalDonation/ConfirmPot.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ const pollForDonationSuccess = ({
for (const donation of alldonations) {
const { project_id, donated_at_ms, donated_at } = donation;
if (projectIds.includes(project_id) && (donated_at_ms || donated_at) > afterTs) {
donations[project_id] = donation;
donations[project_id] = { ...donation, potId };
}
}
if (Object.keys(donations).length === projectIds.length) {
Expand Down
12 changes: 7 additions & 5 deletions apps/potlock/widget/Pots/Deploy.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ const { ownerId } = VM.require("potlock.near/widget/constants") || {
ownerId: "",
};

const { HomeBannerBackground } = VM.require("potlock.near/widget/Pots.HomeBannerBackground") || {
HomeBannerBackground: () => {},
const { HomeBannerStyle } = VM.require("potlock.near/widget/Pots.HomeBannerBackground") || {
HomeBannerStyle: {},
};

const POT_CODE_LINK = "https://github.com/PotLock/core/tree/main/contracts/pot"; // for directing user to view source code for Pot
Expand Down Expand Up @@ -131,9 +131,11 @@ return props.deploymentSuccess || state.deploymentSuccess ? (
</SuccessContainer>
) : (
<Container>
<HeaderContainer>
<HomeBannerBackground className="background" />

<HeaderContainer
style={{
...HomeBannerStyle,
}}
>
<div className="content">
<h3 className="sub-title">Deploy pot</h3>
<h1 className="title">
Expand Down
2 changes: 1 addition & 1 deletion apps/potlock/widget/Pots/FlaggedAccounts.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,12 @@ const Title = styled.div`
const Table = styled.div`
display: flex;
flex-direction: column;
overflow-y: scroll;
width: 100%;
border-radius: 6px;
border: 1px solid #7b7b7b;
transition: max-height 400ms ease-in-out;
overflow: hidden;
overflow-y: scroll;
max-height: 1000px;
opacity: 1;
&.hidden {
Expand Down
28 changes: 16 additions & 12 deletions apps/potlock/widget/Pots/Home.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -96,25 +96,30 @@ if (!pots) {

const compareFunction = (pots) => {
const potsSort = {
cooldown: {
check: filters.cooldown,
time: "cooldown_end_ms",
},
active: {
check: filters.round_open,
time: "public_round_end_ms",
items: [],
},
cooldown: {
check: filters.cooldown,
time: "cooldown_end_ms",
items: [],
},
application: {
check: filters.application_open,
time: "application_end_ms",
items: [],
},
not_started: {
check: filters.application_not_started,
time: "application_start_ms",
items: [],
},
rest: {
check: (round) => true,
time: "application_start_ms",
items: [],
},
};

Expand All @@ -124,9 +129,10 @@ const compareFunction = (pots) => {
const states = Object.keys(potsSort);

pots.forEach((pot) => {
Object.values(potsSort).some((sort, idx) => {
if (sort.check(pot)) {
listOfPots[states[idx]] = [...(listOfPots[states[idx]] || []), pot];
Object.keys(potsSort).some((type) => {
const { check, items } = potsSort[type];
if (check(pot)) {
potsSort[type].items = [...items, pot];
return true;
}
});
Expand All @@ -135,11 +141,10 @@ const compareFunction = (pots) => {
// sort pots(time left)
const inProgressPots = [];

Object.entries(listOfPots).forEach(([status, potsList]) => {
potsList.sort((a, b) => a[potsSort[status].time] - b[potsSort[status].time]);
inProgressPots.push(...potsList);
Object.values(potsSort).forEach(({ items, time }) => {
items.sort((a, b) => a[time] - b[time]);
inProgressPots.push(...items);
});

return inProgressPots;
};

Expand Down Expand Up @@ -245,7 +250,6 @@ const handleFilter = (selected) => {

const filteredRounds = [...inProgressRounds].filter((round) =>
selectedList.some((key) => {
console.log("key", key);
return filters[key](round) === true;
})
);
Expand Down
12 changes: 7 additions & 5 deletions apps/potlock/widget/Pots/HomeBanner.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ const { canDeploy, hrefWithParams } = props;
const { ownerId } = VM.require("potlock.near/widget/constants") || {
ownerId: "",
};
const { HomeBannerBackground } = VM.require("potlock.near/widget/Pots.HomeBannerBackground") || {
HomeBannerBackground: () => {},
const { HomeBannerStyle } = VM.require("potlock.near/widget/Pots.HomeBannerBackground") || {
HomeBannerStyle: {},
};

const Container = styled.div`
Expand Down Expand Up @@ -101,9 +101,11 @@ const Container = styled.div`
`;

return (
<Container>
<HomeBannerBackground className="background" />

<Container
style={{
...HomeBannerStyle,
}}
>
<div className="content">
<h3 className="sub-title">Explore Pots</h3>
<h1 className="title">
Expand Down
Loading
Loading