From 95ba02bfb85d5b4fc49b3b6a2696d278fdb6349d Mon Sep 17 00:00:00 2001 From: Nicolas Brugneaux Date: Mon, 25 Nov 2024 16:59:30 +0100 Subject: [PATCH 1/6] feat: show tips in case there's no possible withdrawal --- src/features/locking/LockForm.tsx | 17 +++++++++++++++++ .../transactions/TransactionConfirmation.tsx | 2 +- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/features/locking/LockForm.tsx b/src/features/locking/LockForm.tsx index cf130cd..f65e3ce 100644 --- a/src/features/locking/LockForm.tsx +++ b/src/features/locking/LockForm.tsx @@ -82,6 +82,9 @@ export function LockForm({ return validateForm(values, lockedBalances, walletBalance, stakeBalances, isVoting); }; + const shouldShowWithdrawalTip = lockedBalances?.pendingFree === 0n && lockedBalances?.locked > 0n; + const isUnstaking = lockedBalances && lockedBalances.pendingBlocked > 0n; + return ( initialValues={{ @@ -102,6 +105,20 @@ export function LockForm({ Lock CELO to begin. )} + {values.action === LockActionType.Withdraw && shouldShowWithdrawalTip && ( + + You currently have no available unlocked CELO. Unstaking takes 3 days.{' '} + {isUnstaking && ( + <> +
+ + You are currently unlocking {fromWeiRounded(lockedBalances.pendingBlocked)}{' '} + CELO. + + + )} +
+ )} (
{label}
-
{value}
+
{value}
))}
From c705dbcea782670fe3b0adc9fb21a15318e8754b Mon Sep 17 00:00:00 2001 From: Nicolas Brugneaux Date: Mon, 25 Nov 2024 17:06:03 +0100 Subject: [PATCH 2/6] fix: wording --- src/features/locking/LockForm.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/features/locking/LockForm.tsx b/src/features/locking/LockForm.tsx index f65e3ce..461a497 100644 --- a/src/features/locking/LockForm.tsx +++ b/src/features/locking/LockForm.tsx @@ -107,7 +107,7 @@ export function LockForm({ )} {values.action === LockActionType.Withdraw && shouldShowWithdrawalTip && ( - You currently have no available unlocked CELO. Unstaking takes 3 days.{' '} + You currently have no available unlocked CELO. Unlocking takes 3 days.{' '} {isUnstaking && ( <>
From acc42f7402c00cf4a6bbc3886676756cb9b83a7e Mon Sep 17 00:00:00 2001 From: Nicolas Brugneaux Date: Tue, 26 Nov 2024 10:54:53 +0100 Subject: [PATCH 3/6] feat: add superbridge on l2 [Closes #97] --- public/logos/superbridge.jpg | Bin 0 -> 5005 bytes src/app/bridge/page.tsx | 17 ++++++++++++++--- src/features/account/hooks.ts | 16 +++++++++++++++- 3 files changed, 29 insertions(+), 4 deletions(-) create mode 100644 public/logos/superbridge.jpg diff --git a/public/logos/superbridge.jpg b/public/logos/superbridge.jpg new file mode 100644 index 0000000000000000000000000000000000000000..c1775bb39bd1759ba7e38a0155e7d585a5f2a18e GIT binary patch literal 5005 zcmbtX2|QI@*WY(AX2=v}xaN7DOSwvBB83n)Gl`q|dfnWILTL~llwMR)Ps5W$t|@br zq70dZOQa0=d;iZmYwf+(+H0MC4ttnA4Z5swVZi`6 zIRSM505{--2?GR#V9)_zy8y=)2EZLA`4juXRR5BJ0{|EKC7%%nkblWTV{Vb{U-v(H zuB!lWK^&y6zP?^I><5Oy5#Z*3^YwIfZ^C|!coY6}#K4<~U-%B^Uou;hY&L8X{HC3y zCC0_o+1k$03cw)y;a5)uM8qI<0f>lekgg`gjRP?t2c(F@|1toGP>dx$oc4?M+nNUf zweVmlJ6G=k!0!ow2o!5x@Bi=fAMu99-W(s44gqj92>{1#0InATpbX6?c$_^3&OvFp zNpR>yz~OKN5&;pC1Gz~YoE%%k`4@3*5%(tX{G=^yI2;L`Je(YyKl%SLU{63*#Kmp~ zLfjw_1R`Ma04@YW2*KFxu-ni&aBLX}+jL`-AUh$$xVU+Ew`~V-7yp(kfH z3l}NGAuOl2pHt+pAD4WTsD4WJEpCMa6)j?}y<|lL|L9a6-W}o+J9jB5tEj4}8yXp# znC{+VdCLc>nR#Ky%Z;1d6F_FP(e#`z1GIk~^*2V70Kg{J9B_gk%!Yz6r z`&LB@kAi_KS`}mnfI$m}5CUkx9KM~Y z!35@0s<$)2-(Bo?KSk6IRGuzH+fy*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;Frrl?#FQ$eUR@Y

Bridge to Celo

- {BRIDGES.map((bridge) => ( + {BRIDGES.filter((x) => (x.cel2Only ? isCel2 : true)).map((bridge) => ( ))} - {/*

+

These bridges are independent, third-party service providers.
Celo assumes no responsibility for their operation. -

*/} +

); } diff --git a/src/features/account/hooks.ts b/src/features/account/hooks.ts index e17450f..75539b0 100644 --- a/src/features/account/hooks.ts +++ b/src/features/account/hooks.ts @@ -1,9 +1,11 @@ import { accountsABI, lockedGoldABI } from '@celo/abis'; +import { useEffect, useState } from 'react'; import { useToastError } from 'src/components/notifications/useToastError'; import { BALANCE_REFRESH_INTERVAL, ZERO_ADDRESS } from 'src/config/consts'; import { Addresses } from 'src/config/contracts'; +import { isCel2 } from 'src/utils/is-cel2'; import { isNullish } from 'src/utils/typeof'; -import { useBalance as _useBalance, useReadContract } from 'wagmi'; +import { useBalance as _useBalance, usePublicClient, useReadContract } from 'wagmi'; export function useBalance(address?: Address) { const { data, isError, isLoading, error, refetch } = _useBalance({ @@ -72,3 +74,15 @@ export function useAccountDetails(address?: Address) { refetch, }; } + +export function useIsCel2() { + const publicClient = usePublicClient(); + const [_isCel2, setIsCel2] = useState(undefined); + useEffect(() => { + if (!publicClient) return; + + void isCel2(publicClient).then((value) => setIsCel2(value)); + }, [publicClient]); + + return _isCel2; +} From ea64fc28834aaa087c36f3847b898abf003d5a3a Mon Sep 17 00:00:00 2001 From: Nicolas Brugneaux Date: Tue, 26 Nov 2024 11:06:47 +0100 Subject: [PATCH 4/6] feat: add link to report bugs [Closes #34] --- src/components/logos/Bug.tsx | 16 ++++++++++++++++ src/components/logos/SocialLogo.tsx | 2 ++ src/components/nav/Footer.tsx | 1 + src/config/links.ts | 4 +++- src/config/types.ts | 1 + 5 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 src/components/logos/Bug.tsx diff --git a/src/components/logos/Bug.tsx b/src/components/logos/Bug.tsx new file mode 100644 index 0000000..cd56071 --- /dev/null +++ b/src/components/logos/Bug.tsx @@ -0,0 +1,16 @@ +import { SVGProps, memo } from 'react'; + +function _Bug(props: SVGProps) { + const { fill, ...rest } = props; + return ( + // Font Awesome Free 6.7.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2024 Fonticons, Inc. + + + + ); +} + +export const Bug = memo(_Bug); diff --git a/src/components/logos/SocialLogo.tsx b/src/components/logos/SocialLogo.tsx index f01cb75..5c504c5 100644 --- a/src/components/logos/SocialLogo.tsx +++ b/src/components/logos/SocialLogo.tsx @@ -1,5 +1,6 @@ import { SVGProps } from 'react'; import { A_Blank } from 'src/components/buttons/A_Blank'; +import { Bug } from 'src/components/logos/Bug'; import { Discord } from 'src/components/logos/Discord'; import { Github } from 'src/components/logos/Github'; import { Twitter } from 'src/components/logos/Twitter'; @@ -18,6 +19,7 @@ const LOGOS: Record> = { [SocialLinkType.Twitter]: Twitter, [SocialLinkType.Github]: Github, [SocialLinkType.Discord]: Discord, + [SocialLinkType.Bug]: Bug, }; export function SocialLogo({ svgProps, type, className, size = 18 }: Props) { diff --git a/src/components/nav/Footer.tsx b/src/components/nav/Footer.tsx index dc2a8a5..6e8377e 100644 --- a/src/components/nav/Footer.tsx +++ b/src/components/nav/Footer.tsx @@ -12,6 +12,7 @@ export function Footer() { +
diff --git a/src/config/links.ts b/src/config/links.ts index d9a5ec9..32a2ebf 100644 --- a/src/config/links.ts +++ b/src/config/links.ts @@ -1,9 +1,11 @@ import { config } from 'src/config/config'; +const github = 'https://github.com/celo-org/celo-mondo'; export const links = { home: 'https://mondo.celo.org', discord: 'https://discord.gg/celo', - github: 'https://github.com/celo-org/celo-mondo', + github, + bug: github + '/issues/new?assignees=&labels=&projects=&template=bug_report.md&title=', twitter: 'https://twitter.com/celo', docs: 'https://docs.celo.org', forum: 'https://forum.celo.org', diff --git a/src/config/types.ts b/src/config/types.ts index 36f8ba3..0441253 100644 --- a/src/config/types.ts +++ b/src/config/types.ts @@ -5,6 +5,7 @@ export enum SocialLinkType { Twitter = 'twitter', Github = 'github', Discord = 'discord', + Bug = 'bug', } export const SocialLinksSchema = z.record(z.nativeEnum(SocialLinkType), z.string().url()); From ee058f366d6057a1d7d0d6de693ff95451519735 Mon Sep 17 00:00:00 2001 From: Nicolas Brugneaux Date: Tue, 26 Nov 2024 11:26:32 +0100 Subject: [PATCH 5/6] feat: allow copying delegates' delegators' addresses [Closes #73] --- src/app/delegate/[address]/page.tsx | 5 ++++- src/features/delegation/components/DelegatorsTable.tsx | 6 +++--- src/features/governance/components/ProposalCard.tsx | 5 ++++- tailwind.config.js | 2 +- 4 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/app/delegate/[address]/page.tsx b/src/app/delegate/[address]/page.tsx index ffffb12..b0841ac 100644 --- a/src/app/delegate/[address]/page.tsx +++ b/src/app/delegate/[address]/page.tsx @@ -53,7 +53,10 @@ function DelegateeDescription({ delegatee }: { delegatee: Delegatee }) {

{delegatee.name}

- + {`Since ${dateString}`}
diff --git a/src/features/delegation/components/DelegatorsTable.tsx b/src/features/delegation/components/DelegatorsTable.tsx index 4f86a6a..2629897 100644 --- a/src/features/delegation/components/DelegatorsTable.tsx +++ b/src/features/delegation/components/DelegatorsTable.tsx @@ -3,9 +3,9 @@ import { SpinnerWithLabel } from 'src/components/animation/Spinner'; import { sortAndCombineChartData } from 'src/components/charts/chartData'; import { Collapse } from 'src/components/menus/Collapse'; import { formatNumberString } from 'src/components/numbers/Amount'; +import { ShortAddress } from 'src/components/text/ShortAddress'; import { useDelegators } from 'src/features/delegation/hooks/useDelegators'; import { Delegatee } from 'src/features/delegation/types'; -import { shortenAddress } from 'src/utils/addresses'; import { fromWei } from 'src/utils/amount'; import { objKeys } from 'src/utils/objects'; @@ -28,7 +28,7 @@ function DelegatorsTableContent({ delegatee }: { delegatee: Delegatee }) { const tableData = useMemo(() => { if (!delegatorToAmount) return []; const data = objKeys(delegatorToAmount).map((address) => ({ - label: shortenAddress(address), + label: address, value: fromWei(delegatorToAmount[address]), })); return sortAndCombineChartData(data, NUM_TO_SHOW); @@ -51,7 +51,7 @@ function DelegatorsTableContent({ delegatee }: { delegatee: Delegatee }) { {tableData.map((row) => ( - {row.label} + {`${formatNumberString(row.value)} CELO`} ))} diff --git a/src/features/governance/components/ProposalCard.tsx b/src/features/governance/components/ProposalCard.tsx index 7e02ad2..3c68f68 100644 --- a/src/features/governance/components/ProposalCard.tsx +++ b/src/features/governance/components/ProposalCard.tsx @@ -112,7 +112,10 @@ export function ProposalBadgeRow({ {showProposer && proposer && ( <>
- + )} {/* Show one of proposer or executedTimeValue but not both, too crowded */} diff --git a/tailwind.config.js b/tailwind.config.js index e4a5da9..8ac90a6 100644 --- a/tailwind.config.js +++ b/tailwind.config.js @@ -39,7 +39,7 @@ module.exports = { fontFamily: { sans: ['var(--font-inter)', 'sans-serif'], serif: ['var(--font-alpina)', 'serif'], - mono: ['Courier New', 'monospace'], + mono: ['monospace'], }, fontSize: { xs: '0.725rem', From b3f5cb14f9e7bea91639a00f5f86ebf96651c2a4 Mon Sep 17 00:00:00 2001 From: Nicolas Brugneaux Date: Tue, 26 Nov 2024 12:09:19 +0100 Subject: [PATCH 6/6] feat: add voters count to proposal detail page --- src/components/text/CopyInline.tsx | 15 ++++++++++ src/components/text/ShortAddress.tsx | 9 ++---- .../delegation/components/DelegatorsTable.tsx | 4 ++- .../components/ProposalVotersTable.tsx | 30 +++++++++++++++---- 4 files changed, 45 insertions(+), 13 deletions(-) create mode 100644 src/components/text/CopyInline.tsx diff --git a/src/components/text/CopyInline.tsx b/src/components/text/CopyInline.tsx new file mode 100644 index 0000000..74e03aa --- /dev/null +++ b/src/components/text/CopyInline.tsx @@ -0,0 +1,15 @@ +import { ButtonHTMLAttributes } from 'react'; +import { useCopyHandler } from 'src/utils/clipboard'; + +type Props = ButtonHTMLAttributes & { + text: string; +}; + +export function CopyInline({ text, ...props }: Props) { + const onClick = useCopyHandler(text); + return ( + + ); +} diff --git a/src/components/text/ShortAddress.tsx b/src/components/text/ShortAddress.tsx index 381f17a..50e2245 100644 --- a/src/components/text/ShortAddress.tsx +++ b/src/components/text/ShortAddress.tsx @@ -1,16 +1,11 @@ import { ButtonHTMLAttributes } from 'react'; +import { CopyInline } from 'src/components/text/CopyInline'; import { shortenAddress } from 'src/utils/addresses'; -import { useCopyHandler } from 'src/utils/clipboard'; type Props = ButtonHTMLAttributes & { address: Address; }; export function ShortAddress({ address, ...props }: Props) { - const onClick = useCopyHandler(address); - return ( - - ); + return ; } diff --git a/src/features/delegation/components/DelegatorsTable.tsx b/src/features/delegation/components/DelegatorsTable.tsx index 2629897..47d0737 100644 --- a/src/features/delegation/components/DelegatorsTable.tsx +++ b/src/features/delegation/components/DelegatorsTable.tsx @@ -51,7 +51,9 @@ function DelegatorsTableContent({ delegatee }: { delegatee: Delegatee }) { {tableData.map((row) => ( - + + + {`${formatNumberString(row.value)} CELO`} ))} diff --git a/src/features/governance/components/ProposalVotersTable.tsx b/src/features/governance/components/ProposalVotersTable.tsx index 2751ca7..b551e97 100644 --- a/src/features/governance/components/ProposalVotersTable.tsx +++ b/src/features/governance/components/ProposalVotersTable.tsx @@ -3,6 +3,7 @@ import { SpinnerWithLabel } from 'src/components/animation/Spinner'; import { ChartDataItem, sortAndCombineChartData } from 'src/components/charts/chartData'; import { Collapse } from 'src/components/menus/Collapse'; import { formatNumberString } from 'src/components/numbers/Amount'; +import { CopyInline } from 'src/components/text/CopyInline'; import { MergedProposalData } from 'src/features/governance/hooks/useGovernanceProposals'; import { useProposalVoters } from 'src/features/governance/hooks/useProposalVoters'; import { ProposalStage, VoteType } from 'src/features/governance/types'; @@ -17,19 +18,28 @@ import { toTitleCase } from 'src/utils/strings'; const NUM_TO_SHOW = 20; export function ProposalVotersTable({ propData }: { propData: MergedProposalData }) { + const votersData = useProposalVoters(propData.id); return ( Voters} + button={ +

+ Voters +

+ } buttonClasses="w-full" defaultOpen={propData.stage >= ProposalStage.Execution} > - +
); } -function VoterTableContent({ propData }: { propData: MergedProposalData }) { - const { isLoading, voters, totals } = useProposalVoters(propData.id); +function VoterTableContent({ + propData, +}: { + propData: MergedProposalData & { votersData: ReturnType }; +}) { + const { isLoading, voters, totals } = propData.votersData; const { addressToGroup } = useValidatorGroups(); const tableData = useMemo(() => { @@ -82,7 +92,11 @@ function VoterTableContent({ propData }: { propData: MergedProposalData }) { {tableData.map((row) => ( - {row.label} + + + {toTitleCase(row.type)}
@@ -98,3 +112,9 @@ function VoterTableContent({ propData }: { propData: MergedProposalData }) { ); } + +function VotersCount({ isLoading, voters }: ReturnType) { + if (isLoading) return null; + + return {Object.keys(voters!).length}; +}