Skip to content

Commit

Permalink
TS Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
ashutoshpw committed Oct 1, 2024
1 parent 904eca6 commit e76b545
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 17 deletions.
6 changes: 2 additions & 4 deletions src/modules/explorer/pages/DAOList/components/DAOItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -123,14 +123,12 @@ export const DAOItem: React.FC<{
}
}> = ({ dao }) => {
const theme = useTheme()
const isExtraSmall = useMediaQuery(theme.breakpoints.down("sm"))
const daoType = dao.dao_type.name
const daoRouteIfLambda = daoType === "lambda" ? `dao/${dao.id}` : `lite/dao/${dao.id}`
const daoHref =
daoType !== "lambda" && daoType !== "lite"
? `${getEnv(EnvKey.REACT_APP_V2_URL)}/explorer/dao/${dao.id}`
: daoType === "lambda"
? `dao/${dao.id}`
: `lite/dao/${dao.id}`
: daoRouteIfLambda

return (
<Link underline="none" href={daoHref}>
Expand Down
29 changes: 16 additions & 13 deletions src/modules/explorer/pages/DAOList/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -131,19 +131,22 @@ export const DAOList: React.FC = () => {
const currentDAOs = useMemo(() => {
if (daos) {
const formattedDAOs = daos
.map(dao => ({
id: dao.address,
name: dao.name,
description: dao.description,
symbol: dao.token.symbol,
votingAddresses: dao.ledgers ? dao.ledgers.map(l => l.holder.address) : [],
votingAddressesCount:
dao.dao_type.name === "lite" ? dao.votingAddressesCount : dao.ledgers ? dao.ledgers?.length : 0,
dao_type: {
name: dao.dao_type.name
},
allowPublicAccess: dao.dao_type.name === "lite" ? dao.allowPublicAccess : true
}))
.map(dao => {
const votingAddressesCount =
dao.dao_type.name === "lite" ? dao.votingAddressesCount : dao.ledgers ? dao.ledgers?.length : 0
return {
id: dao.address,
name: dao.name,
description: dao.description,
symbol: dao.token.symbol,
votingAddresses: dao.ledgers ? dao.ledgers.map(l => l.holder.address) : [],
votingAddressesCount,
dao_type: {
name: dao.dao_type.name
},
allowPublicAccess: dao.dao_type.name === "lite" ? dao.allowPublicAccess : true
}
})
.sort((a, b) => b.votingAddressesCount - a.votingAddressesCount)

if (searchText) {
Expand Down

0 comments on commit e76b545

Please sign in to comment.