This is a simple campaign manager, implemented with React, Next.js, Typescript and other helpful packages as part of a coding challenge. Visit Live Site Here.
The application should be a simple page with the following elements:
- A list of Campaign which shows
- The Name
- The startDate
- The endDate
- A flag to state if the Campaign is active (a campaign is running when the current date is inside the start-end date range)
- The Budget (in USD dollar)
- A Search Form before the list in order to filter the list by Campaign Name
- A DateRange component that filters the list of campaigns based on a Start and End Date.
- If the campaign has a startDate that is contained in the range, it should show
- If the campaign has an endDate that is contained in the range, it should show.
- You should not be able to select an end-date that is before the start-date.
- If the endDate is before the start Date, the campaign should not show.
Also, The candidate will expose a global method called 'AddCampaigns' that takes an array of Campaigns and will render them. This function will be invoked from the browser’s JavaScript console for testing purposes. If it cannot be invoked, the submission will be rejected. The method is allowed to be called multiple times. If so, the new campaigns will append to the existing list. Example of campaign array that can be passed:
;[
{
id: 1,
name: 'Divavu',
startDate: '9/19/2017',
endDate: '3/9/2018',
Budget: 88377,
},
{
id: 2,
name: 'Jaxspan',
startDate: '11/21/2017',
endDate: '2/21/2018',
Budget: 608715,
},
]
- Typescript
- Uses modern ES6-ES7 syntax
- React for UI
- React Hooks for state management
- Next.js for Server Side Rendering, Fast loading, Automatic code Splitting, Styling with JS.
- Clean, tidy and well commented code
- Snapshot Testing with Jest
- Easily deployable
- Linted with Prettier, Eslint, Tslint, etc.
- React.js
- Next.js
- Typescript
- Semantic UI
- Numbro
- Date-fns
- React Dates (by Airbnb)
- Prettier
- Eslint
Follow these steps to run the web app on your local machine
- Open up your terminal and type:
git clone https://github.com/nfuad/campaign-manager.git
- Then enter into the cloned repo from the terminal using:
cd campaign-manager
(assuming the directory name wasn't changed while cloning) - Then type:
yarn
to install all the dependencies - When the installation is complete, type:
yarn dev
- The web app will open up on the default browser
OR, Run with Docker.
yarn dev
- To start the local development environmentyarn build
- To build for production usingnext build
commandyarn start
- To start in production mode usingnext start
yarn test
- To test using jest.
Check out the live demo here: https://campaign-manager.now.sh
If you found any bug and want to report it, you can definitely open a new issue here.