Skip to content

Commit 6817a6f

Browse files
committed
Added a property to show that the icon is required and changed to allow de-selecting a smiley face.
1 parent 34a5f1c commit 6817a6f

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

web-ui/src/components/pulse/Pulse.jsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ const tooltips = [
3030
const propTypes = {
3131
comment: PropTypes.string,
3232
commentRequired: PropTypes.bool,
33+
iconRequired: PropTypes.bool,
3334
score: PropTypes.number,
3435
setComment: PropTypes.func,
3536
setScore: PropTypes.func,
@@ -38,6 +39,7 @@ const propTypes = {
3839
const Pulse = ({
3940
comment,
4041
commentRequired,
42+
iconRequired,
4143
score,
4244
setComment,
4345
setScore,
@@ -46,7 +48,7 @@ const Pulse = ({
4648
<div className="pulse">
4749
<div className="title-row">
4850
<Typography variant="h6">{title}</Typography>
49-
{commentRequired && <Typography variant="h6" color="red">*</Typography>}
51+
{iconRequired && <Typography variant="h6" color="red">*</Typography>}
5052
</div>
5153
<div className="icon-row">
5254
{icons.map((sentiment, index) => (
@@ -55,7 +57,7 @@ const Pulse = ({
5557
aria-label="sentiment"
5658
className={index === score ? 'selected' : ''}
5759
data-testid={`score-button-${index}`}
58-
onClick={() => setScore(index)}
60+
onClick={() => setScore(score == index ? null : index)}
5961
sx={{ color: colors[index] }}
6062
>
6163
{sentiment}

web-ui/src/pages/PulsePage.jsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ const PulsePage = () => {
120120
<Pulse
121121
key="pulse-internal"
122122
comment={internalComment}
123-
commentRequired={true}
123+
iconRequired={true}
124124
score={internalScore}
125125
setComment={setInternalComment}
126126
setScore={setInternalScore}
@@ -138,6 +138,7 @@ const PulsePage = () => {
138138
<Button
139139
style={{ marginTop: 0 }}
140140
onClick={submit}
141+
disabled={internalScore == null}
141142
variant="contained">
142143
Submit
143144
</Button>

0 commit comments

Comments
 (0)