Skip to content
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

Merged
merged 11 commits into from
Jun 30, 2022

Conversation

nebs-dev
Copy link
Contributor

Resolves #422

  • Added search by praise reason
  • Added option so quantify multiple praise at once

@nebs-dev nebs-dev requested review from mattyg and kristoferlund June 23, 2022 15:28
@nebs-dev nebs-dev self-assigned this Jun 23, 2022
mattyg
mattyg previously requested changes Jun 26, 2022
Copy link
Collaborator

@mattyg mattyg left a 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(
Copy link
Collaborator

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);
Copy link
Collaborator

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?

Copy link
Contributor Author

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?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how about both?

Copy link
Member

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);
Copy link
Collaborator

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?

Copy link
Member

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>
Copy link
Collaborator

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 moving the 'Select All' checkbox into the "toolbar" area above? That way it will be "sticky" when user scrolls down the page. Also then we could remove this additional border line.

Something like this:
Screenshot_2022-06-26_12-43-46

}
onClick={onClick}
>
<FontAwesomeIcon icon={faPrayingHands} size="1x" />
Copy link
Collaborator

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

@@ -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]">
Copy link
Collaborator

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?

Copy link
Member

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]">
Copy link
Collaborator

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}
Copy link
Collaborator

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 (
Copy link
Collaborator

@mattyg mattyg Jun 26, 2022

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

Copy link
Member

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

☝️☝️ @nebs-dev, this remains to be done.

Copy link
Member

@kristoferlund kristoferlund left a 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.

image

@nebs-dev nebs-dev requested review from mattyg and kristoferlund June 29, 2022 18:19
Copy link
Member

@kristoferlund kristoferlund left a 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 (
Copy link
Member

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

☝️☝️ @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 = ({
Copy link
Member

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?

@kristoferlund kristoferlund merged commit 9a09159 into main Jun 30, 2022
@kristoferlund kristoferlund deleted the enh/quantifiers_keyword_search branch June 30, 2022 16:00
@kristoferlund kristoferlund mentioned this pull request Jul 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

keyword search for quantifiers
3 participants