Приложение написано на React с использованием Redux архитектуры (что конечно излишне для такого небольшого приложения, но для примера моего кода сойдет).
Приложение адаптировано для мобильных устройств.
Иерархия компонентов:
<App> - приложение, в нем все собрано и обернуто в <Provider>
<Header>
<GuessMap> - карта с передвигаемым маркером, на leaflet.js + react-leaflet
<GuessGame> - fixed контейнер с игровой информацией
- Страна, выбранная маркером, находится через GET запрос (параметры: ширина и долгота игрового маркера) к Nominatim API и сверяется с правильным ответом в
src/shared/flags.json
This React app is mobile-friendly.
I used Redux architecture as part of my learning experience and since the app is here mainly to show how I write code I left it.
The component hierarchy:
<App> - container, where everything is put together and wrapped in Redux <Provider>
<Header>
<GuessMap> - the map with a draggable marker, done using leaflet.js + react-leaflet
<GuessGame> - fixed container with game info
- The chosen country is identified using a HTTP GET request (the query parameters are the marker's latitude and longitude) to Nominatim API and the answer is then compared to the correct answers in
src/shared/flags.json