-
Notifications
You must be signed in to change notification settings - Fork 78
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
LF-4122 handle additional removal reasons in removal flow #3159
LF-4122 handle additional removal reasons in removal flow #3159
Conversation
…reason ids Previously strings defined in the component had been used as selection values
…sons-in-removal-flow
Was getting Error: A component suspended while responding to synchronous input. This will cause the UI to be replaced with a loading indicator.
isOpen={removalModalOpen} | ||
onClose={() => setRemovalModalOpen(false)} | ||
onConfirm={handleAnimalOrBatchRemoval} | ||
showSuccessMessage={false} |
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.
Success message mentions historical inventory, so I am assuming it should not be shown before that has been built out.
default_breed_id: animal.default_breed_id, | ||
}; | ||
}); | ||
return animals |
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.
Ultimately this filter would probably be put somewhere else (once we have a view for removed animals), but for now they are simply removed from the table + KPI
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.
Working great! I like that the hook keeps Inventory
so clean.
I left small comments :)
Will a snackbar or something be added later...?
packages/webapp/src/containers/Animals/Inventory/useAnimalOrBatchRemoval.ts
Outdated
Show resolved
Hide resolved
Thank you @SayakaOno! Honestly I had completely forgotten that snackbar until I saw @Duncan-Brain's daily standup report today. If Duncan has work underway on that, I'll defer to his solution as I'm pretty sure it's one snackbar for both removal and deletion on Figma and I'm assuming they can be implemented pretty easily together -- @Duncan-Brain is that right? |
@kathyavini Its a bit of a challenge lol. Thinking of doing 2 snackbars or rewriting api because non atomic between animals and batch. Mostly have solution but need to troubleshoot over rendering monday. |
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.
Works great! 🙌 I noticed two UI things that aren't really related to this PR so no need to handle them here, but just noting them. The removal reasons dropdown would look better without the padding around the options, and on the Action Menu, it always says "Remove animal" even if there's more than one selected (could be generically "Remove animals" in plural or change depending on the number selected)
// Reset form when a new set of animals/batches is selected | ||
useEffect(() => { | ||
if (props.isOpen) { | ||
reset({ [DATE]: getLocalDateInYYYYDDMM() }); | ||
} | ||
}, [props.isOpen]); |
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 we want to reset the form to default every time the modal's open, I think this can be achieved by passing shouldUnregister: true
to useForm
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.
Oh nice, thank you! I didn't know that reset to default value!
@antsgar let's do "Remove animals" in all cases because the singular entity selected might be a batch... and it's also easier to implement 😉 Could you show me which padding you mean? I actually specifically asked Nav to increase the padding on this dropdown beyond the default React Select 😅 -- but I was basing it on Loïc's Figma design here. |
@kathyavini this spacing here! I do see it in the designs too but I find it odd that the options don't go to the border of the dropdown. The top one's fine actually, it's the left right/margins that look weird to me, we could add in more spacing to the option's padding itself instead of around it? |
@antsgar ah so that the hover effect extends like this? That can definitely be done Alas just noticed that the extra character in Remove Animals doesn't fit 😉 Will adjust, but I imagine will we want to revisit this after all the translations are in? |
@@ -31,7 +31,7 @@ | |||
left: 50%; | |||
|
|||
&.iconCount_4 { | |||
width: 408px; | |||
width: 424px; |
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.
@SayakaOno this was my first thought for fitting the longer label, but now actually I think I slightly prefer the look of decreasing the gap from 8px to 4px (and boosting the width to just 416px); curious which you think is better?
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.
@@ -31,7 +31,7 @@ | |||
left: 50%; | |||
|
|||
&.iconCount_4 { | |||
width: 408px; | |||
width: 424px; |
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.
Description
Integration of removal functionality with inventory.
Deletion (the
CREATED_IN_ERROR
option) is a separate ticket and selecting it will do nothing other than return a network error.Jira link: https://lite-farm.atlassian.net/browse/LF-4122
Type of change
How Has This Been Tested?
Checklist: