Compare commits

..

78 Commits

Author SHA1 Message Date
github-actions[bot]
1f828b6562 🔖 (25.7.0) (#5260)
* 🔖 (25.7.0)

* Empty commit to bump ci

* Remove used release notes

* Empty commit to bump CI

---------

Co-authored-by: jfdoming <9922514+jfdoming@users.noreply.github.com>
Co-authored-by: Julian Dominguez-Schatz <julian.dominguezschatz@gmail.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2025-07-01 14:35:37 -04:00
Mauritz Schild
ad9a84ddf1 Fixes #5238 last synced button text not visible on light theme. (#5241)
* Changed the buttonMenuText color for the light theme so that text is visible on light background as well.

* Updated the release notes.

* Change file name of release notes

* Remove button varient from use last synced total and restore light theme
values to previous.
2025-06-30 07:40:12 -07:00
Matiss Janis Aboltins
d9a171b249 fix: Tracking budget income budget fields missing in mobile view (#5251) 2025-06-29 18:51:04 +01:00
Matiss Janis Aboltins
e5c84d4ae0 Fix switching budget type requiring hard reload to take effect (#5253)
Fixes #5252
2025-06-29 17:43:32 +01:00
An Hoang
94a76a008d fix: reapply thousand separators before passing input to appendDecimals (#5220)
* fix: reapply thousand separators before passing input to appendDecimals

This ensures that the input going into `appendDecimals` is not malformed when the  `hideFraction` option is On, otherwise when hitting delete on the text `"1,234,567"`, it will result in the text `"1,234,56"` which the formatter will parse as `1234.56`. This doesn't happen when `hideFraction` is off since hitting delete on the text `"12,345.67"` results in `"12,345.6"`, which `appendDecimals` will happily handle in a separate case to provide `"1234.56"` as the input into `currencyToAmount`.

* Handle edge cases for reapplyThousandSeparators

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* [autofix.ci] apply automated fixes

---------

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: youngcw <calebyoung94@gmail.com>
2025-06-28 12:49:30 -07:00
Matiss Janis Aboltins
432c2b6165 Patch mobile issues - hold for next month, transfer (#5245) 2025-06-28 14:37:38 +01:00
0x4d4e
46eb2a7c38 Added a gocardless bank parser for Raiffeisen AT bank (#5244)
* Added a gocardless bank parser for Raiffeisen AT bank

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2025-06-28 09:13:45 -04:00
Jeevan Shikaram
3214d5dd53 Update links pointing to /budgeting/users/. (#5246)
* Update links pointing to /budgeting/users/.

* Add release notes.
2025-06-28 00:27:27 -04:00
youngcw
66d8f1a631 Speed up balance history graph (#5229)
* speedy

* bunny, fill in missing data

* small cleanup

* Update packages/desktop-client/src/components/sidebar/BalanceHistoryGraph.tsx

Co-authored-by: Matiss Janis Aboltins <matiss@mja.lv>

* handle some edge cases, fix the month check

* better date formatting

* one more edge case

* fix

---------

Co-authored-by: Matiss Janis Aboltins <matiss@mja.lv>
2025-06-27 12:59:32 -07:00
youngcw
e3aa63d1fa don't import deleted split lines ynab4 (#5226)
* don't import deleted split lines

* Update upcoming-release-notes/5226.md

Co-authored-by: Matt Fiddaman <github@m.fiddaman.uk>

---------

Co-authored-by: Matt Fiddaman <github@m.fiddaman.uk>
2025-06-23 14:28:24 -07:00
Michael Clark
9478707ebb Prevent forks from running nightly worfkflows (#5213)
* dont run nightly worfkflow on forks

* dont run nightly worfkflow on forks

* release notes
2025-06-21 19:04:24 +01:00
Matt Fiddaman
9952412e1d [WIP] 🌍 Mark more files for translation (#5209)
* translate more files

* prefer Trans component in JSX where possible

* note

* [autofix.ci] apply automated fixes

* aria-label

* more...

* [autofix.ci] apply automated fixes

* review

* [autofix.ci] apply automated fixes

* more review

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2025-06-21 02:11:49 -04:00
Matt Fiddaman
8231bbbf5a 🌍 mark titlebar strings for translation (#5206)
* translate title bar

* note

* Update VRT

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2025-06-21 01:45:20 -04:00
Julian Dominguez-Schatz
eadd88ce31 Move more .d.ts files to .ts (#5204)
* Rename .d.ts files to .ts

* Fix type and lint errors

* Add release notes

* CodeRabbit feedback
2025-06-21 00:16:55 -04:00
youngcw
6c61cf6a8d Revert "Mobile running balance (#4809)" (#5205)
This reverts commit 2c87c44168.
2025-06-20 20:37:24 -07:00
Matt Fiddaman
0fb9c252ca improve compatibility with OFX/QFX files (#5203)
* support ofx files with space in opening tag

* note
2025-06-20 22:21:32 -04:00
Guillaume Taquet Gasperini
d73ead135e Improve Boursobank Gocardless transaction parsing (#5202)
* Fix Boursobank transfer parsing

As per the comments on https://github.com/actualbudget/actual/pull/4958#issuecomment-2988814739,
the Boursobank transfer parsing was not working correctly.

Indeed, the array returned by GoCardless for transfers is randomly
ordered. So we cannot rely on the first line to know its type.

To work around this, the code gets a bit more complex by:
- Checking the first line for known types (card, loan, atm withdrawal)
  and handling them accordingly.
- If it's not one of these, we iterate through all the lines by checking
  if the array contains a line with the transfer type.

* Add credit note type for BoursoBank

An `Avoir` is a refund made to the credit card.
Adds the proper payee / notes parsing for it.

* Improve Boursobank card transaction parsing

Some Boursobank transactions have an unknown number attached to the
payee name. Remove it from the payee name to ensure consistency across
transactions.

For instance, `CARTE 19/03/25 Github 4 CB*0494` (notice the `4`).

* Improve Boursobank payee name backslashes handling

After more testing, I found that the backslashes present are for the
pending transactions, and indicating the localization of the payment.

To keep the payee name consistent, remove what follows the backslashes.

For instance `PICARD SA 1234\\PARIS\\ FR` is for a pending transaction
whereas `PICARD SA 1234` is what we receive for a completed one.

* Set notes with date for Boursobank card transactions

@mistyque requested to see the data of the card transaction in this
comment: https://github.com/actualbudget/actual/pull/4958#issuecomment-2981459622

* Add 5202 release note

* [autofix.ci] apply automated fixes

* refactor loops and match

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Matt Fiddaman <github@m.fiddaman.uk>
2025-06-20 19:48:22 -04:00
youngcw
2c87c44168 Mobile running balance (#4809)
* start

* small fix

* clean

* working for regular transactions

* working for schedules

* cleanup

* typing

* cleanup

* cleanup

* vrt

* bunny

* use pref

* use pref right, lint

* more lint

* vrt

* pass hasInitialBalances to isLoading

* remove comment

* Add option to calculate running balances in useTransactions hook

* Fix typecheck error

* Fix lint error

* use the updated hook

* typecheck

* simplify

* don't show balances when searching

* Add runningBalances to usePreviewTransactions and an option to set the starting balance to start running balance calculation from

* Add filter to usePreviewTransactions and set startingBalance to account and category preview transaction hooks

* use runningbalance from preview transactions hook

* lint

* lint;typecheck

* remove initial from preview balances

* remove unneeded type

* Apply suggestions from code review

Co-authored-by: Joel Jeremy Marquez <joeljeremy.marquez@gmail.com>

* typecheck; align right; change color

* types

* add a menu item

* cleanup

* fix for loot-core migrated files

* lint;type

* fix import

* only schedules need fixed

* lint

* it works

* cleanup

* make lint happy

* [autofix.ci] apply automated fixes

* simplify a bit

* fix import

* feedback

---------

Co-authored-by: Joel Jeremy Marquez <joeljeremy.marquez@gmail.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2025-06-19 17:54:00 -07:00
lelemm
15beba2ca3 🐛 Fix to AI generated release note (#5200)
* AI Generated release notes

* lint

* removedverbose console.log

* wrong permission to PR's

* missing write to issues

* Add release notes for PR #5200

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2025-06-19 20:46:22 -03:00
Matt Fiddaman
667cc24fac ⬆️ bump react-i18next from 14.1.3 -> 15.5.3 (#5196)
* bump react-i18next from 14.1.3 -> 15.5.3

* note
2025-06-19 19:17:20 -04:00
Matt Fiddaman
4cc542a658 ⬆️ bump csv-parse and csv-stringify to latest (#5198)
* bump csv-parse and csv-stringify

* note

* fix imports

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2025-06-19 19:17:10 -04:00
lelemm
093d799ba0 Auto generate Release Notes (#5182)
* AI Generated release notes

* lint

* removedverbose console.log
2025-06-19 17:22:44 -03:00
Matt Fiddaman
68d10f6b29 ⬆️ bump vitest from 3.1.4 -> 3.2.4 (#5195)
* bump vitest from 3.1.4 -> 3.2.4

* note
2025-06-19 15:30:25 -04:00
Matt Fiddaman
252f04e02c ♻️ remove body-parser dependency (#5197)
* bodyParser

* note
2025-06-19 15:30:12 -04:00
wachkyri
13cb85835b fix: wrong payeeName for KBC Brussels (#5193) 2025-06-18 20:49:24 -04:00
wachkyri
39cf04c74d add Belfius and KBC to banks with limited history (#5183)
* add Belfius and KBC to banks with limited history

* Update upcoming-release-notes/5183.md

Co-authored-by: Matt Fiddaman <github@m.fiddaman.uk>

---------

Co-authored-by: Matt Fiddaman <github@m.fiddaman.uk>
2025-06-18 16:40:07 -04:00
Jeremy Tan
562b5e2afd [Feature] Store and use last synced account balances (#4799)
* Update `processBankSyncDownload` to store synced balance in `balance_current`

* Display last synced balance in `MoreBalances`

* Add "Use last synced balance" to reconcile

* Remove logs

* Release notes

* Fix lint

* Add missing useEffect dep

* Restore console.log and fix type for id

* Last synced total

* Fix lint

* lint

* Made requested changes from maintainers.

* Added my name to authors note and updated description of feature.

---------

Co-authored-by: Spencer Sawyer <spencer@spencersawyer.com>
Co-authored-by: Matt Fiddaman <github@m.fiddaman.uk>
Co-authored-by: youngcw <calebyoung94@gmail.com>
2025-06-18 14:51:43 -04:00
Tim Nielens
4b4e32d0e2 add BNP_BE_GEBABEBB in gocardless bank-factory.js (#5187)
* add BNP_BE_GEBABEBB in gocardless bank-factory.js

* Create release note 5187.md

* Update 5187.md
2025-06-18 14:50:11 -04:00
Matt Farrell
d821f1cebc fix parsing schedule templates with brackets in the name (#5189) 2025-06-18 11:38:17 -07:00
Joel Jeremy Marquez
53e3694a38 Move spreadsheet bindings to spreadsheets feature folder and move hooks in src/components/spreadsheets to src/hooks (#5007)
* Move loot-core/client/modals code over to desktop-client package

* Fix lint error

* Move loot-core/client/data-hooks over to desktop-client package

* Fix typecheck and lint errors

* Fix lint error

* Fix typecheck error

* Fix test

* Move spreadsheet bindings to spreadsheets feature folder and move hooks from src/components/spreadsheets to src/hooks

* Move NamespaceContext to useSheetName

* Rename NamespaceContext to SheetNameContext and use SheetNameProvider

* Fix lint errors

* Fix import and provider

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2025-06-17 14:34:00 -07:00
Michael Clark
8647452ccc 🔧 Add reset passsword to cli tool (#5185)
* add reset passsword to cli tool

* release notes

* added the script properly
2025-06-17 22:05:45 +01:00
Julian Dominguez-Schatz
5a40b017f0 Move more .d.ts files to .ts (#5060)
* Move more .d.ts files to .ts

* Add release notes

* Some errors with templates snuck in

* Fix API build

* CodeRabbit feedback

* Move budget templates to new directory

* Fix type errors in library module
2025-06-16 21:05:36 -04:00
Matiss Janis Aboltins
8ccc1af77e Clean up configuration files (#5181) 2025-06-16 22:22:38 +01:00
Matiss Janis Aboltins
07904c209e Enhance PullToRefresh component to ensure full height usage on mobile devices (#5179) 2025-06-16 21:30:52 +01:00
Matiss Janis Aboltins
234f008dcf Update feature request management message to clarify voting system and community contributions (#5180) 2025-06-16 20:07:49 +01:00
Matiss Janis Aboltins
d130b427b3 Upgrade react router to v7 (#5172) 2025-06-16 18:23:26 +01:00
Matiss Janis Aboltins
39cd71aa48 Fix: display notifications below modal windows (#5165) 2025-06-15 16:44:03 +01:00
Matiss Janis Aboltins
100711ccfb Fix bottom navbar overlaying content in mobile (#5166) 2025-06-14 20:55:14 +01:00
Matiss Janis Aboltins
7c9f3f241d Added unit tests for CategorySelector and Change components (#5118) 2025-06-14 15:54:13 +01:00
Matiss Janis Aboltins
6509e80061 Update version notification message for Pikapods instances (#5146) 2025-06-14 14:54:46 +01:00
Matiss Janis Aboltins
fbd6989a18 Add GitHub workflow and script for counting monthly contributor points (#5147) 2025-06-14 13:18:40 +01:00
Rob Jackson
180431f9ed Fix account properties being overriden with empty values from metadata (#5115)
My Monzo bank appears to return 'name' through the GoCardless getDetails and getMetadata calls, but the value in the getMetadata response is an empty string! Merging metadata values over detail values therefore risks losing values, that are useful to have & to present to the user.

To solve this, we can make getDetailedAccount smarter about merging the two objects. We could swap the object splattening around so details has priority over metadata, but I'm not at all confident there won't be other banks doing strange things with additional properties that might suffer similar bugs in the reverse scenario.

Instead, we loop through all keys in both objects and construct a new merged object, continuing to prioritise metadata over details but changing it to a truthy-based comparison (with the `||` operator).

Co-authored-by: Matt Fiddaman <github@m.fiddaman.uk>
2025-06-14 08:03:59 -04:00
Matiss Janis Aboltins
d27d62b5fc Add GitHub Actions workflow for automatic code formatting (#5157) 2025-06-14 11:34:08 +01:00
Matiss Janis Aboltins
b5f29ccb4a show account historical balance change in side-nav hover tooltip (#5085) 2025-06-13 20:07:16 +01:00
Matt Fiddaman
0a5acebeaf use fallback linking parameters if initial GoCardless linking process fails (#5150) 2025-06-13 12:19:59 -04:00
Leandro Menezes
fa544d9c08 removed wrong md from master 2025-06-13 12:41:01 -03:00
github-actions[bot]
8976a59c3a Add release notes for PR #5155 2025-06-13 12:34:15 -03:00
Elijah Olmos
9713d09603 feat: add command bar (#5076)
* deps(desktop-client): add cmdk

* feat(desktop-client): create and integrate CommandBar

* hover on selection

* Ctrl+K only opens, ESC closes

* add custom reports

* add navigation items to cmdk

* fix: mouse hovering can interfere with keyboard navigation

* reset search state when CommandBar closes

* revert import order changes

* deps(desktop-client): readd cmdk

* fix vite error

* add item icons

* move navigation items into their own section

* hide scrollbar and release notes

* style: run yarn lint:fix

* fix: infinite loop opening commandbar with active modal

* fix: infinite error loop bc focus conflicts

* fix: kebab case console warning

* chore: update yarn.lock

* refactor: use autoFocus prop

* feat: add i18next

* style: relocate eslint-disable comment
2025-06-13 09:41:16 +01:00
youngcw
814f4fe955 release context menus (#5142) 2025-06-11 14:59:24 -07:00
Michael Clark
dbe6b27d9f :octocat: Prevent nightly npm packages publishing on push (#5144)
* prevent nightly npm packages publishing on push

* release ntoes

* Update upcoming-release-notes/5144.md

Co-authored-by: Matt Fiddaman <github@m.fiddaman.uk>

---------

Co-authored-by: Matt Fiddaman <github@m.fiddaman.uk>
2025-06-11 22:54:18 +01:00
Michael Clark
31a7902a08 :octocat: Add workflow for publishing nightly npm packages (#5047)
* add workflow for publishing edge npm packages

* release notes

* alright mr rabbit

* never trust the wabbit

* changing tag to nightly as per maintainer feedback

* fix hotfix script version

* rename workflow

* wabbit

* exit process

* fix reference to package json

* variable scoping

* change nightly version number to yyyymmdd (#17)

---------

Co-authored-by: Matt Fiddaman <github@m.fiddaman.uk>
2025-06-11 21:37:54 +01:00
Matt Fiddaman
eb35b41c6d fix preview transactions not showing on multi-account views (#5135) 2025-06-11 10:46:40 -04:00
Danish Joseph
a025d2b621 fix: bottom UI overlap with iOS Home Indicator (#5121) 2025-06-11 09:08:01 +01:00
Olicorne
d72140b8b6 add LCL to the list of bank with only 90 days of sync (#5087)
* add LCL to the list of bank with only 90 days of sync

Signed-off-by: thiswillbeyourgithub <26625900+thiswillbeyourgithub@users.noreply.github.com>

* add missing release note

Signed-off-by: thiswillbeyourgithub <26625900+thiswillbeyourgithub@users.noreply.github.com>

* Update upcoming-release-notes/5087.md

Co-authored-by: Matt Fiddaman <github@m.fiddaman.uk>

---------

Signed-off-by: thiswillbeyourgithub <26625900+thiswillbeyourgithub@users.noreply.github.com>
Co-authored-by: Matt Fiddaman <github@m.fiddaman.uk>
2025-06-10 14:04:46 -04:00
Olivier Kamers
254059d4c8 fix: ensure correct PR number is used for release notes file (#5134) 2025-06-10 11:25:09 -04:00
Olivier Kamers
92bc1e8ec9 fix: add missing 'enabled' in sentence. (#5133) 2025-06-10 12:59:40 +01:00
Matiss Janis Aboltins
b211b67f5e Fix: Only sync off-budget accounts when syncing from off-budget page (#5124) 2025-06-08 19:30:06 +01:00
Olivier Kamers
a2abb2b2ae Fix net worth graph gradient conflict (#5129)
* Fix net worth graph gradient conflict

Ensures that the net worth graph's gradient ID is unique to prevent conflicts when multiple graphs are rendered on the same page.
Fixes #3965

* Apply review suggestion
2025-06-08 14:03:59 -04:00
Olivier Kamers
3fab1be737 chore: replace snapshot-diff and jest with jest-diff (#5127)
Unlike the name suggests, jest-diff does not have a dependency on jest.
2025-06-08 14:00:33 -04:00
youngcw
bf9fbc5137 🐛 fix goal type templates (#5120)
* fix

* note

* fix test
2025-06-08 07:38:06 -07:00
youngcw
52eced1f21 🐛 group template apply (#5112)
* fix

* Update upcoming-release-notes/5112.md

Co-authored-by: Matt Fiddaman <github@m.fiddaman.uk>

---------

Co-authored-by: Matt Fiddaman <github@m.fiddaman.uk>
2025-06-08 07:36:54 -07:00
Michael Clark
359af05cc4 🐳 Fix nightly Docker edge image (#5123)
* fix nightly docker edge test

* release notes
2025-06-07 15:54:52 +01:00
Matt Fiddaman
9f1a8f6d5c ⬆️ upgrade uuid from 9.0.1 -> 11.1.0 (#5048) 2025-06-07 01:02:35 -04:00
Matiss Janis Aboltins
b22d712b4f fix: add missing dependency array to useEffect in SaveReportChoose.tsx (#5044) (#5111) 2025-06-06 18:51:11 +01:00
Michael Clark
098cacd904 :electron: Guide user to the docs on the electron configure server page (#5107)
* add link to docs on configure server page

* release note

* release note

* bump

* Update VRT

* huh

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2025-06-06 10:48:01 +01:00
Matiss Janis Aboltins
127f114914 🔧 improving the needs-info stale issue management (#5110) 2025-06-05 23:08:51 +01:00
Matiss Janis Aboltins
b56e26ee56 🔧 auto close issues with inaactivity and 'needs info' label (#5109) 2025-06-05 22:45:20 +01:00
Matiss Janis Aboltins
cd6b141117 🔧 (eslint) patch no-restriced-imports rule (#5081) 2025-06-05 19:59:51 +01:00
Roger Goldfinger
cd15aded05 Add test that docker images are working (#4952)
* use build directory in dockerfiles

* add release notes

* add test

* Add test for cli, try to fix image test

* - fail

* try again

* try again to fail

* done testing

* Code review

* publish is unecessary
2025-06-05 10:31:56 -04:00
Baruch Odem (Rothkoff)
cac318255d [Proposal] Enhance transaction import functionality with new Transaction type and type annotations (#4720)
* Enhance transaction import functionality with new Transaction type and type annotations

* release notes

* fixes for PR

* move transaction type as requested by @MatissJanis

* type importTransaction return value

---------

Co-authored-by: Matiss Janis Aboltins <matiss@mja.lv>
2025-06-05 10:31:29 -04:00
dependabot[bot]
6872dd235b bump tar-fs from 2.1.2 to 2.1.3 (#5084)
* Bump tar-fs from 2.1.2 to 2.1.3

Bumps [tar-fs](https://github.com/mafintosh/tar-fs) from 2.1.2 to 2.1.3.
- [Commits](https://github.com/mafintosh/tar-fs/commits)

---
updated-dependencies:
- dependency-name: tar-fs
  dependency-version: 2.1.3
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

* note

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Matt Fiddaman <github@m.fiddaman.uk>
2025-06-05 10:30:09 -04:00
Will Garrison
649932b42f [bugfix] Include split transactions in select-all (#5086)
* Include parent transactions in select-all when all of their children are selected

* Added release notes

* Fix release notes file name

* Make function return type explicit
2025-06-05 10:29:54 -04:00
Albert Pedersen
d372b71f36 Trim EndToEndID from the Danish Danske Bank branch (#5101)
* Trim EndToEndID from the Danish Danske Bank

* Add release note for PR #5101

---------

Co-authored-by: Matt Fiddaman <github@m.fiddaman.uk>
2025-06-05 10:29:45 -04:00
youngcw
47cb5e1ecf Add ability to auto hold funds for future months (#4778)
* add spreadsheet logic

* separate to own cell

* add selection cell

* fix selection

* added button

* arrow

* switches between the two hold options gracefully

* reset manual hold on apply auto hold

* working?

* fix

* lint

* better to budget menu logic

* type

* typing

* missing function pass

* some cleanup

* typecheck

* translation

* closer to good arrow

* lint

* prevent rollover arrow from clipping

* move to a menu; position is broken

* lint

* fix location

* lint

* standardize verbage

* right case

* fix import

* cleanup

* start of a mobile menu

* slightly better

* some cleanup

* lint

* Update packages/desktop-client/src/components/modals/EnvelopeIncomeBalanceMenuModal.tsx

Co-authored-by: Matt Fiddaman <github@m.fiddaman.uk>

* fix styling

* types

* Update packages/desktop-client/src/components/budget/envelope/BalanceMenu.tsx

Co-authored-by: Matt Fiddaman <github@m.fiddaman.uk>

* Apply suggestions from code review

Co-authored-by: Matt Fiddaman <github@m.fiddaman.uk>

---------

Co-authored-by: Matt Fiddaman <github@m.fiddaman.uk>
2025-06-05 06:04:14 -07:00
github-actions[bot]
02c59d9a1c 🔖 (25.6.1) (#5099)
* 🔖 (25.6.1)

* Remove used release notes

---------

Co-authored-by: matt-fidd <81489167+matt-fidd@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2025-06-04 18:13:40 -04:00
Matt Fiddaman
f9f6917fcd update dockerfiles to use node 20 (#5091)
* update dockerfiles to use node 20

* note
2025-06-04 13:31:45 -04:00
Michael Clark
7441b5fa92 🐛 Fix server version on docker (#5093)
* fix server version on docker

* bit more safety

* fix lint

* release notes

* more error handling
2025-06-04 13:31:37 -04:00
Matt Fiddaman
bfb2d61286 fix crash when datepicker deselected with no date set (#5095)
* fix crash when datepicker not set

* note
2025-06-04 13:31:29 -04:00
329 changed files with 5692 additions and 3137 deletions

View File

@@ -0,0 +1,24 @@
---
description:
globs:
alwaysApply: true
---
Before pushing code changes or opening a pull request, follow these steps:
1. Check if your branch already has a changelog file in the "upcoming-release-notes" folder.
2. If there is no changelog file for your branch:
a. Find the number of the most recent (highest-numbered) open issue or pull request on GitHub.
b. Increment that number by 1. Use this as the filename for your new changelog file.
c. Create a new markdown file in the "upcoming-release-notes" folder with the following format:
```
---
category: Features OR Maintenance OR Enhancements OR Bugfix
authors: [$GithubUsername]
---
$Description
```
3. Commit the new changelog file.
4. Proceed with your push or pull request.

View File

@@ -0,0 +1,32 @@
---
description:
globs: *.ts,*.tsx
alwaysApply: false
---
You are an expert in TypeScript and React.
Code Style and Structure
- Write concise, technical TypeScript code.
- Use functional and declarative programming patterns; avoid classes.
- Prefer iteration and modularization over code duplication.
- Use descriptive variable names with auxiliary verbs (e.g., isLoaded, hasError).
- Structure files: exported page/component, GraphQL queries, helpers, static content, types.
Naming Conventions
- Favor named exports for components and utilities.
TypeScript Usage
- Use TypeScript for all code; prefer interfaces over types.
- Avoid enums; use objects or maps instead.
- Avoid using `any` or `unknown` unless absolutely necessary. Look for type definitions in the codebase instead.
- Avoid type assertions with `as` or `!`; prefer using `satisfies`.
Syntax and Formatting
- Use the "function" keyword for pure functions.
- Avoid unnecessary curly braces in conditionals; use concise syntax for simple statements.
- Use declarative JSX, keeping JSX minimal and readable.

View File

@@ -0,0 +1,14 @@
---
description:
globs:
alwaysApply: true
---
Vitest test runner is used for unit tests.
When running unit tests, always include the flag `--watch=false` to prevent watch mode.
To run unit tests for a specific package in the monorepo, use the following command:
`yarn workspace <workspaceNameFromPackageJson> run test <pathToTest>`
Recommendation: Minimize the number of dependencies you mock. The fewer dependencies you mock, the better.

View File

@@ -4,12 +4,10 @@ title: '[Bug]: '
labels: ['needs triage', 'bug']
body:
- type: markdown
id: intro-md
attributes:
value: |
Thanks for taking the time to fill out this bug report! Please ensure you provide as much information as possible to better assist in confirming and identifying a fix for the bug.
- type: markdown
id: intro-md
attributes:
value: |
**IMPORTANT:** we use GitHub Issues only for BUG REPORTS and FEATURE REQUESTS. If you are looking for help/support - please reach out to the [community on Discord](https://discord.gg/pRYNYr4W5A). All non-bug and non-feature-request issues will be closed.
@@ -23,8 +21,6 @@ body:
options:
- label: 'I have searched and found no existing issue'
required: true
validations:
required: true
- type: textarea
id: what-happened
attributes:
@@ -43,7 +39,6 @@ body:
validations:
required: true
- type: markdown
id: env-info
attributes:
value: '## Environment Details'
- type: dropdown

View File

@@ -4,7 +4,6 @@ title: '[Feature] '
labels: ['feature']
body:
- type: markdown
id: intro-md
attributes:
value: |
Thanks for taking the time to fill out this feature request! Please ensure you provide as much information as possible so we can better understand what youre proposing so we can come up with the best solution for everyone.
@@ -16,8 +15,6 @@ body:
options:
- label: 'I have searched and found no existing issue'
required: true
validations:
required: true
- type: checkboxes
attributes:
label: '💻'

View File

@@ -0,0 +1,75 @@
#!/usr/bin/env node
import { Octokit } from '@octokit/rest';
import fs from 'fs';
const token = process.env.GITHUB_TOKEN;
const repo = process.env.GITHUB_REPOSITORY;
const issueNumber = process.env.GITHUB_EVENT_ISSUE_NUMBER;
const commentId = process.env.GITHUB_EVENT_COMMENT_ID;
if (!token || !repo || !issueNumber || !commentId) {
console.log('Missing required environment variables');
process.exit(1);
}
const [owner, repoName] = repo.split('/');
const octokit = new Octokit({ auth: token });
function setOutput(name, value) {
fs.appendFileSync(process.env.GITHUB_OUTPUT, `${name}=${value}\n`);
}
async function checkFirstComment() {
try {
console.log('Fetching comments with Octokit...');
// Get all comments with automatic pagination
const comments = await octokit.paginate(octokit.rest.issues.listComments, {
owner,
repo: repoName,
issue_number: issueNumber,
});
console.log(`Total comments found: ${comments.length}`);
// Filter for CodeRabbit summary comments (containing the specific marker)
const coderabbitSummaryComments = comments.filter(comment => {
const isCodeRabbit = comment.user.login === 'coderabbitai[bot]';
const hasSummaryMarker = comment.body.includes(
'<!-- This is an auto-generated comment: summarize by coderabbit.ai -->',
);
if (isCodeRabbit) {
console.log(
`CodeRabbit comment found (ID: ${comment.id}), has summary marker: ${hasSummaryMarker}`,
);
}
return isCodeRabbit && hasSummaryMarker;
});
const isFirstSummaryComment =
coderabbitSummaryComments.length === 1 &&
coderabbitSummaryComments[0].id == commentId;
console.log(
`CodeRabbit summary comments found: ${coderabbitSummaryComments.length}`,
);
console.log(`Current comment ID: ${commentId}`);
console.log(`Is first summary comment: ${isFirstSummaryComment}`);
setOutput('result', isFirstSummaryComment);
} catch (error) {
console.log('Error checking CodeRabbit comment:', error.message);
console.log('Stack:', error.stack);
setOutput('result', 'false');
process.exit(1);
}
}
checkFirstComment().catch(error => {
console.log('Unhandled error:', error.message);
console.log('Stack:', error.stack);
setOutput('result', 'false');
process.exit(1);
});

View File

@@ -0,0 +1,76 @@
#!/usr/bin/env node
import { Octokit } from '@octokit/rest';
import fs from 'fs';
const token = process.env.GITHUB_TOKEN;
const repo = process.env.GITHUB_REPOSITORY;
const issueNumber = process.env.GITHUB_EVENT_ISSUE_NUMBER;
const prDetailsJson = process.env.PR_DETAILS;
if (!token || !repo || !issueNumber || !prDetailsJson) {
console.log('Missing required environment variables');
process.exit(1);
}
const [owner, repoName] = repo.split('/');
const octokit = new Octokit({ auth: token });
function setOutput(name, value) {
fs.appendFileSync(process.env.GITHUB_OUTPUT, `${name}=${value}\n`);
}
async function checkReleaseNotesExists() {
try {
const prDetails = JSON.parse(prDetailsJson);
if (!prDetails) {
console.log('No PR details available, skipping file check');
setOutput('result', 'false');
return;
}
const fileName = `upcoming-release-notes/${prDetails.number}.md`;
// Get PR info to get head SHA
const { data: pr } = await octokit.rest.pulls.get({
owner,
repo: repoName,
pull_number: issueNumber,
});
const prHeadSha = pr.head.sha;
console.log(
`Checking for file on PR branch: ${pr.head.ref} (${prHeadSha})`,
);
// Check if file exists
try {
await octokit.rest.repos.getContent({
owner,
repo: repoName,
path: fileName,
ref: prHeadSha,
});
console.log(
`Release notes file already exists on PR branch: ${fileName}`,
);
setOutput('result', 'true');
} catch (error) {
if (error.status === 404) {
console.log(
`No existing release notes file found on PR branch: ${fileName}`,
);
setOutput('result', 'false');
} else {
console.log('Error checking file existence:', error.message);
setOutput('result', 'false');
}
}
} catch (error) {
console.log('Error in file existence check:', error.message);
setOutput('result', 'false');
}
}
checkReleaseNotesExists();

View File

@@ -0,0 +1,76 @@
#!/usr/bin/env node
import { Octokit } from '@octokit/rest';
const token = process.env.GITHUB_TOKEN;
const repo = process.env.GITHUB_REPOSITORY;
const issueNumber = process.env.GITHUB_EVENT_ISSUE_NUMBER;
const summaryDataJson = process.env.SUMMARY_DATA;
const category = process.env.CATEGORY;
if (!token || !repo || !issueNumber || !summaryDataJson || !category) {
console.log('Missing required environment variables');
process.exit(1);
}
const [owner, repoName] = repo.split('/');
const octokit = new Octokit({ auth: token });
async function commentOnPR() {
try {
const summaryData = JSON.parse(summaryDataJson);
if (!summaryData) {
console.log('No summary data available, skipping comment');
return;
}
if (!category || category === 'null') {
console.log('No valid category available, skipping comment');
return;
}
// Clean category for display
const cleanCategory =
typeof category === 'string'
? category.replace(/^["']|["']$/g, '')
: category;
// Get PR info for the file URL
const { data: pr } = await octokit.rest.pulls.get({
owner,
repo: repoName,
pull_number: issueNumber,
});
const prBranch = pr.head.ref;
const headOwner = pr.head.repo.owner.login;
const headRepo = pr.head.repo.name;
const fileUrl = `https://github.com/${headOwner}/${headRepo}/blob/${prBranch}/upcoming-release-notes/${summaryData.prNumber}.md`;
const commentBody = [
'🤖 **Auto-generated Release Notes**',
'',
`Hey @${summaryData.author}! I've automatically created a release notes file based on CodeRabbit's analysis:`,
'',
`**Category:** ${cleanCategory}`,
`**Summary:** ${summaryData.summary}`,
`**File:** [upcoming-release-notes/${summaryData.prNumber}.md](${fileUrl})`,
'',
'The release notes file has been committed to the repository. You can edit it if needed before merging.',
].join('\n');
await octokit.rest.issues.createComment({
owner,
repo: repoName,
issue_number: issueNumber,
body: commentBody,
});
console.log('✅ Successfully commented on PR');
} catch (error) {
console.log('Error commenting on PR:', error.message);
}
}
commentOnPR();

View File

@@ -0,0 +1,96 @@
#!/usr/bin/env node
import { Octokit } from '@octokit/rest';
const token = process.env.GITHUB_TOKEN;
const repo = process.env.GITHUB_REPOSITORY;
const issueNumber = process.env.GITHUB_EVENT_ISSUE_NUMBER;
const summaryDataJson = process.env.SUMMARY_DATA;
const category = process.env.CATEGORY;
if (!token || !repo || !issueNumber || !summaryDataJson || !category) {
console.log('Missing required environment variables');
process.exit(1);
}
const [owner, repoName] = repo.split('/');
const octokit = new Octokit({ auth: token });
async function createReleaseNotesFile() {
try {
const summaryData = JSON.parse(summaryDataJson);
console.log('Debug - Category value:', category);
console.log('Debug - Category type:', typeof category);
console.log('Debug - Category JSON stringified:', JSON.stringify(category));
if (!summaryData) {
console.log('No summary data available, cannot create file');
return;
}
if (!category || category === 'null') {
console.log('No valid category available, cannot create file');
return;
}
// Create file content - ensure category is not quoted
const cleanCategory =
typeof category === 'string'
? category.replace(/^["']|["']$/g, '')
: category;
console.log('Debug - Clean category:', cleanCategory);
const fileContent = `---
category: ${cleanCategory}
authors: [${summaryData.author}]
---
${summaryData.summary}`;
const fileName = `upcoming-release-notes/${summaryData.prNumber}.md`;
console.log(`Creating release notes file: ${fileName}`);
console.log('File content:');
console.log(fileContent);
// Get PR info
const { data: pr } = await octokit.rest.pulls.get({
owner,
repo: repoName,
pull_number: issueNumber,
});
const prBranch = pr.head.ref;
const headOwner = pr.head.repo.owner.login;
const headRepo = pr.head.repo.name;
console.log(
`Committing to PR branch: ${headOwner}/${headRepo}:${prBranch}`,
);
// Create the file via GitHub API on the PR branch
await octokit.rest.repos.createOrUpdateFileContents({
owner: headOwner,
repo: headRepo,
path: fileName,
message: `Add release notes for PR #${summaryData.prNumber}`,
content: Buffer.from(`${fileContent}\n\n`).toString('base64'),
branch: prBranch,
committer: {
name: 'github-actions[bot]',
email: 'github-actions[bot]@users.noreply.github.com',
},
author: {
name: 'github-actions[bot]',
email: 'github-actions[bot]@users.noreply.github.com',
},
});
console.log(`✅ Successfully created release notes file: ${fileName}`);
} catch (error) {
console.log('Error creating release notes file:', error.message);
}
}
createReleaseNotesFile();

View File

@@ -0,0 +1,118 @@
#!/usr/bin/env node
const https = require('https');
const fs = require('fs');
const commentBody = process.env.GITHUB_EVENT_COMMENT_BODY;
const prDetailsJson = process.env.PR_DETAILS;
const summaryDataJson = process.env.SUMMARY_DATA;
const openaiApiKey = process.env.OPENAI_API_KEY;
if (!commentBody || !prDetailsJson || !summaryDataJson || !openaiApiKey) {
console.log('Missing required environment variables');
process.exit(1);
}
function setOutput(name, value) {
fs.appendFileSync(process.env.GITHUB_OUTPUT, `${name}=${value}\n`);
}
try {
const prDetails = JSON.parse(prDetailsJson);
const summaryData = JSON.parse(summaryDataJson);
if (!summaryData || !prDetails) {
console.log('Missing data for categorization');
setOutput('result', 'null');
process.exit(0);
}
const data = JSON.stringify({
model: 'gpt-4o-mini',
messages: [
{
role: 'system',
content:
'You are categorizing pull requests for release notes. You must respond with exactly one of these categories: "Features", "Enhancements", "Bugfix", or "Maintenance". No other text or explanation.',
},
{
role: 'user',
content: `PR Title: ${prDetails.title}\n\nGenerated Summary: ${summaryData.summary}\n\nCodeRabbit Analysis:\n${commentBody}\n\nCategories:\n- Features: New functionality or capabilities\n- Bugfix: Fixes for broken or incorrect behavior\n- Enhancements: Improvements to existing functionality\n- Maintenance: Code cleanup, refactoring, dependencies, etc.\n\nWhat category does this PR belong to?`,
},
],
max_tokens: 10,
temperature: 0.1,
});
const options = {
hostname: 'api.openai.com',
path: '/v1/chat/completions',
method: 'POST',
headers: {
Authorization: `Bearer ${openaiApiKey}`,
'Content-Type': 'application/json',
},
};
const req = https.request(options, res => {
let responseData = '';
res.on('data', chunk => (responseData += chunk));
res.on('end', () => {
if (res.statusCode !== 200) {
console.log('OpenAI API error for categorization');
setOutput('result', 'null');
return;
}
try {
const response = JSON.parse(responseData);
console.log('OpenAI raw response:', JSON.stringify(response, null, 2));
const rawContent = response.choices[0].message.content.trim();
console.log('Raw content from OpenAI:', rawContent);
let category;
try {
category = JSON.parse(rawContent);
console.log('Parsed category:', category);
} catch (parseError) {
console.log(
'JSON parse error, using raw content:',
parseError.message,
);
category = rawContent;
}
// Validate the category response
const validCategories = [
'Features',
'Bugfix',
'Enhancements',
'Maintenance',
];
if (validCategories.includes(category)) {
console.log('OpenAI categorized as:', category);
setOutput('result', category);
} else {
console.log('Invalid category from OpenAI:', category);
console.log('Valid categories are:', validCategories);
setOutput('result', 'null');
}
} catch (error) {
console.log('Error parsing OpenAI response:', error.message);
setOutput('result', 'null');
}
});
});
req.on('error', error => {
console.log('Error in categorization:', error.message);
setOutput('result', 'null');
});
req.write(data);
req.end();
} catch (error) {
console.log('Error in categorization:', error.message);
setOutput('result', 'null');
}

View File

@@ -0,0 +1,97 @@
#!/usr/bin/env node
const https = require('https');
const fs = require('fs');
const commentBody = process.env.GITHUB_EVENT_COMMENT_BODY;
const prDetailsJson = process.env.PR_DETAILS;
const openaiApiKey = process.env.OPENAI_API_KEY;
if (!commentBody || !prDetailsJson || !openaiApiKey) {
console.log('Missing required environment variables');
process.exit(1);
}
function setOutput(name, value) {
fs.appendFileSync(process.env.GITHUB_OUTPUT, `${name}=${value}\n`);
}
try {
const prDetails = JSON.parse(prDetailsJson);
if (!prDetails) {
console.log('No PR details available, cannot generate summary');
setOutput('result', 'null');
process.exit(0);
}
console.log('CodeRabbit comment body:', commentBody);
const data = JSON.stringify({
model: 'gpt-4o-mini',
messages: [
{
role: 'system',
content:
'You are a technical writer helping to create concise release notes. Generate a maximum 15-word summary that describes what this PR does. Focus on the user-facing changes or bug fixes. Do not include "This PR" or similar phrases - just describe the change directly. Start with a base form verb (e.g., "Add" not "Adds", "Fix" not "Fixes", "Introduce" not "Introduces").',
},
{
role: 'user',
content: `PR Title: ${prDetails.title}\n\nCodeRabbit Analysis:\n${commentBody}\n\nPlease provide a concise summary (max 15 words) of what this PR accomplishes.`,
},
],
max_tokens: 50,
temperature: 0.3,
});
const options = {
hostname: 'api.openai.com',
path: '/v1/chat/completions',
method: 'POST',
headers: {
Authorization: `Bearer ${openaiApiKey}`,
'Content-Type': 'application/json',
},
};
const req = https.request(options, res => {
let responseData = '';
res.on('data', chunk => (responseData += chunk));
res.on('end', () => {
if (res.statusCode !== 200) {
console.log(`OpenAI API error: ${res.statusCode} ${res.statusMessage}`);
setOutput('result', 'null');
return;
}
try {
const response = JSON.parse(responseData);
const summary = response.choices[0].message.content.trim();
console.log('Generated summary:', summary);
const result = {
summary: summary,
prNumber: prDetails.number,
author: prDetails.author,
};
setOutput('result', JSON.stringify(result));
} catch (error) {
console.log('Error parsing OpenAI response:', error.message);
setOutput('result', 'null');
}
});
});
req.on('error', error => {
console.log('Error generating summary:', error.message);
setOutput('result', 'null');
});
req.write(data);
req.end();
} catch (error) {
console.log('Error generating summary:', error.message);
setOutput('result', 'null');
}

View File

@@ -0,0 +1,59 @@
#!/usr/bin/env node
import { Octokit } from '@octokit/rest';
import fs from 'fs';
const token = process.env.GITHUB_TOKEN;
const repo = process.env.GITHUB_REPOSITORY;
const issueNumber = process.env.GITHUB_EVENT_ISSUE_NUMBER;
if (!token || !repo || !issueNumber) {
console.log('Missing required environment variables');
process.exit(1);
}
const [owner, repoName] = repo.split('/');
const octokit = new Octokit({ auth: token });
function setOutput(name, value) {
fs.appendFileSync(process.env.GITHUB_OUTPUT, `${name}=${value}\n`);
}
async function getPRDetails() {
try {
console.log(
`Fetching PR details for ${owner}/${repoName}#${issueNumber}...`,
);
const { data: pr } = await octokit.rest.pulls.get({
owner,
repo: repoName,
pull_number: issueNumber,
});
console.log('PR details fetched successfully');
console.log('- PR Number:', pr.number);
console.log('- PR Author:', pr.user.login);
console.log('- PR Title:', pr.title);
const result = {
number: pr.number,
author: pr.user.login,
title: pr.title,
};
setOutput('result', JSON.stringify(result));
} catch (error) {
console.log('Error getting PR details:', error.message);
console.log('Stack:', error.stack);
setOutput('result', 'null');
process.exit(1);
}
}
getPRDetails().catch(error => {
console.log('Unhandled error:', error.message);
console.log('Stack:', error.stack);
setOutput('result', 'null');
process.exit(1);
});

View File

@@ -0,0 +1,94 @@
#!/usr/bin/env node
// This script is used in GitHub Actions to get the next version based on the current package.json version.
// It supports three types of versioning: nightly, hotfix, and monthly.
const { parseArgs } = require('node:util');
const fs = require('node:fs');
const args = process.argv;
const options = {
'package-json': {
type: 'string',
short: 'p',
},
type: {
type: 'string', // nightly, hotfix, monthly
short: 't',
},
};
const { values } = parseArgs({
args,
options,
allowPositionals: true,
});
if (!values['package-json']) {
console.error(
'Please specify the path to package.json using --package-json or -p option.',
);
process.exit(1);
}
try {
const packageJsonPath = values['package-json'];
// Read and parse package.json
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'));
const currentVersion = packageJson.version;
// Parse year and month from version (e.g. 25.5.1 -> year=2025, month=5)
const versionParts = currentVersion.split('.');
const versionYear = parseInt(versionParts[0]);
const versionMonth = parseInt(versionParts[1]);
const versionHotfix = parseInt(versionParts[2]);
// Create date and add 1 month
const versionDate = new Date(2000 + versionYear, versionMonth - 1, 1); // month is 0-indexed
const nextVersionMonthDate = new Date(
versionDate.getFullYear(),
versionDate.getMonth() + 1,
1,
);
// Format back to YY.M format
const nextVersionYear = nextVersionMonthDate
.getFullYear()
.toString()
.slice(-2);
const nextVersionMonth = nextVersionMonthDate.getMonth() + 1; // Convert back to 1-indexed
// Get current date string
const currentDate = new Date()
.toISOString()
.split('T')[0]
.replaceAll('-', '');
switch (values.type) {
case 'nightly': {
const newVersion = `${nextVersionYear}.${nextVersionMonth}.0-nightly.${currentDate}`;
process.stdout.write(newVersion); // return the new version to stdout
process.exit();
}
case 'hotfix': {
const bugfixVersion = `${versionYear}.${versionMonth}.${versionHotfix + 1}`;
process.stdout.write(bugfixVersion); // return the bugfix version to stdout
process.exit();
}
case 'monthly': {
const stableVersion = `${nextVersionYear}.${nextVersionMonth}.0`;
process.stdout.write(stableVersion); // return the stable version to stdout
process.exit();
}
default:
console.error(
'Invalid type specified. Use "nightly", "hotfix", or "monthly".',
);
process.exit(1);
}
} catch (error) {
console.error('Error:', error.message);
process.exit(1);
}

View File

@@ -1,4 +1,5 @@
name: Setup
description: Setup the environment for the project
inputs:
working-directory:

350
.github/scripts/count-points.mjs vendored Normal file
View File

@@ -0,0 +1,350 @@
import { Octokit } from '@octokit/rest';
import { minimatch } from 'minimatch';
/** Repository-specific configuration for points calculation */
const REPOSITORY_CONFIG = new Map([
[
'actual',
{
POINTS_PER_ISSUE_TRIAGE_ACTION: 1,
POINTS_PER_ISSUE_CLOSING_ACTION: 1,
POINTS_PER_RELEASE_PR: 0,
PR_REVIEW_POINT_TIERS: [
{ minChanges: 1000, points: 6 },
{ minChanges: 100, points: 4 },
{ minChanges: 0, points: 2 },
],
EXCLUDED_FILES: [
'yarn.lock',
'.yarn/**/*',
'packages/component-library/src/icons/**/*',
'release-notes/**/*',
],
},
],
[
'docs',
{
POINTS_PER_ISSUE_TRIAGE_ACTION: 1,
POINTS_PER_ISSUE_CLOSING_ACTION: 1,
POINTS_PER_RELEASE_PR: 4,
PR_REVIEW_POINT_TIERS: [
{ minChanges: 1000, points: 6 },
{ minChanges: 100, points: 4 },
{ minChanges: 0, points: 2 },
],
EXCLUDED_FILES: ['yarn.lock', '.yarn/**/*'],
},
],
]);
/**
* Get the start and end dates for the last month.
* @returns {Object} An object containing the start and end dates.
*/
function getLastMonthDates() {
// Get data relating to the last month
const now = new Date();
const firstDayOfLastMonth = new Date(
now.getFullYear(),
now.getMonth() - 1,
1,
);
const since = process.env.START_DATE
? new Date(process.env.START_DATE)
: firstDayOfLastMonth;
// Calculate the end of the month for the since date
const until = new Date(
since.getFullYear(),
since.getMonth() + 1,
0,
23,
59,
59,
999,
);
return { since, until };
}
/**
* Used for calculating the monthly points each core contributor has earned.
* These are used for payouts depending.
* @param {string} repo - The repository to analyze ('actual' or 'docs')
* @returns {number} The total points earned for the repository
*/
async function countContributorPoints(repo) {
const octokit = new Octokit({ auth: process.env.GITHUB_TOKEN });
const owner = 'actualbudget';
const config = REPOSITORY_CONFIG.get(repo);
const { since, until } = getLastMonthDates();
// Get organization members
const { data: orgMembers } = await octokit.orgs.listMembers({
org: owner,
});
const orgMemberLogins = new Set(orgMembers.map(member => member.login));
// Initialize stats map with all org members
const stats = new Map(
Array.from(orgMemberLogins).map(login => [
login,
{
reviews: [], // Will store objects with PR number and points
labelRemovals: [],
issueClosings: [],
points: 0,
},
]),
);
// Helper function to print statistics
const printStats = (title, getValue, formatLine) => {
console.log(`\n${title}:`);
console.log('='.repeat(title.length + 1));
const entries = Array.from(stats.entries())
.map(([user, userStats]) => [user, getValue(userStats)])
.filter(([, count]) => count > 0)
.sort((a, b) => b[1] - a[1]);
if (entries.length === 0) {
console.log(`No ${title.toLowerCase()} found in the last month.`);
} else {
entries.forEach(([user, count]) => {
console.log(formatLine(user, count));
});
}
};
// Get all PRs using search
const searchQuery = `repo:${owner}/${repo} is:pr is:merged merged:${since.toISOString()}..${until.toISOString()}`;
const recentPRs = await octokit.paginate(
octokit.search.issuesAndPullRequests,
{
q: searchQuery,
per_page: 100,
advanced_search: true,
},
response => response.data,
);
// Get reviews and PR details for each PR
for (const pr of recentPRs) {
const { data: reviews } = await octokit.pulls.listReviews({
owner,
repo,
pull_number: pr.number,
});
// Get list of modified files
const { data: modifiedFiles } = await octokit.pulls.listFiles({
owner,
repo,
pull_number: pr.number,
});
// Calculate points based on PR size, excluding specified files
const totalChanges = modifiedFiles
.filter(
file =>
!config.EXCLUDED_FILES.some(pattern =>
minimatch(file.filename, pattern),
),
)
.reduce((sum, file) => sum + file.additions + file.deletions, 0);
// Check if this is a release PR
const isReleasePR = pr.title.match(/^🔖 \(\d+\.\d+\.\d+\)/);
// Calculate points for reviewers based on PR size
const prPoints = config.PR_REVIEW_POINT_TIERS.find(
tier => totalChanges > tier.minChanges,
).points;
// Add points to the reviewers
const uniqueReviewers = new Set();
reviews
.filter(
review =>
stats.has(review.user?.login) &&
review.state === 'APPROVED' &&
!uniqueReviewers.has(review.user?.login),
)
.forEach(({ user: { login: reviewer } }) => {
uniqueReviewers.add(reviewer);
const userStats = stats.get(reviewer);
userStats.reviews.push({ pr: pr.number.toString(), points: prPoints });
userStats.points += prPoints;
});
// Award points to the PR creator if it's a release PR
if (isReleasePR && stats.has(pr.user.login)) {
const creatorStats = stats.get(pr.user.login);
creatorStats.reviews.push({
pr: pr.number.toString(),
points: config.POINTS_PER_RELEASE_PR,
isReleaseCreator: true,
});
creatorStats.points += config.POINTS_PER_RELEASE_PR;
}
}
// Get all issues with label events in the last month
const issues = await octokit.paginate(
octokit.issues.listForRepo,
{
owner,
repo,
state: 'all',
sort: 'updated',
direction: 'desc',
per_page: 100,
since: since.toISOString(),
},
(response, done) =>
response.data.filter(issue => new Date(issue.updated_at) <= until),
);
// Get label events for each issue
for (const issue of issues) {
const { data: events } = await octokit.issues.listEventsForTimeline({
owner,
repo,
issue_number: issue.number,
});
// Process events
events
.filter(
event =>
new Date(event.created_at) > since &&
new Date(event.created_at) <= until &&
stats.has(event.actor?.login),
)
.forEach(event => {
if (
event.event === 'unlabeled' &&
event.label &&
event.label.name.toLowerCase() === 'needs triage'
) {
const remover = event.actor.login;
const userStats = stats.get(remover);
userStats.labelRemovals.push(issue.number.toString());
userStats.points += config.POINTS_PER_ISSUE_TRIAGE_ACTION;
}
if (event.event === 'closed') {
const closer = event.actor.login;
const userStats = stats.get(closer);
userStats.issueClosings.push(issue.number.toString());
userStats.points += config.POINTS_PER_ISSUE_CLOSING_ACTION;
}
});
}
// Print all statistics
printStats(
`PR Review Statistics (${repo})`,
stats => stats.reviews.length,
(user, count) =>
`${user}: ${count} (PRs: ${stats
.get(user)
.reviews.map(r => {
if (r.isReleaseCreator) {
return `#${r.pr} (${r.points}pts - Release Creator)`;
}
return `#${r.pr} (${r.points}pts)`;
})
.join(', ')})`,
);
printStats(
`"Needs Triage" Label Removal Statistics (${repo})`,
stats => stats.labelRemovals.length,
(user, count) =>
`${user}: ${count} (Issues: ${stats.get(user).labelRemovals.join(', ')})`,
);
printStats(
`Issue Closing Statistics (${repo})`,
stats => stats.issueClosings.length,
(user, count) =>
`${user}: ${count} (Issues: ${stats.get(user).issueClosings.join(', ')})`,
);
// Print points summary
printStats(
`Points Summary (${repo})`,
stats => stats.points,
(user, userPoints) => `${user}: ${userPoints}`,
);
// Calculate and print total points
const totalPoints = Array.from(stats.values()).reduce(
(sum, userStats) => sum + userStats.points,
0,
);
console.log(`\nTotal points earned for ${repo}: ${totalPoints}`);
// Return the points
return new Map(
Array.from(stats.entries()).map(([login, userStats]) => [
login,
userStats.points,
]),
);
}
/**
* Calculate the points for both repositories and print cumulative results
*/
async function calculateCumulativePoints() {
// Get stats for each repository
const repoPointsResults = await Promise.all(
Array.from(REPOSITORY_CONFIG.keys()).map(countContributorPoints),
);
// Calculate cumulative stats
const cumulativeStats = new Map(repoPointsResults[0]);
// Combine stats from all repositories
for (let i = 1; i < repoPointsResults.length; i++) {
for (const [login, points] of repoPointsResults[i].entries()) {
if (!cumulativeStats.has(login)) {
cumulativeStats.set(login, 0);
}
cumulativeStats.set(login, cumulativeStats.get(login) + points);
}
}
// Print cumulative statistics
console.log('\n\nCUMULATIVE STATISTICS ACROSS ALL REPOSITORIES');
console.log('='.repeat(50));
console.log('\nCumulative Points Summary:');
console.log('='.repeat('Cumulative Points Summary'.length + 1));
const entries = Array.from(cumulativeStats.entries())
.filter(([, count]) => count > 0)
.sort((a, b) => b[1] - a[1]);
if (entries.length === 0) {
console.log('No cumulative points summary found.');
} else {
entries.forEach(([user, points]) => {
console.log(`${user}: ${points}`);
});
}
// Calculate and print total cumulative points
const totalCumulativePoints = Array.from(cumulativeStats.values()).reduce(
(sum, points) => sum + points,
0,
);
console.log('\nTotal cumulative points earned: ' + totalCumulativePoints);
}
// Run the calculations
calculateCumulativePoints().catch(console.error);

View File

@@ -0,0 +1,89 @@
name: Generate Release Notes from CodeRabbit summary
on:
issue_comment:
types: [created]
jobs:
generate-release-notes:
# Only run on PR comments from CodeRabbit bot
if: github.event.issue.pull_request && github.event.comment.user.login == 'coderabbitai[bot]'
runs-on: ubuntu-latest
timeout-minutes: 10
permissions:
contents: write
pull-requests: write
issues: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up environment
uses: ./.github/actions/setup
- name: Check if this is CodeRabbit's first comment
id: check-first-comment
run: node .github/actions/ai-generated-release-notes/check-first-comment.js
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_REPOSITORY: ${{ github.repository }}
GITHUB_EVENT_ISSUE_NUMBER: ${{ github.event.issue.number }}
GITHUB_EVENT_COMMENT_ID: ${{ github.event.comment.id }}
- name: Get PR details
if: steps.check-first-comment.outputs.result == 'true'
id: pr-details
run: node .github/actions/ai-generated-release-notes/pr-details.js
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_REPOSITORY: ${{ github.repository }}
GITHUB_EVENT_ISSUE_NUMBER: ${{ github.event.issue.number }}
- name: Check if release notes file already exists
if: steps.check-first-comment.outputs.result == 'true' && steps.pr-details.outputs.result != 'null'
id: check-release-notes-exists
run: node .github/actions/ai-generated-release-notes/check-release-notes-exists.js
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_REPOSITORY: ${{ github.repository }}
GITHUB_EVENT_ISSUE_NUMBER: ${{ github.event.issue.number }}
PR_DETAILS: ${{ steps.pr-details.outputs.result }}
- name: Generate summary with OpenAI
if: steps.check-first-comment.outputs.result == 'true' && steps.check-release-notes-exists.outputs.result == 'false'
id: generate-summary
run: node .github/actions/ai-generated-release-notes/generate-summary.js
env:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
GITHUB_EVENT_COMMENT_BODY: ${{ github.event.comment.body }}
PR_DETAILS: ${{ steps.pr-details.outputs.result }}
- name: Determine category with OpenAI
if: steps.check-first-comment.outputs.result == 'true' && steps.check-release-notes-exists.outputs.result == 'false' && steps.generate-summary.outputs.result != 'null'
id: determine-category
run: node .github/actions/ai-generated-release-notes/determine-category.js
env:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
GITHUB_EVENT_COMMENT_BODY: ${{ github.event.comment.body }}
PR_DETAILS: ${{ steps.pr-details.outputs.result }}
SUMMARY_DATA: ${{ steps.generate-summary.outputs.result }}
- name: Create and commit release notes file via GitHub API
if: steps.check-first-comment.outputs.result == 'true' && steps.check-release-notes-exists.outputs.result == 'false' && steps.generate-summary.outputs.result != 'null' && steps.determine-category.outputs.result != 'null' && steps.determine-category.outputs.result != ''
run: node .github/actions/ai-generated-release-notes/create-release-notes-file.js
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_REPOSITORY: ${{ github.repository }}
GITHUB_EVENT_ISSUE_NUMBER: ${{ github.event.issue.number }}
SUMMARY_DATA: ${{ steps.generate-summary.outputs.result }}
CATEGORY: ${{ steps.determine-category.outputs.result }}
- name: Comment on PR
if: steps.check-first-comment.outputs.result == 'true' && steps.check-release-notes-exists.outputs.result == 'false' && steps.generate-summary.outputs.result != 'null' && steps.determine-category.outputs.result != 'null' && steps.determine-category.outputs.result != ''
run: node .github/actions/ai-generated-release-notes/comment-on-pr.js
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_REPOSITORY: ${{ github.repository }}
GITHUB_EVENT_ISSUE_NUMBER: ${{ github.event.issue.number }}
SUMMARY_DATA: ${{ steps.generate-summary.outputs.result }}
CATEGORY: ${{ steps.determine-category.outputs.result }}

23
.github/workflows/autofix.yml vendored Normal file
View File

@@ -0,0 +1,23 @@
name: autofix.ci
defaults:
run:
shell: bash
on:
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
permissions:
contents: read
jobs:
autofix:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up environment
uses: ./.github/actions/setup
- name: Format code
run: yarn lint:fix
- uses: autofix-ci/action@635ffb0c9798bd160680f18fd73371e355b85f27

View File

@@ -27,6 +27,16 @@ jobs:
uses: ./.github/actions/setup
- name: Typecheck
run: yarn typecheck
validate-cli:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up environment
uses: ./.github/actions/setup
- name: Build Web
run: yarn build:server
- name: Check that the built CLI works
run: node packages/sync-server/build/bin/actual-server.js --version
test:
runs-on: ubuntu-latest
steps:

26
.github/workflows/count-points.yml vendored Normal file
View File

@@ -0,0 +1,26 @@
name: Count points
on:
schedule:
# Run at 00:00 on the first day of every month
- cron: '0 0 1 * *'
workflow_dispatch:
inputs:
startDate:
description: 'Start date for point counter (YYYY-MM-DD)'
required: true
type: string
jobs:
count-points:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up environment
uses: ./.github/actions/setup
- name: Count points
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
START_DATE: ${{ inputs.startDate }}
run: node .github/scripts/count-points.mjs

View File

@@ -80,7 +80,24 @@ jobs:
- name: Build Web
run: yarn build:server
- name: Build and push image
- name: Build image for testing
uses: docker/build-push-action@v5
with:
context: .
push: false
load: true
file: packages/sync-server/docker/${{ matrix.os }}.Dockerfile
tags: actualbudget/actual-server-testing
- name: Test that the docker image boots
run: |
docker run --detach --network=host actualbudget/actual-server-testing
sleep 5
curl --fail -sS -LI -w '%{http_code}\n' --retry 10 --retry-delay 1 --retry-connrefused localhost:5006
# This will use the cache from the earlier build step and not rebuild the image
# https://docs.docker.com/build/ci/github-actions/test-before-push/
- name: Build and push images
uses: docker/build-push-action@v5
with:
context: .

View File

@@ -3,7 +3,7 @@ name: Extract and upload i18n strings
on:
schedule:
# 4am UTC
- cron: "0 4 * * *"
- cron: '0 4 * * *'
workflow_dispatch:
jobs:
@@ -19,7 +19,7 @@ jobs:
uses: ./actual/.github/actions/setup
with:
working-directory: actual
download-translations: false # As we'll manually clone instead
download-translations: false # As we'll manually clone instead
- name: Configure Git config
run: |
git config --global user.name "github-actions[bot]"
@@ -78,7 +78,7 @@ jobs:
actualbudget/actual
- name: Unlock translations
if: always() # Clean up even on failure
if: always() # Clean up even on failure
run: |
wlc \
--url https://hosted.weblate.org/api/ \

View File

@@ -24,7 +24,7 @@ jobs:
body: |
:sparkles: Thanks for sharing your idea! :sparkles:
This repository uses lodash style issue management for enhancements. That means enhancement issues are automatically closed. This doesnt mean we dont accept feature requests, though! We will consider implementing ones that receive many upvotes, and we welcome contributions for any feature requests marked as needing votes (just post a comment first so we can help you make a successful contribution).
This repository uses a voting-based system for feature requests. While enhancement issues are automatically closed, we still welcome feature requests! The voting system helps us gauge community interest in potential features. We also encourage community contributions for any feature requests marked as needing votes (just post a comment first so we can help guide you toward a successful contribution).
The enhancement backlog can be found here: https://github.com/actualbudget/actual/issues?q=label%3A%22needs+votes%22+sort%3Areactions-%2B1-desc+

View File

@@ -22,15 +22,15 @@ jobs:
steps:
- name: Repository Checkout
uses: actions/checkout@v4
- name: Set up environment
uses: ./.github/actions/setup
- name: Install Netlify
run: npm install netlify-cli@17.10.1 -g
- name: Build Actual
run: yarn build:browser
run: yarn build:browser
- name: Deploy to Netlify
id: netlify_deploy
@@ -40,4 +40,4 @@ jobs:
--site ${{ secrets.NETLIFY_SITE_ID }} \
--auth ${{ secrets.NETLIFY_API_TOKEN }} \
--filter @actual-app/web \
--prod
--prod

View File

@@ -0,0 +1,95 @@
name: Publish nightly npm packages
# Nightly npm packages are built daily
on:
schedule:
- cron: '0 0 * * *'
workflow_dispatch:
jobs:
build-and-pack:
runs-on: ubuntu-latest
name: Build and pack npm packages
if: github.event.repository.fork == false
steps:
- uses: actions/checkout@v4
- name: Set up environment
uses: ./.github/actions/setup
- name: Update package versions
run: |
# Get new nightly versions
NEW_WEB_VERSION=$(node ./.github/actions/get-next-package-version.js --package-json ./packages/desktop-client/package.json --type nightly)
NEW_SYNC_VERSION=$(node ./.github/actions/get-next-package-version.js --package-json ./packages/sync-server/package.json --type nightly)
NEW_API_VERSION=$(node ./.github/actions/get-next-package-version.js --package-json ./packages/api/package.json --type nightly)
# Set package versions
npm version $NEW_WEB_VERSION --no-git-tag-version --workspace=@actual-app/web --no-workspaces-update
npm version $NEW_SYNC_VERSION --no-git-tag-version --workspace=@actual-app/sync-server --no-workspaces-update
npm version $NEW_API_VERSION --no-git-tag-version --workspace=@actual-app/api --no-workspaces-update
- name: Yarn install
run: |
yarn install
- name: Build Server & Web
run: yarn build:server
- name: Pack the web and server packages
run: |
yarn workspace @actual-app/web pack --filename @actual-app/web.tgz
yarn workspace @actual-app/sync-server pack --filename @actual-app/sync-server.tgz
- name: Build API
run: yarn build:api
- name: Pack the api package
run: |
yarn workspace @actual-app/api pack --filename @actual-app/api.tgz
- name: Upload package artifacts
uses: actions/upload-artifact@v4
with:
name: npm-packages
path: |
packages/desktop-client/@actual-app/web.tgz
packages/sync-server/@actual-app/sync-server.tgz
packages/api/@actual-app/api.tgz
publish:
runs-on: ubuntu-latest
name: Publish Nightly npm packages
needs: build-and-pack
permissions:
contents: read
packages: write
steps:
- name: Download the artifacts
uses: actions/download-artifact@v4
with:
name: npm-packages
- name: Setup node and npm registry
uses: actions/setup-node@v4
with:
node-version: 20
registry-url: 'https://registry.npmjs.org'
- name: Publish Web
run: |
npm publish desktop-client/@actual-app/web.tgz --access public --tag nightly
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Publish Sync-Server
run: |
npm publish sync-server/@actual-app/sync-server.tgz --access public --tag nightly
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Publish API
run: |
npm publish api/@actual-app/api.tgz --access public --tag nightly
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

View File

@@ -2,6 +2,7 @@ name: 'Close stale PRs'
on:
schedule:
- cron: '30 1 * * *'
workflow_dispatch: # Allow manual triggering
jobs:
stale:
@@ -24,3 +25,18 @@ jobs:
any-of-labels: ':construction: WIP'
days-before-close: -1
days-before-issue-stale: -1
stale-needs-info:
runs-on: ubuntu-latest
steps:
- uses: actions/stale@v9
with:
stale-issue-label: 'needs info'
days-before-stale: -1
days-before-close: 7
close-issue-message: 'This issue has been automatically closed because there have been no comments for 7 days after the "needs info" label was added. If you still need help, please feel free to reopen the issue with the requested information.'
remove-stale-when-updated: false
stale-pr-message: '' # Disable PR processing
close-pr-message: '' # Disable PR processing
days-before-pr-stale: -1 # Disable PR processing
days-before-pr-close: -1 # Disable PR processing

View File

@@ -20,11 +20,8 @@ packages/desktop-client/playwright-report/
packages/desktop-electron/client-build/
packages/desktop-electron/build/
packages/desktop-electron/dist/
packages/import-ynab4/**/node_modules/*
packages/import-ynab5/**/node_modules/*
packages/loot-core/**/node_modules/*
packages/loot-core/**/lib-dist/*
packages/loot-core/**/proto/*
.yarn/*
.github/*
upcoming-release-notes/*

View File

@@ -5,7 +5,7 @@
# you are doing.
###################################################
FROM node:18-bullseye as dev
FROM node:20-bullseye as dev
RUN apt-get update -y && apt-get upgrade -y && apt-get install -y openssl
WORKDIR /app
CMD ["sh", "./bin/docker-start"]

View File

@@ -16,7 +16,7 @@ async function run() {
`Found potentially matching PR ${activePr.number}: ${activePr.title}`,
);
}
const prNumber = activePr?.number ?? (await getNextPrNumber());
const initialPrNumber = activePr?.number ?? (await getNextPrNumber());
const result = await prompts([
{
@@ -29,7 +29,7 @@ async function run() {
name: 'pullRequestNumber',
message: 'PR Number',
type: 'number',
initial: prNumber,
initial: initialPrNumber,
},
{
name: 'releaseNoteType',
@@ -53,7 +53,8 @@ async function run() {
if (
!result.githubUsername ||
!result.oneLineSummary ||
!result.releaseNoteType
!result.releaseNoteType ||
!result.pullRequestNumber
) {
console.log('All questions must be answered. Exiting');
exit(1);
@@ -64,6 +65,7 @@ async function run() {
result.githubUsername,
result.oneLineSummary,
);
const prNumber = result.pullRequestNumber;
const filepath = `./upcoming-release-notes/${prNumber}.md`;
if (existsSync(filepath)) {
@@ -83,9 +85,7 @@ async function run() {
console.error('Failed to write release note file:', err);
exit(1);
} else {
console.log(
`Release note generated successfully: ./upcoming-release-notes/${prNumber}.md`,
);
console.log(`Release note generated successfully: ${filepath}`);
}
});
}

View File

@@ -108,11 +108,10 @@ export default pluginTypescript.config(
'packages/desktop-electron/client-build/',
'packages/desktop-electron/build/',
'packages/desktop-electron/dist/',
'packages/import-ynab4/**/node_modules/*',
'packages/import-ynab5/**/node_modules/*',
'packages/loot-core/**/node_modules/*',
'packages/loot-core/**/lib-dist/*',
'packages/loot-core/**/proto/*',
'packages/sync-server/build/',
'.yarn/*',
'.github/*',
],
@@ -504,6 +503,32 @@ export default pluginTypescript.config(
'no-restricted-imports': [
'warn',
{
paths: [
{
name: 'react-router',
importNames: ['useNavigate'],
message:
"Please import Actual's useNavigate() hook from `src/hooks` instead.",
},
{
name: 'react-redux',
importNames: ['useDispatch'],
message:
"Please import Actual's useDispatch() hook from `src/redux` instead.",
},
{
name: 'react-redux',
importNames: ['useSelector'],
message:
"Please import Actual's useSelector() hook from `src/redux` instead.",
},
{
name: 'react-redux',
importNames: ['useStore'],
message:
"Please import Actual's useStore() hook from `src/redux` instead.",
},
],
patterns: [
{
group: ['*.api', '*.web', '*.electron'],
@@ -519,6 +544,10 @@ export default pluginTypescript.config(
importNames: ['colors'],
message: 'Please use themes instead of colors',
},
{
group: ['@actual-app/web/*'],
message: 'Please do not import `@actual-app/web` in `loot-core`',
},
],
},
],
@@ -652,88 +681,6 @@ export default pluginTypescript.config(
],
},
},
{
files: ['packages/desktop-client/**/*'],
ignores: ['packages/desktop-client/src/hooks/useNavigate.{ts,tsx}'],
rules: {
'no-restricted-imports': [
'warn',
{
paths: [
{
name: 'react-router-dom',
importNames: ['useNavigate'],
message:
"Please import Actual's useNavigate() hook from `src/hooks` instead.",
},
],
},
],
},
},
{
files: ['packages/desktop-client/**/*', 'packages/loot-core/**/*'],
ignores: ['packages/desktop-client/src/redux/index.{ts,tsx}'],
rules: {
'no-restricted-imports': [
'warn',
{
paths: [
{
name: 'react-redux',
importNames: ['useDispatch'],
message:
"Please import Actual's useDispatch() hook from `src/redux` instead.",
},
{
name: 'react-redux',
importNames: ['useSelector'],
message:
"Please import Actual's useSelector() hook from `src/redux` instead.",
},
{
name: 'react-redux',
importNames: ['useStore'],
message:
"Please import Actual's useStore() hook from `src/redux` instead.",
},
],
},
],
},
},
{
files: ['packages/loot-core/src/**/*'],
rules: {
'no-restricted-imports': [
'warn',
{
patterns: [
{
group: ['*.api', '*.web', '*.electron'],
message: "Don't directly reference imports from other platforms",
},
{
group: ['uuid'],
importNames: ['*'],
message: "Use `import { v4 as uuidv4 } from 'uuid'` instead",
},
{
group: ['loot-core/**'],
message:
'Please use relative imports in loot-core instead of importing from `loot-core/*`',
},
{
group: ['@actual-app/web/*'],
message: 'Please do not import `@actual-app/web` in `loot-core`',
},
],
},
],
},
},
{
files: [
'packages/loot-core/src/types/**/*',
@@ -748,27 +695,6 @@ export default pluginTypescript.config(
'import/no-unused-modules': 'off',
},
},
{
files: [
'packages/desktop-client/src/style/index.*',
'packages/desktop-client/src/style/palette.*',
],
rules: {
'no-restricted-imports': [
'off',
{
patterns: [
{
group: ['**/style', '**/colors'],
importNames: ['colors'],
message: 'Please use themes instead of colors',
},
],
},
],
},
},
{
files: ['packages/api/migrations/*', 'packages/loot-core/migrations/*'],

View File

@@ -53,6 +53,7 @@
"prepare": "husky"
},
"devDependencies": {
"@octokit/rest": "^22.0.0",
"@types/node": "^22.15.18",
"@types/prompts": "^2.4.9",
"@typescript-eslint/parser": "^8.32.1",
@@ -70,6 +71,7 @@
"html-to-image": "^1.11.13",
"husky": "^9.1.7",
"lint-staged": "^15.5.2",
"minimatch": "^10.0.3",
"node-jq": "^6.0.1",
"npm-run-all": "^4.1.5",
"prettier": "^3.5.3",
@@ -89,7 +91,7 @@
"yarn": "^4.9.1"
},
"lint-staged": {
"*.{js,jsx,ts,tsx,md,json,yml}": [
"*.{js,mjs,jsx,ts,tsx,md,json,yml}": [
"eslint --fix",
"prettier --write"
]

View File

@@ -568,8 +568,20 @@ describe('API CRUD operations', () => {
const accountId = await api.createAccount({ name: 'test-account' }, 0);
let newTransaction = [
{ date: '2023-11-03', imported_id: '11', amount: 100, notes: 'notes' },
{ date: '2023-11-03', imported_id: '12', amount: 100, notes: '' },
{
account: accountId,
date: '2023-11-03',
imported_id: '11',
amount: 100,
notes: 'notes',
},
{
account: accountId,
date: '2023-11-03',
imported_id: '12',
amount: 100,
notes: '',
},
];
const addResult = await api.addTransactions(accountId, newTransaction, {
@@ -597,9 +609,27 @@ describe('API CRUD operations', () => {
expect(transactions).toHaveLength(2);
newTransaction = [
{ date: '2023-12-03', imported_id: '11', amount: 100, notes: 'notes' },
{ date: '2023-12-03', imported_id: '12', amount: 100, notes: 'notes' },
{ date: '2023-12-03', imported_id: '22', amount: 200, notes: '' },
{
account: accountId,
date: '2023-12-03',
imported_id: '11',
amount: 100,
notes: 'notes',
},
{
account: accountId,
date: '2023-12-03',
imported_id: '12',
amount: 100,
notes: 'notes',
},
{
account: accountId,
date: '2023-12-03',
imported_id: '22',
amount: 200,
notes: '',
},
];
const reconciled = await api.importTransactions(accountId, newTransaction);

View File

@@ -1,5 +1,6 @@
// @ts-strict-ignore
import type { Handlers } from 'loot-core/types/handlers';
import type { ImportTransactionEntity } from 'loot-core/types/models/import-transaction';
import * as injected from './injected';
@@ -98,8 +99,8 @@ export interface ImportTransactionsOpts {
}
export function importTransactions(
accountId,
transactions,
accountId: string,
transactions: ImportTransactionEntity[],
opts: ImportTransactionsOpts = {
defaultCleared: true,
},

View File

@@ -1,6 +1,6 @@
{
"name": "@actual-app/api",
"version": "25.6.0",
"version": "25.7.0",
"license": "MIT",
"description": "An API for Actual",
"engines": {
@@ -27,12 +27,11 @@
"better-sqlite3": "^11.10.0",
"compare-versions": "^6.1.1",
"node-fetch": "^3.3.2",
"uuid": "^9.0.1"
"uuid": "^11.1.0"
},
"devDependencies": {
"@types/uuid": "^9.0.8",
"tsc-alias": "^1.8.16",
"typescript": "^5.8.3",
"vitest": "^3.1.3"
"vitest": "^3.2.4"
}
}

View File

@@ -11,7 +11,7 @@
"outDir": "dist",
"declarationDir": "@types",
"paths": {
"loot-core/*": ["./@types/loot-core/*"]
"loot-core/*": ["./@types/loot-core/src/*"]
}
},
"include": ["."],

View File

@@ -16,7 +16,7 @@
"@types/react": "^19.1.4",
"react": "19.1.0",
"react-dom": "19.1.0",
"vitest": "^3.1.3"
"vitest": "^3.2.4"
},
"exports": {
"./hooks/*": "./src/hooks/*.ts",

View File

@@ -17,12 +17,11 @@
"dependencies": {
"google-protobuf": "^3.21.4",
"murmurhash": "^2.0.1",
"uuid": "^9.0.1"
"uuid": "^11.1.0"
},
"devDependencies": {
"@types/uuid": "^9.0.8",
"ts-protoc-gen": "^0.15.0",
"typescript": "^5.8.3",
"vitest": "^3.1.3"
"vitest": "^3.2.4"
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 104 KiB

After

Width:  |  Height:  |  Size: 106 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 66 KiB

After

Width:  |  Height:  |  Size: 67 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 66 KiB

After

Width:  |  Height:  |  Size: 66 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 66 KiB

After

Width:  |  Height:  |  Size: 66 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 73 KiB

After

Width:  |  Height:  |  Size: 73 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 73 KiB

After

Width:  |  Height:  |  Size: 74 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 71 KiB

After

Width:  |  Height:  |  Size: 71 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 73 KiB

After

Width:  |  Height:  |  Size: 73 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 73 KiB

After

Width:  |  Height:  |  Size: 73 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 72 KiB

After

Width:  |  Height:  |  Size: 72 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 100 KiB

After

Width:  |  Height:  |  Size: 100 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 101 KiB

After

Width:  |  Height:  |  Size: 101 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 100 KiB

After

Width:  |  Height:  |  Size: 100 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 72 KiB

After

Width:  |  Height:  |  Size: 72 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 72 KiB

After

Width:  |  Height:  |  Size: 72 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 71 KiB

After

Width:  |  Height:  |  Size: 71 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 97 KiB

After

Width:  |  Height:  |  Size: 97 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 97 KiB

After

Width:  |  Height:  |  Size: 97 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 96 KiB

After

Width:  |  Height:  |  Size: 96 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 95 KiB

After

Width:  |  Height:  |  Size: 95 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 96 KiB

After

Width:  |  Height:  |  Size: 96 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 95 KiB

After

Width:  |  Height:  |  Size: 95 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 95 KiB

After

Width:  |  Height:  |  Size: 95 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 96 KiB

After

Width:  |  Height:  |  Size: 96 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 95 KiB

After

Width:  |  Height:  |  Size: 95 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 97 KiB

After

Width:  |  Height:  |  Size: 97 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 97 KiB

After

Width:  |  Height:  |  Size: 97 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 96 KiB

After

Width:  |  Height:  |  Size: 96 KiB

View File

@@ -4,7 +4,7 @@
<meta charset="utf-8" />
<meta
name="viewport"
content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no"
content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no, viewport-fit=cover"
/>
<title>Actual</title>
<link rel="canonical" href="/" />

View File

@@ -1,6 +1,6 @@
{
"name": "@actual-app/web",
"version": "25.6.0",
"version": "25.7.0",
"license": "MIT",
"files": [
"build"
@@ -16,6 +16,7 @@
"@swc/helpers": "^0.5.17",
"@swc/plugin-react-remove-properties": "^1.5.121",
"@testing-library/dom": "10.4.0",
"@testing-library/jest-dom": "^6.6.3",
"@testing-library/react": "16.3.0",
"@testing-library/user-event": "14.6.1",
"@types/debounce": "^1.2.4",
@@ -25,19 +26,19 @@
"@types/react-dom": "^19.1.5",
"@types/react-grid-layout": "^1",
"@types/react-modal": "^3.16.3",
"@types/uuid": "^9.0.8",
"@types/webpack-bundle-analyzer": "^4.7.0",
"@use-gesture/react": "^10.3.1",
"@vitejs/plugin-basic-ssl": "^1.2.0",
"@vitejs/plugin-react-swc": "^3.6.0",
"auto-text-size": "^0.2.3",
"chokidar": "^3.6.0",
"cmdk": "^1.1.1",
"cross-env": "^7.0.3",
"date-fns": "^4.1.0",
"debounce": "^1.2.1",
"downshift": "7.6.2",
"focus-visible": "^4.1.5",
"i18next": "^23.16.8",
"i18next": "^25.2.1",
"i18next-parser": "^9.3.0",
"i18next-resources-to-backend": "^1.2.1",
"inter-ui": "^3.19.3",
@@ -59,11 +60,11 @@
"react-error-boundary": "^5.0.0",
"react-grid-layout": "^1.5.1",
"react-hotkeys-hook": "^4.6.2",
"react-i18next": "^14.1.3",
"react-i18next": "^15.5.3",
"react-markdown": "^10.1.0",
"react-modal": "3.16.3",
"react-redux": "^9.2.0",
"react-router-dom": "6.30.0",
"react-router": "7.6.2",
"react-simple-pull-to-refresh": "^1.3.3",
"react-spring": "^10.0.0",
"react-stately": "^3.37.0",
@@ -77,11 +78,11 @@
"swc-loader": "^0.2.6",
"terser-webpack-plugin": "^5.3.14",
"usehooks-ts": "^3.1.1",
"uuid": "^9.0.1",
"uuid": "^11.1.0",
"vite": "^6.3.5",
"vite-plugin-pwa": "^1.0.0",
"vite-tsconfig-paths": "^4.3.2",
"vitest": "^3.1.3",
"vitest": "^3.2.4",
"webpack": "^5.99.8",
"webpack-bundle-analyzer": "^4.10.2",
"xml2js": "^0.6.2"

View File

@@ -233,25 +233,41 @@ export const syncAccounts = createAppAsyncThunk(
return false;
}
const batchSync = !id;
// Build an array of IDs for accounts to sync.. if no `id` provided
// then we assume that all accounts should be synced
const queriesState = getState().queries;
let accountIdsToSync = !batchSync
? [id]
: queriesState.accounts
.filter(
({ bank, closed, tombstone }) => !!bank && !closed && !tombstone,
)
.sort((a, b) =>
a.offbudget === b.offbudget
? a.sort_order - b.sort_order
: a.offbudget - b.offbudget,
)
.map(({ id }) => id);
const { setAccountsSyncing } = accountsSlice.actions;
if (id === 'uncategorized') {
// Sync no accounts
dispatch(setAccountsSyncing({ ids: [] }));
return false;
}
const queriesState = getState().queries;
let accountIdsToSync: string[];
if (id === 'offbudget' || id === 'onbudget') {
const targetOffbudget = id === 'offbudget' ? 1 : 0;
accountIdsToSync = queriesState.accounts
.filter(
({ bank, closed, tombstone, offbudget }) =>
!!bank && !closed && !tombstone && offbudget === targetOffbudget,
)
.sort((a, b) => a.sort_order - b.sort_order)
.map(({ id }) => id);
} else if (id) {
accountIdsToSync = [id];
} else {
// Default: all accounts
accountIdsToSync = queriesState.accounts
.filter(
({ bank, closed, tombstone }) => !!bank && !closed && !tombstone,
)
.sort((a, b) =>
a.offbudget === b.offbudget
? a.sort_order - b.sort_order
: a.offbudget - b.offbudget,
)
.map(({ id }) => id);
}
dispatch(setAccountsSyncing({ ids: accountIdsToSync }));
// TODO: Force cast to AccountEntity.
@@ -260,7 +276,9 @@ export const syncAccounts = createAppAsyncThunk(
'accounts-get',
)) as unknown as AccountEntity[];
const simpleFinAccounts = accountsData.filter(
a => a.account_sync_source === 'simpleFin',
a =>
a.account_sync_source === 'simpleFin' &&
accountIdsToSync.includes(a.id),
);
let isSyncSuccess = false;
@@ -268,7 +286,7 @@ export const syncAccounts = createAppAsyncThunk(
const matchedTransactions: Array<TransactionEntity['id']> = [];
const updatedAccounts: Array<AccountEntity['id']> = [];
if (batchSync && simpleFinAccounts.length > 0) {
if (simpleFinAccounts.length > 0) {
console.log('Using SimpleFin batch sync');
const res = await send('simplefin-batch-sync', {

View File

@@ -121,7 +121,9 @@ export const syncAndDownload = createAppAsyncThunk(
return { error: syncState.error };
}
const hasDownloaded = await dispatch(syncAccounts({ id: accountId }));
const hasDownloaded = await dispatch(
syncAccounts({ id: accountId }),
).unwrap();
if (hasDownloaded) {
// Sync again afterwards if new transactions were created

View File

@@ -22,7 +22,7 @@ const ACTUAL_VERSION = Platform.isPlaywright
: packageJson.version;
// *** Start the backend ***
let worker;
let worker = null;
function createBackendWorker() {
worker = new Worker(backendWorkerUrl);

View File

@@ -9,7 +9,7 @@ import {
} from 'react-error-boundary';
import { HotkeysProvider } from 'react-hotkeys-hook';
import { useTranslation } from 'react-i18next';
import { BrowserRouter } from 'react-router-dom';
import { BrowserRouter } from 'react-router';
import { styles } from '@actual-app/components/styles';
import { View } from '@actual-app/components/view';
@@ -71,7 +71,7 @@ function AppInner() {
};
async function init() {
const socketName = await maybeUpdate(() =>
const serverSocket = await maybeUpdate(() =>
global.Actual.getServerSocket(),
);
@@ -82,7 +82,7 @@ function AppInner() {
),
}),
);
await initConnection(socketName);
await initConnection(serverSocket);
// Load any global prefs
dispatch(

View File

@@ -0,0 +1,278 @@
import {
type ComponentType,
type SVGProps,
useCallback,
useEffect,
useMemo,
useState,
} from 'react';
import { Trans, useTranslation } from 'react-i18next';
import {
SvgCog,
SvgPiggyBank,
SvgReports,
SvgStoreFront,
SvgTuning,
SvgWallet,
} from '@actual-app/components/icons/v1';
import {
SvgCalendar3,
SvgNotesPaperText,
} from '@actual-app/components/icons/v2';
import { css } from '@emotion/css';
import { Command } from 'cmdk';
import { useAccounts } from '@desktop-client/hooks/useAccounts';
import { useMetadataPref } from '@desktop-client/hooks/useMetadataPref';
import { useModalState } from '@desktop-client/hooks/useModalState';
import { useNavigate } from '@desktop-client/hooks/useNavigate';
import { useReports } from '@desktop-client/hooks/useReports';
type SearchableItem = {
id: string;
name: string;
Icon: ComponentType<SVGProps<SVGSVGElement>>;
};
type SearchSection = {
key: string;
heading: string;
items: Readonly<SearchableItem[]>;
onSelect: (item: Pick<SearchableItem, 'id'>) => void;
};
export function CommandBar() {
const { t } = useTranslation();
const [open, setOpen] = useState(false);
const [search, setSearch] = useState('');
const navigate = useNavigate();
const [budgetName] = useMetadataPref('budgetName');
const { modalStack } = useModalState();
const navigationItems = useMemo(
() => [
{ id: 'budget', name: t('Budget'), path: '/budget', Icon: SvgWallet },
{
id: 'reports-nav',
name: t('Reports'),
path: '/reports',
Icon: SvgReports,
},
{
id: 'schedules',
name: t('Schedules'),
path: '/schedules',
Icon: SvgCalendar3,
},
{ id: 'payees', name: t('Payees'), path: '/payees', Icon: SvgStoreFront },
{ id: 'rules', name: t('Rules'), path: '/rules', Icon: SvgTuning },
{ id: 'settings', name: t('Settings'), path: '/settings', Icon: SvgCog },
],
[t],
);
useEffect(() => {
// Reset search when closing
if (!open) setSearch('');
}, [open]);
const allAccounts = useAccounts();
const { data: customReports } = useReports();
const accounts = allAccounts.filter(acc => !acc.closed);
const openEventListener = useCallback(
(e: KeyboardEvent) => {
if (e.key === 'k' && (e.metaKey || e.ctrlKey)) {
e.preventDefault();
// Do not open CommandBar if a modal is already open
if (modalStack.length > 0) return;
setOpen(true);
}
},
[modalStack.length],
);
useEffect(() => {
document.addEventListener('keydown', openEventListener);
return () => document.removeEventListener('keydown', openEventListener);
}, [openEventListener]);
const handleNavigate = useCallback(
(path: string) => {
setOpen(false);
navigate(path);
},
[navigate],
);
const sections: SearchSection[] = [
{
key: 'navigation',
heading: t('Navigation'),
items: navigationItems.map(({ id, name, Icon }) => ({
id,
name,
Icon,
})),
onSelect: ({ id }) => {
const item = navigationItems.find(item => item.id === id);
if (!!item) handleNavigate(item.path);
},
},
{
key: 'accounts',
heading: t('Accounts'),
items: accounts.map(account => ({
...account,
Icon: SvgPiggyBank,
})),
onSelect: ({ id }) => handleNavigate(`/accounts/${id}`),
},
{
key: 'reports-custom',
heading: t('Custom Reports'),
items: customReports.map(report => ({
...report,
Icon: SvgNotesPaperText,
})),
onSelect: ({ id }) => handleNavigate(`/reports/custom/${id}`),
},
];
const searchLower = search.toLowerCase();
const filteredSections = sections.map(section => ({
...section,
items: section.items.filter(item =>
item.name.toLowerCase().includes(searchLower),
),
}));
const hasResults = filteredSections.some(section => !!section.items.length);
return (
<Command.Dialog
vimBindings
open={open}
onOpenChange={setOpen}
label={t('Command Bar')}
aria-label={t('Command Bar')}
shouldFilter={false}
className={css({
position: 'fixed',
top: '30%',
left: '50%',
transform: 'translate(-50%, -30%)',
width: '90%',
maxWidth: '600px',
backgroundColor: 'var(--color-modalBackground)',
border: '1px solid var(--color-modalBorder)',
color: 'var(--color-pageText)',
borderRadius: '8px',
boxShadow: '0 4px 12px rgba(0, 0, 0, 0.1)',
overflow: 'hidden',
zIndex: 3001,
})}
>
<Command.Input
autoFocus
placeholder={t('Search {{budgetName}}...', { budgetName })}
value={search}
onValueChange={setSearch}
className={css({
width: '100%',
padding: '12px 16px',
fontSize: '1rem',
border: 'none',
borderBottom: '1px solid var(--color-tableBorderSeparator)',
backgroundColor: 'transparent',
color: 'var(--color-pageText)',
outline: 'none',
'&::placeholder': {
color: 'var(--color-pageTextSubdued)',
},
})}
/>
<Command.List
className={css({
maxHeight: '300px',
overflowY: 'auto',
padding: '8px 0',
// Hide the scrollbar
scrollbarWidth: 'none',
'&::-webkit-scrollbar': {
display: 'none',
},
// Ensure content is still scrollable
msOverflowStyle: 'none',
})}
>
{filteredSections.map(
section =>
!!section.items.length && (
<Command.Group
key={section.key}
heading={section.heading}
className={css({
padding: '0 8px',
'& [cmdk-group-heading]': {
padding: '8px 8px 4px',
fontSize: '0.8rem',
fontWeight: 500,
color: 'var(--color-pageTextSubdued)',
textTransform: 'uppercase',
},
})}
>
{section.items.map(({ id, name, Icon }) => (
<Command.Item
key={id}
onSelect={() => section.onSelect({ id })}
value={name}
className={css({
padding: '8px 16px',
cursor: 'pointer',
fontSize: '0.9rem',
borderRadius: '4px',
margin: '0',
display: 'flex',
alignItems: 'center',
gap: '8px',
// Avoid showing mouse hover styles when using keyboard navigation
'[data-cmdk-list]:not([data-cmdk-list-nav-active]) &:hover':
{
backgroundColor:
'var(--color-menuItemBackgroundHover)',
color: 'var(--color-menuItemTextHover)',
},
// eslint-disable-next-line rulesdir/typography
"&[data-selected='true']": {
backgroundColor: 'var(--color-menuItemBackgroundHover)',
color: 'var(--color-menuItemTextHover)',
},
})}
>
<Icon width={16} height={16} />
{name}
</Command.Item>
))}
</Command.Group>
),
)}
{!hasResults && (
<Command.Empty
className={css({
padding: '16px',
textAlign: 'center',
fontSize: '0.9rem',
color: 'var(--color-pageTextSubdued)',
})}
>
<Trans>No results found</Trans>
</Command.Empty>
)}
</Command.List>
</Command.Dialog>
);
}

View File

@@ -1,13 +1,7 @@
// @ts-strict-ignore
import React, { type ReactElement, useEffect, useRef } from 'react';
import { useTranslation } from 'react-i18next';
import {
Route,
Routes,
Navigate,
useLocation,
useHref,
} from 'react-router-dom';
import { Route, Routes, Navigate, useLocation, useHref } from 'react-router';
import { useResponsive } from '@actual-app/components/hooks/useResponsive';
import { theme } from '@actual-app/components/theme';
@@ -18,6 +12,7 @@ import * as undo from 'loot-core/platform/client/undo';
import { UserAccessPage } from './admin/UserAccess/UserAccessPage';
import { BankSync } from './banksync';
import { BankSyncStatus } from './BankSyncStatus';
import { CommandBar } from './CommandBar';
import { GlobalKeys } from './GlobalKeys';
import { ManageRulesPage } from './ManageRulesPage';
import { Category } from './mobile/budget/Category';
@@ -146,10 +141,16 @@ export function FinancesApp() {
notification: {
type: 'message',
title: t('A new version of Actual is available!'),
message: t(
'Version {{latestVersion}} of Actual was recently released.',
{ latestVersion },
),
message:
(process.env.REACT_APP_IS_PIKAPODS ?? '').toLowerCase() ===
'true'
? t(
'A new version of Actual is available! Your Pikapods instance will be automatically updated in the next few days - no action needed.',
)
: t(
'Version {{latestVersion}} of Actual was recently released.',
{ latestVersion },
),
sticky: true,
id: 'update-notification',
button: {
@@ -176,7 +177,7 @@ export function FinancesApp() {
<View style={{ height: '100%' }}>
<RouterBehaviors />
<GlobalKeys />
<CommandBar />
<View
style={{
flexDirection: 'row',

View File

@@ -1,7 +1,7 @@
import { forwardRef, useRef } from 'react';
import { useHotkeys } from 'react-hotkeys-hook';
import { Trans, useTranslation } from 'react-i18next';
import { useLocation } from 'react-router-dom';
import { useLocation } from 'react-router';
import { Button } from '@actual-app/components/button';
import { SvgHelp } from '@actual-app/components/icons/v2';

View File

@@ -1,6 +1,6 @@
import React, { useState, useEffect, useRef, type CSSProperties } from 'react';
import { Trans, useTranslation } from 'react-i18next';
import { useLocation } from 'react-router-dom';
import { useLocation } from 'react-router';
import { Button } from '@actual-app/components/button';
import { Menu } from '@actual-app/components/menu';

View File

@@ -7,7 +7,7 @@ import React, {
type SetStateAction,
type Dispatch,
} from 'react';
import { useTranslation } from 'react-i18next';
import { Trans, useTranslation } from 'react-i18next';
import { Button } from '@actual-app/components/button';
import { Stack } from '@actual-app/components/stack';
@@ -114,6 +114,8 @@ export function ManageRules({
payeeId,
setLoading = () => {},
}: ManageRulesProps) {
const { t } = useTranslation();
const [allRules, setAllRules] = useState<RuleEntity[]>([]);
const [page, setPage] = useState(0);
const [filter, setFilter] = useState('');
@@ -210,7 +212,7 @@ export function ManageRules({
if (someDeletionsFailed) {
alert(
t('Some rules were not deleted because they are linked to schedules'),
t('Some rules were not deleted because they are linked to schedules.'),
);
}
@@ -284,7 +286,6 @@ export function ManageRules({
const onHover = useCallback(id => {
setHoveredRule(id);
}, []);
const { t } = useTranslation();
return (
<SelectedProvider instance={selectedInst}>
@@ -306,13 +307,15 @@ export function ManageRules({
}}
>
<Text>
{t('Rules are always run in the order that you see them.')}{' '}
<Trans>
Rules are always run in the order that you see them.
</Trans>{' '}
<Link
variant="external"
to="https://actualbudget.org/docs/budgeting/rules/"
linkColor="muted"
>
{t('Learn more')}
<Trans>Learn more</Trans>
</Link>
</Text>
</View>
@@ -351,11 +354,13 @@ export function ManageRules({
<Stack direction="row" align="center" justify="flex-end" spacing={2}>
{selectedInst.items.size > 0 && (
<Button onPress={onDeleteSelected}>
Delete {selectedInst.items.size} rules
<Trans count={selectedInst.items.size}>
Delete {{ count: selectedInst.items.size }} rules
</Trans>
</Button>
)}
<Button variant="primary" onPress={onCreateRule}>
{t('Create new rule')}
<Trans>Create new rule</Trans>
</Button>
</Stack>
</View>

View File

@@ -1,6 +1,6 @@
// @ts-strict-ignore
import React, { useEffect } from 'react';
import { useLocation } from 'react-router-dom';
import { useLocation } from 'react-router';
import { send } from 'loot-core/platform/client/fetch';
import * as monthUtils from 'loot-core/shared/months';
@@ -31,6 +31,7 @@ import { EnvelopeBalanceMenuModal } from './modals/EnvelopeBalanceMenuModal';
import { EnvelopeBudgetMenuModal } from './modals/EnvelopeBudgetMenuModal';
import { EnvelopeBudgetMonthMenuModal } from './modals/EnvelopeBudgetMonthMenuModal';
import { EnvelopeBudgetSummaryModal } from './modals/EnvelopeBudgetSummaryModal';
import { EnvelopeIncomeBalanceMenuModal } from './modals/EnvelopeIncomeBalanceMenuModal';
import { EnvelopeToBudgetMenuModal } from './modals/EnvelopeToBudgetMenuModal';
import { FixEncryptionKeyModal } from './modals/FixEncryptionKeyModal';
import { GoalTemplateModal } from './modals/GoalTemplateModal';
@@ -73,10 +74,10 @@ import { PostsOfflineNotification } from './schedules/PostsOfflineNotification';
import { ScheduleDetails } from './schedules/ScheduleDetails';
import { ScheduleLink } from './schedules/ScheduleLink';
import { UpcomingLength } from './schedules/UpcomingLength';
import { NamespaceContext } from './spreadsheet/NamespaceContext';
import { useMetadataPref } from '@desktop-client/hooks/useMetadataPref';
import { useModalState } from '@desktop-client/hooks/useModalState';
import { SheetNameProvider } from '@desktop-client/hooks/useSheetName';
import { closeModal } from '@desktop-client/modals/modalsSlice';
import { useDispatch } from '@desktop-client/redux';
@@ -203,12 +204,12 @@ export function Modals() {
case 'envelope-budget-summary':
return (
<NamespaceContext.Provider
<SheetNameProvider
key={key}
value={monthUtils.sheetForMonth(modal.options.month)}
name={monthUtils.sheetForMonth(modal.options.month)}
>
<EnvelopeBudgetSummaryModal key={key} {...modal.options} />
</NamespaceContext.Provider>
</SheetNameProvider>
);
case 'tracking-budget-summary':
@@ -240,22 +241,22 @@ export function Modals() {
case 'envelope-budget-menu':
return (
<NamespaceContext.Provider
<SheetNameProvider
key={key}
value={monthUtils.sheetForMonth(modal.options.month)}
name={monthUtils.sheetForMonth(modal.options.month)}
>
<EnvelopeBudgetMenuModal {...modal.options} />
</NamespaceContext.Provider>
</SheetNameProvider>
);
case 'tracking-budget-menu':
return (
<NamespaceContext.Provider
<SheetNameProvider
key={key}
value={monthUtils.sheetForMonth(modal.options.month)}
name={monthUtils.sheetForMonth(modal.options.month)}
>
<TrackingBudgetMenuModal {...modal.options} />
</NamespaceContext.Provider>
</SheetNameProvider>
);
case 'category-group-menu':
@@ -266,42 +267,52 @@ export function Modals() {
case 'envelope-balance-menu':
return (
<NamespaceContext.Provider
<SheetNameProvider
key={key}
value={monthUtils.sheetForMonth(modal.options.month)}
name={monthUtils.sheetForMonth(modal.options.month)}
>
<EnvelopeBalanceMenuModal {...modal.options} />
</NamespaceContext.Provider>
</SheetNameProvider>
);
case 'envelope-income-balance-menu':
return (
<SheetNameProvider
key={key}
name={monthUtils.sheetForMonth(modal.options.month)}
>
<EnvelopeIncomeBalanceMenuModal {...modal.options} />
</SheetNameProvider>
);
case 'envelope-summary-to-budget-menu':
return (
<NamespaceContext.Provider
<SheetNameProvider
key={key}
value={monthUtils.sheetForMonth(modal.options.month)}
name={monthUtils.sheetForMonth(modal.options.month)}
>
<EnvelopeToBudgetMenuModal {...modal.options} />
</NamespaceContext.Provider>
</SheetNameProvider>
);
case 'hold-buffer':
return (
<NamespaceContext.Provider
<SheetNameProvider
key={key}
value={monthUtils.sheetForMonth(modal.options.month)}
name={monthUtils.sheetForMonth(modal.options.month)}
>
<HoldBufferModal {...modal.options} />
</NamespaceContext.Provider>
</SheetNameProvider>
);
case 'tracking-balance-menu':
return (
<NamespaceContext.Provider
<SheetNameProvider
key={key}
value={monthUtils.sheetForMonth(modal.options.month)}
name={monthUtils.sheetForMonth(modal.options.month)}
>
<TrackingBalanceMenuModal {...modal.options} />
</NamespaceContext.Provider>
</SheetNameProvider>
);
case 'transfer':
@@ -318,22 +329,22 @@ export function Modals() {
case 'envelope-budget-month-menu':
return (
<NamespaceContext.Provider
<SheetNameProvider
key={key}
value={monthUtils.sheetForMonth(modal.options.month)}
name={monthUtils.sheetForMonth(modal.options.month)}
>
<EnvelopeBudgetMonthMenuModal {...modal.options} />
</NamespaceContext.Provider>
</SheetNameProvider>
);
case 'tracking-budget-month-menu':
return (
<NamespaceContext.Provider
<SheetNameProvider
key={key}
value={monthUtils.sheetForMonth(modal.options.month)}
name={monthUtils.sheetForMonth(modal.options.month)}
>
<TrackingBudgetMonthMenuModal {...modal.options} />
</NamespaceContext.Provider>
</SheetNameProvider>
);
case 'budget-file-selection':

View File

@@ -22,6 +22,7 @@ import { View } from '@actual-app/components/view';
import { css } from '@emotion/css';
import { Link } from './common/Link';
import { MODAL_Z_INDEX } from './common/Modal';
import {
removeNotification,
@@ -313,7 +314,7 @@ export function Notifications({ style }: { style?: CSSProperties }) {
top: notificationInset?.top,
right: notificationInset?.right || 13,
left: notificationInset?.left || (isNarrowWidth ? 13 : undefined),
zIndex: 10000,
zIndex: MODAL_Z_INDEX - 1,
...style,
}}
>

View File

@@ -1,7 +1,7 @@
import React, { useState, useEffect } from 'react';
import { useHotkeys } from 'react-hotkeys-hook';
import { useTranslation } from 'react-i18next';
import { Routes, Route, useLocation } from 'react-router-dom';
import { Trans, useTranslation } from 'react-i18next';
import { Routes, Route, useLocation } from 'react-router';
import { Button } from '@actual-app/components/button';
import { useResponsive } from '@actual-app/components/hooks/useResponsive';
@@ -34,19 +34,19 @@ import { HelpMenu } from './HelpMenu';
import { LoggedInUser } from './LoggedInUser';
import { useServerURL } from './ServerContext';
import { useSidebar } from './sidebar/SidebarProvider';
import { useSheetValue } from './spreadsheet/useSheetValue';
import { ThemeSelector } from './ThemeSelector';
import { sync } from '@desktop-client/app/appSlice';
import { useGlobalPref } from '@desktop-client/hooks/useGlobalPref';
import { useMetadataPref } from '@desktop-client/hooks/useMetadataPref';
import { useNavigate } from '@desktop-client/hooks/useNavigate';
import { useSheetValue } from '@desktop-client/hooks/useSheetValue';
import { useSyncedPref } from '@desktop-client/hooks/useSyncedPref';
import * as queries from '@desktop-client/queries/queries';
import { useDispatch } from '@desktop-client/redux';
import * as bindings from '@desktop-client/spreadsheet/bindings';
function UncategorizedButton() {
const count: number | null = useSheetValue(queries.uncategorizedCount());
const count: number | null = useSheetValue(bindings.uncategorizedCount());
if (count === null || count <= 0) {
return null;
}
@@ -60,7 +60,7 @@ function UncategorizedButton() {
color: theme.errorText,
}}
>
{count} uncategorized {count === 1 ? 'transaction' : 'transactions'}
<Trans count={count}>{{ count }} uncategorized transactions</Trans>
</Link>
);
}
@@ -70,6 +70,7 @@ type PrivacyButtonProps = {
};
function PrivacyButton({ style }: PrivacyButtonProps) {
const { t } = useTranslation();
const [isPrivacyEnabledPref, setPrivacyEnabledPref] =
useSyncedPref('isPrivacyEnabled');
const isPrivacyEnabled = String(isPrivacyEnabledPref) === 'true';
@@ -91,7 +92,9 @@ function PrivacyButton({ style }: PrivacyButtonProps) {
return (
<Button
variant="bare"
aria-label={`${isPrivacyEnabled ? 'Disable' : 'Enable'} privacy mode`}
aria-label={
isPrivacyEnabled ? t('Disable privacy mode') : t('Enable privacy mode')
}
onPress={() => setPrivacyEnabledPref(String(!isPrivacyEnabled))}
style={style}
>
@@ -242,10 +245,10 @@ function SyncButton({ style, isMobile = false }: SyncButtonProps) {
)}
<Text style={isMobile ? { ...mobileTextStyle } : { marginLeft: 3 }}>
{syncState === 'disabled'
? 'Disabled'
? t('Disabled')
: syncState === 'offline'
? 'Offline'
: 'Sync'}
? t('Offline')
: t('Sync')}
</Text>
</Button>
);
@@ -328,7 +331,7 @@ export function Titlebar({ style }: TitlebarProps) {
height={10}
style={{ marginRight: 5, color: 'currentColor' }}
/>{' '}
{t('Back')}
<Trans>Back</Trans>
</Button>
) : null
}

View File

@@ -1,5 +1,5 @@
import React from 'react';
import { useTranslation } from 'react-i18next';
import { Trans, useTranslation } from 'react-i18next';
import { Button } from '@actual-app/components/button';
import { SvgClose } from '@actual-app/components/icons/v1';
@@ -45,7 +45,7 @@ export function UpdateNotification() {
<View style={{ flexDirection: 'row', alignItems: 'center' }}>
<View style={{ marginRight: 10, fontWeight: 700 }}>
<Text>
{t('App updated to {{version}}', { version: updateInfo.version })}
<Trans>App updated to {{ version: updateInfo.version }}</Trans>
</Text>
</View>
<View style={{ flex: 1 }} />
@@ -59,7 +59,7 @@ export function UpdateNotification() {
textDecoration: 'underline',
}}
>
{t('Restart')}
<Trans>Restart</Trans>
</Link>{' '}
(
<Link
@@ -74,7 +74,7 @@ export function UpdateNotification() {
)
}
>
{t('notes')}
<Trans>notes</Trans>
</Link>
)
<Button

View File

@@ -7,7 +7,7 @@ import React, {
useEffect,
} from 'react';
import { Trans } from 'react-i18next';
import { Navigate, useParams, useLocation } from 'react-router-dom';
import { Navigate, useParams, useLocation } from 'react-router';
import { styles } from '@actual-app/components/styles';
import { theme } from '@actual-app/components/theme';
@@ -73,12 +73,12 @@ import {
replaceModal,
} from '@desktop-client/modals/modalsSlice';
import { addNotification } from '@desktop-client/notifications/notificationsSlice';
import * as queries from '@desktop-client/queries';
import { aqlQuery } from '@desktop-client/queries/aqlQuery';
import {
pagedQuery,
type PagedQuery,
} from '@desktop-client/queries/pagedQuery';
import * as queries from '@desktop-client/queries/queries';
import {
createPayee,
initiallyLoadPayees,
@@ -583,7 +583,7 @@ class AccountInternal extends PureComponent<
const account = this.props.accounts.find(acct => acct.id === accountId);
await this.props.dispatch(
syncAndDownload({ accountId: account ? account.id : undefined }),
syncAndDownload({ accountId: account ? account.id : accountId }),
);
};
@@ -1713,6 +1713,14 @@ class AccountInternal extends PureComponent<
const balanceQuery = this.getBalanceQuery(accountId);
const selectAllFilter = (item: TransactionEntity): boolean => {
if (item.is_parent) {
const children = transactions.filter(t => t.parent_id === item.id);
return children.every(t => selectAllFilter(t));
}
return !item._unmatched;
};
return (
<AllTransactions
account={account}
@@ -1727,7 +1735,7 @@ class AccountInternal extends PureComponent<
items={allTransactions}
fetchAllIds={this.fetchAllIds}
registerDispatch={dispatch => (this.dispatchSelected = dispatch)}
selectAllFilter={item => !item._unmatched && !item.is_parent}
selectAllFilter={selectAllFilter}
>
<View style={styles.page}>
<AccountHeader

View File

@@ -1,6 +1,6 @@
import React, { useCallback, useRef, useState } from 'react';
import { Trans, useTranslation } from 'react-i18next';
import { useParams } from 'react-router-dom';
import { useParams } from 'react-router';
import { Button } from '@actual-app/components/button';
import { SvgExclamationOutline } from '@actual-app/components/icons/v1';

View File

@@ -14,15 +14,15 @@ import { isPreviewId } from 'loot-core/shared/transactions';
import { type AccountEntity } from 'loot-core/types/models';
import { PrivacyFilter } from '@desktop-client/components/PrivacyFilter';
import { type Binding } from '@desktop-client/components/spreadsheet';
import {
CellValue,
CellValueText,
} from '@desktop-client/components/spreadsheet/CellValue';
import { useFormat } from '@desktop-client/components/spreadsheet/useFormat';
import { useSheetValue } from '@desktop-client/components/spreadsheet/useSheetValue';
import { useCachedSchedules } from '@desktop-client/hooks/useCachedSchedules';
import { useFormat } from '@desktop-client/hooks/useFormat';
import { useSelectedItems } from '@desktop-client/hooks/useSelected';
import { useSheetValue } from '@desktop-client/hooks/useSheetValue';
import { type Binding } from '@desktop-client/spreadsheet';
type DetailedBalanceProps = {
name: string;

View File

@@ -1,4 +1,4 @@
import React, { type FormEvent, useState } from 'react';
import React, { useEffect, type FormEvent, useState } from 'react';
import { Form } from 'react-aria-components';
import { Trans } from 'react-i18next';
@@ -17,10 +17,10 @@ import { currencyToInteger, tsToRelativeTime } from 'loot-core/shared/util';
import { type AccountEntity } from 'loot-core/types/models';
import { type TransObjectLiteral } from 'loot-core/types/util';
import { useFormat } from '@desktop-client/components/spreadsheet/useFormat';
import { useSheetValue } from '@desktop-client/components/spreadsheet/useSheetValue';
import { useFormat } from '@desktop-client/hooks/useFormat';
import { useLocale } from '@desktop-client/hooks/useLocale';
import * as queries from '@desktop-client/queries/queries';
import { useSheetValue } from '@desktop-client/hooks/useSheetValue';
import * as bindings from '@desktop-client/spreadsheet/bindings';
type ReconcilingMessageProps = {
balanceQuery: { name: `balance-query-${string}`; query: Query };
@@ -128,15 +128,24 @@ export function ReconcileMenu({
onReconcile,
onClose,
}: ReconcileMenuProps) {
const balanceQuery = queries.accountBalance(account.id);
const balanceQuery = bindings.accountBalance(account.id);
const clearedBalance = useSheetValue<'account', `balance-${string}-cleared`>({
name: (balanceQuery.name + '-cleared') as `balance-${string}-cleared`,
value: null,
query: balanceQuery.query.filter({ cleared: true }),
});
const lastSyncedBalance = account.balance_current;
const format = useFormat();
const locale = useLocale();
const [inputValue, setInputValue] = useState<string | null>(null);
const [inputValue, setInputValue] = useState<string | null>();
// useEffect is needed here. clearedBalance does not work as a default value for inputValue and
// to use a button to update inputValue we can't use defaultValue in the input form below
useEffect(() => {
if (clearedBalance != null) {
setInputValue(format(clearedBalance, 'financial'));
}
}, [clearedBalance, format]);
function onSubmit(e: FormEvent<HTMLFormElement>) {
e.preventDefault();
@@ -161,14 +170,28 @@ export function ReconcileMenu({
reconcile with:
</Trans>
</Text>
{clearedBalance != null && (
<InitialFocus>
<Input
defaultValue={format(clearedBalance, 'financial')}
onChangeValue={setInputValue}
style={{ margin: '7px 0' }}
/>
</InitialFocus>
<InitialFocus>
<Input
value={inputValue ?? ''}
onChangeValue={setInputValue}
style={{ margin: '7px 0' }}
/>
</InitialFocus>
{lastSyncedBalance != null && (
<View>
<Text>
<Trans>Last Balance from Bank: </Trans>
{format(lastSyncedBalance, 'financial')}
</Text>
<Button
onPress={() =>
setInputValue(format(lastSyncedBalance, 'financial'))
}
style={{ marginBottom: 7 }}
>
<Trans>Use last synced total</Trans>
</Button>
</View>
)}
<Text style={{ color: theme.pageTextSubdued, paddingBottom: 6 }}>
{account?.last_reconciled

View File

@@ -176,7 +176,7 @@ function UserAccessContent({
</Trans>{' '}
<Link
variant="external"
to="https://actualbudget.org/docs/budgeting/users-access/"
to="https://actualbudget.org/docs/config/multi-user#user-access-management"
linkColor="muted"
>
<Trans>Learn more</Trans>
@@ -274,13 +274,14 @@ type LockToggleProps = {
function LockToggle({ style, onToggleSave }: LockToggleProps) {
const [hover, setHover] = useState(false);
const dispatch = useDispatch();
const { t } = useTranslation();
return (
<Button
onHoverStart={() => setHover(true)}
onHoverEnd={() => setHover(false)}
variant="primary"
aria-label="Menu"
aria-label={t('Menu')}
onPress={() =>
dispatch(
pushModal({

View File

@@ -286,7 +286,7 @@ function UserDirectoryContent({
</Trans>{' '}
<Link
variant="external"
to="https://actualbudget.org/docs/budgeting/users/"
to="https://actualbudget.org/docs/config/multi-user/"
linkColor="muted"
>
<Trans>Learn more</Trans>

View File

@@ -33,13 +33,13 @@ import { ItemHeader } from './ItemHeader';
import { useEnvelopeSheetValue } from '@desktop-client/components/budget/envelope/EnvelopeBudgetComponents';
import { makeAmountFullStyle } from '@desktop-client/components/budget/util';
import { useSheetValue } from '@desktop-client/components/spreadsheet/useSheetValue';
import { useCategories } from '@desktop-client/hooks/useCategories';
import { useSheetValue } from '@desktop-client/hooks/useSheetValue';
import { useSyncedPref } from '@desktop-client/hooks/useSyncedPref';
import {
trackingBudget,
envelopeBudget,
} from '@desktop-client/queries/queries';
} from '@desktop-client/spreadsheet/bindings';
type CategoryAutocompleteItem = Omit<CategoryEntity, 'group'> & {
group?: CategoryGroupEntity;

View File

@@ -19,14 +19,14 @@ import { type TransObjectLiteral } from 'loot-core/types/util';
import { makeBalanceAmountStyle } from './util';
import { type Binding } from '@desktop-client/components/spreadsheet';
import {
CellValue,
CellValueText,
} from '@desktop-client/components/spreadsheet/CellValue';
import { useFormat } from '@desktop-client/components/spreadsheet/useFormat';
import { useSheetValue } from '@desktop-client/components/spreadsheet/useSheetValue';
import { useFeatureFlag } from '@desktop-client/hooks/useFeatureFlag';
import { useFormat } from '@desktop-client/hooks/useFormat';
import { useSheetValue } from '@desktop-client/hooks/useSheetValue';
import { type Binding } from '@desktop-client/spreadsheet';
type CarryoverIndicatorProps = {
style?: CSSProperties;

View File

@@ -13,7 +13,7 @@ import * as monthUtils from 'loot-core/shared/months';
import { MonthsContext } from './MonthsContext';
import { NamespaceContext } from '@desktop-client/components/spreadsheet/NamespaceContext';
import { SheetNameProvider } from '@desktop-client/hooks/useSheetName';
type RenderMonthsProps = {
component?: ComponentType<{ month: string; editing: boolean }>;
@@ -34,10 +34,7 @@ export function RenderMonths({
const editing = editingMonth === month;
return (
<NamespaceContext.Provider
key={index}
value={monthUtils.sheetForMonth(month)}
>
<SheetNameProvider key={index} name={monthUtils.sheetForMonth(month)}>
<View
style={{
flex: 1,
@@ -47,7 +44,7 @@ export function RenderMonths({
>
<Component month={month} editing={editing} {...args} />
</View>
</NamespaceContext.Provider>
</SheetNameProvider>
);
}) as unknown as JSX.Element;
}

View File

@@ -5,16 +5,16 @@ import { Menu } from '@actual-app/components/menu';
import { useEnvelopeSheetValue } from './EnvelopeBudgetComponents';
import { envelopeBudget } from '@desktop-client/queries/queries';
import { envelopeBudget } from '@desktop-client/spreadsheet/bindings';
type BalanceMenuProps = Omit<
ComponentPropsWithoutRef<typeof Menu>,
'onMenuSelect' | 'items'
> & {
categoryId: string;
onTransfer: () => void;
onCarryover: (carryOver: boolean) => void;
onCover: () => void;
onTransfer?: () => void;
onCarryover?: (carryOver: boolean) => void;
onCover?: () => void;
};
export function BalanceMenu({

View File

@@ -5,7 +5,7 @@ import { CoverMenu } from './CoverMenu';
import { useEnvelopeSheetValue } from './EnvelopeBudgetComponents';
import { TransferMenu } from './TransferMenu';
import { envelopeBudget } from '@desktop-client/queries/queries';
import { envelopeBudget } from '@desktop-client/spreadsheet/bindings';
type BalanceMovementMenuProps = {
categoryId: string;

View File

@@ -29,19 +29,14 @@ import {
import { BalanceMovementMenu } from './BalanceMovementMenu';
import { BudgetMenu } from './BudgetMenu';
import { IncomeMenu } from './IncomeMenu';
import { BalanceWithCarryover } from '@desktop-client/components/budget/BalanceWithCarryover';
import { makeAmountGrey } from '@desktop-client/components/budget/util';
import {
type Binding,
type SheetFields,
} from '@desktop-client/components/spreadsheet';
import {
CellValue,
CellValueText,
} from '@desktop-client/components/spreadsheet/CellValue';
import { useSheetName } from '@desktop-client/components/spreadsheet/useSheetName';
import { useSheetValue } from '@desktop-client/components/spreadsheet/useSheetValue';
import {
Row,
Field,
@@ -51,8 +46,11 @@ import {
import { useCategoryScheduleGoalTemplateIndicator } from '@desktop-client/hooks/useCategoryScheduleGoalTemplateIndicator';
import { useContextMenu } from '@desktop-client/hooks/useContextMenu';
import { useNavigate } from '@desktop-client/hooks/useNavigate';
import { useSheetName } from '@desktop-client/hooks/useSheetName';
import { useSheetValue } from '@desktop-client/hooks/useSheetValue';
import { useUndo } from '@desktop-client/hooks/useUndo';
import { envelopeBudget } from '@desktop-client/queries/queries';
import { type Binding, type SheetFields } from '@desktop-client/spreadsheet';
import { envelopeBudget } from '@desktop-client/spreadsheet/bindings';
export function useEnvelopeSheetName<
FieldName extends SheetFields<'envelope-budget'>,
@@ -334,7 +332,7 @@ export const ExpenseCategoryMonth = memo(function ExpenseCategoryMonth({
category: category.id,
});
showUndoNotification({
message: t(`Budget set to last months budget.`),
message: t(`Budget set to last months budget.`),
});
}}
onSetMonthsAverage={numberOfMonths => {
@@ -482,7 +480,7 @@ export const ExpenseCategoryMonth = memo(function ExpenseCategoryMonth({
}}
onContextMenu={e => {
handleBalanceContextMenu(e);
// We need to calculate differently from the hook ue to being aligned to the right
// We need to calculate differently from the hook due to being aligned to the right
const rect = e.currentTarget.getBoundingClientRect();
resetBalancePosition(
e.clientX - rect.right + 200 - 8,
@@ -553,20 +551,32 @@ type IncomeCategoryMonthProps = {
isLast: boolean;
month: string;
onShowActivity: (id: CategoryEntity['id'], month: string) => void;
onBudgetAction: (month: string, action: string, arg?: unknown) => void;
};
export function IncomeCategoryMonth({
category,
isLast,
month,
onShowActivity,
onBudgetAction,
}: IncomeCategoryMonthProps) {
const incomeMenuTriggerRef = useRef(null);
const {
setMenuOpen: setIncomeMenuOpen,
menuOpen: incomeMenuOpen,
handleContextMenu: handleIncomeContextMenu,
resetPosition: resetIncomePosition,
position: incomePosition,
} = useContextMenu();
return (
<View style={{ flex: 1 }}>
<Field
name="received"
width="flex"
truncate={false}
ref={incomeMenuTriggerRef}
style={{
paddingRight: styles.monthRightPadding,
textAlign: 'right',
...(isLast && { borderBottomWidth: 0 }),
backgroundColor: monthUtils.isCurrentMonth(month)
@@ -574,15 +584,58 @@ export function IncomeCategoryMonth({
: theme.budgetOtherMonth,
}}
>
<span onClick={() => onShowActivity(category.id, month)}>
<BalanceWithCarryover
carryover={envelopeBudget.catCarryover(category.id)}
balance={envelopeBudget.catSumAmount(category.id)}
goal={envelopeBudget.catGoal(category.id)}
budgeted={envelopeBudget.catBudgeted(category.id)}
longGoal={envelopeBudget.catLongGoal(category.id)}
/>
</span>
<View
name="received"
style={{
display: 'flex',
flexDirection: 'row',
alignItems: 'center',
justifyContent: 'flex-end',
position: 'relative',
}}
>
<span
onClick={() => {
resetIncomePosition(-6, -4);
setIncomeMenuOpen(true);
}}
onContextMenu={e => {
handleIncomeContextMenu(e);
// We need to calculate differently from the hook due to being aligned to the right
const rect = e.currentTarget.getBoundingClientRect();
resetIncomePosition(
e.clientX - rect.right + 200 - 8,
e.clientY - rect.bottom - 8,
);
}}
style={{ paddingRight: styles.monthRightPadding }}
>
<BalanceWithCarryover
carryover={envelopeBudget.catCarryover(category.id)}
balance={envelopeBudget.catSumAmount(category.id)}
goal={envelopeBudget.catGoal(category.id)}
budgeted={envelopeBudget.catBudgeted(category.id)}
longGoal={envelopeBudget.catLongGoal(category.id)}
/>
</span>
<Popover
triggerRef={incomeMenuTriggerRef}
placement="bottom end"
isOpen={incomeMenuOpen}
onOpenChange={() => setIncomeMenuOpen(false)}
style={{ margin: 1 }}
isNonModal
{...incomePosition}
>
<IncomeMenu
categoryId={category.id}
month={month}
onBudgetAction={onBudgetAction}
onShowActivity={onShowActivity}
onClose={() => setIncomeMenuOpen(false)}
/>
</Popover>
</View>
</Field>
</View>
);

View File

@@ -10,7 +10,7 @@ import { View } from '@actual-app/components/view';
import { evalArithmetic } from 'loot-core/shared/arithmetic';
import { integerToCurrency, amountToInteger } from 'loot-core/shared/util';
import { useSheetValue } from '@desktop-client/components/spreadsheet/useSheetValue';
import { useSheetValue } from '@desktop-client/hooks/useSheetValue';
type HoldMenuProps = {
onSubmit: (amount: number) => void;

View File

@@ -0,0 +1,64 @@
import { useTranslation } from 'react-i18next';
import { Menu } from '@actual-app/components/menu';
import { type CategoryEntity } from 'loot-core/types/models';
import { useEnvelopeSheetValue } from './EnvelopeBudgetComponents';
import { envelopeBudget } from '@desktop-client/spreadsheet/bindings';
type IncomeMenuProps = {
categoryId: string;
month: string;
onBudgetAction: (month: string, action: string, arg?: unknown) => void;
onShowActivity: (id: CategoryEntity['id'], month: string) => void;
onClose?: () => void;
};
export function IncomeMenu({
categoryId,
month,
onBudgetAction,
onShowActivity,
onClose = () => {},
}: IncomeMenuProps) {
const { t } = useTranslation();
const carryover = useEnvelopeSheetValue(
envelopeBudget.catCarryover(categoryId),
);
return (
<span>
<Menu
onMenuSelect={name => {
switch (name) {
case 'view':
onShowActivity(categoryId, month);
break;
case 'carryover':
if (!carryover) onBudgetAction(month, 'reset-hold');
onBudgetAction(month, 'carryover', {
category: categoryId,
flag: !carryover,
});
onClose();
break;
default:
throw new Error(`Unrecognized menu option: ${name}`);
}
}}
items={[
{
name: 'carryover',
text: carryover ? t('Disable auto hold') : t('Enable auto hold'),
},
{
name: 'view',
text: t('View transactions'),
},
]}
/>
</span>
);
}

View File

@@ -21,8 +21,8 @@ import { TotalsList } from './TotalsList';
import { useEnvelopeBudget } from '@desktop-client/components/budget/envelope/EnvelopeBudgetContext';
import { NotesButton } from '@desktop-client/components/NotesButton';
import { NamespaceContext } from '@desktop-client/components/spreadsheet/NamespaceContext';
import { useLocale } from '@desktop-client/hooks/useLocale';
import { SheetNameProvider } from '@desktop-client/hooks/useSheetName';
import { useUndo } from '@desktop-client/hooks/useUndo';
type BudgetSummaryProps = {
@@ -88,7 +88,7 @@ export const BudgetSummary = memo(({ month }: BudgetSummaryProps) => {
},
}}
>
<NamespaceContext.Provider value={monthUtils.sheetForMonth(month)}>
<SheetNameProvider name={monthUtils.sheetForMonth(month)}>
<View
style={{
padding: '0 13px',
@@ -287,7 +287,7 @@ export const BudgetSummary = memo(({ month }: BudgetSummaryProps) => {
</View>
</>
)}
</NamespaceContext.Provider>
</SheetNameProvider>
</View>
);
});

View File

@@ -16,7 +16,7 @@ import { useEnvelopeSheetValue } from '@desktop-client/components/budget/envelop
import { HoldMenu } from '@desktop-client/components/budget/envelope/HoldMenu';
import { TransferMenu } from '@desktop-client/components/budget/envelope/TransferMenu';
import { useContextMenu } from '@desktop-client/hooks/useContextMenu';
import { envelopeBudget } from '@desktop-client/queries/queries';
import { envelopeBudget } from '@desktop-client/spreadsheet/bindings';
type ToBudgetProps = {
month: string;
@@ -102,6 +102,8 @@ export function ToBudget({
onBudgetAction(month, 'reset-hold');
setMenuOpen(false);
}}
month={month}
onBudgetAction={onBudgetAction}
/>
)}
{menuStep === 'buffer' && (

View File

@@ -15,8 +15,8 @@ import {
useEnvelopeSheetValue,
} from '@desktop-client/components/budget/envelope/EnvelopeBudgetComponents';
import { PrivacyFilter } from '@desktop-client/components/PrivacyFilter';
import { useFormat } from '@desktop-client/components/spreadsheet/useFormat';
import { envelopeBudget } from '@desktop-client/queries/queries';
import { useFormat } from '@desktop-client/hooks/useFormat';
import { envelopeBudget } from '@desktop-client/spreadsheet/bindings';
type ToBudgetAmountProps = {
prevMonthName: string;

View File

@@ -4,7 +4,7 @@ import { useTranslation } from 'react-i18next';
import { Menu } from '@actual-app/components/menu';
import { useEnvelopeSheetValue } from '@desktop-client/components/budget/envelope/EnvelopeBudgetComponents';
import { envelopeBudget } from '@desktop-client/queries/queries';
import { envelopeBudget } from '@desktop-client/spreadsheet/bindings';
type ToBudgetMenuProps = Omit<
ComponentPropsWithoutRef<typeof Menu>,
@@ -14,18 +14,26 @@ type ToBudgetMenuProps = Omit<
onCover: () => void;
onHoldBuffer: () => void;
onResetHoldBuffer: () => void;
onBudgetAction?: (month: string, action: string, arg?: unknown) => void;
month: string;
};
export function ToBudgetMenu({
onTransfer,
onCover,
onHoldBuffer,
onResetHoldBuffer,
onBudgetAction,
month,
...props
}: ToBudgetMenuProps) {
const { t } = useTranslation();
const toBudget = useEnvelopeSheetValue(envelopeBudget.toBudget) ?? 0;
const forNextMonth = useEnvelopeSheetValue(envelopeBudget.forNextMonth) ?? 0;
const manualBuffered =
useEnvelopeSheetValue(envelopeBudget.manualBuffered) ?? 0;
const autoBuffered = useEnvelopeSheetValue(envelopeBudget.autoBuffered) ?? 0;
const items = [
...(toBudget > 0
? [
@@ -33,6 +41,10 @@ export function ToBudgetMenu({
name: 'transfer',
text: t('Move to a category'),
},
]
: []),
...(autoBuffered === 0
? [
{
name: 'buffer',
text: t('Hold for next month'),
@@ -47,7 +59,15 @@ export function ToBudgetMenu({
},
]
: []),
...(forNextMonth > 0
...(forNextMonth > 0 && manualBuffered === 0
? [
{
name: 'disable-auto-buffer',
text: t('Disable current auto hold'),
},
]
: []),
...(forNextMonth > 0 && manualBuffered !== 0
? [
{
name: 'reset-buffer',
@@ -70,10 +90,14 @@ export function ToBudgetMenu({
break;
case 'buffer':
onHoldBuffer?.();
onBudgetAction?.(month, 'reset-income-carryover', {});
break;
case 'reset-buffer':
onResetHoldBuffer?.();
break;
case 'disable-auto-buffer':
onBudgetAction?.(month, 'reset-income-carryover', {});
break;
default:
throw new Error(`Unrecognized menu option: ${name}`);
}

View File

@@ -9,8 +9,8 @@ import { View } from '@actual-app/components/view';
import { EnvelopeCellValue } from '@desktop-client/components/budget/envelope/EnvelopeBudgetComponents';
import { CellValueText } from '@desktop-client/components/spreadsheet/CellValue';
import { useFormat } from '@desktop-client/components/spreadsheet/useFormat';
import { envelopeBudget } from '@desktop-client/queries/queries';
import { useFormat } from '@desktop-client/hooks/useFormat';
import { envelopeBudget } from '@desktop-client/spreadsheet/bindings';
type TotalsListProps = {
prevMonthName: string;

View File

@@ -3,11 +3,11 @@ import { useCallback, useMemo, useReducer, useState } from 'react';
import { Stack } from '@actual-app/components/stack';
import { type CSSProperties } from '@actual-app/components/styles';
import { type Template } from 'loot-core/server/budget/types/templates';
import {
type CategoryGroupEntity,
type ScheduleEntity,
} from 'loot-core/types/models';
import { type Template } from 'loot-core/types/models/templates';
import { type Action } from './actions';
import { BudgetAutomationEditor } from './BudgetAutomationEditor';

Some files were not shown because too many files have changed in this diff Show More