Skip to content

Commit

Permalink
New: Show badge of number of created txns
Browse files Browse the repository at this point in the history
  • Loading branch information
brafdlog committed Nov 21, 2022
1 parent 1e35bf7 commit 88be256
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion ui-react/src/Store.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ export default class Store {
}
const accountScrapingData = this.accountScrapingData.get(accountId);
if (accountScrapingData) {
accountScrapingData.logs.push({message: budgetTrackingEvent.message});
accountScrapingData.logs.push({message: budgetTrackingEvent.message, originalEvent: budgetTrackingEvent});
accountScrapingData.status = budgetTrackingEvent.accountStatus;
}
}
Expand Down
4 changes: 4 additions & 0 deletions ui-react/src/components/accounts/Account.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,7 @@
height: 18px;
width: 18px;
}

.newTxnsIndicator {
margin-right: 8px;
}
4 changes: 4 additions & 0 deletions ui-react/src/components/accounts/Account.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import Badge from 'react-bootstrap/Badge';
import styles from './Account.module.css';
import { Account as AccountType } from '../../types';
import StatusIndicator from './StatusIndicator';
Expand All @@ -17,6 +18,8 @@ export default function Account({
account, actionButtons
}: AccountProps) {
const containerStyles = [styles.container];

const badgeNumberLog = account.logs.find(log => log.originalEvent && log.originalEvent.exportedTransactionsNum > 0);
if (!account.active) containerStyles.push(styles.notActive);
return (
<div className={containerStyles.join(' ')}>
Expand All @@ -28,6 +31,7 @@ export default function Account({
<img className={styles.logsButton} src={icon} alt="action" onClick={clickHandler} key={icon} />)
}
<StatusIndicator status={account.status} />
{ badgeNumberLog && <Badge className={styles.newTxnsIndicator} bg={'success'}>{badgeNumberLog.originalEvent.exportedTransactionsNum}</Badge>}
</div>
);
}
1 change: 1 addition & 0 deletions ui-react/src/types.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ export type BudgetTrackingEvent = {

export interface Log {
message: string;
originalEvent?: BudgetTrackingEvent
}

export interface Account {
Expand Down

0 comments on commit 88be256

Please sign in to comment.