Skip to content
This repository has been archived by the owner on Jan 13, 2023. It is now read-only.

Flavor Stash / Notes #75

Open
wants to merge 27 commits into
base: master
Choose a base branch
from

Conversation

daviddyess
Copy link
Member

User's Flavor Stash, with editors for min/max percentage and notes. Each flavor gets a single note, which utilizes markdown for rich text.

@codecov
Copy link

codecov bot commented May 15, 2020

Codecov Report

Merging #75 (74a7a79) into master (abfb892) will decrease coverage by 2.43%.
The diff coverage is 59.89%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #75      +/-   ##
==========================================
- Coverage   83.19%   80.75%   -2.44%     
==========================================
  Files          88       92       +4     
  Lines        1660     1850     +190     
==========================================
+ Hits         1381     1494     +113     
- Misses        279      356      +77     
Impacted Files Coverage Δ
src/components/FlavorStash/Note.js 0.00% <0.00%> (ø)
src/reducers/index.js 40.00% <ø> (ø)
src/sagas/index.js 100.00% <ø> (ø)
src/pages/user/FlavorStash.js 50.00% <42.55%> (-50.00%) ⬇️
src/sagas/note.js 80.23% <80.23%> (ø)
src/reducers/note.js 100.00% <100.00%> (ø)
src/selectors/note.js 100.00% <100.00%> (ø)
... and 1 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update abfb892...74a7a79. Read the comment docs.

@daviddyess daviddyess requested a review from ayan4m1 May 15, 2020 17:51
super(props);

this.state = {
editingNote: false,
Copy link
Contributor

Choose a reason for hiding this comment

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

Could just be editing

);
}

handleNoteEditor() {
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe handleToggleEditing?

} else {
actions.createNote(values);
}
this.setState({ updatedNote: note || '' });
Copy link
Contributor

Choose a reason for hiding this comment

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

Why are we copying the note to local component state?

Copy link
Member Author

Choose a reason for hiding this comment

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

It's mostly for user experience: it makes the update instant instead of having to pull it back from the API. But it also prevents the need for another GET request.

Copy link
Member Author

Choose a reason for hiding this comment

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

I've refactored this, when you create or update a note it updates the collection in the reducer

<Col md="12">
{
/* eslint-disable-next-line no-sync */
unified()
Copy link
Contributor

Choose a reason for hiding this comment

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

My two cents, this shouldn't be done synchronously or inline. Maybe use an async function that updates local component state with the parsed result?

Copy link
Member Author

Choose a reason for hiding this comment

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

I haven't been able to get this to work with async. I also haven't been able to find an async example, they all show using this method

</Button>
<Button
onClick={e => this.handleNoteEditor(false, e)}
className="button-animation button--cancel"
Copy link
Contributor

Choose a reason for hiding this comment

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

This is likely something for a different pr, but I think this class name should be button--animated

<Fragment>
{
/* eslint-disable-next-line no-sync */
unified()
Copy link
Contributor

Choose a reason for hiding this comment

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

Same thing here with the inline/sync parsing.

export const mapDispatchToProps = dispatch => ({
actions: bindActionCreators(
{
...noteActions
Copy link
Contributor

Choose a reason for hiding this comment

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

No need to spread if it's the only action group being used.

Copy link
Member Author

Choose a reason for hiding this comment

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

Also fixed in the page as well.

expect(tree).toMatchSnapshot();
});

it('calls requestStash on mount', () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Should be requestNote right?

date(d) {
const s = new Date(d);

return s.toLocaleDateString();
Copy link
Contributor

@ayan4m1 ayan4m1 Jun 6, 2020

Choose a reason for hiding this comment

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

Use date-fns format for this - docs

Copy link
Member Author

Choose a reason for hiding this comment

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

This seems to be something we should probably work on and integrate later. date-fns doesn't seem to be flexible enough to be used within the scope of this PR.

editingStash: false,
removed: {},
usage: {},
viewingNote: {}
Copy link
Contributor

Choose a reason for hiding this comment

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

This doesn't seem to be used, is it leftover?

</InputGroup.Text>
</InputGroup.Prepend>
<Form.Control {...input} type="number" step="0.1" />
<InputGroup.Text id="inputGroupAppend">%</InputGroup.Text>
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't need the id= attribute here.

<Form.Group as={Col}>
<InputGroup>
<InputGroup.Prepend>
<InputGroup.Text id="inputGroupPrepend">
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't need the id= attribute here or above.

</Col>
</Form.Row>
) : null}
<Field name="userId">
Copy link
Contributor

Choose a reason for hiding this comment

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

Can these fields be pulled at submit-time rather than populated as hidden fields now?

Copy link
Member Author

Choose a reason for hiding this comment

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

I removed them and added a commit, their values are pre-filled and submitted with the form. I mainly just had them there for readability in the generated page source.

# Conflicts:
#	src/pages/user/FlavorStash.js
#	src/pages/user/FlavorStash.test.js
#	src/pages/user/__snapshots__/FlavorStash.test.js.snap
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants