Skip to content

Commit a2bffb8

Browse files
authored
Merge pull request #3172 from IntersectMBO/feat/3148-improve-numerical-data-formatting-in-drep-directory
feat(#3148): improve numerical data formatting in drep directory
2 parents 376c95e + 3ca7470 commit a2bffb8

File tree

5 files changed

+33
-12
lines changed

5 files changed

+33
-12
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ changes.
1212

1313
### Added
1414

15-
- Add support for ada handle in drep payment address [Issue 3155]()
15+
- Add support for ada handle in drep payment address [Issue 3155](https://github.com/IntersectMBO/govtool/issues/3155)
16+
- Improve numerical data formatting in drep directory [Issue 3148](https://github.com/IntersectMBO/govtool/issues/3148)
1617

1718
### Fixed
1819

govtool/frontend/src/components/organisms/AutomatedVotingOptions.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { ICONS } from "@consts";
1111
import { PendingTransaction } from "@context";
1212
import { useGetNetworkMetrics, useTranslation } from "@hooks";
1313
import { AutomatedVotingCard } from "@molecules";
14-
import { correctVoteAdaFormat, openInNewTab } from "@/utils";
14+
import { correctDRepDirectoryFormat, openInNewTab } from "@/utils";
1515
import {
1616
AutomatedVotingOptionCurrentDelegation,
1717
AutomatedVotingOptionDelegationId,
@@ -129,7 +129,9 @@ export const AutomatedVotingOptions = ({
129129
}
130130
votingPower={
131131
networkMetrics
132-
? correctVoteAdaFormat(networkMetrics?.alwaysAbstainVotingPower)
132+
? correctDRepDirectoryFormat(
133+
networkMetrics?.alwaysAbstainVotingPower,
134+
)
133135
: ""
134136
}
135137
transactionId={
@@ -170,7 +172,7 @@ export const AutomatedVotingOptions = ({
170172
}
171173
votingPower={
172174
networkMetrics
173-
? correctVoteAdaFormat(
175+
? correctDRepDirectoryFormat(
174176
networkMetrics?.alwaysNoConfidenceVotingPower,
175177
)
176178
: ""

govtool/frontend/src/components/organisms/DRepCard.tsx

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { useTranslation } from "@hooks";
88
import { DRepData, DRepStatus } from "@models";
99
import { Card } from "@molecules";
1010
import {
11-
correctVoteAdaFormat,
11+
correctDRepDirectoryFormat,
1212
ellipsizeText,
1313
encodeCIP129Identifier,
1414
getBase64ImageDetails,
@@ -218,8 +218,21 @@ export const DRepCard = ({
218218
</Box>
219219
</Box>
220220

221-
<Box sx={{ display: "flex", flex: { xl: 1 }, gap: 3 }}>
222-
<Box sx={{ width: { lg: "128px" } }}>
221+
<Box
222+
sx={{
223+
display: "flex",
224+
flex: { xl: 1 },
225+
gap: 3,
226+
}}
227+
>
228+
<Box
229+
sx={{
230+
width: { lg: "128px" },
231+
display: "flex",
232+
alignItems: "flex-end",
233+
flexDirection: "column",
234+
}}
235+
>
223236
<Typography
224237
data-testid={`${view}-voting-power-label`}
225238
variant="caption"
@@ -232,7 +245,7 @@ export const DRepCard = ({
232245
data-testid={`${view}-voting-power`}
233246
sx={{ whiteSpace: "nowrap" }}
234247
>
235-
{correctVoteAdaFormat(votingPower)}
248+
{correctDRepDirectoryFormat(votingPower)}
236249
</Typography>
237250
</Box>
238251
<Divider

govtool/frontend/src/components/organisms/DRepDetailsCard.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { useCardano, useModal } from "@context";
77
import { useDelegateTodRep, useScreenDimension, useTranslation } from "@hooks";
88
import { Card, DataMissingInfoBox } from "@molecules";
99
import {
10-
correctVoteAdaFormat,
10+
correctDRepDirectoryFormat,
1111
encodeCIP129Identifier,
1212
testIdFromLabel,
1313
} from "@utils";
@@ -146,7 +146,7 @@ export const DRepDetailsCard = ({
146146
sx={{ display: "flex", flexDirection: "row", mt: 0.5 }}
147147
>
148148
{"₳ "}
149-
{correctVoteAdaFormat(votingPower)}
149+
{correctDRepDirectoryFormat(votingPower)}
150150
</Typography>
151151
</DRepDetailsInfoItem>
152152
</Box>

govtool/frontend/src/pages/DRepDirectoryContent.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,12 @@ import {
1414
} from "@hooks";
1515
import { DataActionsBar, EmptyStateDrepDirectory } from "@molecules";
1616
import { AutomatedVotingOptions, DRepCard } from "@organisms";
17-
import { correctVoteAdaFormat, isSameDRep, uniqBy, parseBoolean } from "@utils";
17+
import {
18+
isSameDRep,
19+
uniqBy,
20+
parseBoolean,
21+
correctDRepDirectoryFormat,
22+
} from "@utils";
1823
import { DRepData, DRepListSort, DRepStatus } from "@models";
1924
import {
2025
AutomatedVotingOptionCurrentDelegation,
@@ -102,7 +107,7 @@ export const DRepDirectoryContent: FC<DRepDirectoryContentProps> = ({
102107
return <Loader />;
103108
}
104109

105-
const ada = correctVoteAdaFormat(votingPower);
110+
const ada = correctDRepDirectoryFormat(votingPower);
106111

107112
const filteredDoNotListDReps = uniqBy(
108113
dRepList?.filter((dRep) => {

0 commit comments

Comments
 (0)