-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feature] Add ability to create schedules from existing transactions #2222
Conversation
✅ Deploy Preview for actualbudget ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
Bundle Stats — desktop-clientHey there, this message comes from a GitHub action that helps you and reviewers to understand how these changes affect the size of this project's bundle. As this PR is updated, I'll keep you updated on how the bundle size is impacted. Total
Changeset No files were changed View detailed bundle breakdownAdded No assets were added Removed No assets were removed Bigger No assets were bigger Smaller No assets were smaller Unchanged
|
Bundle Stats — loot-coreHey there, this message comes from a GitHub action that helps you and reviewers to understand how these changes affect the size of this project's bundle. As this PR is updated, I'll keep you updated on how the bundle size is impacted. Total
Changeset No files were changed View detailed bundle breakdownAdded No assets were added Removed No assets were removed Bigger No assets were bigger Smaller No assets were smaller Unchanged
|
👋 Cool feature! The list of all transaction options is getting quite long. Could you instead create a "create schedule" button in the "Link schedule" modal? That would solve the same problem (albeit with one more click, but I think that's fine since we don't expect people to be creating schedules often). |
Adjusted let me know thoughts. |
Nice. I like that new placement of the button. We probably should add this to the docs in some way |
Fixed lint's, |
Where do I update that? |
if you run |
There is a repo for the docs and website https://github.com/actualbudget/docs |
Added -> |
Nice! This looks much better. But I'm seeing some usability problems:
Would you mind taking a look at these small issues? Also: please run Let me know if I/we can help! |
Makes sense, adjusted as per comments, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
UX looks and works great! Did a first pass code review. Some smaller issues, but some bigger. Overall looks pretty good. Thanks!
packages/desktop-client/src/components/schedules/ScheduleLink.tsx
Outdated
Show resolved
Hide resolved
packages/desktop-client/src/components/schedules/ScheduleLink.tsx
Outdated
Show resolved
Hide resolved
packages/desktop-client/src/components/schedules/ScheduleLink.tsx
Outdated
Show resolved
Hide resolved
packages/desktop-client/src/components/transactions/SelectedTransactions.jsx
Outdated
Show resolved
Hide resolved
packages/desktop-client/src/components/transactions/SimpleTransactionsTable.jsx
Outdated
Show resolved
Hide resolved
Updated all comments, |
# Conflicts: # packages/desktop-client/src/components/schedules/ScheduleLink.tsx
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We're getting very close! Noticed a few other small bugs and some small code issues. LMK what you think.
if (fromTrans) { | ||
action.transactions = action.transactions.filter( | ||
x => x.id !== transaction.id, | ||
); | ||
action.transactions.unshift(transaction); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💬 suggestion: Is this just sorting the transactions so a specific one would be always one the top? Could we instead use the sort
operation for it and keep the input (action.transactions
) immutable?
i.e. something along the lines of
return {
...state,
transactions: action.transactions.sort((a, b) => {
if (fromTrans) {
// some custom sorting logic
}
return 0;
})
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done, However as discussed this now means that if you adjust the details of the schedule, you can lose the transaction you are trying to link from.
if (fromTrans) { | ||
schedule._account = transaction.account; | ||
schedule._amount = transaction.amount; | ||
schedule._amountOp = 'is'; | ||
schedule._date = { | ||
frequency: 'monthly', | ||
start: transaction.date, | ||
patterns: [], | ||
}; | ||
schedule.name = payees[transaction.payee].name; | ||
schedule._payee = transaction.payee; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
start: transaction.date, | ||
patterns: [], | ||
}; | ||
schedule.name = payees[transaction.payee].name; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔨 warning: what if the transaction doesn't have a payee?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
const selectedInst = useSelected('transactions', state.transactions, [ | ||
transaction ? transaction.id : null, | ||
]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💬 suggestion: I'm not entirely sure what problems a null value here might cause in other parts of the product. It would be safer to do this:
const selectedInst = useSelected('transactions', state.transactions, [ | |
transaction ? transaction.id : null, | |
]); | |
const selectedInst = useSelected('transactions', state.transactions, transaction ? [transaction.id] : []); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Like it makes, sense
}: { | ||
actions: BoundActions; | ||
modalProps?: CommonModalProps; | ||
transactionIds: string[]; | ||
getTransaction: (tranID: string) => TransactionEntity; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🥜 nitpick: no need to truncate the variable name
getTransaction: (tranID: string) => TransactionEntity; | |
getTransaction: (transactionId: string) => TransactionEntity; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
style={{ marginLeft: 15, padding: '4px 10px' }} | ||
onClick={onCreate} | ||
> | ||
<SvgAdd style={{ width: '20px', padding: '3px' }} /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🥜 nitpick:
<SvgAdd style={{ width: '20px', padding: '3px' }} /> | |
<SvgAdd style={{ width: 20, padding: 3 }} /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Thanks for being so patient and thanks for your contribution!
As discussed.. actualbudget/actual#2222 --------- Co-authored-by: xentara1 <xentara1@xentara1.com> Co-authored-by: alex Foreman <>
#2221
Please let me know thoughts, or if you need any additional information