diff --git a/apps/potlock/widget/Components/Donors.jsx b/apps/potlock/widget/Components/Donors.jsx index 3673765..469e21c 100644 --- a/apps/potlock/widget/Components/Donors.jsx +++ b/apps/potlock/widget/Components/Donors.jsx @@ -223,7 +223,7 @@ const [allDonations, totalsByDonor, sortedDonations] = useMemo(() => { accumulator[currentDonation.donor_id] = { amount: (accumulator[currentDonation.donor_id].amount || 0) + - calcNetDonationAmount(currentDonation), + (currentDonation.ft_id === "near" ? calcNetDonationAmount(currentDonation) : 0), ...currentDonation, }; return accumulator; diff --git a/apps/potlock/widget/Components/DonorsTrx.jsx b/apps/potlock/widget/Components/DonorsTrx.jsx index 8da0e6b..fbaff24 100644 --- a/apps/potlock/widget/Components/DonorsTrx.jsx +++ b/apps/potlock/widget/Components/DonorsTrx.jsx @@ -11,7 +11,7 @@ const nearLogo = const { ownerId } = VM.require("potlock.near/widget/constants"); -const { getTimePassed, _address, calcNetDonationAmount, reverseArr } = VM.require( +const { getTimePassed, _address, reverseArr } = VM.require( `potlock.near/widget/Components.DonorsUtils` ); @@ -140,6 +140,10 @@ const ProfileImg = ({ address }) => ( ); +const NEAR_DECEMIALS = 24; + +const calcNetDonationAmount = (amount, decimals) => Big(amount).div(Big(`1e${decimals}`)); + return allDonations.length ? ( @@ -152,8 +156,25 @@ return allDonations.length ? ( {reverseArr(allDonations) .slice((currentPage - 1) * perPage, currentPage * perPage) .map((donation) => { - const { donor_id, recipient_id, donated_at_ms, donated_at, project_id } = donation; + const { + donor_id, + recipient_id, + donated_at_ms, + donated_at, + project_id, + ft_id, + total_amount, + } = donation; const projectId = recipient_id || project_id; + const isNear = ft_id === "near"; + + const frMetaDate = !isNear ? Near.view(ft_id, "ft_metadata", {}) : null; + const assetIcon = isNear ? nearLogo : frMetaDate.icon; + + const decimals = isNear ? NEAR_DECEMIALS : frMetaDate.decimals; + + console.log("decimals", decimals); + return ( - - {calcNetDonationAmount(donation).toFixed(2)} + + + {decimals ? calcNetDonationAmount(total_amount, decimals).toFixed(2) : "-"} {getTimePassed(donated_at_ms || donated_at)} ago diff --git a/apps/potlock/widget/Pots/Applications.jsx b/apps/potlock/widget/Pots/Applications.jsx index 53f3e5e..c4492bc 100644 --- a/apps/potlock/widget/Pots/Applications.jsx +++ b/apps/potlock/widget/Pots/Applications.jsx @@ -19,6 +19,8 @@ const { getTimePassed, _address } = VM.require(`${ownerId}/widget/Components.Don _address: (address) => address, }; +const MAX_APPLICATION_MESSAGE_LENGTH = 1000; + const applications = PotSDK.getApplications(potId); const getApplicationCount = (sortVal) => { diff --git a/apps/potlock/widget/Pots/Header.jsx b/apps/potlock/widget/Pots/Header.jsx index 1108b84..2cdacfe 100644 --- a/apps/potlock/widget/Pots/Header.jsx +++ b/apps/potlock/widget/Pots/Header.jsx @@ -65,12 +65,13 @@ const applicationExists = existingApplication || applicationSuccess; const now = Date.now(); const publicRoundOpen = now >= public_round_start_ms && now < public_round_end_ms; +const publicRoundEnded = now > public_round_end_ms; const applicationOpen = now >= application_start_ms && now < application_end_ms; const canApply = applicationOpen && !applicationExists && !userIsChefOrGreater; -const canPayoutsBeSet = userIsChefOrGreater && !cooldown_end_ms && !all_paid_out; +const canPayoutsBeSet = userIsChefOrGreater && !all_paid_out && publicRoundEnded; const canPayoutsBeProcessed = userIsAdminOrGreater && now >= cooldown_end_ms && !all_paid_out; @@ -155,6 +156,7 @@ const Fund = styled.div` `; const ButtonsWrapper = styled.div` display: flex; + flex-wrap: wrap; gap: 2rem; a, button { diff --git a/apps/potlock/widget/Pots/Sponsors.jsx b/apps/potlock/widget/Pots/Sponsors.jsx index 39f3286..cb21c6e 100644 --- a/apps/potlock/widget/Pots/Sponsors.jsx +++ b/apps/potlock/widget/Pots/Sponsors.jsx @@ -61,12 +61,6 @@ const Container = styled.div` } `; -const OuterTextContainer = styled.div` - display: flex; - flex-direction: row; - gap: 10px; -`; - const TableContainer = styled.div` display: flex; flex-direction: column; @@ -76,76 +70,6 @@ const TableContainer = styled.div` padding-bottom: 1rem; `; -const Header = styled.div` - display: flex; - flex-direction: row; - align-items: center; - justify-content: space-between; - background: #f6f5f3; - width: 100%; -`; - -const HeaderItem = styled.div` - display: flex; - flex-direction: row; - align-items: space-between; - justify-content: flex-start; - padding: 10px 20px; - width: 24%; - @media screen and (min-width: 390px) and (max-width: 768px) { - padding: 10px 15px; - } - @media screen and (max-width: 390px) { - padding: 10px; - } -`; - -const HeaderItemText = styled.div` - color: #292929; - font-size: 14px; - font-weight: 600; - line-height: 24px; - @media screen and (max-width: 390px) { - font-size: 12px; - } -`; - -const Row = styled.div` - display: flex; - flex-direction: row; - align-items: center; - justify-content: space-between; - width: 100%; -`; - -const RowItem = styled.div` - display: flex; - flex-direction: row; - align-items: center; - justify-content: flex-start; - gap: 20px; - padding: 20px; - width: 24%; - @media screen and (min-width: 390px) and (max-width: 768px) { - padding: 10px 15px; - gap: 10px; - } - @media screen and (max-width: 390px) { - padding: 10px; - gap: 0px; - } -`; - -const RowText = styled.div` - color: #292929; - font-size: 14px; - font-weight: 400; - line-height: 24px; - @media screen and (max-width: 390px) { - font-size: 12px; - } -`; - const { base_currency } = potDetail; const maxRowItemLength = 14; diff --git a/apps/potlock/widget/Project/ListPage.jsx b/apps/potlock/widget/Project/ListPage.jsx index 92f0aad..7586d34 100644 --- a/apps/potlock/widget/Project/ListPage.jsx +++ b/apps/potlock/widget/Project/ListPage.jsx @@ -507,7 +507,7 @@ const [projects, approvedProjects] = useMemo(() => { return [allRegistrations, approvedProjects]; }, allRegistrations); -const featuredProjectIds = ["magicbuild.near", "potlock.near", "yearofchef.near"]; +const featuredProjectIds = ["v1.foodbank.near", "potlock.near", "yearofchef.near"]; const featuredProjects = useMemo( () => projects.filter((project) => featuredProjectIds.includes(project.registrant_id)), projects