From e76b54539209d671d8130abb2eb63cf768255c8a Mon Sep 17 00:00:00 2001 From: Ashutosh Kumar Date: Tue, 3 Sep 2024 22:17:07 +0530 Subject: [PATCH] TS Fixes --- .../pages/DAOList/components/DAOItem.tsx | 6 ++-- src/modules/explorer/pages/DAOList/index.tsx | 29 ++++++++++--------- 2 files changed, 18 insertions(+), 17 deletions(-) diff --git a/src/modules/explorer/pages/DAOList/components/DAOItem.tsx b/src/modules/explorer/pages/DAOList/components/DAOItem.tsx index c7b9145e..3de2f799 100644 --- a/src/modules/explorer/pages/DAOList/components/DAOItem.tsx +++ b/src/modules/explorer/pages/DAOList/components/DAOItem.tsx @@ -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 ( diff --git a/src/modules/explorer/pages/DAOList/index.tsx b/src/modules/explorer/pages/DAOList/index.tsx index f04209a1..824b4e96 100644 --- a/src/modules/explorer/pages/DAOList/index.tsx +++ b/src/modules/explorer/pages/DAOList/index.tsx @@ -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) {