Conversation
ui/src/App.js
Outdated
| import Dashboard from './Components/Dashboard/Dashboard'; | ||
| import Filters from './Components/Filters/Filters'; | ||
| import Search from './Components/Search/Search'; | ||
| import { useFilterContext } from './Context/filter_context'; |
There was a problem hiding this comment.
The naming convention of the filter_context is not as per the pattern of the project. Please use the Pascal case
There was a problem hiding this comment.
Renamed filter_context to FilterContext
ui/src/Context/filter_context.js
Outdated
| @@ -0,0 +1,60 @@ | |||
| import { createContext, useContext, useEffect, useReducer } from 'react'; | |||
| import { FEATURE_FLAGS, FEATURE_FLAGS_HEADERS } from '../Mock/featureFlags'; | |||
| import { filterReducer } from '../reducers/filter_reducer'; | |||
There was a problem hiding this comment.
The naming convention of the filter_reducers and reducers is not as per the pattern of the project. Please use the Pascal case
There was a problem hiding this comment.
Converted file name to Pascal case
ui/src/reducers/filter_reducer.js
Outdated
| CLEAR_FILTER, | ||
| LOADING, | ||
| FILTER_LIST, | ||
| } from '../actions/actions'; |
There was a problem hiding this comment.
The naming convention of the action folder is not as per the pattern of the project. Please use the Pascal case
There was a problem hiding this comment.
Converted filename to pascal case
ui/src/Components/Search/Search.js
Outdated
| name='userInput' | ||
| value={userInput} | ||
| onChange={handleInputChange} | ||
| placeholder='Search issues by Name, Createdby, Repository...' |
There was a problem hiding this comment.
This should come from the constant file
There was a problem hiding this comment.
Added CONST file for placeholder
ui/src/Components/Search/Search.js
Outdated
| @@ -0,0 +1,47 @@ | |||
| import { useState, useCallback } from 'react'; | |||
There was a problem hiding this comment.
We are not using useState, and useCallback in the component. Please remove it
ui/src/Components/Filters/Filters.js
Outdated
|
|
||
| export default function Filters() { | ||
| const { | ||
| filterByEnabled, |
There was a problem hiding this comment.
filterByEnabled is not getting used in this component please remove it.
ui/src/Components/Filters/Filters.js
Outdated
| name='status' | ||
| onChange={handleValueChange} | ||
| > | ||
| <option value='all'>Both</option> |
| import Filters from './Components/Filters/Filters'; | ||
| import Search from './Components/Search/Search'; | ||
| import { useFilterContext } from './Context/filter_context'; | ||
| import { FEATURE_FLAGS, FEATURE_FLAGS_HEADERS } from './Mock/featureFlags'; |
There was a problem hiding this comment.
Not getting used in the component. Please remove
ui/src/App.js
Outdated
|
|
||
| if (isLoading) { | ||
| // We can add spinner here - TODO | ||
| return <div>Loading...</div>; |
There was a problem hiding this comment.
This is not accessible content. We should :
- Use text tag eg: heading, P, span
- We might need to put the focus of the tab on loading text later (it will be decided how our screen is coming). For now, just do point 1
| @@ -0,0 +1,5 @@ | |||
| export const UPDATE_FILTERS = 'UPDATE_FILTERS'; | |||
There was a problem hiding this comment.
The naming convention of this file should be filters.action.js
ui/src/Components/Filters/Filters.js
Outdated
| name='status' | ||
| onChange={handleValueChange} | ||
| > | ||
| <option value='all'>Both</option> |
| /> | ||
| <main className='flex flex-col items-center'> | ||
| <section className='flex justify-center items-center '> | ||
| <Search /> |
ui/src/Context/filter_context.js
Outdated
| dispatch({ type: UPDATE_FILTERS, payload: { name, value } }); | ||
| } | ||
|
|
||
| function clearFilter() { |
There was a problem hiding this comment.
Are we removing only 1 filter at a time? If no, then the name should be clearFilters
ui/src/reducers/filter_reducer.js
Outdated
| } | ||
| if (status !== 'all') { | ||
| tempList = tempList.filter((value) => String(value.enabled) === status); | ||
| console.log(tempList, 'status', status); |
ui/src/Components/Search/Search.js
Outdated
| placeholder-opacity-25 | ||
| ' | ||
| name='userInput' | ||
| value={userInput} |
There was a problem hiding this comment.
please rename it to a self-explanatory name such as: searchValue or userSearchInput
ui/src/Components/Filters/Filters.js
Outdated
| updateFilters, | ||
| } = useFilterContext(); | ||
|
|
||
| const handleValueChange = (event) => { |
There was a problem hiding this comment.
the name should be consistent with the rest of the event handlers. Instead of handleValueChange use onValueChange or something more align to the event happening.
ui/src/Components/Filters/Filters.js
Outdated
| ease-in-out | ||
| m-0 | ||
| focus:text-gray-700 focus:bg-white focus:border-blue-600 focus:outline-none' | ||
| aria-label='.form-select-sm example' |
There was a problem hiding this comment.
aria-label is not correct here. Aria-label should be the label content
There was a problem hiding this comment.
aria-label been removed as we are not using label.
ui/src/Components/Filters/Filters.js
Outdated
| m-0 | ||
| focus:text-gray-700 focus:bg-white focus:border-blue-600 focus:outline-none' | ||
| aria-label='.form-select-sm example' | ||
| value={status} |
There was a problem hiding this comment.
The status is not implying the use/information about what information it would be holding. Please rename it
ui/src/Components/Filters/Filters.js
Outdated
| focus:text-gray-700 focus:bg-white focus:border-blue-600 focus:outline-none' | ||
| aria-label='.form-select-sm example' | ||
| value={status} | ||
| name='status' |
There was a problem hiding this comment.
The status is not implying the use/information about what information it would be holding. Please rename it
There was a problem hiding this comment.
renamed to featureStatus as per suggestion
ui/src/App.js
Outdated
| <Search /> | ||
| <Filters /> | ||
| </section> | ||
| <button |
There was a problem hiding this comment.
button should be wrapped within the section of Filters and Search
ui/src/Components/Filters/Filters.js
Outdated
| }; | ||
|
|
||
| return ( | ||
| <div className='mb-2 xl:w-96'> |
There was a problem hiding this comment.
use section tag instead of div for:
- consistency
- we use section for the section partition
ui/src/App.js
Outdated
| import { FEATURE_FLAGS, FEATURE_FLAGS_HEADERS } from './Mock/featureFlags'; | ||
|
|
||
| function App() { | ||
| const { filteredList, isLoading, featureFlagHeader, clearFilter } = |
There was a problem hiding this comment.
Should isLoading be a part of FilterContext?
There was a problem hiding this comment.
It should be part of context where we are calling API
DeRaowl
left a comment
There was a problem hiding this comment.
Addressed all the review comments
| /> | ||
| <main className='flex flex-col items-center'> | ||
| <section className='flex justify-center items-center '> | ||
| <Search /> |
ui/src/Components/Filters/Filters.js
Outdated
| name='status' | ||
| onChange={handleValueChange} | ||
| > | ||
| <option value='all'>Both</option> |
ui/src/reducers/FilterReducer.js
Outdated
| value.createdBy | ||
| .toLowerCase() | ||
| .includes(userSearchInput.toLowerCase()) || | ||
| value.featureFlag | ||
| .toLowerCase() | ||
| .includes(userSearchInput.toLowerCase()) || | ||
| value.repository | ||
| .toLowerCase() | ||
| .includes(userSearchInput.toLowerCase()) |
There was a problem hiding this comment.
Is it good to create a function for the same?
There was a problem hiding this comment.
Is it better to be present in util file? A function which could be used for search
| .includes(userSearchInput.toLowerCase()) | ||
| ); | ||
| } | ||
| if (featureStatus !== 'all') { |
There was a problem hiding this comment.
Should 'all' be added to constants?
|
Good PR @DeRaowl , well written context, reducer |
| name='featureStatus' | ||
| onChange={onValueChange} | ||
| > | ||
| {FEATURE_STATUS.map((status, idx) => { |




Description
Fixes #32
Type of change
Please delete options that are not relevant.
How Has This Been Tested?
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration
Test Configuration:
Checklist: