Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions web-ui/src/components/pulse/Pulse.css
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@
margin-bottom: 1rem;
padding: 1rem;
}

.title-row {
display: flex;
}
}

:root[data-mui-color-scheme='dark'] {
Expand Down
11 changes: 8 additions & 3 deletions web-ui/src/components/pulse/Pulse.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ const tooltips = [
const propTypes = {
comment: PropTypes.string,
commentRequired: PropTypes.bool,
iconRequired: PropTypes.bool,
score: PropTypes.number,
setComment: PropTypes.func,
setScore: PropTypes.func,
Expand All @@ -38,21 +39,25 @@ const propTypes = {
const Pulse = ({
comment,
commentRequired,
iconRequired,
score,
setComment,
setScore,
title
}) => (
<div className="pulse">
<Typography variant="h6">{title}</Typography>
<div className="title-row">
<Typography variant="h6">{title}</Typography>
{iconRequired && <Typography variant="h6" color="red">*</Typography>}
</div>
<div className="icon-row">
{icons.map((sentiment, index) => (
<Tooltip key={`sentiment-${index}`} title={tooltips[index]} arrow>
<IconButton
aria-label="sentiment"
className={index === score ? 'selected' : ''}
data-testid={`score-button-${index}`}
onClick={() => setScore(index)}
onClick={() => setScore(score == index ? null : index)}
sx={{ color: colors[index] }}
>
{sentiment}
Expand All @@ -70,7 +75,7 @@ const Pulse = ({
}}
placeholder="Comment"
required={commentRequired}
rows={4}
maxRows={4}
value={comment}
/>
</div>
Expand Down
13 changes: 8 additions & 5 deletions web-ui/src/components/pulse/__snapshots__/Pulse.test.jsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,15 @@ exports[`renders correctly 1`] = `
<div
class="pulse"
>
<h6
class="MuiTypography-root MuiTypography-h6 css-2ulfj5-MuiTypography-root"
<div
class="title-row"
>
How are you feeling about work today? (*)
</h6>
<h6
class="MuiTypography-root MuiTypography-h6 css-2ulfj5-MuiTypography-root"
>
How are you feeling about work today? (*)
</h6>
</div>
<div
class="icon-row"
>
Expand Down Expand Up @@ -203,7 +207,6 @@ exports[`renders correctly 1`] = `
class="MuiInputBase-input MuiOutlinedInput-input MuiInputBase-inputMultiline css-1sqnrkk-MuiInputBase-input-MuiOutlinedInput-input"
id=":r5:"
placeholder="Comment"
rows="4"
style="height: 0px; overflow: hidden;"
>
Just testing
Expand Down
15 changes: 5 additions & 10 deletions web-ui/src/pages/PulsePage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,9 @@ const PulsePage = () => {
const [year, month, day] = pulse.submissionDate;
setSubmittedToday(
year === now.getFullYear() &&
month === now.getMonth() + 1 &&
day === now.getDate()
month === now.getMonth() + 1 &&
day === now.getDate()
);

setInternalComment(pulse.internalFeelings ?? '');
setExternalComment(pulse.externalFeelings ?? '');
setInternalScore(pulse.internalScore == undefined ?
center : pulse.internalScore - 1);
setExternalScore(pulse.externalScore == undefined ?
center : pulse.externalScore - 1);
}, [pulse]);

const loadTodayPulse = async () => {
Expand Down Expand Up @@ -120,10 +113,11 @@ const PulsePage = () => {
<Pulse
key="pulse-internal"
comment={internalComment}
iconRequired={true}
score={internalScore}
setComment={setInternalComment}
setScore={setInternalScore}
title="How are you feeling about work today? (*)"
title="How are you feeling about work today?"
/>
<Pulse
key="pulse-external"
Expand All @@ -137,6 +131,7 @@ const PulsePage = () => {
<Button
style={{ marginTop: 0 }}
onClick={submit}
disabled={internalScore == null}
variant="contained">
Submit
</Button>
Expand Down
31 changes: 21 additions & 10 deletions web-ui/src/pages/__snapshots__/PulsePage.test.jsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,20 @@ exports[`renders correctly 1`] = `
<div
class="pulse"
>
<h6
class="MuiTypography-root MuiTypography-h6 css-2ulfj5-MuiTypography-root"
<div
class="title-row"
>
How are you feeling about work today? (*)
</h6>
<h6
class="MuiTypography-root MuiTypography-h6 css-2ulfj5-MuiTypography-root"
>
How are you feeling about work today?
</h6>
<h6
class="MuiTypography-root MuiTypography-h6 css-1i2vuon-MuiTypography-root"
>
*
</h6>
</div>
<div
class="icon-row"
>
Expand Down Expand Up @@ -205,7 +214,6 @@ exports[`renders correctly 1`] = `
class="MuiInputBase-input MuiOutlinedInput-input MuiInputBase-inputMultiline css-1sqnrkk-MuiInputBase-input-MuiOutlinedInput-input"
id=":r5:"
placeholder="Comment"
rows="4"
style="height: 0px; overflow: hidden;"
/>
<textarea
Expand Down Expand Up @@ -233,11 +241,15 @@ exports[`renders correctly 1`] = `
<div
class="pulse"
>
<h6
class="MuiTypography-root MuiTypography-h6 css-2ulfj5-MuiTypography-root"
<div
class="title-row"
>
How are you feeling about life outside of work?
</h6>
<h6
class="MuiTypography-root MuiTypography-h6 css-2ulfj5-MuiTypography-root"
>
How are you feeling about life outside of work?
</h6>
</div>
<div
class="icon-row"
>
Expand Down Expand Up @@ -430,7 +442,6 @@ exports[`renders correctly 1`] = `
class="MuiInputBase-input MuiOutlinedInput-input MuiInputBase-inputMultiline css-1sqnrkk-MuiInputBase-input-MuiOutlinedInput-input"
id=":rb:"
placeholder="Comment"
rows="4"
style="height: 0px; overflow: hidden;"
/>
<textarea
Expand Down
Loading