Skip to content

Commit e51c66d

Browse files
committed
Improve activity feed visuals
1 parent 37b132a commit e51c66d

File tree

3 files changed

+45
-33
lines changed

3 files changed

+45
-33
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
},
1919
"dependencies": {
2020
"@aptos-labs/confidential-asset-wasm-bindings": "^0.0.2",
21-
"@aptos-labs/confidential-assets": "file:/Users/dport/a/aptos-ts-sdk/confidential-assets",
21+
"@aptos-labs/confidential-assets": "^0.2.6",
2222
"@aptos-labs/gas-station-client": "^1.0.0",
2323
"@aptos-labs/ts-sdk": "^1.38.0",
2424
"@distributedlab/tools": "^1.0.0-rc.17",

pnpm-lock.yaml

Lines changed: 8 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/app/dashboard/components/ActivitiesFeed.tsx

Lines changed: 36 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { useInfiniteQuery } from '@tanstack/react-query';
33
import {
44
ArrowDownIcon,
55
ArrowUpIcon,
6-
ExternalLinkIcon,
6+
DollarSignIcon,
77
FolderOpenIcon,
88
RefreshCw,
99
} from 'lucide-react';
@@ -253,7 +253,6 @@ export default function ActivitiesFeed() {
253253
</div>
254254
);
255255
}
256-
257256
function TxItem({
258257
activityType,
259258
timestamp,
@@ -272,6 +271,10 @@ function TxItem({
272271
}) {
273272
const isOutgoing = fromAddress.toString() === currentAddress.toString();
274273

274+
// This case can only happen on testnet, courtesy of minting.
275+
const isSelfDeposit =
276+
activityType === 'deposit' && fromAddress.toString() === currentAddress.toString();
277+
275278
let title = '';
276279
let icon;
277280
let amountDisplay = '';
@@ -283,10 +286,15 @@ function TxItem({
283286
) : (
284287
<ArrowDownIcon size={18} className={cn('text-textPrimary')} />
285288
);
289+
// TODO: Show the real amount.
286290
amountDisplay = 'Confidential';
287291
} else if (activityType === 'deposit') {
288-
title = 'Deposit';
289-
icon = <ArrowDownIcon size={18} className={cn('text-textPrimary')} />;
292+
title = isSelfDeposit ? 'Mint' : 'Deposit';
293+
icon = isSelfDeposit ? (
294+
<DollarSignIcon size={18} className={cn('text-textPrimary')} />
295+
) : (
296+
<ArrowDownIcon size={18} className={cn('text-textPrimary')} />
297+
);
290298
// Cast rest to DepositActivity to access amount
291299
const { amount } = rest as unknown as DepositActivity;
292300
amountDisplay = formatAmount(amount, tokenSymbol, tokenDecimals);
@@ -316,39 +324,40 @@ function TxItem({
316324

317325
{/* To/From information */}
318326
<div className='flex items-center gap-1'>
319-
<span className='typography-caption2 text-textSecondary'>
327+
<span className='typography-caption1 text-textSecondary'>
320328
{activityType === 'transfer' && (isOutgoing ? 'To: ' : 'From: ')}
321329
{activityType === 'deposit' && 'From: '}
322330
{activityType === 'withdraw' && 'To: '}
323331
</span>
324-
<AddressDisplay
325-
address={
326-
activityType === 'transfer'
327-
? isOutgoing
328-
? toAddress
329-
: fromAddress
330-
: activityType === 'deposit'
331-
? fromAddress
332-
: toAddress
333-
}
334-
/>
335-
336-
<div className='ml-2 flex items-center gap-1'>
337-
<UiIcon name='CalendarIcon' size={12} className='text-textSecondary' />
338-
{timestamp && (
339-
<span className='typography-caption2 text-textSecondary'>
340-
{timestamp.toLocaleString()}
341-
</span>
342-
)}
343-
</div>
332+
<>
333+
<AddressDisplay
334+
address={
335+
activityType === 'transfer'
336+
? isOutgoing
337+
? toAddress
338+
: fromAddress
339+
: activityType === 'deposit'
340+
? fromAddress
341+
: toAddress
342+
}
343+
/>
344+
<div className='ml-2' />
345+
</>
344346

345347
<Link
346348
href={getTxExplorerUrl(txnVersion.toString())}
347349
target='_blank'
348350
className='ml-auto'
349351
aria-label='View transaction details'
350352
>
351-
<ExternalLinkIcon size={14} className='text-textSecondary' />
353+
<div className='flex items-center gap-1'>
354+
<UiIcon name='CalendarIcon' size={12} className='text-textSecondary' />
355+
{timestamp && (
356+
<span className='typography-caption2 text-textSecondary'>
357+
{timestamp.toLocaleString()}
358+
</span>
359+
)}
360+
</div>
352361
</Link>
353362
</div>
354363
</div>
@@ -407,7 +416,7 @@ const AddressDisplay = ({ address }: { address: AccountAddress }) => {
407416
// Extract the part before the first dot if it's a valid name
408417
const formattedName = name.split('.')[0];
409418
return (
410-
<span className='typography-caption1 text-textPrimary'>{formattedName}</span>
419+
<span className='typography-caption1 text-textPrimary'>@{formattedName}</span>
411420
);
412421
}
413422

0 commit comments

Comments
 (0)