Draft
refactor: enforce highest coding standards across th4dev source#2
Conversation
Co-authored-by: ak4dev <92195328+ak4dev@users.noreply.github.com>
Co-authored-by: ak4dev <92195328+ak4dev@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Refactor code for improved standards and functionality
refactor: enforce highest coding standards across th4dev source
Mar 14, 2026
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 free
to 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.
Full audit and cleanup of the codebase — remove dead code, fix two silent bugs, and replace every magic number and repeated inline style with named abstractions.
Dead code removed
src/index.tsx— orphaned second entry point (index.htmlalways bootsmain.tsx)src/global.ts— duplicateglobalStyles; canonical version is institches.config.tssrc/App.css/src/index.css— leftover Vite scaffold, never importedsrc/components/ThemePopover.tsx/sidebar/theme-button.tsx— unused alternative theme UIs, never importedBugs fixed
State key mismatch (
App.tsx): defaultslidersinitialisedyearlyInflationA/yearlyInflationB, but the component exclusively reads/writesyearlyInflation. The inflation slider silently fell back to the hard-coded2.5on every load, and the value was dropped on state export/import.Invalid active-state style (
ThemeSwitcher.tsx): active theme button usedstyle={{ backgroundColor: "$purple" }}— Stitches token strings are not valid CSS and the browser received the literal text$purple. Replaced with a Stitchesactivevariant so the CSS variable is resolved at build time.Code quality
App.tsx: removed redundantglobalStyles()useEffect(already called inmain.tsxbefore first render).main.tsx: modernised to{ StrictMode }named import.InvestmentCalculatorModern.tsx:30,100,5000,10000,10) and default fallbacks (10,30,2.5) replaced with named constants fromapp-constants.getGrowthMatrix()calls that ran beforecalculateGrowth()populated the matrix.style={{ display:"flex", gap:"12px", alignItems:"center" }}inline objects extracted into aSwitchRowstyled component.investmentToRolloff-state andsetYearContributionsStopfallback use explicit0rather thanMIN_VALUE— the zero here carries semantic meaning ("no rollover" / "never stop contributions"), not a slider constraint.date-amount-table.tsx: replaced unstable array-indexkey={idx}with stablekey={year}.Original prompt
Created from VS Code.
📱 Kick off Copilot coding agent tasks wherever you are with GitHub Mobile, available on iOS and Android.