I've refactored the existing model by not reading existing code but adding unit tests, as existing code was barely readable. I've written Unit tests for all the business cases which led me to way simpler implementation of Glided Rose class. After writing unit tests I've refactored the code by creating domain methods for updating sell in and quality properties in readable maneur.
Not much time left to acomplish this task that is why I've decided to make it as simple as possible but still with proper practices. But definietly have the list of TODO's for the future which you can find below
- Fix state management by using API that handles domain glided rose model
- Accessibility
- Virtualize list of items so the list is dynamically removed from DOM, it makes the app smoother
- Consider SSR/SSG
- Display more details about Glided Rose Item but it is up to domain
- Add more functionalities e.g adding items to cart, but it is not handled by the domain for now
- Animations in Framer Motion when the quality/sell-in changes
- Handle domain states/different items by UI representation. E.g Quality is red when it is below 0, Sell in gets orange if it reaches end for normal items or so
- Write some tests of user flow
yarn dev