feat: add work regimes and view pay by any period - #11
Merged
Conversation
Adds the domain rules behind #6. `calculateSocialSecurity` now takes a regime. CLT and Empregado Público are both RGPS contributors, so they share the existing four brackets and its 8.475,55 ceiling. Estatutário follows the federal RPPS ladder from Anexo III of Portaria Interministerial MPS/MF nº 13 de 09/01/2026 — which continues the RGPS brackets rather than replacing them, adding 14,5% / 16,5% / 19% / 22% and no cap. Expressing it as the general table plus four tiers keeps a single progressive implementation instead of two tables that could drift. The two regimes are therefore identical up to 8.475,55 and only diverge above it: at a 20.000,00 salary CLT contributes the capped 988,09 while Estatutário contributes 2.768,85. `calculateIncomeTax` now accepts a dependent count at 189,59 each, competing with the 607,20 simplified deduction — larger wins, as the Receita computes it. Worth noting the interaction: above the 5.000,00 exemption the contribution alone is already at least 501,51, so a single declared dependent always tips the comparison to the legal deduction. `lib/salary-period.ts` converts a monthly amount to any period, deriving the hourly rate from the monthly workload and the day from a configurable daily journey. A year is thirteen paid months, counting the 13th salary. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Closes#6. The calculator gains a regime selector (CLT, Empregado Público, Estatutário), a dependent count in the taxes panel, a daily journey field, and a period selector on the headline card covering hour, day, week, month and year. Everything persists alongside the existing preferences, and a stored value that is not a known regime or period falls back to the default rather than being trusted. The period selector is a real radio group rather than a row of buttons, so grouping, the checked state and arrow-key navigation come from the platform instead of being reimplemented. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The latest updates on your projects. Learn more about Vercel for GitHub.
|
codecov-commenter
commented
Aug 1, 2026
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
devRMA
marked this pull request as ready for review
August 1, 2026 21:45
Uh oh!
There was an error while loading. Please reload this page.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for freeto join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes#6.
Both requests from the issue: a work regime field, and viewing pay by any period.
Work regime
The issue notes each regime has different deduction rules. Concretely, the difference is which social security table applies — the income tax treatment is identical across all three.
CLT and Empregado Público are both RGPS contributors, so they genuinely share one table. Estatutário follows the federal RPPS ladder from Anexo III of Portaria Interministerial MPS/MF nº 13 de 09/01/2026, which continues the RGPS brackets rather than replacing them:
Expressing it as the general table plus four tiers keeps a single progressive implementation, so the two can never drift apart in the shared range.
The practical consequence: the regimes are identical up to 8.475,55 and only diverge above it. At a 20.000,00 salary CLT contributes the capped 988,09 while Estatutário contributes 2.768,85.
Dependents
The income tax had no dependent field. Each one now deducts 189,59, competing with the 607,20 simplified deduction — larger wins, as the Receita computes it.
One interaction worth knowing: above the 5.000,00 exemption the contribution alone is already at least 501,51, so a single declared dependent always tips the comparison to the legal deduction. The simplified deduction only wins with zero dependents, between 5.000 and roughly 5.755.
Viewing by period
The headline card gains a period selector. Everything derives from the monthly net, the monthly workload and a new configurable daily journey:
A year counts thirteen paid months, including the 13th salary — that answers "what do I make in a year" rather than a literal ×12.
Notes for review
The period selector is a real radio group rather than a row of buttons, so grouping, the checked state and arrow-key navigation come from the platform instead of being reimplemented.
Every new preference persists alongside the existing ones, and a stored value that is not a known regime or period falls back to the default rather than being trusted — the same treatment #9 gave the other stored values.