From d2c3ff868152594c23c3db29a10944572859f070 Mon Sep 17 00:00:00 2001
From: David Colon <38386583+Da-Colon@users.noreply.github.com>
Date: Tue, 19 Mar 2024 01:20:13 -0400
Subject: [PATCH 01/27] update Badge component with updated designs -
ProposalCountdown updated for compadability
---
src/components/ui/badges/Badge.tsx | 125 +++++++++++-------
.../ui/proposal/ProposalCountdown.tsx | 9 +-
2 files changed, 86 insertions(+), 48 deletions(-)
diff --git a/src/components/ui/badges/Badge.tsx b/src/components/ui/badges/Badge.tsx
index 3c0de816ec..4fcd0981b5 100644
--- a/src/components/ui/badges/Badge.tsx
+++ b/src/components/ui/badges/Badge.tsx
@@ -1,91 +1,106 @@
-import { Flex, Text, Tooltip } from '@chakra-ui/react';
-import { ActiveTwo, Check, ClockTwo, CloseX, DoubleCheck } from '@decent-org/fractal-ui';
+import { Box, Flex, Text, Tooltip } from '@chakra-ui/react';
import { useTranslation } from 'react-i18next';
import { TOOLTIP_MAXW } from '../../../constants/common';
-import { FractalProposalState, DAOState } from '../../../types';
-import { Green, Red } from '../colors';
+import { FractalProposalState, DAOState, FractalProposal } from '../../../types';
+import { ProposalCountdown } from '../proposal/ProposalCountdown';
-type BadgeType = { [key: string]: { Icon?: any; tooltipKey?: string; bg: string; color: string } };
+type BadgeType = {
+ [key: string]: {
+ tooltipKey?: string;
+ bg: string;
+ _hover: { bg: string };
+ textColor: string;
+ };
+};
+
+const greenPlus2 = '#56A355';
+const greenMinus4 = '#0A320A';
+const greenHover = '#0E440E';
+
+const redPlus4 = '#FFC7C7';
+const redMinus2 = '#640E0D';
+const redHover = '#76110F';
const BADGE_MAPPING: BadgeType = {
[FractalProposalState.ACTIVE]: {
- Icon: ActiveTwo,
tooltipKey: 'stateActiveTip',
- bg: Green._500,
- color: 'grayscale.black',
+ bg: greenMinus4,
+ textColor: greenPlus2,
+ _hover: { bg: greenHover },
},
[FractalProposalState.TIMELOCKED]: {
- Icon: ClockTwo,
tooltipKey: 'stateTimelockedTip',
bg: 'sand.700',
- color: 'grayscale.black',
+ textColor: 'grayscale.black',
+ _hover: { bg: 'grayscale.black' },
},
[FractalProposalState.EXECUTED]: {
- Icon: DoubleCheck,
tooltipKey: 'stateExecutedTip',
- bg: Green._600,
- color: 'grayscale.black',
+ bg: greenMinus4,
+ textColor: greenPlus2,
+ _hover: { bg: greenHover },
},
[FractalProposalState.EXECUTABLE]: {
- Icon: Check,
tooltipKey: 'stateExecutableTip',
- bg: Green._500,
- color: 'grayscale.black',
+ bg: greenMinus4,
+ textColor: greenPlus2,
+ _hover: { bg: greenHover },
},
[FractalProposalState.FAILED]: {
- Icon: CloseX,
tooltipKey: 'stateFailedTip',
- bg: Red._600,
- color: 'grayscale.black',
+ bg: redMinus2,
+ textColor: redPlus4,
+ _hover: { bg: redHover },
},
[FractalProposalState.TIMELOCKABLE]: {
- Icon: ClockTwo,
tooltipKey: 'stateTimelockableTip',
- bg: Green._500,
- color: 'grayscale.black',
+ bg: greenMinus4,
+ textColor: greenPlus2,
+ _hover: { bg: greenHover },
},
[FractalProposalState.MODULE]: {
tooltipKey: 'stateModuleTip',
bg: 'sand.700',
- color: 'grayscale.black',
+ textColor: 'grayscale.black',
+ _hover: { bg: '' },
},
[FractalProposalState.EXPIRED]: {
- Icon: ClockTwo,
tooltipKey: 'stateExpiredTip',
- bg: Red._600,
- color: 'grayscale.black',
+ bg: redMinus2,
+ textColor: redPlus4,
+ _hover: { bg: redHover },
},
[FractalProposalState.REJECTED]: {
- Icon: CloseX,
tooltipKey: 'stateRejectedTip',
- bg: Red._600,
- color: 'grayscale.black',
+ bg: redMinus2,
+ textColor: redPlus4,
+ _hover: { bg: redHover },
},
[FractalProposalState.PENDING]: {
- Icon: ClockTwo,
tooltipKey: 'statePendingTip',
- bg: Green._500,
- color: 'grayscale.black',
+ bg: greenMinus4,
+ textColor: greenPlus2,
+ _hover: { bg: greenHover },
},
[FractalProposalState.CLOSED]: {
- Icon: ClockTwo,
tooltipKey: 'stateClosedTip',
- bg: Green._600,
- color: 'grayscale.black',
+ bg: greenMinus4,
+ textColor: greenPlus2,
+ _hover: { bg: greenHover },
},
[DAOState.freezeInit]: {
- Icon: Check,
tooltipKey: 'stateFreezeInitTip',
bg: 'blue.400',
- color: 'grayscale.black',
+ textColor: 'grayscale.black',
+ _hover: { bg: 'grayscale.black' },
},
[DAOState.frozen]: {
- Icon: DoubleCheck,
tooltipKey: 'stateFrozenTip',
bg: 'blue.400',
- color: 'grayscale.black',
+ textColor: 'grayscale.black',
+ _hover: { bg: 'grayscale.black' },
},
- ownerApproved: { bg: 'sand.700', color: 'grayscale.black' },
+ ownerApproved: { bg: 'sand.700', textColor: 'grayscale.black', _hover: { bg: 'grayscale.black' } },
};
type BadgeSize = { [key: string]: { minWidth: string; height: string } };
@@ -97,10 +112,12 @@ const BADGE_SIZES: BadgeSize = {
interface IBadge {
size: 'sm' | 'base';
labelKey: FractalProposalState | DAOState | string;
+ // add as undefined to avoid breaking changes
+ proposal?: FractalProposal;
}
-export function Badge({ labelKey, size }: IBadge) {
- const { Icon, tooltipKey, ...colors } = BADGE_MAPPING[labelKey];
+export function Badge({ labelKey, size, proposal }: IBadge) {
+ const { tooltipKey, ...colors } = BADGE_MAPPING[labelKey];
const sizes = BADGE_SIZES[size];
const { t } = useTranslation('proposal');
@@ -112,16 +129,32 @@ export function Badge({ labelKey, size }: IBadge) {
placement="top"
>
- {!!Icon && }
- {t(labelKey)}
+
+ {t(labelKey)}
+ {proposal && (
+
+ )}
>
diff --git a/src/components/ui/proposal/ProposalCountdown.tsx b/src/components/ui/proposal/ProposalCountdown.tsx
index c7d0ac17c3..03fe56a695 100644
--- a/src/components/ui/proposal/ProposalCountdown.tsx
+++ b/src/components/ui/proposal/ProposalCountdown.tsx
@@ -21,9 +21,14 @@ const zeroPad = (num: number) => String(num).padStart(2, '0');
export function ProposalCountdown({
proposal,
showIcon = true,
+ textColor = 'chocolate.200',
+ textStyle = 'text-base-mono-semibold', // previous default
}: {
proposal: FractalProposal;
showIcon?: boolean;
+ // custom text color and style
+ textColor?: string;
+ textStyle?: string;
}) {
const totalSecondsLeft = useProposalCountdown(proposal);
const { t } = useTranslation('proposal');
@@ -85,8 +90,8 @@ export function ProposalCountdown({
gap={1}
>
{showDays && `${zeroPad(daysLeft)}:`}
{showHours && `${zeroPad(hoursLeft)}:`}
From f0e2538c3aeff91f3fb1be8f3c5769522b4ed334 Mon Sep 17 00:00:00 2001
From: David Colon <38386583+Da-Colon@users.noreply.github.com>
Date: Tue, 19 Mar 2024 13:16:21 -0400
Subject: [PATCH 02/27] create badge to display quorum
---
src/components/ui/badges/QuorumBadge.tsx | 96 ++++++++++++++++++++++++
1 file changed, 96 insertions(+)
create mode 100644 src/components/ui/badges/QuorumBadge.tsx
diff --git a/src/components/ui/badges/QuorumBadge.tsx b/src/components/ui/badges/QuorumBadge.tsx
new file mode 100644
index 0000000000..ef32af3276
--- /dev/null
+++ b/src/components/ui/badges/QuorumBadge.tsx
@@ -0,0 +1,96 @@
+import { Box, Flex } from '@chakra-ui/react';
+import { Check } from '@decent-org/fractal-ui';
+import { BigNumber } from 'ethers';
+import { useMemo } from 'react';
+import { useTranslation } from 'react-i18next';
+import { useFractal } from '../../../providers/App/AppProvider';
+import {
+ AzoriusGovernance,
+ AzoriusProposal,
+ FractalProposal,
+ SnapshotProposal,
+} from '../../../types';
+
+const quorumNotReachedColor = '#838383';
+const quorumReachedColor = '#56A355';
+export default function QuorumBadge({ proposal }: { proposal: FractalProposal }) {
+ const { governance } = useFractal();
+ const { t } = useTranslation('common');
+
+ const azoriusGovernance = governance as AzoriusGovernance;
+ const { votesToken, erc721Tokens, votingStrategy } = azoriusGovernance;
+
+ const votesTokenDecimalsDenominator = useMemo(
+ () => BigNumber.from(10).pow(votesToken?.decimals || 0),
+ [votesToken?.decimals],
+ );
+ const { votesSummary } = proposal as AzoriusProposal;
+ const totalVotesCasted = useMemo(() => {
+ if (votesSummary) {
+ return votesSummary.yes.add(votesSummary.no).add(votesSummary.abstain);
+ }
+ return BigNumber.from(0);
+ }, [votesSummary]);
+ // @dev only azorius governance has quorum
+ if ((proposal as SnapshotProposal).snapshotProposalId || !votingStrategy) {
+ return null;
+ }
+
+ if (votesToken !== undefined && erc721Tokens !== undefined) {
+ return null;
+ }
+
+ const quorumDisplay = !!votingStrategy.quorumPercentage
+ ? votingStrategy.quorumPercentage.formatted
+ : !!votingStrategy.quorumThreshold
+ ? votingStrategy.quorumThreshold.formatted
+ : null;
+
+ const strategyQuorum =
+ erc721Tokens !== undefined
+ ? votingStrategy.quorumThreshold!.value.toNumber()
+ : votesToken
+ ? votingStrategy.quorumPercentage!.value.toNumber()
+ : 1;
+ const reachedQuorum =
+ erc721Tokens !== undefined
+ ? totalVotesCasted.sub(votesSummary.no).toString()
+ : votesToken !== undefined
+ ? totalVotesCasted.sub(votesSummary.no).div(votesTokenDecimalsDenominator).toString()
+ : '0';
+ const totalQuorum =
+ erc721Tokens !== undefined
+ ? strategyQuorum.toString()
+ : votesToken !== undefined
+ ? votesToken.totalSupply
+ .div(votesTokenDecimalsDenominator)
+ .div(100)
+ .mul(strategyQuorum)
+ .toString()
+ : 0;
+
+ const displayColor = !totalVotesCasted.isZero() && reachedQuorum >= totalQuorum ? quorumReachedColor : quorumNotReachedColor;
+ return (
+ <>
+
+
+
+ {t('quorum', { ns: 'common' })}
+ {quorumDisplay}
+
+
+ >
+ );
+}
From 910092cdd067059acb6b56f122c6d9ae565672a2 Mon Sep 17 00:00:00 2001
From: David Colon <38386583+Da-Colon@users.noreply.github.com>
Date: Tue, 19 Mar 2024 14:27:20 -0400
Subject: [PATCH 03/27] update badge to use meetQuroum for linearERC20Strategy
---
src/components/ui/badges/QuorumBadge.tsx | 50 +++++++++++++++---------
1 file changed, 31 insertions(+), 19 deletions(-)
diff --git a/src/components/ui/badges/QuorumBadge.tsx b/src/components/ui/badges/QuorumBadge.tsx
index ef32af3276..e010a66a4e 100644
--- a/src/components/ui/badges/QuorumBadge.tsx
+++ b/src/components/ui/badges/QuorumBadge.tsx
@@ -3,6 +3,7 @@ import { Check } from '@decent-org/fractal-ui';
import { BigNumber } from 'ethers';
import { useMemo } from 'react';
import { useTranslation } from 'react-i18next';
+import useSafeContracts from '../../../hooks/safe/useSafeContracts';
import { useFractal } from '../../../providers/App/AppProvider';
import {
AzoriusGovernance,
@@ -14,16 +15,16 @@ import {
const quorumNotReachedColor = '#838383';
const quorumReachedColor = '#56A355';
export default function QuorumBadge({ proposal }: { proposal: FractalProposal }) {
- const { governance } = useFractal();
+ const {
+ governance,
+ governanceContracts: { ozLinearVotingContractAddress },
+ } = useFractal();
+ const baseContracts = useSafeContracts();
const { t } = useTranslation('common');
const azoriusGovernance = governance as AzoriusGovernance;
const { votesToken, erc721Tokens, votingStrategy } = azoriusGovernance;
- const votesTokenDecimalsDenominator = useMemo(
- () => BigNumber.from(10).pow(votesToken?.decimals || 0),
- [votesToken?.decimals],
- );
const { votesSummary } = proposal as AzoriusProposal;
const totalVotesCasted = useMemo(() => {
if (votesSummary) {
@@ -31,6 +32,22 @@ export default function QuorumBadge({ proposal }: { proposal: FractalProposal })
}
return BigNumber.from(0);
}, [votesSummary]);
+
+ const erc20MeetsQuorum = useMemo(async() => {
+ if (!ozLinearVotingContractAddress || !baseContracts || !votesToken || !votesSummary) {
+ return undefined;
+ }
+ const linearStrategyContract = baseContracts.linearVotingMasterCopyContract.asProvider.attach(
+ ozLinearVotingContractAddress,
+ );
+ const result = await linearStrategyContract.meetsQuorum(
+ votesToken.totalSupply,
+ votesSummary.yes,
+ votesSummary.abstain,
+ );
+ return result
+ }, [votesToken, votesSummary, baseContracts, ozLinearVotingContractAddress]);
+
// @dev only azorius governance has quorum
if ((proposal as SnapshotProposal).snapshotProposalId || !votingStrategy) {
return null;
@@ -49,27 +66,22 @@ export default function QuorumBadge({ proposal }: { proposal: FractalProposal })
const strategyQuorum =
erc721Tokens !== undefined
? votingStrategy.quorumThreshold!.value.toNumber()
- : votesToken
- ? votingStrategy.quorumPercentage!.value.toNumber()
- : 1;
+ : 1;
const reachedQuorum =
erc721Tokens !== undefined
? totalVotesCasted.sub(votesSummary.no).toString()
- : votesToken !== undefined
- ? totalVotesCasted.sub(votesSummary.no).div(votesTokenDecimalsDenominator).toString()
- : '0';
+ : '0';
const totalQuorum =
erc721Tokens !== undefined
? strategyQuorum.toString()
- : votesToken !== undefined
- ? votesToken.totalSupply
- .div(votesTokenDecimalsDenominator)
- .div(100)
- .mul(strategyQuorum)
- .toString()
- : 0;
+ : 0;
+
+ const meetsQuorum = erc20MeetsQuorum !== undefined ? erc20MeetsQuorum : reachedQuorum >= totalQuorum;
- const displayColor = !totalVotesCasted.isZero() && reachedQuorum >= totalQuorum ? quorumReachedColor : quorumNotReachedColor;
+ const displayColor =
+ !totalVotesCasted.isZero() && meetsQuorum
+ ? quorumReachedColor
+ : quorumNotReachedColor;
return (
<>
Date: Tue, 19 Mar 2024 14:27:41 -0400
Subject: [PATCH 04/27] update hover colors for timelock and frozen badges
---
src/components/ui/badges/Badge.tsx | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/src/components/ui/badges/Badge.tsx b/src/components/ui/badges/Badge.tsx
index 4fcd0981b5..fbd428eeb3 100644
--- a/src/components/ui/badges/Badge.tsx
+++ b/src/components/ui/badges/Badge.tsx
@@ -32,7 +32,7 @@ const BADGE_MAPPING: BadgeType = {
tooltipKey: 'stateTimelockedTip',
bg: 'sand.700',
textColor: 'grayscale.black',
- _hover: { bg: 'grayscale.black' },
+ _hover: { bg: 'sand.600' },
},
[FractalProposalState.EXECUTED]: {
tooltipKey: 'stateExecutedTip',
@@ -62,7 +62,7 @@ const BADGE_MAPPING: BadgeType = {
tooltipKey: 'stateModuleTip',
bg: 'sand.700',
textColor: 'grayscale.black',
- _hover: { bg: '' },
+ _hover: { bg: 'sand.600' },
},
[FractalProposalState.EXPIRED]: {
tooltipKey: 'stateExpiredTip',
@@ -92,15 +92,15 @@ const BADGE_MAPPING: BadgeType = {
tooltipKey: 'stateFreezeInitTip',
bg: 'blue.400',
textColor: 'grayscale.black',
- _hover: { bg: 'grayscale.black' },
+ _hover: { bg: 'blue.400-hover' },
},
[DAOState.frozen]: {
tooltipKey: 'stateFrozenTip',
bg: 'blue.400',
textColor: 'grayscale.black',
- _hover: { bg: 'grayscale.black' },
+ _hover: { bg: 'blue.400-hover' },
},
- ownerApproved: { bg: 'sand.700', textColor: 'grayscale.black', _hover: { bg: 'grayscale.black' } },
+ ownerApproved: { bg: 'sand.700', textColor: 'grayscale.black', _hover: { bg: 'sand.600' }, },
};
type BadgeSize = { [key: string]: { minWidth: string; height: string } };
From 04c06ecc0f7a97b39c82172f301dd852aa245fa6 Mon Sep 17 00:00:00 2001
From: David Colon <38386583+Da-Colon@users.noreply.github.com>
Date: Tue, 19 Mar 2024 16:40:04 -0400
Subject: [PATCH 05/27] update Activity/Proposal description and title to
updated designs
---
.../Activity/ActivityDescription.tsx | 6 +++---
.../ActivityDescriptionGovernance.tsx | 16 ++++++++++-----
src/components/ui/proposal/Markdown.tsx | 20 +++----------------
3 files changed, 17 insertions(+), 25 deletions(-)
diff --git a/src/components/Activity/ActivityDescription.tsx b/src/components/Activity/ActivityDescription.tsx
index 88aeaae158..1b518bd46b 100644
--- a/src/components/Activity/ActivityDescription.tsx
+++ b/src/components/Activity/ActivityDescription.tsx
@@ -17,21 +17,21 @@ export function ActivityDescription({ activity, showFullDescription }: IActivity
return (
{description && (
)}
diff --git a/src/components/Activity/ActivityDescriptionGovernance.tsx b/src/components/Activity/ActivityDescriptionGovernance.tsx
index 7ef99cd291..c717fb252f 100644
--- a/src/components/Activity/ActivityDescriptionGovernance.tsx
+++ b/src/components/Activity/ActivityDescriptionGovernance.tsx
@@ -1,4 +1,4 @@
-import { Text } from '@chakra-ui/react';
+import { Box, Flex, Text } from '@chakra-ui/react';
import { useTranslation } from 'react-i18next';
import { useGetMetadata } from '../../hooks/DAO/proposal/useGetMetadata';
import {
@@ -58,11 +58,17 @@ export function ProposalTitle({ activity }: { activity: Activity }) {
treasuryActivity.transferAddresses && !!treasuryActivity.transferAddresses.length;
return (
- <>
- {formatId((activity as GovernanceActivity).proposalId)}
- {metaData.title ? {metaData.title} : null}
+
+
+ {formatId((activity as GovernanceActivity).proposalId)}
+ {metaData.title ? {metaData.title} : null}
+
{hasTransfers && {t('proposalDescriptionCont', { ns: 'dashboard' })} }
- >
+
);
}
diff --git a/src/components/ui/proposal/Markdown.tsx b/src/components/ui/proposal/Markdown.tsx
index 3467492e0f..5fc818ceb0 100644
--- a/src/components/ui/proposal/Markdown.tsx
+++ b/src/components/ui/proposal/Markdown.tsx
@@ -3,7 +3,6 @@ import { useEffect, useRef, useState } from 'react';
import { useTranslation } from 'react-i18next';
import ReactMarkdown, { Components } from 'react-markdown';
import remarkGfm from 'remark-gfm';
-import removeMd from 'remove-markdown';
import '../../../assets/css/Markdown.css';
function CustomMarkdownImage({ src, alt }: { src?: string; alt?: string }) {
@@ -39,13 +38,12 @@ interface IMarkdown {
content: string;
}
-export default function Markdown({ truncate, content, collapsedLines = 6 }: IMarkdown) {
+export default function Markdown({ truncate, content, collapsedLines = 6}: IMarkdown) {
const { t } = useTranslation('common');
const [collapsed, setCollapsed] = useState(true);
const [totalLines, setTotalLines] = useState(0);
const [totalLinesError, setTotalLinesError] = useState(false);
const markdownTextContainerRef = useRef(null);
- const plainText = removeMd(content);
useEffect(() => {
if (
@@ -83,22 +81,10 @@ export default function Markdown({ truncate, content, collapsedLines = 6 }: IMar
return uri;
};
- if (truncate) {
- return (
-
- {plainText}
-
- );
- }
-
return (
<>
@@ -112,7 +98,7 @@ export default function Markdown({ truncate, content, collapsedLines = 6 }: IMar
- {totalLines > collapsedLines && !totalLinesError && (
+ {totalLines > collapsedLines && !totalLinesError && !truncate && (
) : proposals.length > 0 ? (
proposals.map(proposal => (
-
))
) : (
From 680a38e759d2d355fbe9959ec90c2804e81036fe Mon Sep 17 00:00:00 2001
From: David Colon <38386583+Da-Colon@users.noreply.github.com>
Date: Tue, 19 Mar 2024 23:55:03 -0400
Subject: [PATCH 08/27] replace ActivityGovernance with ProposalCard
---
src/components/pages/DaoDashboard/Activities/index.tsx | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/components/pages/DaoDashboard/Activities/index.tsx b/src/components/pages/DaoDashboard/Activities/index.tsx
index f21e469066..aecd7dd7f8 100644
--- a/src/components/pages/DaoDashboard/Activities/index.tsx
+++ b/src/components/pages/DaoDashboard/Activities/index.tsx
@@ -3,9 +3,9 @@ import { useState } from 'react';
import { useTranslation } from 'react-i18next';
import { useFractal } from '../../../../providers/App/AppProvider';
import { ActivityEventType, SortBy, TreasuryActivity, FractalProposal } from '../../../../types';
-import { ActivityGovernance } from '../../../Activity/ActivityGovernance';
import { ActivityModule } from '../../../Activity/ActivityModule';
import { ActivityTreasury } from '../../../Activity/ActivityTreasury';
+import ProposalCard from '../../../Proposals/ProposalCard/ProposalCard';
import { EmptyBox } from '../../../ui/containers/EmptyBox';
import { InfoBoxLoader } from '../../../ui/loaders/InfoBoxLoader';
import { Sort } from '../../../ui/utils/Sort';
@@ -48,9 +48,9 @@ export function Activities() {
{sortedActivities.map((activity, i) => {
if (activity.eventType === ActivityEventType.Governance) {
return (
-
);
}
From 4e2c15e4ade1c2b2b6047c71cd7d6cac79a9035a Mon Sep 17 00:00:00 2001
From: David Colon <38386583+Da-Colon@users.noreply.github.com>
Date: Wed, 20 Mar 2024 00:06:14 -0400
Subject: [PATCH 09/27] update to lastest badge colors
---
src/components/ui/badges/Badge.tsx | 61 +++++++++++++++++++-----------
1 file changed, 38 insertions(+), 23 deletions(-)
diff --git a/src/components/ui/badges/Badge.tsx b/src/components/ui/badges/Badge.tsx
index fbd428eeb3..a02e0cc3a9 100644
--- a/src/components/ui/badges/Badge.tsx
+++ b/src/components/ui/badges/Badge.tsx
@@ -14,35 +14,50 @@ type BadgeType = {
};
const greenPlus2 = '#56A355';
-const greenMinus4 = '#0A320A';
+const greenMinus5 = '#0A320A';
const greenHover = '#0E440E';
const redPlus4 = '#FFC7C7';
const redMinus2 = '#640E0D';
const redHover = '#76110F';
+const sandBG = '#C18D5A';
+const sandHover = '#B97F46'
+const blackText = '#150D04'
+
+const grayBG = '#9A979D'
+const grayHover = '#8C8990'
+
+const lightBlueBG = '#A3B9EC'
+const lightBlueHover = '#8DA8E7'
+const darkBlueText = '#0A1E3D'
+
+const darkBlueBG = '#1B3B83'
+const darkBlueHover = '#17326E'
+const lightBlueText = '#D1DCF5'
+
const BADGE_MAPPING: BadgeType = {
[FractalProposalState.ACTIVE]: {
tooltipKey: 'stateActiveTip',
- bg: greenMinus4,
+ bg: greenMinus5,
textColor: greenPlus2,
_hover: { bg: greenHover },
},
[FractalProposalState.TIMELOCKED]: {
tooltipKey: 'stateTimelockedTip',
- bg: 'sand.700',
- textColor: 'grayscale.black',
- _hover: { bg: 'sand.600' },
+ bg: greenMinus5,
+ textColor: greenPlus2,
+ _hover: { bg: greenHover },
},
[FractalProposalState.EXECUTED]: {
tooltipKey: 'stateExecutedTip',
- bg: greenMinus4,
+ bg: greenMinus5,
textColor: greenPlus2,
_hover: { bg: greenHover },
},
[FractalProposalState.EXECUTABLE]: {
tooltipKey: 'stateExecutableTip',
- bg: greenMinus4,
+ bg: greenMinus5,
textColor: greenPlus2,
_hover: { bg: greenHover },
},
@@ -54,15 +69,15 @@ const BADGE_MAPPING: BadgeType = {
},
[FractalProposalState.TIMELOCKABLE]: {
tooltipKey: 'stateTimelockableTip',
- bg: greenMinus4,
+ bg: greenMinus5,
textColor: greenPlus2,
_hover: { bg: greenHover },
},
[FractalProposalState.MODULE]: {
tooltipKey: 'stateModuleTip',
- bg: 'sand.700',
- textColor: 'grayscale.black',
- _hover: { bg: 'sand.600' },
+ bg: greenMinus5,
+ textColor: greenPlus2,
+ _hover: { bg: greenHover },
},
[FractalProposalState.EXPIRED]: {
tooltipKey: 'stateExpiredTip',
@@ -78,27 +93,27 @@ const BADGE_MAPPING: BadgeType = {
},
[FractalProposalState.PENDING]: {
tooltipKey: 'statePendingTip',
- bg: greenMinus4,
- textColor: greenPlus2,
- _hover: { bg: greenHover },
+ bg: sandBG,
+ textColor: blackText,
+ _hover: { bg: sandHover },
},
[FractalProposalState.CLOSED]: {
tooltipKey: 'stateClosedTip',
- bg: greenMinus4,
- textColor: greenPlus2,
- _hover: { bg: greenHover },
+ bg: grayBG,
+ textColor: '#000',
+ _hover: { bg: grayHover },
},
[DAOState.freezeInit]: {
tooltipKey: 'stateFreezeInitTip',
- bg: 'blue.400',
- textColor: 'grayscale.black',
- _hover: { bg: 'blue.400-hover' },
+ bg: lightBlueBG,
+ textColor: lightBlueText,
+ _hover: { bg: darkBlueHover },
},
[DAOState.frozen]: {
tooltipKey: 'stateFrozenTip',
- bg: 'blue.400',
- textColor: 'grayscale.black',
- _hover: { bg: 'blue.400-hover' },
+ bg: darkBlueBG,
+ textColor: darkBlueText,
+ _hover: { bg: lightBlueHover },
},
ownerApproved: { bg: 'sand.700', textColor: 'grayscale.black', _hover: { bg: 'sand.600' }, },
};
From 4e2941cfc910efc21300641812e3589d64ea6026 Mon Sep 17 00:00:00 2001
From: David Colon <38386583+Da-Colon@users.noreply.github.com>
Date: Wed, 20 Mar 2024 00:23:49 -0400
Subject: [PATCH 10/27] remove unused file
---
.../Activity/ActivityGovernance.tsx | 64 -------------------
1 file changed, 64 deletions(-)
delete mode 100644 src/components/Activity/ActivityGovernance.tsx
diff --git a/src/components/Activity/ActivityGovernance.tsx b/src/components/Activity/ActivityGovernance.tsx
deleted file mode 100644
index 812ec81667..0000000000
--- a/src/components/Activity/ActivityGovernance.tsx
+++ /dev/null
@@ -1,64 +0,0 @@
-import { Flex } from '@chakra-ui/react';
-import { format } from 'date-fns';
-import { useTranslation } from 'react-i18next';
-import { Link } from 'react-router-dom';
-import { DAO_ROUTES } from '../../constants/routes';
-import { useFractal } from '../../providers/App/AppProvider';
-import { FractalProposal, ActivityEventType, SnapshotProposal } from '../../types';
-import { DEFAULT_DATE_FORMAT } from '../../utils/numberFormats';
-import { ProposalAction } from '../Proposals/ProposalActions/ProposalAction';
-import { VoteContextProvider } from '../Proposals/ProposalVotes/context/VoteContext';
-import { Badge } from '../ui/badges/Badge';
-import { ProposalCountdown } from '../ui/proposal/ProposalCountdown';
-
-import { ActivityCard } from './ActivityCard';
-import { ActivityDescription } from './ActivityDescription';
-
-export function ActivityGovernance({ activity }: { activity: FractalProposal }) {
- const {
- node: { safe },
- } = useFractal();
- const { t } = useTranslation();
-
- const eventDateLabel = t(
- activity.eventType === ActivityEventType.Treasury
- ? activity.transaction?.to === safe?.address
- ? 'received'
- : 'sent'
- : 'created',
- );
-
- const {
- node: { daoAddress },
- } = useFractal();
-
- return (
-
-
- )
- }
- description={}
- RightElement={
-
-
-
-
-
-
- }
- eventDate={format(activity.eventDate, DEFAULT_DATE_FORMAT)}
- eventDateLabel={eventDateLabel}
- isSnapshot={!!(activity as SnapshotProposal).snapshotProposalId}
- />
-
- );
-}
From 4fe5fa3839450b98b9240a90c1cca9079309123e Mon Sep 17 00:00:00 2001
From: David Colon <38386583+Da-Colon@users.noreply.github.com>
Date: Wed, 20 Mar 2024 00:25:53 -0400
Subject: [PATCH 11/27] remove comments
---
src/components/Proposals/ProposalCard/ProposalCard.tsx | 10 ----------
1 file changed, 10 deletions(-)
diff --git a/src/components/Proposals/ProposalCard/ProposalCard.tsx b/src/components/Proposals/ProposalCard/ProposalCard.tsx
index 3566ce7634..d4796291b0 100644
--- a/src/components/Proposals/ProposalCard/ProposalCard.tsx
+++ b/src/components/Proposals/ProposalCard/ProposalCard.tsx
@@ -56,17 +56,7 @@ function ProposalCard({ proposal }: { proposal: FractalProposal }) {
- {/* Proposal Description Row */}
- {/* Voting Data Row */}
-
- {/* For/Yes Votes % */}
- {/* No Votes % */}
- {/* Abstain Votes % */}
-
- {/* Voting Data Row Visual Bar */}
- {/* pass/fail + passing threshold Votes Bar */}
- {/* Created Data */}
{proposal.eventDate && (
Date: Wed, 20 Mar 2024 00:31:45 -0400
Subject: [PATCH 12/27] run lint/pretty
---
.../Activity/ActivityDescription.tsx | 2 +-
.../ActivityDescriptionGovernance.tsx | 5 +++-
src/components/ui/badges/Badge.tsx | 22 ++++++++--------
src/components/ui/badges/QuorumBadge.tsx | 26 +++++++------------
src/components/ui/proposal/Markdown.tsx | 2 +-
5 files changed, 26 insertions(+), 31 deletions(-)
diff --git a/src/components/Activity/ActivityDescription.tsx b/src/components/Activity/ActivityDescription.tsx
index fe6b7a8a47..1bd55ec499 100644
--- a/src/components/Activity/ActivityDescription.tsx
+++ b/src/components/Activity/ActivityDescription.tsx
@@ -49,7 +49,7 @@ export function ActivityDescription({ activity, showFullDescription }: IActivity
alignItems="center"
color="#B3B3B3"
textStyle="text-md-sans-regular"
- >
+ >
-
+
{formatId((activity as GovernanceActivity).proposalId)}
{metaData.title ? {metaData.title} : null}
diff --git a/src/components/ui/badges/Badge.tsx b/src/components/ui/badges/Badge.tsx
index a02e0cc3a9..a9226977f0 100644
--- a/src/components/ui/badges/Badge.tsx
+++ b/src/components/ui/badges/Badge.tsx
@@ -22,19 +22,19 @@ const redMinus2 = '#640E0D';
const redHover = '#76110F';
const sandBG = '#C18D5A';
-const sandHover = '#B97F46'
-const blackText = '#150D04'
+const sandHover = '#B97F46';
+const blackText = '#150D04';
-const grayBG = '#9A979D'
-const grayHover = '#8C8990'
+const grayBG = '#9A979D';
+const grayHover = '#8C8990';
-const lightBlueBG = '#A3B9EC'
-const lightBlueHover = '#8DA8E7'
-const darkBlueText = '#0A1E3D'
+const lightBlueBG = '#A3B9EC';
+const lightBlueHover = '#8DA8E7';
+const darkBlueText = '#0A1E3D';
-const darkBlueBG = '#1B3B83'
-const darkBlueHover = '#17326E'
-const lightBlueText = '#D1DCF5'
+const darkBlueBG = '#1B3B83';
+const darkBlueHover = '#17326E';
+const lightBlueText = '#D1DCF5';
const BADGE_MAPPING: BadgeType = {
[FractalProposalState.ACTIVE]: {
@@ -115,7 +115,7 @@ const BADGE_MAPPING: BadgeType = {
textColor: darkBlueText,
_hover: { bg: lightBlueHover },
},
- ownerApproved: { bg: 'sand.700', textColor: 'grayscale.black', _hover: { bg: 'sand.600' }, },
+ ownerApproved: { bg: 'sand.700', textColor: 'grayscale.black', _hover: { bg: 'sand.600' } },
};
type BadgeSize = { [key: string]: { minWidth: string; height: string } };
diff --git a/src/components/ui/badges/QuorumBadge.tsx b/src/components/ui/badges/QuorumBadge.tsx
index e010a66a4e..2e81fea1a2 100644
--- a/src/components/ui/badges/QuorumBadge.tsx
+++ b/src/components/ui/badges/QuorumBadge.tsx
@@ -33,7 +33,7 @@ export default function QuorumBadge({ proposal }: { proposal: FractalProposal })
return BigNumber.from(0);
}, [votesSummary]);
- const erc20MeetsQuorum = useMemo(async() => {
+ const erc20MeetsQuorum = useMemo(async () => {
if (!ozLinearVotingContractAddress || !baseContracts || !votesToken || !votesSummary) {
return undefined;
}
@@ -45,9 +45,9 @@ export default function QuorumBadge({ proposal }: { proposal: FractalProposal })
votesSummary.yes,
votesSummary.abstain,
);
- return result
+ return result;
}, [votesToken, votesSummary, baseContracts, ozLinearVotingContractAddress]);
-
+
// @dev only azorius governance has quorum
if ((proposal as SnapshotProposal).snapshotProposalId || !votingStrategy) {
return null;
@@ -64,24 +64,16 @@ export default function QuorumBadge({ proposal }: { proposal: FractalProposal })
: null;
const strategyQuorum =
- erc721Tokens !== undefined
- ? votingStrategy.quorumThreshold!.value.toNumber()
- : 1;
+ erc721Tokens !== undefined ? votingStrategy.quorumThreshold!.value.toNumber() : 1;
const reachedQuorum =
- erc721Tokens !== undefined
- ? totalVotesCasted.sub(votesSummary.no).toString()
- : '0';
- const totalQuorum =
- erc721Tokens !== undefined
- ? strategyQuorum.toString()
- : 0;
+ erc721Tokens !== undefined ? totalVotesCasted.sub(votesSummary.no).toString() : '0';
+ const totalQuorum = erc721Tokens !== undefined ? strategyQuorum.toString() : 0;
- const meetsQuorum = erc20MeetsQuorum !== undefined ? erc20MeetsQuorum : reachedQuorum >= totalQuorum;
+ const meetsQuorum =
+ erc20MeetsQuorum !== undefined ? erc20MeetsQuorum : reachedQuorum >= totalQuorum;
const displayColor =
- !totalVotesCasted.isZero() && meetsQuorum
- ? quorumReachedColor
- : quorumNotReachedColor;
+ !totalVotesCasted.isZero() && meetsQuorum ? quorumReachedColor : quorumNotReachedColor;
return (
<>
Date: Wed, 20 Mar 2024 13:28:31 -0400
Subject: [PATCH 13/27] fix badge colors
---
src/components/ui/badges/Badge.tsx | 44 +++++++++++++++---------------
1 file changed, 22 insertions(+), 22 deletions(-)
diff --git a/src/components/ui/badges/Badge.tsx b/src/components/ui/badges/Badge.tsx
index a9226977f0..a12dc145fd 100644
--- a/src/components/ui/badges/Badge.tsx
+++ b/src/components/ui/badges/Badge.tsx
@@ -13,12 +13,12 @@ type BadgeType = {
};
};
-const greenPlus2 = '#56A355';
-const greenMinus5 = '#0A320A';
+const greenText = '#56A355';
+const greenBG = '#0A320A';
const greenHover = '#0E440E';
-const redPlus4 = '#FFC7C7';
-const redMinus2 = '#640E0D';
+const redText = '#FFB2B2';
+const redBG = '#640E0D';
const redHover = '#76110F';
const sandBG = '#C18D5A';
@@ -39,56 +39,56 @@ const lightBlueText = '#D1DCF5';
const BADGE_MAPPING: BadgeType = {
[FractalProposalState.ACTIVE]: {
tooltipKey: 'stateActiveTip',
- bg: greenMinus5,
- textColor: greenPlus2,
+ bg: greenBG,
+ textColor: greenText,
_hover: { bg: greenHover },
},
[FractalProposalState.TIMELOCKED]: {
tooltipKey: 'stateTimelockedTip',
- bg: greenMinus5,
- textColor: greenPlus2,
+ bg: greenBG,
+ textColor: greenText,
_hover: { bg: greenHover },
},
[FractalProposalState.EXECUTED]: {
tooltipKey: 'stateExecutedTip',
- bg: greenMinus5,
- textColor: greenPlus2,
+ bg: greenBG,
+ textColor: greenText,
_hover: { bg: greenHover },
},
[FractalProposalState.EXECUTABLE]: {
tooltipKey: 'stateExecutableTip',
- bg: greenMinus5,
- textColor: greenPlus2,
+ bg: greenBG,
+ textColor: greenText,
_hover: { bg: greenHover },
},
[FractalProposalState.FAILED]: {
tooltipKey: 'stateFailedTip',
- bg: redMinus2,
- textColor: redPlus4,
+ bg: redBG,
+ textColor: redText,
_hover: { bg: redHover },
},
[FractalProposalState.TIMELOCKABLE]: {
tooltipKey: 'stateTimelockableTip',
- bg: greenMinus5,
- textColor: greenPlus2,
+ bg: greenBG,
+ textColor: greenText,
_hover: { bg: greenHover },
},
[FractalProposalState.MODULE]: {
tooltipKey: 'stateModuleTip',
- bg: greenMinus5,
- textColor: greenPlus2,
+ bg: greenBG,
+ textColor: greenText,
_hover: { bg: greenHover },
},
[FractalProposalState.EXPIRED]: {
tooltipKey: 'stateExpiredTip',
- bg: redMinus2,
- textColor: redPlus4,
+ bg: redBG,
+ textColor: redText,
_hover: { bg: redHover },
},
[FractalProposalState.REJECTED]: {
tooltipKey: 'stateRejectedTip',
- bg: redMinus2,
- textColor: redPlus4,
+ bg: redBG,
+ textColor: redText,
_hover: { bg: redHover },
},
[FractalProposalState.PENDING]: {
From 574fbc8b53938e33928659d76137535c70333569 Mon Sep 17 00:00:00 2001
From: David Colon <38386583+Da-Colon@users.noreply.github.com>
Date: Wed, 20 Mar 2024 13:32:16 -0400
Subject: [PATCH 14/27] fix alignment
---
src/components/ui/badges/Badge.tsx | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/components/ui/badges/Badge.tsx b/src/components/ui/badges/Badge.tsx
index a12dc145fd..79eb05a318 100644
--- a/src/components/ui/badges/Badge.tsx
+++ b/src/components/ui/badges/Badge.tsx
@@ -150,7 +150,7 @@ export function Badge({ labelKey, size, proposal }: IBadge) {
justifyContent="center"
h="1.5rem"
w="fit-content"
- p="0.5rem"
+ p="0.5rem 0.25rem"
lineHeight={1.5}
{...sizes}
{...colors}
@@ -161,7 +161,7 @@ export function Badge({ labelKey, size, proposal }: IBadge) {
w="0.5rem"
h="0.5rem"
/>
- {t(labelKey)}
+ {t(labelKey)}
{proposal && (
Date: Wed, 20 Mar 2024 13:52:11 -0400
Subject: [PATCH 15/27] pretty/lint run
---
src/components/ui/badges/Badge.tsx | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/src/components/ui/badges/Badge.tsx b/src/components/ui/badges/Badge.tsx
index 79eb05a318..0a1841846c 100644
--- a/src/components/ui/badges/Badge.tsx
+++ b/src/components/ui/badges/Badge.tsx
@@ -161,7 +161,12 @@ export function Badge({ labelKey, size, proposal }: IBadge) {
w="0.5rem"
h="0.5rem"
/>
- {t(labelKey)}
+
+ {t(labelKey)}
+
{proposal && (
Date: Thu, 21 Mar 2024 10:04:50 -0400
Subject: [PATCH 16/27] remove fragment
---
src/components/ui/badges/QuorumBadge.tsx | 38 +++++++++++-------------
1 file changed, 18 insertions(+), 20 deletions(-)
diff --git a/src/components/ui/badges/QuorumBadge.tsx b/src/components/ui/badges/QuorumBadge.tsx
index 2e81fea1a2..bc76ff4f36 100644
--- a/src/components/ui/badges/QuorumBadge.tsx
+++ b/src/components/ui/badges/QuorumBadge.tsx
@@ -75,26 +75,24 @@ export default function QuorumBadge({ proposal }: { proposal: FractalProposal })
const displayColor =
!totalVotesCasted.isZero() && meetsQuorum ? quorumReachedColor : quorumNotReachedColor;
return (
- <>
-
+
-
-
- {t('quorum', { ns: 'common' })}
- {quorumDisplay}
-
-
- >
+
+ {t('quorum', { ns: 'common' })}
+ {quorumDisplay}
+
+
);
}
From b728ea08ca80577b1494af8d557cb99a6b8d0da9 Mon Sep 17 00:00:00 2001
From: David Colon <38386583+Da-Colon@users.noreply.github.com>
Date: Mon, 25 Mar 2024 09:35:31 -0400
Subject: [PATCH 17/27] update colors to match figma
---
src/components/ui/badges/Badge.tsx | 67 +++++++++++++++++-------------
1 file changed, 38 insertions(+), 29 deletions(-)
diff --git a/src/components/ui/badges/Badge.tsx b/src/components/ui/badges/Badge.tsx
index 0a1841846c..72e687a380 100644
--- a/src/components/ui/badges/Badge.tsx
+++ b/src/components/ui/badges/Badge.tsx
@@ -8,114 +8,123 @@ type BadgeType = {
[key: string]: {
tooltipKey?: string;
bg: string;
- _hover: { bg: string };
+ _hover: { bg: string; textColor: string };
textColor: string;
};
};
-const greenText = '#56A355';
+const greenText = '#8BDA8B';
const greenBG = '#0A320A';
+const greenHoverText = '#78D378';
const greenHover = '#0E440E';
const redText = '#FFB2B2';
const redBG = '#640E0D';
-const redHover = '#76110F';
+const redHoverText = '#FF9999';
+const redHover = '#4D0B0A';
const sandBG = '#C18D5A';
const sandHover = '#B97F46';
-const blackText = '#150D04';
+const sandText = '#2C1A08';
+const sandHoverText = '#150D04 ';
const grayBG = '#9A979D';
const grayHover = '#8C8990';
-const lightBlueBG = '#A3B9EC';
-const lightBlueHover = '#8DA8E7';
-const darkBlueText = '#0A1E3D';
+const freezeBG = '#A3B9EC';
+const freezeHover = '#8DA8E7';
+const freezeText = '#0D2356';
+const freezeHoverText = '#09193E';
-const darkBlueBG = '#1B3B83';
-const darkBlueHover = '#17326E';
-const lightBlueText = '#D1DCF5';
+const frozenBG = '#09193E';
+const frozenText = '#D1DCF5';
+const frozenHoverText = '#BCCCF0';
+const frozenHover = '#17326E';
const BADGE_MAPPING: BadgeType = {
[FractalProposalState.ACTIVE]: {
tooltipKey: 'stateActiveTip',
bg: greenBG,
textColor: greenText,
- _hover: { bg: greenHover },
+ _hover: { bg: greenHover, textColor: greenHoverText },
},
[FractalProposalState.TIMELOCKED]: {
tooltipKey: 'stateTimelockedTip',
bg: greenBG,
textColor: greenText,
- _hover: { bg: greenHover },
+ _hover: { bg: greenHover, textColor: greenHoverText },
},
[FractalProposalState.EXECUTED]: {
tooltipKey: 'stateExecutedTip',
bg: greenBG,
textColor: greenText,
- _hover: { bg: greenHover },
+ _hover: { bg: greenHover, textColor: greenHoverText },
},
[FractalProposalState.EXECUTABLE]: {
tooltipKey: 'stateExecutableTip',
bg: greenBG,
textColor: greenText,
- _hover: { bg: greenHover },
+ _hover: { bg: greenHover, textColor: greenHoverText },
},
[FractalProposalState.FAILED]: {
tooltipKey: 'stateFailedTip',
bg: redBG,
textColor: redText,
- _hover: { bg: redHover },
+ _hover: { bg: redHover, textColor: redHoverText },
},
[FractalProposalState.TIMELOCKABLE]: {
tooltipKey: 'stateTimelockableTip',
bg: greenBG,
textColor: greenText,
- _hover: { bg: greenHover },
+ _hover: { bg: greenHover, textColor: greenHoverText },
},
[FractalProposalState.MODULE]: {
tooltipKey: 'stateModuleTip',
bg: greenBG,
textColor: greenText,
- _hover: { bg: greenHover },
+ _hover: { bg: greenHover, textColor: greenHoverText },
},
[FractalProposalState.EXPIRED]: {
tooltipKey: 'stateExpiredTip',
bg: redBG,
textColor: redText,
- _hover: { bg: redHover },
+ _hover: { bg: redHover, textColor: redHoverText },
},
[FractalProposalState.REJECTED]: {
tooltipKey: 'stateRejectedTip',
bg: redBG,
textColor: redText,
- _hover: { bg: redHover },
+ _hover: { bg: redHover, textColor: redHoverText },
},
[FractalProposalState.PENDING]: {
tooltipKey: 'statePendingTip',
bg: sandBG,
- textColor: blackText,
- _hover: { bg: sandHover },
+ textColor: sandText,
+ _hover: { bg: sandHover, textColor: sandHoverText },
},
[FractalProposalState.CLOSED]: {
tooltipKey: 'stateClosedTip',
bg: grayBG,
textColor: '#000',
- _hover: { bg: grayHover },
+ _hover: { bg: grayHover, textColor: '#000' },
},
[DAOState.freezeInit]: {
tooltipKey: 'stateFreezeInitTip',
- bg: lightBlueBG,
- textColor: lightBlueText,
- _hover: { bg: darkBlueHover },
+ bg: freezeBG,
+ textColor: freezeText,
+ _hover: { bg: freezeHover, textColor: freezeHoverText },
},
[DAOState.frozen]: {
tooltipKey: 'stateFrozenTip',
- bg: darkBlueBG,
- textColor: darkBlueText,
- _hover: { bg: lightBlueHover },
+ bg: frozenBG,
+ textColor: frozenText,
+ _hover: { bg: frozenHover, textColor: frozenHoverText },
+ },
+ ownerApproved: {
+ bg: 'sand.700',
+ textColor: sandText,
+ _hover: { bg: sandBG, textColor: sandHoverText },
},
- ownerApproved: { bg: 'sand.700', textColor: 'grayscale.black', _hover: { bg: 'sand.600' } },
};
type BadgeSize = { [key: string]: { minWidth: string; height: string } };
From 36f73db4a9307ee9eede9068985aa67ee3f3f0ba Mon Sep 17 00:00:00 2001
From: David Colon <38386583+Da-Colon@users.noreply.github.com>
Date: Mon, 25 Mar 2024 09:39:37 -0400
Subject: [PATCH 18/27] adjust padding
---
src/components/ui/badges/Badge.tsx | 74 +++++++++++++++---------------
1 file changed, 36 insertions(+), 38 deletions(-)
diff --git a/src/components/ui/badges/Badge.tsx b/src/components/ui/badges/Badge.tsx
index 72e687a380..7cd83829d9 100644
--- a/src/components/ui/badges/Badge.tsx
+++ b/src/components/ui/badges/Badge.tsx
@@ -146,46 +146,44 @@ export function Badge({ labelKey, size, proposal }: IBadge) {
const { t } = useTranslation('proposal');
return (
- <>
-
+
-
+
-
-
+ {proposal && (
+
- {t(labelKey)}
-
- {proposal && (
-
- )}
-
-
- >
+ />
+ )}
+
+
);
}
From 3b0d3a616de2e3d0908d244588eea498ae13cbf8 Mon Sep 17 00:00:00 2001
From: David Colon <38386583+Da-Colon@users.noreply.github.com>
Date: Mon, 25 Mar 2024 14:51:11 -0400
Subject: [PATCH 19/27] clean up logic around description and title to more
closely match designs
---
.../Activity/ActivityDescription.tsx | 42 ++--------
.../ActivityDescriptionGovernance.tsx | 79 +++++++++++++------
.../Activity/ActivityDescriptionModule.tsx | 74 +++++++++++------
.../Activity/ActivityDescriptionTreasury.tsx | 42 +++++-----
src/components/Activity/ActivityModule.tsx | 51 +++---------
src/components/ui/proposal/Markdown.tsx | 6 +-
6 files changed, 149 insertions(+), 145 deletions(-)
diff --git a/src/components/Activity/ActivityDescription.tsx b/src/components/Activity/ActivityDescription.tsx
index 1bd55ec499..cf2db52225 100644
--- a/src/components/Activity/ActivityDescription.tsx
+++ b/src/components/Activity/ActivityDescription.tsx
@@ -1,14 +1,10 @@
-import { Box, Flex } from '@chakra-ui/react';
+import { Box } from '@chakra-ui/react';
import { useGetMetadata } from '../../hooks/DAO/proposal/useGetMetadata';
-import useDisplayName from '../../hooks/utils/useDisplayName';
import {
Activity,
- AzoriusProposal,
FractalProposal,
- MultisigProposal,
SnapshotProposal,
} from '../../types';
-import Avatar from '../ui/page/Header/Avatar';
import Markdown from '../ui/proposal/Markdown';
import { ProposalTitle } from './ActivityDescriptionGovernance';
import { ActivityDescriptionTreasury } from './ActivityDescriptionTreasury';
@@ -22,44 +18,20 @@ export function ActivityDescription({ activity, showFullDescription }: IActivity
const metaData = useGetMetadata(activity as FractalProposal);
const snapshotProposal = activity as SnapshotProposal;
- const azoriusProposal = activity as AzoriusProposal;
- const multisigProposal = activity as MultisigProposal;
const description = snapshotProposal.description || metaData.description;
- const isSnapshotProposal = !!snapshotProposal.snapshotProposalId;
- const isAzoriusProposal = !!azoriusProposal.proposer;
- const proposer = isAzoriusProposal
- ? azoriusProposal.proposer
- : isSnapshotProposal
- ? snapshotProposal.author
- : multisigProposal.confirmations[0].owner;
-
- const { displayName: author } = useDisplayName(proposer);
return (
-
-
-
- {author}
-
{description && (
)}
- {!!activity.transaction && }
-
+
+ {!!activity.transaction && }
+
+
);
}
diff --git a/src/components/Activity/ActivityDescriptionGovernance.tsx b/src/components/Activity/ActivityDescriptionGovernance.tsx
index d32f69178a..d3d15e7e5b 100644
--- a/src/components/Activity/ActivityDescriptionGovernance.tsx
+++ b/src/components/Activity/ActivityDescriptionGovernance.tsx
@@ -1,15 +1,17 @@
import { Box, Flex, Text } from '@chakra-ui/react';
import { useTranslation } from 'react-i18next';
import { useGetMetadata } from '../../hooks/DAO/proposal/useGetMetadata';
+import useDisplayName from '../../hooks/utils/useDisplayName';
import {
Activity,
GovernanceActivity,
MultisigProposal,
ActivityEventType,
- TreasuryActivity,
SnapshotProposal,
FractalProposal,
+ AzoriusProposal,
} from '../../types';
+import Avatar from '../ui/page/Header/Avatar';
const formatId = (proposalId: string) => {
if (proposalId.startsWith('0x')) {
@@ -36,34 +38,53 @@ function OnChainRejectionMessage({ activity }: { activity: Activity }) {
);
}
+function ProposalAuthor({ activity }: { activity: Activity }) {
+ const snapshotProposal = activity as SnapshotProposal;
+ const azoriusProposal = activity as AzoriusProposal;
+ const multisigProposal = activity as MultisigProposal;
+ const isSnapshotProposal = !!snapshotProposal.snapshotProposalId;
+ const isAzoriusProposal = !!azoriusProposal.proposer;
+
+ const proposer = isAzoriusProposal
+ ? azoriusProposal.proposer
+ : isSnapshotProposal
+ ? snapshotProposal.author
+ : multisigProposal.confirmations[0].owner;
+
+ const { displayName: author } = useDisplayName(proposer);
+ return (
+
+
+ {author}
+
+ );
+}
+
export function ProposalTitle({ activity }: { activity: Activity }) {
- const { t } = useTranslation(['common', 'dashboard']);
const metaData = useGetMetadata(activity as FractalProposal);
if (activity.eventType !== ActivityEventType.Governance) {
return null;
}
- if ((activity as SnapshotProposal).snapshotProposalId) {
- return (
-
- {formatId((activity as SnapshotProposal).snapshotProposalId)}
- {(activity as SnapshotProposal).title}
-
- );
- }
-
- const treasuryActivity = activity as TreasuryActivity;
- const hasTransfers =
- treasuryActivity.transferAddresses && !!treasuryActivity.transferAddresses.length;
+ // Check if it's a SnapshotProposal and set variables accordingly
+ const isSnapshotProposal = (activity as SnapshotProposal).snapshotProposalId !== undefined;
+ const proposalIdText = isSnapshotProposal
+ ? formatId((activity as SnapshotProposal).snapshotProposalId)
+ : formatId((activity as GovernanceActivity).proposalId);
+ const proposaltitleText = isSnapshotProposal
+ ? (activity as SnapshotProposal).title
+ : metaData.title || '';
+ const titleText = proposalIdText + ' ' + proposaltitleText;
return (
- {formatId((activity as GovernanceActivity).proposalId)}
- {metaData.title ? {metaData.title} : null}
+
+ {titleText}
+
+
- {hasTransfers && {t('proposalDescriptionCont', { ns: 'dashboard' })} }
-
+
+
+
);
}
diff --git a/src/components/Activity/ActivityDescriptionModule.tsx b/src/components/Activity/ActivityDescriptionModule.tsx
index dead54af51..fe1c8de28b 100644
--- a/src/components/Activity/ActivityDescriptionModule.tsx
+++ b/src/components/Activity/ActivityDescriptionModule.tsx
@@ -1,34 +1,60 @@
-import { Flex, Text } from '@chakra-ui/react';
+import { Box, Flex, Text } from '@chakra-ui/react';
+import { format } from 'date-fns';
import { useTranslation } from 'react-i18next';
-import { FractalProposal } from '../../types';
+import { useFractal } from '../../providers/App/AppProvider';
+import { ActivityEventType, FractalProposal } from '../../types';
+import { DEFAULT_DATE_FORMAT } from '../../utils';
import { ActivityAddress } from './ActivityAddress';
export function ActivityDescriptionModule({ activity }: { activity: FractalProposal }) {
- const { t } = useTranslation(['treasury', 'dashboard']);
+ const { t } = useTranslation(['treasury', 'dashboard', 'common']);
+
+ const {
+ node: { daoAddress },
+ } = useFractal();
+ const eventDateLabel = t(
+ activity.eventType === ActivityEventType.Treasury
+ ? activity.transaction?.to === daoAddress
+ ? 'received'
+ : 'sent'
+ : 'created',
+ );
return (
-
- {t('moduleDescription', { ns: 'dashboard', count: activity.targets.length })}
- {activity.targets.length > 2 ? (
-
- {t('addresses', {
- ns: 'treasury',
- numOfAddresses: activity.targets.length,
- })}
-
- ) : (
- activity.targets.map((address, i, arr) => (
-
- ))
- )}
-
+
+ {t('moduleDescription', { ns: 'dashboard', count: activity.targets.length })}
+
+ {activity.targets.length > 2
+ ? t('addresses', {
+ ns: 'treasury',
+ numOfAddresses: activity.targets.length,
+ })
+ : activity.targets.map((address, i, arr) => (
+
+ ))}
+
+
+
+ {activity.eventDate && (
+
+ {eventDateLabel} {format(activity.eventDate, DEFAULT_DATE_FORMAT)}
+
+ )}
+
+
);
}
diff --git a/src/components/Activity/ActivityDescriptionTreasury.tsx b/src/components/Activity/ActivityDescriptionTreasury.tsx
index 9866ab31d7..50a21b9185 100644
--- a/src/components/Activity/ActivityDescriptionTreasury.tsx
+++ b/src/components/Activity/ActivityDescriptionTreasury.tsx
@@ -1,4 +1,4 @@
-import { Text } from '@chakra-ui/react';
+import { Flex, Text } from '@chakra-ui/react';
import { useTranslation } from 'react-i18next';
import { Activity, TreasuryActivity, ActivityEventType } from '../../types';
import { ActivityAddress } from './ActivityAddress';
@@ -26,27 +26,29 @@ export function ActivityDescriptionTreasury({ activity }: { activity: Activity }
? t('from')
: t('to');
+ const textString = transferTypeStr
+ ? transferTypeStr +
+ ' ' +
+ treasuryActivity.transferAmountTotals.join(', ') +
+ ' ' +
+ transferDirStr
+ : undefined;
+
return (
- <>
-
- {transferTypeStr} {treasuryActivity.transferAmountTotals.join(', ')} {transferDirStr}
-
- {treasuryActivity.transferAddresses.length > 2 ? (
-
- {t('addresses', {
+
+ {textString}
+ {treasuryActivity.transferAddresses.length > 2
+ ? t('addresses', {
ns: 'treasury',
numOfAddresses: treasuryActivity.transferAddresses.length,
- })}
-
- ) : (
- treasuryActivity.transferAddresses.map((address, i, arr) => (
-
- ))
- )}
- >
+ })
+ : treasuryActivity.transferAddresses.map((address, i, arr) => (
+
+ ))}
+
);
}
diff --git a/src/components/Activity/ActivityModule.tsx b/src/components/Activity/ActivityModule.tsx
index d1cdf1e422..c0bb90cb3e 100644
--- a/src/components/Activity/ActivityModule.tsx
+++ b/src/components/Activity/ActivityModule.tsx
@@ -1,48 +1,23 @@
-import { Button } from '@chakra-ui/react';
-import { ArrowAngleUp } from '@decent-org/fractal-ui';
-import { format } from 'date-fns';
-import { useTranslation } from 'react-i18next';
import { FractalProposal } from '../../types';
-import { DEFAULT_DATE_FORMAT } from '../../utils/numberFormats';
import { Badge } from '../ui/badges/Badge';
import EtherscanLinkTransaction from '../ui/links/EtherscanLinkTransaction';
import { ActivityCard } from './ActivityCard';
import { ActivityDescriptionModule } from './ActivityDescriptionModule';
export function ActivityModule({ activity }: { activity: FractalProposal }) {
- const { t } = useTranslation('common');
return (
-
- )
- }
- description={}
- RightElement={
- !!activity.transactionHash && (
-
-
- }
- >
- {t('labelEtherscan')}
-
-
- )
- }
- eventDate={format(activity.eventDate, DEFAULT_DATE_FORMAT)}
- />
+
+
+ )
+ }
+ description={}
+ />
+
);
}
diff --git a/src/components/ui/proposal/Markdown.tsx b/src/components/ui/proposal/Markdown.tsx
index ac0cf1c15c..f1b63fe2fa 100644
--- a/src/components/ui/proposal/Markdown.tsx
+++ b/src/components/ui/proposal/Markdown.tsx
@@ -1,4 +1,4 @@
-import { Text, Button, Image } from '@chakra-ui/react';
+import { Button, Image, Box } from '@chakra-ui/react';
import { useEffect, useRef, useState } from 'react';
import { useTranslation } from 'react-i18next';
import ReactMarkdown, { Components } from 'react-markdown';
@@ -83,7 +83,7 @@ export default function Markdown({ truncate, content, collapsedLines = 6 }: IMar
return (
<>
-
{content}
-
+
{totalLines > collapsedLines && !totalLinesError && !truncate && (