Skip to content

Commit 25a1562

Browse files
authored
Merge branch 'main' into dependabot/npm_and_yarn/minor-and-patch-728026c859
2 parents aa10bb7 + ea1fcae commit 25a1562

7 files changed

Lines changed: 53 additions & 6 deletions

File tree

.changeset/config.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"$schema": "https://unpkg.com/@changesets/config@3.0.5/schema.json",
33
"access": "restricted",
44
"baseBranch": "main",
5+
"changedFilePatterns": ["src/**"],
56
"changelog": ["@changesets/changelog-github", { "repo": "aragon/gov-ui-kit" }],
67
"commit": false,
78
"fixed": [],

.changeset/nine-moles-start.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@aragon/gov-ui-kit': minor
3+
---
4+
5+
Add `hideValue` flag to `TransactionDataListItem` to hide fiat value

.github/workflows/library-release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ jobs:
5050
git push --follow-tags
5151
- name: Read changelog updates
5252
id: read-changelog
53-
uses: actions/github-script@v7.0.1
53+
uses: actions/github-script@v8.0.0
5454
env:
5555
version: "${{ steps.package-version.outputs.current-version }}"
5656
path: ./CHANGELOG.md
@@ -59,7 +59,7 @@ jobs:
5959
const readChangelog = require('./.github/workflows/scripts/readChangelog.js');
6060
readChangelog({ github, context, core });
6161
- name: Create release
62-
uses: softprops/action-gh-release@v2.3.2
62+
uses: softprops/action-gh-release@v2.3.3
6363
with:
6464
prerelease: false
6565
tag_name: "v${{ steps.package-version.outputs.current-version}}"

src/modules/components/transaction/transactionDataListItem/transactionDataListItemStructure/transactionDataListItemStructure.api.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@ export type ITransactionDataListItemProps = IDataListItemProps & {
3030
* The price of the transaction in USD.
3131
*/
3232
amountUsd?: number | string;
33+
/**
34+
* Whether to hide the value of the transaction (USD price).
35+
*/
36+
hideValue?: boolean;
3337
/**
3438
* The type of transaction.
3539
* @default TransactionType.ACTION

src/modules/components/transaction/transactionDataListItem/transactionDataListItemStructure/transactionDataListItemStructure.stories.tsx

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,15 @@ type Story = StoryObj<typeof TransactionDataListItemStructure>;
2323
/**
2424
* Default usage example of the TransactionDataList module component.
2525
*/
26-
export const Default: Story = {};
26+
export const Deposit: Story = {
27+
args: {
28+
status: TransactionStatus.SUCCESS,
29+
type: TransactionType.DEPOSIT,
30+
tokenAmount: 10,
31+
tokenSymbol: 'ETH',
32+
date: 1613984914000,
33+
},
34+
};
2735

2836
/**
2937
* Example of the TransactionDataList component with withdraw transaction.
@@ -52,4 +60,19 @@ export const Failed: Story = {
5260
},
5361
};
5462

63+
/**
64+
* Example of the TransactionDataList component without fiat price.
65+
*/
66+
export const HideValue: Story = {
67+
args: {
68+
status: TransactionStatus.SUCCESS,
69+
type: TransactionType.DEPOSIT,
70+
tokenSymbol: 'ETH',
71+
tokenAmount: 10,
72+
amountUsd: 100,
73+
hideValue: true,
74+
date: 1613984914000,
75+
},
76+
};
77+
5578
export default meta;

src/modules/components/transaction/transactionDataListItem/transactionDataListItemStructure/transactionDataListItemStructure.test.tsx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,4 +92,13 @@ describe('<TransactionDataListItem.Structure /> component', () => {
9292
render(createTestComponent({ href }));
9393
expect(screen.getByRole('link')).toHaveAttribute('href', href);
9494
});
95+
96+
it('does not render the formatted USD price of the transaction when hideValue flag is set', () => {
97+
const amountUsd = '123.21';
98+
const tokenAmount = 10;
99+
const type = TransactionType.DEPOSIT;
100+
const usdPrice = formatterUtils.formatNumber(amountUsd, { format: NumberFormat.FIAT_TOTAL_SHORT })!;
101+
render(createTestComponent({ amountUsd, tokenAmount, type, hideValue: true }));
102+
expect(screen.queryByText(usdPrice)).not.toBeInTheDocument();
103+
});
95104
});

src/modules/components/transaction/transactionDataListItem/transactionDataListItemStructure/transactionDataListItemStructure.tsx

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ export const TransactionDataListItemStructure: React.FC<ITransactionDataListItem
4040
tokenSymbol,
4141
tokenAmount,
4242
amountUsd,
43+
hideValue,
4344
type = TransactionType.ACTION,
4445
status = TransactionStatus.PENDING,
4546
date,
@@ -81,7 +82,7 @@ export const TransactionDataListItemStructure: React.FC<ITransactionDataListItem
8182
<Spinner className="transition" variant="neutral" responsiveSize={{ md: 'lg' }} />
8283
</div>
8384
)}
84-
<div className="flex w-full flex-col items-start gap-y-1 self-center">
85+
<div className="flex w-full flex-col items-start gap-y-0.5 self-center md:gap-y-1">
8586
<span className="leading-tight text-neutral-800 md:text-lg">{typeToHeading[type]}</span>
8687
{date && (
8788
<p className="text-sm leading-tight text-neutral-500 md:text-base">
@@ -90,9 +91,13 @@ export const TransactionDataListItemStructure: React.FC<ITransactionDataListItem
9091
)}
9192
</div>
9293

93-
<div className="flex shrink-0 flex-col items-end gap-y-1 truncate">
94+
<div className="flex h-full shrink-0 flex-col items-end gap-y-0.5 truncate md:gap-y-1">
9495
<span className="leading-tight text-neutral-800 md:text-lg">{processedTokenAmount}</span>
95-
<span className="text-sm leading-tight text-neutral-500 md:text-base">{formattedTransactionValue}</span>
96+
{!hideValue && (
97+
<span className="text-sm leading-tight text-neutral-500 md:text-base">
98+
{formattedTransactionValue}
99+
</span>
100+
)}
96101
</div>
97102
</DataList.Item>
98103
);

0 commit comments

Comments
 (0)