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

Reskin | DAO info cards #1581

Merged
merged 23 commits into from
Apr 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
a9f967b
Reskin InfoBox
DarksightKellar Apr 18, 2024
31181e3
Rename obscure index.tsx to DaoInfoHeader.tsx
DarksightKellar Apr 18, 2024
e835202
Rename misleading InfoHeader to DaoSpecificMetadataHeader, make its c…
DarksightKellar Apr 18, 2024
c726f35
Remove 1-line limit on info card DAO name
DarksightKellar Apr 19, 2024
812bea0
Resking AddressCopier, hopefully completely
DarksightKellar Apr 19, 2024
98c7c53
Reskin FavoriteIcon
DarksightKellar Apr 19, 2024
b06ffe5
Reskin DAO info crad
DarksightKellar Apr 19, 2024
e1d1c87
prettier
DarksightKellar Apr 19, 2024
2bf5be3
Add hover, active effects to AdderssCopier
DarksightKellar Apr 19, 2024
192eaf0
Resking SnapshotButton
DarksightKellar Apr 19, 2024
553becd
Size SnapshotButton
DarksightKellar Apr 19, 2024
8144f6c
Adjust font sizes and colors
DarksightKellar Apr 19, 2024
4c0bfc2
Fine tune infobox spacing. Remove unutilised minWidth prop
DarksightKellar Apr 19, 2024
f5c0b5b
Reskin sorter
DarksightKellar Apr 19, 2024
3da8ee7
Half-assed sort and dao options menu reskin. Needs more work
DarksightKellar Apr 19, 2024
fa3944d
prettier
DarksightKellar Apr 19, 2024
19e92ac
Remove unneeded `iconColor`
DarksightKellar Apr 19, 2024
8d2be86
cleanup
DarksightKellar Apr 22, 2024
1419366
prettier
DarksightKellar Apr 22, 2024
5e0911a
cleanup
DarksightKellar Apr 23, 2024
735cfc8
Have `AddressCopier` box width fit its content
DarksightKellar Apr 23, 2024
30fa18d
Merge branch 'reskin/refactor-root-reskin' into reskin/dao-info-cards
DarksightKellar Apr 23, 2024
e087af5
prettier
DarksightKellar Apr 23, 2024
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
4 changes: 0 additions & 4 deletions public/images/snapshot-icon.svg

This file was deleted.

