Open
Conversation
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.
Vytvořil jsem
.envsoubor a ten přidal do.gitignore. Přesunul jsem do něj API klíč, protože by neměl být veřejně viditelný.Vytáhnul jsem fetchovací logiku na počasí do single hooku, kvůli porušení single responsibility principle a lepší testovatelnosti.
Přidal jsem podporu pro zobrazení loading skeletonu a chyb při fetchování dat pro lepší UX.
Zrefaktoroval jsem WeatherCard a rozdělil na menší komponenty pro lepší přehlednost a testovatelnost. Podrobnější informace o počasí jdou nyní přes jednu společnou komponentu - redukce 4 téměř duplicitních bloků.
Upravil jsem adresářovou strukturu pro lepší přehlednost - components, hooks, types, utils.
Přidal jsem Vitest a RTL balíčky a doplnil ke všemu testy. Hooky testovány izolovaně, komponenty s mockovanými daty. U
useCitiestestuji i integraci s localStorage, včetně fallbacku při corrupted datech.V useWeather jsem přidal city prop do hook dependencies. Při změně city prop by se v původním řešení nenačetla nová data.
Do hooků s fetchem jsem přidal AbortController proti race conditions.
Odstranil jsem zapomenutý console.log, který by se neměl v produkčním kódu vyskytovat.
Funkci formatTime jsem rozšířil o podporu časových zón (timezone offset z API response), aby uživatel viděl místní časy.
Jako vlastní feature jsem přidal search bar s autocomplete podporou.