Skip to content

[FE] Ismayil Aghazada (ismayil.aqazade@gmail.com)#264

Open
IsmayilAghazada wants to merge 1 commit into
99techteam:mainfrom
IsmayilAghazada:main
Open

[FE] Ismayil Aghazada (ismayil.aqazade@gmail.com)#264
IsmayilAghazada wants to merge 1 commit into
99techteam:mainfrom
IsmayilAghazada:main

Conversation

@IsmayilAghazada
Copy link
Copy Markdown

@IsmayilAghazada IsmayilAghazada commented May 9, 2026

Problem 1

  • Implemented sum_to_n in three ways: iterative (sum_to_n_a), closed form (n(n+1)/2) (sum_to_n_b), and recursive (sum_to_n_c).
  • Shared input validation: finite integers only; non-numbers, NaN, infinities, and non-integers throw clear TypeError messages; n < 1 returns 0.
  • sum_to_n.test.ts: Vitest coverage for all three implementations (correctness vs naive reference, edge cases, runtime validation, cross-implementation agreement).

Problem 2

  • Vite + React 19 swap form: fetches prices.json, dedupes/sorts price rows, omits tokens without usable data.
  • Chakra UI v3 with a custom createSystem theme (tokens, fonts, swap-specific radii/shadows).
  • React Hook Form for amount validation, loading/error states, flip pay/receive, live output and rate hints via useSwapUI, token icons from the Switcheo token-icons base URL (configurable with VITE_* env vars).
  • Docker: multi-stage build + nginx under src/problem2/docker/; root package.json scripts docker:build:problem2 and docker:run:problem2.
Screenshot 2026-05-10 at 01 55 00

Problem 3

  • Refactor of the “messy React” wallet list: fixes undefined lhsPriority, inverted filter logic for non-positive amounts, any typing, and getPriority recreated every render.
  • walletRowPipeline.ts: pure pipeline (filter eligible rows by chain priority + positive amount, sort, map to view models with formatted amount and USD value) for testability and separation from React.
  • models.ts / consts.ts: typed Blockchain / WalletBalance, priority map at module scope.
  • page.tsx: composes hooks + pipeline with useMemo for row elements; WalletRow.tsx presentational row; stub hooks.ts for balances/prices.
  • README.md in Problem 3 documents issues vs fixes (code review style).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant