Problem
Three issues affect the overall code quality, maintainability, and consistency of the component library.
1. Multiple components have inline magic numbers with no named constants
truncateAddress default values start=6, end=4, PAGE_SIZE=10 in TransactionHistory, pollInterval defaults, and pixel sizes like size * dpr in QRCode are magic numbers scattered through the codebase. Extracting them to named constants (e.g. const DEFAULT_TRUNCATE_START = 6) would make the intent clearer and changes easier.
2. TODO comments in SorobanInvokeButton and main.tsx are tracked as code comments not issues
// TODO: Implement contract invocation and similar comments should not live in source code — they are tracked as GitHub issues. Dead TODO comments that have corresponding open issues should be replaced with // See issue #22 references.
3. Components inconsistently use cn() from @/lib/utils vs raw template literals
Some className concatenations use cn(...) correctly, others use raw template literals like `... ${condition ? 'class-a' : 'class-b'}`. This inconsistency makes it harder to search for class usage and defeats tailwind-merge's deduplication. All conditional class logic should use cn().
Solution
- Extract magic numbers to named constants in their respective files.
- Replace
TODO comments with // See issue #N references to the tracking issue.
- Audit all components and replace raw template literal class concatenation with
cn().
Acceptance Criteria
Note for Contributors: Write a clear PR description. List every file modified and the magic numbers or TODOs replaced. Run grep -r "TODO" src/ before and after to confirm zero remaining TODOs.
Problem
Three issues affect the overall code quality, maintainability, and consistency of the component library.
1. Multiple components have inline magic numbers with no named constants
truncateAddressdefault valuesstart=6, end=4,PAGE_SIZE=10inTransactionHistory,pollIntervaldefaults, and pixel sizes likesize * dprinQRCodeare magic numbers scattered through the codebase. Extracting them to named constants (e.g.const DEFAULT_TRUNCATE_START = 6) would make the intent clearer and changes easier.2.
TODOcomments inSorobanInvokeButtonandmain.tsxare tracked as code comments not issues// TODO: Implement contract invocationand similar comments should not live in source code — they are tracked as GitHub issues. Dead TODO comments that have corresponding open issues should be replaced with// See issue #22references.3. Components inconsistently use
cn()from@/lib/utilsvs raw template literalsSome className concatenations use
cn(...)correctly, others use raw template literals like`... ${condition ? 'class-a' : 'class-b'}`. This inconsistency makes it harder to search for class usage and defeatstailwind-merge's deduplication. All conditional class logic should usecn().Solution
TODOcomments with// See issue #Nreferences to the tracking issue.cn().Acceptance Criteria
TODOcomments — replaced with issue referencescn()from@/lib/utilsnpm run lintpasses with no warningsnpm run buildpasses