-
Notifications
You must be signed in to change notification settings - Fork 6
fixes in PulsePage.jsx #2442
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
fixes in PulsePage.jsx #2442
Changes from all commits
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 |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| import { format } from 'date-fns'; | ||
| import React, { useContext, useEffect, useState } from 'react'; | ||
| import {useHistory} from 'react-router-dom'; | ||
| import { useHistory } from 'react-router-dom'; | ||
| import { Button, Typography } from '@mui/material'; | ||
|
|
||
| import { resolve } from '../api/api.js'; | ||
|
|
@@ -14,6 +14,7 @@ const PulsePage = () => { | |
| const { state } = useContext(AppContext); | ||
| const currentUser = selectCurrentUser(state); | ||
| const csrf = selectCsrfToken(state); | ||
| const history = useHistory(); | ||
|
|
||
| const [externalComment, setExternalComment] = useState(''); | ||
| const [externalScore, setExternalScore] = useState(2); // zero-based | ||
|
|
@@ -66,8 +67,6 @@ const PulsePage = () => { | |
| }); | ||
| if (res.error) throw new Error(res.error.message); | ||
| const pulses = res.payload.data; | ||
| //TODO: Currently these objects only contain the comment text value, | ||
| // not scores, but story 2345 will add those. | ||
| setPulse(pulses.at(-1)); // last element is most recent | ||
| } catch (err) { | ||
| console.error('PulsePage.jsx loadTodayPulse:', err); | ||
|
|
@@ -103,7 +102,7 @@ const PulsePage = () => { | |
| if (res.error) throw new Error(res.error.message); | ||
|
|
||
| // Refresh browser to show that pulses where already submitted today. | ||
| history.push(location.pathname); | ||
|
Collaborator
Author
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. The
Contributor
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. I didn't realize go was available in v5. Thanks! |
||
| history.go(0); | ||
| } catch (err) { | ||
| console.error('PulsePage.jsx submit:', err); | ||
| } | ||
|
|
@@ -135,11 +134,7 @@ const PulsePage = () => { | |
| setScore={setExternalScore} | ||
| title="How you feeling about life outside of work?" | ||
| /> | ||
| <Button | ||
| disabled={!internalComment} | ||
|
Collaborator
Author
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. Removed requirement to supply |
||
| onClick={submit} | ||
| variant="contained" | ||
| > | ||
| <Button onClick={submit} variant="contained"> | ||
| Submit | ||
| </Button> | ||
| </> | ||
|
|
||
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.
Just added spaces inside braces.