-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
keyword search for quantifiers & Quantify multiple praise #499
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome this looks great!
I requested some changes inline.
Also a few additional I'd like to request:
- After dismissal, quantifying multiple, or marking duplicates, the "Select All" checkbox itself is unchecked
- Write tests for the new quantifyMultiple controller (you can do this in another PR -- you'll mostly copy the praise controller tests from pr Test: additional api tests #479)
|
||
const allowedValues = usePeriodSettingValueRealized( | ||
periodId, | ||
'PRAISE_QUANTIFY_ALLOWED_VALUES' | ||
) as number[]; | ||
|
||
const applyFilter = React.useCallback( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we rename this function to be a bit semantically clearer? Maybe filterBySearchValue
or something?
if (!searchValue) return data; | ||
|
||
const filteredData = data.filter((praise: PraiseDto) => { | ||
return praise.reasonRealized.includes(searchValue); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you think we should filter by both reasonRealized and user name?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and which username should we use? receiver's or giver's?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how about both?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yess
if (!searchValue) return data; | ||
|
||
const filteredData = data.filter((praise: PraiseDto) => { | ||
return praise.reasonRealized.includes(searchValue); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we make the search case-insensitive?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yesss
<td colSpan={5}> | ||
<div className="mb-5 border-2 border-t border-warm-gray-400" /> | ||
</td> | ||
</tr> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
} | ||
onClick={onClick} | ||
> | ||
<FontAwesomeIcon icon={faPrayingHands} size="1x" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you think about using the "unbalanced scale" icon instead of praying hands? https://fontawesome.com/search?q=scale%20unbalanced&s=solid%2Cbrands%2Cregular
packages/frontend/src/pages/QuantifyPeriodReceiver/components/QuantifyMultipleDialog.tsx
Outdated
Show resolved
Hide resolved
@@ -109,7 +109,7 @@ const EventLogsPage = (): JSX.Element => { | |||
</div> | |||
|
|||
{/* Search */} | |||
<div className="w-5/12 mt-5 mb-5 mr-4"> | |||
<div className="w-5/12 mt-5 mb-5 mr-4 h-[42px]"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we use tailwind's built-in sizing classes instead of fixed pixel sizes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We just want to ensure all the inputs are the same height. If that can be achieved without specifying a fixed height, all the better.
@@ -120,7 +120,7 @@ const EventLogsPage = (): JSX.Element => { | |||
</div> | |||
|
|||
{/* Sort */} | |||
<div className="w-2/12 mt-5 mb-5 ml-auto mr-5"> | |||
<div className="w-2/12 mt-5 mb-5 ml-auto mr-5 h-[42px]"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as above
@@ -25,7 +27,7 @@ const SearchInput = ({ | |||
className="block pl-8 bg-transparent border-none outline-none focus:ring-0" | |||
name="search" | |||
type="text" | |||
placeholder="Search" | |||
placeholder={placeholder} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
@@ -201,3 +202,49 @@ export const quantify = async ( | |||
const response = await praiseDocumentListTransformer(affectedPraises); | |||
res.status(200).json(response); | |||
}; | |||
|
|||
export const quantifyMultiple = async ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function will need to have same logic used in the quantify
function to determine all the praises with an affected scoreRealized
. It probably makes sense to pull that logic out into a utility function and use it in both controllers.
The reason for that logic is so the "Duplicate Score" display is updated when the original praise's score is updated. See the screencast below:
Kazam_screencast_00003.mp4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function will need to have same logic used in the
quantify
function to determine all the praises with an affectedscoreRealized
. It probably makes sense to pull that logic out into a utility function and use it in both controllers.The reason for that logic is so the "Duplicate Score" display is updated when the original praise's score is updated. See the screencast below:
Kazam_screencast_00003.mp4
☝️☝️ @nebs-dev, this remains to be done.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe it is time to remove the text from the buttons.
- Move "select all" checkbox to inline with buttons
- Hide and show only relevant buttons. No items checked = no buttons visible.
- Use the
praise-button-round
style - Tooltip below buttons describe function
- (see mail.google.com for reference 😄)
- Please note that image below is just wireframe, use exisiting styles and colours.
…modified inputs, changed buttons style
…x merge conflicts
…ommons-stack/praise into enh/quantifiers_keyword_search
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added the IconRoundButton
because I wanted another look than the regular button. And had to make a custom tooltip because the MUI one don't work over well buttons that are disabled.
We can talk the changes through tomorrow if you like?
Merging now.
@@ -201,3 +202,49 @@ export const quantify = async ( | |||
const response = await praiseDocumentListTransformer(affectedPraises); | |||
res.status(200).json(response); | |||
}; | |||
|
|||
export const quantifyMultiple = async ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function will need to have same logic used in the
quantify
function to determine all the praises with an affectedscoreRealized
. It probably makes sense to pull that logic out into a utility function and use it in both controllers.The reason for that logic is so the "Duplicate Score" display is updated when the original praise's score is updated. See the screencast below:
Kazam_screencast_00003.mp4
☝️☝️ @nebs-dev, this remains to be done.
@@ -3,25 +3,26 @@ import { faMinusCircle } from '@fortawesome/free-solid-svg-icons'; | |||
|
|||
interface Props { | |||
disabled?: boolean; | |||
small?: boolean; | |||
onClick(); | |||
} | |||
|
|||
const MarkDismissedButton = ({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd suggest creating a more generic component, similar to IconButton
. IconButtonRound
perhaps?
Resolves #422