Skip to content

Commit

Permalink
Readable name dao table (#766)
Browse files Browse the repository at this point in the history
* adding readbale network dao table

* uipdating getNetowrk
  • Loading branch information
brossetti1 authored Aug 31, 2022
1 parent f68cbcd commit 2296b15
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
4 changes: 2 additions & 2 deletions apps/hub-app/src/components/DaoCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import styled from 'styled-components';

import {
charLimit,
getNetwork,
getNetworkName,
readableNumbers,
} from '@daohaus/common-utilities';
import {
Expand Down Expand Up @@ -137,7 +137,7 @@ export const DaoCard = ({
)}
</div>
<div className="tag-box">
<Tag tagColor="red">{getNetwork(networkId as string)?.name}</Tag>
<Tag tagColor="red">{getNetworkName(networkId)}</Tag>
<Tag tagColor="blue">{contractType}</Tag>
</div>
<a
Expand Down
4 changes: 4 additions & 0 deletions apps/hub-app/src/components/DaoTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { indigoDark } from '@radix-ui/colors';
import { ProfileAvatar, Tag } from '@daohaus/ui';
import {
charLimit,
getNetworkName,
readableNumbers,
truncateAddress,
} from '@daohaus/common-utilities';
Expand Down Expand Up @@ -177,6 +178,9 @@ export const DaoTable = ({ daoData }: IDaoTableData) => {
{
Header: 'Network',
accessor: 'networkId',
Cell: ({ value }: { value: string | undefined }) => {
return <Highlight>{getNetworkName(value)}</Highlight>;
},
},
{
Header: 'Delegate',
Expand Down
4 changes: 2 additions & 2 deletions libs/common-utilities/src/constants/chainData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@ export const NETWORK_DATA: Keychain<NetworkType> = {
},
};

export const getNetwork = (chainId: string) => {
export const getNetwork = (chainId: string | undefined) => {
if (!isValidNetwork(chainId)) {
return null;
}
return NETWORK_DATA[chainId];
};

export const getNetworkName = (chainId: string) => {
export const getNetworkName = (chainId: string | undefined) => {
return getNetwork(chainId)?.name || null;
};

Expand Down

0 comments on commit 2296b15

Please sign in to comment.