-
-
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
feat: new UX for submitting changes #224
Conversation
useEffect(() => { | ||
if (nodeObject && originalNodeObject) { | ||
const changesMade = | ||
JSON.stringify(nodeObject) !== JSON.stringify(originalNodeObject); |
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.
JSON.stringify does not ensure that the strings will have the same shape. Let's use https://www.npmjs.com/package/fast-deep-equal for this. Also, no need for this to be a state, it can be a derived value
</Button> | ||
{/* Fab for submitting edits */} | ||
{changesMade && ( | ||
<Fab |
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.
could we add some background color for the Fab, just so that the button is not floating on top of the content?
const [updateChildren, setUpdateChildren] = useState([]); // Storing updates of children in node | ||
const [open, setOpen] = useState(false); // Used for Dialog component | ||
const [changesMade, setChangesMade] = useState(false); // Used for displaying Fab |
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.
We can probably name this to isNewChange
?
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.
what about hasChanges
@@ -54,6 +67,7 @@ const AccumulateAllComponents = ({ id, taxonomyName, branchName }) => { | |||
}); | |||
} | |||
setNodeObject(duplicateNode); | |||
setOriginalNodeObject(JSON.parse(JSON.stringify(duplicateNode))); // Deep copy |
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.
Why do we need the parse
and stringify
?
@diivi Can you resolve the conflicts? This PR seems to be stalled for a long time. Is there anything you need help with? |
Unfortunately, I don't have access to the device I set this project up on, so I'll have to set it up again some time 😞 |
Signed-off-by: eeshaanSA <[email protected]>
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.
@eeshaanSA Check out the comments and also run lint before you're committing.
<ListAllEntryProperties | ||
nodeObject={nodeObject} | ||
setNodeObject={setNodeObject} | ||
/> | ||
{changesMade && ( |
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.
Please change the variable name to hasChanges
. This makes it more understandable.
minHeight : "50px", | ||
borderRadius : "20px", |
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.
If possible, please make the dimensions in relative units. Will be easier when everything is being made responsive.
thanks. On it. |
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.
Thanks @eeshaanSA @diivi!
@eeshaanSA thanks for taking this past the finish line! |
What
nodeObject
Screenshot
Fixes bug(s)