Skip to content

Dav-C/bgg-library

Repository files navigation

Board Game Library

What is this?

A fun way to view a user's public board game library as provided by Board Game Geek


Getting Started


Install dependencies

npm install

Start the development server

npm dev start

Open a browser and view the site

http://localhost:3000

Using the App

To load a user's library simply enter a valid Board Game Geek username into the form on the mane page and click the Load Library button.

BGG will cache the request for processing and return status 202 until the request has been processed. UseFetchControl.js will make 4 attempts to load a user's library before timing out and presenting a message asking the user to wait for a short period before trying another request. Most user's libraries will load within the 4 request limit, but some larger libraries may take longer.

As soon as UseFetchControl.js receives a 200 status response, the XML returned by BGG is parsed and loaded into userDataSlice.js. appStateSlice.js, formStatusSlice.js and userDataSlice.jsare used to distribute data to the various components as needed.

Unfortunately error responses from the BGG API do not support CORS, so all errors are assumed to be due to an invalid username(the most common scenario).

Once a library has been loaded the results can be filtered by using switches in the sidebar menu. Data does not persist through refreshes. Any page refreshes will result in the app returning to its default state and the username input form will again be presented.

Clicking on a game image will open a modal with additional details about the game.


Testing

All tests are run through Cypress. To run the tests, start the development server and run cypress run.

Alternatively, you can interact with the cypress GUI with cypress open

Once the tests have completed the coverage report can be viewed by opening overage/lcov-report/index.html in a browser.