Setup in project directory:
nvm use 16.13.2
- Use Node.js 16.13.2 (anything on the v16.x line should be good as well)yarn install
- install dependenciesyarn start
- Page will be available atlocalhost:3000
Design decisions:
- I've opted to not use an external state management library, to not over-complicate the state management. For the purposes of this task
useState
andcontext
was enough. - For the table that displays the list of children, I've used
react-window
to create a virtualized table, instead of dumping all line entries into the DOM. - Network calls use
fetch
instead ofaxios
or similar libraries. It has wide enough browser support, and if needed, for older browsers a polyfill can be loaded conditionally. There is also a wrapper for it, to handle app-specific requirements, like adding the access token to the request. - To simulate pagination on the children list, the
getChildren
method loads the full list of children first, then returns a slice of the whole list based on page number on subsequent calls. - The checkout and checkin of children is handled on the actual row associated with the child. This is done this way to allow for individual loading and error states for each row, as well as individual settings for the requests (like the
pickupTime
on the checkin call). - State updates are propagated up from the table rows via context, to keep the local list of children updated, as well as displaying errors. Context was used here instead of prop drilling, so the row component can be mostly de-coupled from the table (of course
react-window
has some expectations about it's rows props, but thats communicated via an interface)
Give us a chance to see your beautiful code! 🤩
How to get started:
- Fork this repository
- Create a small application in React (or another agreed upon framework)
- Describe your design decisions and setup instructions in the README.md of the forked repository
You are tasked to build a simple application for a nursery to manage the attendance of children each day.
The application should be able to do 3 things:
- List children with some form of pagination/lazy-loading/infinite-scroll
- Checkin a child
- Checkout a child
There are no other requirements than that—don't worry about design or anything like that.
If you have any questions feel free to reach out to [email protected] (Christian) or [email protected] (Adam)
You will receive an access token in an email during the recruiment process.
The API does not support any limit or offset, so the pagination/lazy-loading/infinite-scroll will have to be done client-side only.
GET https://app.famly.co/api/daycare/tablet/group
Arguments: {
accessToken: <accessToken>,
groupId: '86413ecf-01a1-44da-ba73-1aeda212a196',
institutionId: 'dc4bd858-9e9c-4df7-9386-0d91e42280eb'
}
Example in cURL:
curl "https://app.famly.co/api/daycare/tablet/group?accessToken=<accessToken>&groupId=86413ecf-01a1-44da-ba73-1aeda212a196&institutionId=dc4bd858-9e9c-4df7-9386-0d91e42280eb"
POST https://app.famly.co/api/v2/children/<childId>/checkins
Arguments: {
accessToken: <accessToken>
pickupTime: 16:00
}
Example in cURL:
curl \
-d 'accessToken=<accessToken>&pickupTime=16:00' \
https://app.famly.co/api/v2/children/fcd683d0-bc31-468c-948f-1ca70b91439d/checkins
POST https://app.famly.co/api/v2/children/<childId>/checkout
Arguments: {
accessToken: <accessToken>
}
Example in cURL:
curl \
-d 'accessToken=<accessToken>' \
https://app.famly.co/api/v2/children/fcd683d0-bc31-468c-948f-1ca70b91439d/checkout