1 change: 1 addition & 0 deletions src/components/Activity/ActivityCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ export function ActivityCard({
mb="1rem"
>
{Badge}
{/* TODO: replace with <SnapshotIcon /> */}
{isSnapshot && (
<Image
src="/images/snapshot-icon-fill.svg"
Expand Down
1 change: 1 addition & 0 deletions src/components/Proposals/ProposalActions/CastVote.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ function Vote({
<Text>{t('poweredBy')}</Text>
<Flex>
<Flex mr={1}>
{/* TODO: replace with <SnapshotIcon /> */}
<Image
src="/images/snapshot-icon.svg"
alt="Snapshot icon"
Expand Down
1 change: 1 addition & 0 deletions src/components/Proposals/ProposalCard/ProposalCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ function ProposalCard({ proposal }: { proposal: FractalProposal }) {
size="sm"
proposal={proposal}
/>
{/* TODO: replace with <SnapshotIcon /> */}
{isSnapshotProposal && (
<Image
src="/images/snapshot-icon-fill.svg"
Expand Down
5 changes: 2 additions & 3 deletions src/components/Proposals/ProposalInfo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { useGetMetadata } from '../../hooks/DAO/proposal/useGetMetadata';
import { useFractal } from '../../providers/App/AppProvider';
import { ExtendedSnapshotProposal, FractalProposal } from '../../types';
import { ActivityDescription } from '../Activity/ActivityDescription';
import Snapshot from '../ui/badges/Snapshot';
import { SnapshotButton } from '../ui/badges/Snapshot';
import { ModalType } from '../ui/modals/ModalProvider';
import { useFractalModal } from '../ui/modals/useFractalModal';
import ProposalExecutableCode from '../ui/proposal/ProposalExecutableCode';
Expand Down Expand Up @@ -35,9 +35,8 @@ export function ProposalInfo({
<ProposalStateBox state={proposal.state} />
{isSnapshotProposal && (
<>
<Snapshot
<SnapshotButton
snapshotENS={`https://snapshot.org/#${daoSnapshotENS}/proposal/${proposal.proposalId}`}
mt={0}
/>
{(proposal as ExtendedSnapshotProposal).privacy === 'shutter' && (
<Button
Expand Down
3 changes: 2 additions & 1 deletion src/components/pages/DaoDashboard/Activities/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,9 @@ export function Activities() {
return (
<Box>
<Flex
justifyContent="flex-end"
justifyContent="flex-start"
alignItems="center"
mx="0.5rem"
my="1rem"
>
<Sort
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { InfoProposals } from './InfoProposals';
import { InfoTreasury } from './InfoTreasury';
import { ParentLink } from './ParentLink';

export function Info() {
export function DaoInfoHeader() {
const {
node: { daoAddress },
} = useFractal();
Expand All @@ -32,7 +32,7 @@ export function Info() {
<Flex
flexWrap="wrap"
justifyContent="space-between"
mb="1rem"
mb="2rem"
>
<Box
width={{ base: '100%', md: '100%', lg: '33%', xl: '40%' }}
Expand Down Expand Up @@ -98,13 +98,8 @@ export function Info() {
backgroundPosition="50%"
/>
)}
<Text
textStyle="text-lg-mono-regular"
marginBottom={2}
>
{section.title}
</Text>
<Text textStyle="text-base-mono-regular">
<Text marginBottom={2}>{section.title}</Text>
<Text>
{section.link && section.link.position === 'start' && (
<ExternalLink href={section.link.url}>{section.link.text}</ExternalLink>
)}
Expand All @@ -130,6 +125,7 @@ export function Info() {
<InfoGovernance />
</InfoBox>
</Box>

<Box
width={{ base: '100%', md: '33.3%', lg: '19%', xl: '20%' }}
ps={{ base: NONE, md: PAD }}
Expand All @@ -141,6 +137,7 @@ export function Info() {
<InfoProposals />
</InfoBox>
</Box>

<Box
width={{ base: '100%', md: '33.3%', lg: '23%', xl: '20%' }}
ps={{ base: NONE, md: PAD }}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,17 @@
import { Box, Flex, Image, Menu, MenuButton, MenuList, Text } from '@chakra-ui/react';
import { ArrowAngleUp, Burger } from '@decent-org/fractal-ui';
import { useTranslation } from 'react-i18next';
import useDAOMetadata from '../../../../hooks/DAO/useDAOMetadata';
import { useFractal } from '../../../../providers/App/AppProvider';
import { DAOMetadata } from '../../../../types';
import ExternalLink from '../../../ui/links/ExternalLink';

export default function InfoHeader() {
export function DaoSpecificMetadataHeader(props: { metadata: DAOMetadata }) {
const {
node: { daoName },
} = useFractal();
const daoMetadata = useDAOMetadata();
const { t } = useTranslation();

if (!daoMetadata) {
return null;
}
const { metadata: daoMetadata } = props;

return (
<Flex
Expand Down
1 change: 0 additions & 1 deletion src/components/pages/DaoDashboard/Info/InfoDAO.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ export function InfoDAO() {
const { node, guardContracts, guard } = useFractal();
return (
<DAOInfoCard
h="8.5rem"
parentAddress={node.nodeHierarchy.parentAddress || undefined}
node={node}
childCount={node.nodeHierarchy.childNodes.length}
Expand Down
100 changes: 16 additions & 84 deletions src/components/pages/DaoDashboard/Info/InfoGovernance.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Box, Flex, Text } from '@chakra-ui/react';
import { Govern } from '@decent-org/fractal-ui';
import { Bank } from '@phosphor-icons/react';
import { useEffect, useState } from 'react';
import { useTranslation } from 'react-i18next';
import useSafeContracts from '../../../../hooks/safe/useSafeContracts';
Expand Down Expand Up @@ -85,41 +85,23 @@ export function InfoGovernance() {
const governanceAzorius = dao?.isAzorius ? (governance as AzoriusGovernance) : undefined;

return (
<Box
data-testid="dashboard-daoGovernance"
textStyle="text-sm-sans-regular"
>
<Box data-testid="dashboard-daoGovernance">
<Flex
alignItems="center"
gap="0.4rem"
mb="0.5rem"
>
<Govern />
<Text
textStyle="text-sm-sans-regular"
color="grayscale.100"
>
{t('titleGovernance')}
</Text>
<Bank size="1.5rem" />
<Text textStyle="display-lg">{t('titleGovernance')}</Text>
</Flex>

<Flex
alignItems="center"
justifyContent="space-between"
mb="0.25rem"
>
<Text
textStyle="text-base-sans-regular"
color="chocolate.200"
>
{t('titleType')}
</Text>
<Text
textStyle="text-base-sans-regular"
color="grayscale.100"
>
{governance.type ? t(governance.type.toString(), { ns: 'daoCreate' }) : ''}
</Text>
<Text color="neutral-7">{t('titleType')}</Text>
<Text>{governance.type ? t(governance.type.toString(), { ns: 'daoCreate' }) : ''}</Text>
</Flex>

{governanceAzorius?.votingStrategy?.votingPeriod && (
Expand All @@ -128,18 +110,8 @@ export function InfoGovernance() {
justifyContent="space-between"
mb="0.25rem"
>
<Text
textStyle="text-base-sans-regular"
color="chocolate.200"
>
{t('titleVotingPeriod')}
</Text>
<Text
textStyle="text-base-sans-regular"
color="grayscale.100"
>
{governanceAzorius.votingStrategy?.votingPeriod?.formatted}
</Text>
<Text color="neutral-7">{t('titleVotingPeriod')}</Text>
<Text>{governanceAzorius.votingStrategy?.votingPeriod?.formatted}</Text>
</Flex>
)}
{governanceAzorius?.votingStrategy?.quorumPercentage && (
Expand All @@ -148,18 +120,8 @@ export function InfoGovernance() {
justifyContent="space-between"
mb="0.25rem"
>
<Text
textStyle="text-base-sans-regular"
color="chocolate.200"
>
{t('titleQuorum')}
</Text>
<Text
textStyle="text-base-sans-regular"
color="grayscale.100"
>
{governanceAzorius.votingStrategy.quorumPercentage.formatted}
</Text>
<Text color="neutral-7">{t('titleQuorum')}</Text>
<Text>{governanceAzorius.votingStrategy.quorumPercentage.formatted}</Text>
</Flex>
)}
{governanceAzorius?.votingStrategy?.quorumThreshold && (
Expand All @@ -168,18 +130,8 @@ export function InfoGovernance() {
justifyContent="space-between"
mb="0.25rem"
>
<Text
textStyle="text-base-sans-regular"
color="chocolate.200"
>
{t('titleQuorum')}
</Text>
<Text
textStyle="text-base-sans-regular"
color="grayscale.100"
>
{governanceAzorius.votingStrategy.quorumThreshold.formatted}
</Text>
<Text color="neutral-7">{t('titleQuorum')}</Text>
<Text>{governanceAzorius.votingStrategy.quorumThreshold.formatted}</Text>
</Flex>
)}
{timelockPeriod && (
Expand All @@ -188,18 +140,8 @@ export function InfoGovernance() {
justifyContent="space-between"
mb="0.25rem"
>
<Text
textStyle="text-base-sans-regular"
color="chocolate.200"
>
{t('timelock', { ns: 'common' })}
</Text>
<Text
textStyle="text-base-sans-regular"
color="grayscale.100"
>
{timelockPeriod}
</Text>
<Text color="neutral-7">{t('timelock', { ns: 'common' })}</Text>
<Text>{timelockPeriod}</Text>
</Flex>
)}
{executionPeriod && (
Expand All @@ -208,18 +150,8 @@ export function InfoGovernance() {
justifyContent="space-between"
mb="0.25rem"
>
<Text
textStyle="text-base-sans-regular"
color="chocolate.200"
>
{t('execution', { ns: 'common' })}
</Text>
<Text
textStyle="text-base-sans-regular"
color="grayscale.100"
>
{executionPeriod}
</Text>
<Text color="neutral-7">{t('execution', { ns: 'common' })}</Text>
<Text>{executionPeriod}</Text>
</Flex>
)}
</Box>
Expand Down
39 changes: 7 additions & 32 deletions src/components/pages/DaoDashboard/Info/InfoProposals.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Box, Flex, Text } from '@chakra-ui/react';
import { Proposals } from '@decent-org/fractal-ui';
import { Scroll } from '@phosphor-icons/react';
import { useTranslation } from 'react-i18next';
import { useFractal } from '../../../../providers/App/AppProvider';
import { FractalProposalState } from '../../../../types';
Expand Down Expand Up @@ -51,50 +51,25 @@ export function InfoProposals({}: IDAOGovernance) {
gap="0.4rem"
mb="0.5rem"
>
<Proposals />
<Text
textStyle="text-sm-sans-regular"
color="grayscale.100"
>
{t('titleProposals')}
</Text>
<Scroll size="1.5rem" />
<Text>{t('titleProposals')}</Text>
</Flex>

<Flex
alignItems="center"
justifyContent="space-between"
mb="0.25rem"
>
<Text
textStyle="text-base-sans-regular"
color="chocolate.200"
>
{t('titlePending')}
</Text>
<Text
textStyle="text-base-sans-regular"
color="grayscale.100"
>
{active}
</Text>
<Text color="neutral-7">{t('titlePending')}</Text>
<Text>{active}</Text>
</Flex>
<Flex
alignItems="center"
justifyContent="space-between"
mb="0.25rem"
>
<Text
textStyle="text-base-sans-regular"
color="chocolate.200"
>
{t('titlePassed')}
</Text>
<Text
textStyle="text-base-sans-regular"
color="grayscale.100"
>
{passed}
</Text>
<Text color="neutral-7">{t('titlePassed')}</Text>
<Text>{passed}</Text>
</Flex>
</Box>
);
Expand Down
18 changes: 4 additions & 14 deletions src/components/pages/DaoDashboard/Info/InfoTreasury.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Box, Flex, Text } from '@chakra-ui/react';
import { Treasury } from '@decent-org/fractal-ui';
import { Coins } from '@phosphor-icons/react';
import { useTranslation } from 'react-i18next';
import { useFractal } from '../../../../providers/App/AppProvider';
import { formatUSD } from '../../../../utils';
Expand Down Expand Up @@ -37,21 +37,11 @@ export function InfoTreasury({}: IDAOGovernance) {
gap="0.4rem"
mb="0.5rem"
>
<Treasury />
<Text
textStyle="text-sm-sans-regular"
color="grayscale.100"
>
{t('titleTreasury')}
</Text>
<Coins size="1.5rem" />
<Text textStyle="display-lg">{t('titleTreasury')}</Text>
</Flex>

<Text
textStyle="text-lg-mono-semibold"
color="grayscale.100"
>
{formatUSD(totalFiatValue)}
</Text>
<Text>{formatUSD(totalFiatValue)}</Text>
</Box>
);
}
Loading