From 6b8230c0ac7d5714609eace386af118b2e48247a Mon Sep 17 00:00:00 2001 From: "Eng. Juan Combetto" Date: Wed, 15 Nov 2023 12:27:49 +0900 Subject: [PATCH] fix(governance-screen): fix layout issues in GovernanceDetails.tsx Fix layout issues in the GovernanceDetails.tsx file. The changes include: - Added missing import statement for useIsMobile hook. - Updated the styling of certain components to fix layout issues. - Removed unnecessary code related to layout. - Updated the styling of the GovernanceBox component to fix layout issues. Fixes: fix/governance-screen --- .../GovernanceBox/GovernanceBox.tsx | 38 ++- .../screens/Governance/GovernanceDetails.tsx | 298 +++++++----------- .../screens/Governance/GovernanceScreen.tsx | 82 +++-- 3 files changed, 192 insertions(+), 226 deletions(-) diff --git a/packages/components/GovernanceBox/GovernanceBox.tsx b/packages/components/GovernanceBox/GovernanceBox.tsx index 06fc0704c5..768f7394f3 100644 --- a/packages/components/GovernanceBox/GovernanceBox.tsx +++ b/packages/components/GovernanceBox/GovernanceBox.tsx @@ -8,10 +8,11 @@ import { View, } from "react-native"; -import { BrandText } from "../../components/BrandText/BrandText"; -import { TertiaryBox } from "../../components/boxes/TertiaryBox"; import { ProposalStatus } from "../../screens/Governance/types"; import { tulipTree } from "../../utils/style/colors"; +import { layout } from "../../utils/style/layout"; +import { BrandText } from "../BrandText"; +import { TertiaryBox } from "../boxes/TertiaryBox"; // FIXME: code dedup @@ -56,16 +57,14 @@ export const GovernanceBox: React.FC<{ useState(false); const test = "%"; - const percentageYes = - ((percentageYesValue / totalUsers) * 100) - .toFixed(2) - .toString() - .substring(0, 5) + test; - const percentageNo = - ((percentageNoValue / totalUsers) * 100) - .toFixed(2) - .toString() - .substring(0, 5) + test; + let percentageYes = ((percentageYesValue / totalUsers) * 100) + .toFixed(2) + .toString(); + percentageYes = percentageYes.substring(0, 5) + test; + let percentageNo = ((percentageNoValue / totalUsers) * 100) + .toFixed(2) + .toString(); + percentageNo = percentageNo.substring(0, 5) + test; const percentageNoWithVeto = ((percentageNoWithVetoValue / totalUsers) * 100) .toFixed(2) @@ -121,7 +120,13 @@ export const GovernanceBox: React.FC<{ } return ( - + { activePopup(); @@ -134,7 +139,6 @@ export const GovernanceBox: React.FC<{ style={{ flexDirection: "column", top: 20, - width: "96%", height: "100%", }} > @@ -267,7 +271,7 @@ export const GovernanceBox: React.FC<{ > diff --git a/packages/screens/Governance/GovernanceDetails.tsx b/packages/screens/Governance/GovernanceDetails.tsx index a469f3a17a..e0489f2ba1 100644 --- a/packages/screens/Governance/GovernanceDetails.tsx +++ b/packages/screens/Governance/GovernanceDetails.tsx @@ -14,9 +14,12 @@ import { PrimaryButton } from "../../components/buttons/PrimaryButton"; import { SecondaryButton } from "../../components/buttons/SecondaryButton"; import ModalBase from "../../components/modals/ModalBase"; import { useFeedbacks } from "../../context/FeedbacksProvider"; +import { useIsMobile } from "../../hooks/useIsMobile"; import useSelectedWallet from "../../hooks/useSelectedWallet"; import { getKeplrSigningStargateClient } from "../../networks"; -import { neutral44, tulipTree } from "../../utils/style/colors"; +import { neutral33, neutral44, tulipTree } from "../../utils/style/colors"; +import { fontSemibold14, fontSemibold20 } from "../../utils/style/fonts"; +import { layout } from "../../utils/style/layout"; const Separator: React.FC<{ style?: StyleProp }> = ({ style }) => ( @@ -308,16 +310,6 @@ export const GovernanceDetails: React.FC<{ {"\u00A0"} UTC - - - - - - + - Total - - - - - {totalParticipant} - - - - - - null} - /> + > + Total + + + {totalParticipant} + + + null} + /> - - Yes {percentageYes} - - - - + + + Yes {percentageYes} + + - - Yes {percentageNo} - - - - + + + Abstain {percentageNo} + + - - NoWithVeto {percentageNoWithVeto} - - - + + + No {percentageNo} + + - - NoWithVeto {percentageNoWithVeto} - + + + NoWithVeto {percentageNoWithVeto} + + {canVoteDeposit() && ( @@ -660,10 +604,12 @@ export const GovernanceDetails: React.FC<{ } > {numberProposal} @@ -797,7 +743,7 @@ export const GovernanceDetails: React.FC<{ - + { ); return ( - - Decentralized Governance - - - + Governance} + responsive + forceNetworkKind={NetworkKind.Cosmos} + > - {filteredProposals.map((proposals, index) => ( - Decentralized Governance + + + + + ( + )} - status={proposals.status} /> - ))} + );