A comprehensive guide to the React application's structure and components.
- How to run the app locally
- Folder Structure
- Components & Main Files Overview
- Utilities & Configurations
- Redux Architecture
- Service Layer
- Further Steps
- Disclaimer
- clone the repository
- npm install
- npm start
src/
|-- components/
| |-- DataTable/
| |-- Layout/
| |-- Footer/
| |-- Header/
| | modals/
| |-- LoginForm/
| |-- CustomModal/
| | utilities/
| |-- PieChart/
| |-- SkeletonLoader/
| |-- Pagination/
| |-- PieChart/
| |-- CharacterPopUpInfo/
| |-- Table/
| |-- TableHead/
| |-- TableBody/
| |-- TableRow/
|-- conf/ | -- characterTableData.ts
|-- store/
| |-- actions/
| |-- reducers/
|-- services/ | -- disneyService.ts
|-- utils/
| |-- debounce.ts
| |-- sorting.ts
- Description: Entry point of the React application. App wrapped in Provider for Redux store access.
- Dependencies: Bootstrap, FontAwesome, React, ReactDOM, Redux store.
- Description: Main layout of the application.
- Dependencies: CSS styling from 'App.css'.
- Components:
- Layout: Wrapper component that includes header and footer.
- DataTable: Main content component.
- Description: Wraps the main content with a header and footer.
- Components:
- Header: Top navigation and branding.
- Footer: Bottom navigation and branding.
- Description: Contains main navigation, disclaimer, login button.
- Features: Navigation toggle, Disclaimer text, Login Modal.
- Description: Displays logo, links, social media icons, copyright note.
- Description: Modal form for user login.
- Dependencies: Material-UI, Formik.
- Features: Modal can open/close, Login & Cancel actions.
-
Description: Fetches and displays character data.
-
Components and Utilities:
-
Table: A generic table container.
-
TableHead: Represents the header allowing sorting of columns.
-
TableBody: Contains rows of characters' data.
-
TableRow: A single row displaying character details.
-
Pagination: Controls for page size and navigation.
-
PieChart: Visual representation of character film participation.
-
SkeletonLoader: Displays placeholder rows while data is fetched.
-
Character PopUp: Presents a modal with detailed information about a selected character, including their image and appearances.
-
Features:
-
Filtering:
- Search by Name: Allows users to filter the table's data based on character names.
- Search by TV Show: Permits filtering of characters based on the TV shows they appeared in.
-
Sorting:
- The table offers dynamic multi-level sorting using the
multiLevelSort
utility. - Users can click on column headers to toggle the sorting direction for that particular column.
- The table offers dynamic multi-level sorting using the
-
State Management (Redux):
- Action:
fetchCharacters
- Reducer: State shape managed under
state.characters
- Action:
-
Filtering Utilities and Configurations
- Sorting:
multiLevelSort
,SortedByState
- Debounce:
debounce
- Configuration:
disneyCharacterColumns
- Sorting:
-
Styling: Uses a dedicated CSS file:
DataTable.css
. -
How to Use: How to Use
- Filtering:
- Type in the
Search by Name
orSearch by TV Show
input fields to filter the table data. - Filtering is debounced, meaning the API call to fetch filtered data will be made a short while after the user stops typing to ensure optimal performance.
- Type in the
- Sorting:
- Click on the column headers to sort the data based on that column.
- The sorting direction (ascending/descending) toggles with each click.
- View Character Details:
- Click on a table row to view detailed information about the selected character in a popup modal.
- View Pie Chart:
- Click the
Show Pie Chart
button to open a modal displaying a pie chart of the characters based on their TV show appearances.
- Click the
- Pagination:
- Use the pagination controls below the table to navigate between pages or adjust the number of rows displayed per page.
- Refine Filtering:
- Remove debouncers and handle input changes in a more optimal way.
- Implement a filtering procedure similar to how
sortingModel
works in the app.
- Filtering:
-
-
- Description: Specifies how each column in the data table should be presented and functioned.
- Description: Debounces a function to avoid excessive calls.
- Usage: Useful during window resize or input change.
- Description: Utilities for sorting.
- Features: Allows multi-level sorting based on multiple criteria.
- store.js: Redux store configuration.
- reducers/characterReducer.js: Reducer for character actions.
- reducers/index.js: Combines all reducers.
- actions/characterActions.js: Action creators for character-related actions.
DisneyService:
- Description: API service to fetch character data from Disney.
- Features: Constructs API URL based on parameters for flexible requests.
- Error Handling: Handle various types of errors distinctly.
- Unit Tests: Write tests for actions, reducers, services.
- Redux Toolkit: Simplify boilerplate.
- Refine Filtering:
- Remove debouncers and handle input changes in a more optimal way.
- Implement a filtering procedure similar to how
sortingModel
works in the app.
The logos and trademarks used in this technical assignment belong to their respective owners
I do not claim ownership or any rights to these logos.
They have been used solely for the purpose of this assignment.