-
Notifications
You must be signed in to change notification settings - Fork 22
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
Changes from 2 commits
937b648
086e226
ac0ff3f
6ad48cb
da5b6d6
7e27097
013ebff
7acf2a1
316f94a
4cdb995
e697acd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,15 +3,17 @@ import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; | |
|
||
interface SearchInputProps { | ||
handleChange: (element) => void; | ||
value: string; | ||
value?: string; | ||
placeholder?: string; | ||
} | ||
|
||
const SearchInput = ({ | ||
handleChange, | ||
value, | ||
placeholder = 'Search', | ||
}: SearchInputProps): JSX.Element => { | ||
return ( | ||
<div className="relative flex items-center border border-warm-gray-400 h-[42px]"> | ||
<div className="relative flex items-center border border-warm-gray-400"> | ||
<div className="absolute inset-y-0 left-0 flex items-center pl-3"> | ||
<span className="text-warm-gray-800 dark:text-white"> | ||
<FontAwesomeIcon | ||
|
@@ -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 commentThe reason will be displayed to describe this comment to others. Learn more. 👍 |
||
value={value} | ||
onChange={(e: React.ChangeEvent<HTMLInputElement>): void => | ||
handleChange(e.target.value) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 commentThe 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 commentThe 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. |
||
<SearchInput | ||
handleChange={(e): void => { | ||
setSearchValue(e); | ||
|
@@ -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 commentThe reason will be displayed to describe this comment to others. Learn more. same as above |
||
<SelectInput | ||
handleChange={(e): void => { | ||
setSelectedSort(e); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; | ||
import { faPrayingHands } from '@fortawesome/free-solid-svg-icons'; | ||
|
||
interface Props { | ||
disabled?: boolean; | ||
onClick(); | ||
} | ||
|
||
const QuantifyMultipleButton = ({ | ||
disabled = false, | ||
onClick, | ||
}: Props): JSX.Element => { | ||
return ( | ||
<button | ||
disabled={disabled} | ||
className={ | ||
disabled | ||
? 'praise-button-disabled space-x-2' | ||
: 'praise-button space-x-2' | ||
} | ||
onClick={onClick} | ||
> | ||
<FontAwesomeIcon icon={faPrayingHands} size="1x" /> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 |
||
<span>Quantify</span> | ||
</button> | ||
); | ||
}; | ||
|
||
export default QuantifyMultipleButton; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
import ScrollableDialog from '@/components/ScrollableDialog'; | ||
import QuantifyMultipleButton from '@/pages/QuantifyPeriodReceiver/components/QuantifyMultipleButton'; | ||
import QuantifySlider from '@/pages/QuantifyPeriodReceiver/components/QuantifySlider'; | ||
import { faCalculator, faTimes } from '@fortawesome/free-solid-svg-icons'; | ||
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; | ||
import { PraiseDto } from 'api/dist/praise/types'; | ||
import { useState } from 'react'; | ||
|
||
interface QuantifyMultipleDialogProps { | ||
open: boolean; | ||
onClose(): void; | ||
selectedPraises: PraiseDto[]; | ||
allowedValues: number[]; | ||
onSetScore(newScore: number, selectedPraises: PraiseDto[]); | ||
} | ||
|
||
const QuantifyMultipleDialog = ({ | ||
open = false, | ||
onClose, | ||
selectedPraises, | ||
allowedValues, | ||
onSetScore, | ||
}: QuantifyMultipleDialogProps): JSX.Element | null => { | ||
const [score, setScore] = useState<number>(0); | ||
|
||
return ( | ||
<ScrollableDialog open={open} onClose={onClose}> | ||
<div className="w-full h-full"> | ||
<div className="flex justify-end p-6"> | ||
<button className="praise-button-round" onClick={onClose}> | ||
<FontAwesomeIcon icon={faTimes} size="1x" /> | ||
</button> | ||
</div> | ||
<div className="px-20 space-y-6"> | ||
<div className="flex justify-center"> | ||
<FontAwesomeIcon icon={faCalculator} size="2x" /> | ||
</div> | ||
<h2 className="text-center"> | ||
Quantify selected ({selectedPraises.length}) praises | ||
mattyg marked this conversation as resolved.
Show resolved
Hide resolved
|
||
</h2> | ||
|
||
<div className="text-center"> | ||
<QuantifySlider | ||
allowedScores={allowedValues} | ||
onChange={(newScore): void => setScore(newScore)} | ||
/> | ||
</div> | ||
|
||
<div className="flex justify-center"> | ||
<QuantifyMultipleButton | ||
onClick={(): void => { | ||
onSetScore(score, selectedPraises); | ||
onClose(); | ||
}} | ||
/> | ||
</div> | ||
</div> | ||
</div> | ||
</ScrollableDialog> | ||
); | ||
}; | ||
|
||
export default QuantifyMultipleDialog; |
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
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.
☝️☝️ @nebs-dev, this remains to be done.