Skip to content

Commit

Permalink
Merge pull request #1835 from kaloudis/activity-filter-in-transit
Browse files Browse the repository at this point in the history
Activity Filter: In transit payments
  • Loading branch information
kaloudis authored Nov 12, 2023
2 parents dcd0b08 + 5bf25af commit 479bebe
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 0 deletions.
1 change: 1 addition & 0 deletions locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -803,6 +803,7 @@
"views.ActivityFilter.lightningPayments": "Lightning payments",
"views.ActivityFilter.onChainPayments": "On-chain payments",
"views.ActivityFilter.minimumAmount": "Minimum Amount (sats)",
"views.ActivityFilter.inTransit": "In transit payments",
"general.clearChanges": "Clear changes",
"views.Routing.RoutingEvent.sourceChannel": "Source Channel",
"views.Routing.RoutingEvent.destinationChannel": "Destination Channel",
Expand Down
3 changes: 3 additions & 0 deletions stores/ActivityStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export interface Filter {
sent: boolean;
received: boolean;
unpaid: boolean;
inTransit: boolean;
minimumAmount: number;
startDate?: Date;
endDate?: Date;
Expand All @@ -35,6 +36,7 @@ export const DEFAULT_FILTERS = {
sent: true,
received: true,
unpaid: true,
inTransit: false,
minimumAmount: 0,
startDate: undefined,
endDate: undefined
Expand Down Expand Up @@ -83,6 +85,7 @@ export default class ActivityStore {
sent: false,
received: true,
unpaid: false,
inTransit: false,
minimumAmount: 0,
startDate: undefined,
endDate: undefined
Expand Down
11 changes: 11 additions & 0 deletions utils/ActivityFilterUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,17 @@ class ActivityFilterUtils {
);
}

if (filter.inTransit == false) {
filteredActivity = filteredActivity.filter(
(activity: any) =>
!(
activity.model ===
localeString('views.Payment.title') &&
activity.isInTransit
)
);
}

if (filter.minimumAmount > 0) {
filteredActivity = filteredActivity.filter(
(activity: any) =>
Expand Down
7 changes: 7 additions & 0 deletions views/Activity/ActivityFilter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ export default class ActivityFilter extends React.Component<
sent,
received,
unpaid,
inTransit,
minimumAmount,
startDate,
endDate
Expand Down Expand Up @@ -185,6 +186,12 @@ export default class ActivityFilter extends React.Component<
var: 'unpaid',
type: 'Toggle'
},
{
label: localeString('views.ActivityFilter.inTransit'),
value: inTransit,
var: 'inTransit',
type: 'Toggle'
},
{
label: localeString('views.ActivityFilter.minimumAmount'),
value: minimumAmount,
Expand Down

0 comments on commit 479bebe

Please sign in to comment.