Skip to content

Commit

Permalink
Merge pull request #1381 from decent-dao/user-feedback/#1380-clickabl…
Browse files Browse the repository at this point in the history
…e-proposal-card

User feedback/#1380 clickable proposal card
  • Loading branch information
adamgall authored Feb 28, 2024
2 parents 8b2f71b + 4418769 commit 35d256d
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 38 deletions.
2 changes: 2 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
NEXT_PUBLIC_ALCHEMY_API_KEY=""
# Alchemy provider API key, used on Sepolia
NEXT_PUBLIC_ALCHEMY_SEPOLIA_API_KEY=""
# automated testing workflows
NEXT_PUBLIC_ALCHEMY_TESTING_API_KEY=""
Expand All @@ -12,6 +13,7 @@ NEXT_PUBLIC_INFURA_IPFS_API_KEY=""
NEXT_PUBLIC_INFURA_IPFS_API_SECRET=""
# site preview links
NEXT_PUBLIC_SITE_URL="https://app.dev.fractalframework.xyz/"
# WalletConnect Cloud Project ID
NEXT_PUBLIC_WALLET_CONNECT_PROJECT_ID=""
# Shutter Public Key
NEXT_PUBLIC_SHUTTER_EON_PUBKEY=0x0e6493bbb4ee8b19aa9b70367685049ff01dc9382c46aed83f8bc07d2a5ba3e6030bd83b942c1fd3dff5b79bef3b40bf6b666e51e7f0be14ed62daaffad47435265f5c9403b1a801921981f7d8659a9bd91fe92fb1cf9afdb16178a532adfaf51a237103874bb03afafe9cab2118dae1be5f08a0a28bf488c1581e9db4bc23ca
11 changes: 0 additions & 11 deletions src/components/Activity/ActivityDescriptionGovernance.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import {
SnapshotProposal,
FractalProposal,
} from '../../types';
import { ActivityAddress } from './ActivityAddress';

const formatId = (proposalId: string) => {
if (proposalId.startsWith('0x')) {
Expand All @@ -22,15 +21,6 @@ const formatId = (proposalId: string) => {
}
};

function TargetAddress({ activity }: { activity: Activity }) {
const governanceActivity = activity as GovernanceActivity;
if (governanceActivity.targets.length === 1) {
return <ActivityAddress address={governanceActivity.targets[0]} />;
} else {
return null;
}
}

function OnChainRejectionMessage({ activity }: { activity: Activity }) {
const { t } = useTranslation('dashboard');
const governanceActivity = activity as MultisigProposal;
Expand Down Expand Up @@ -71,7 +61,6 @@ export function ProposalTitle({ activity }: { activity: Activity }) {
<>
<Text>{formatId((activity as GovernanceActivity).proposalId)}</Text>
<Text>{metaData.title || metaData.description}</Text>
<TargetAddress activity={activity} />
{hasTransfers && <Text> {t('proposalDescriptionCont', { ns: 'dashboard' })} </Text>}
<OnChainRejectionMessage activity={activity} />
</>
Expand Down
58 changes: 33 additions & 25 deletions src/components/Activity/ActivityGovernance.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { Flex } from '@chakra-ui/react';
import { format } from 'date-fns';
import Link from 'next/link';
import { useTranslation } from 'react-i18next';
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';
Expand All @@ -26,31 +28,37 @@ export function ActivityGovernance({ activity }: { activity: FractalProposal })
: 'created'
);

const {
node: { daoAddress },
} = useFractal();

return (
<ActivityCard
Badge={
activity.state && (
<Badge
labelKey={activity.state}
size="base"
/>
)
}
description={<ActivityDescription activity={activity} />}
RightElement={
<Flex
gap={14}
alignItems="center"
>
<ProposalCountdown proposal={activity} />
<VoteContextProvider proposal={activity}>
<ProposalAction proposal={activity} />
</VoteContextProvider>
</Flex>
}
eventDate={format(activity.eventDate, DEFAULT_DATE_FORMAT)}
eventDateLabel={eventDateLabel}
isSnapshot={!!(activity as SnapshotProposal).snapshotProposalId}
/>
<Link href={DAO_ROUTES.proposal.relative(daoAddress, activity.proposalId)}>
<ActivityCard
Badge={
activity.state && (
<Badge
labelKey={activity.state}
size="base"
/>
)
}
description={<ActivityDescription activity={activity} />}
RightElement={
<Flex
gap={14}
alignItems="center"
>
<ProposalCountdown proposal={activity} />
<VoteContextProvider proposal={activity}>
<ProposalAction proposal={activity} />
</VoteContextProvider>
</Flex>
}
eventDate={format(activity.eventDate, DEFAULT_DATE_FORMAT)}
eventDateLabel={eventDateLabel}
isSnapshot={!!(activity as SnapshotProposal).snapshotProposalId}
/>
</Link>
);
}
2 changes: 1 addition & 1 deletion src/providers/NetworkConfig/networks/polygon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const SAFE_VERSION = '1.3.0';

export const polygonConfig: NetworkConfig = {
safeBaseURL: 'https://safe-transaction-polygon.safe.global',
etherscanBaseURL: 'https://polygonscan.com/',
etherscanBaseURL: 'https://polygonscan.com',
etherscanAPIBaseUrl: 'https://api.polygonscan.com/api', // TODO test ABISelector on template builder
chainId: CHAIN_ID,
name: polygon.name,
Expand Down
2 changes: 1 addition & 1 deletion src/providers/NetworkConfig/networks/sepolia.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const SAFE_VERSION = '1.3.0';

export const sepoliaConfig: NetworkConfig = {
safeBaseURL: 'https://safe-transaction-sepolia.safe.global',
etherscanBaseURL: 'https://sepolia.etherscan.io/',
etherscanBaseURL: 'https://sepolia.etherscan.io',
etherscanAPIBaseUrl: 'https://api-sepolia.etherscan.io',
chainId: CHAIN_ID,
name: sepolia.name,
Expand Down

0 comments on commit 35d256d

Please sign in to comment.