Skip to content
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

Merged

Conversation

kathyavini
Copy link
Collaborator

@kathyavini kathyavini commented Mar 14, 2024

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

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

  • Passes test case
  • UI components visually reviewed on desktop view
  • UI components visually reviewed on mobile view
  • Other (please explain)

Checklist:

  • I have commented my code, particularly in hard-to-understand areas
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • The precommit and linting ran successfully
  • I have added or updated language tags for text that's part of the UI
  • I have added "MISSING" for all new language tags to languages I don't speak
  • I have added the GNU General Public License to all new files

@kathyavini kathyavini added the enhancement New feature or request label Mar 14, 2024
@kathyavini kathyavini self-assigned this Mar 14, 2024
@kathyavini kathyavini requested review from a team as code owners March 14, 2024 01:47
@kathyavini kathyavini requested review from antsgar and SayakaOno and removed request for a team March 14, 2024 01:47
@kathyavini kathyavini changed the base branch from integration to LF-4087/Create_or_modify_containers_to_associate_action_bar_and_table March 14, 2024 01:52
@kathyavini kathyavini marked this pull request as draft March 14, 2024 01:52
Base automatically changed from LF-4087/Create_or_modify_containers_to_associate_action_bar_and_table to integration March 14, 2024 16:03
Was getting Error: A component suspended while responding to synchronous input. This will cause the UI to be replaced with a loading indicator.
@kathyavini kathyavini marked this pull request as ready for review March 14, 2024 19:23
isOpen={removalModalOpen}
onClose={() => setRemovalModalOpen(false)}
onConfirm={handleAnimalOrBatchRemoval}
showSuccessMessage={false}
Copy link
Collaborator Author

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
Copy link
Collaborator Author

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

Copy link
Collaborator

@SayakaOno SayakaOno left a 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...?

@kathyavini
Copy link
Collaborator Author

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?

@Duncan-Brain
Copy link
Collaborator

@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.

SayakaOno
SayakaOno previously approved these changes Mar 19, 2024
antsgar
antsgar previously approved these changes Mar 20, 2024
Copy link
Collaborator

@antsgar antsgar left a 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)

Comment on lines 75 to 80
// Reset form when a new set of animals/batches is selected
useEffect(() => {
if (props.isOpen) {
reset({ [DATE]: getLocalDateInYYYYDDMM() });
}
}, [props.isOpen]);
Copy link
Collaborator

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

Copy link
Collaborator Author

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!

@kathyavini
Copy link
Collaborator Author

@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 kathyavini dismissed stale reviews from antsgar and SayakaOno via 3534fff March 20, 2024 19:21
@antsgar
Copy link
Collaborator

antsgar commented Mar 20, 2024

@kathyavini this spacing here!

Captura de pantalla 2024-03-20 a la(s) 16 53 55

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?

@kathyavini
Copy link
Collaborator Author

@antsgar ah so that the hover effect extends like this? That can definitely be done

Screenshot 2024-03-20 at 1 24 20 PM

Alas just noticed that the extra character in Remove Animals doesn't fit 😉

Screenshot 2024-03-20 at 1 24 26 PM

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;
Copy link
Collaborator Author

@kathyavini kathyavini Mar 20, 2024

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?

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think I set the gap to 8px because the space looked too narrow with 4px.
Screenshot 2024-03-20 at 3 20 52 PM

To me, an 8 pixel gap still seems better when thinking about other languages...

@@ -31,7 +31,7 @@
left: 50%;

&.iconCount_4 {
width: 408px;
width: 424px;
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think I set the gap to 8px because the space looked too narrow with 4px.
Screenshot 2024-03-20 at 3 20 52 PM

To me, an 8 pixel gap still seems better when thinking about other languages...

@kathyavini kathyavini requested a review from antsgar March 20, 2024 22:51
@antsgar antsgar added this pull request to the merge queue Mar 21, 2024
Merged via the queue into integration with commit 26e6273 Mar 21, 2024
5 checks passed
@antsgar antsgar deleted the LF-4122-handle-additional-removal-reasons-in-removal-flow branch March 21, 2024 16:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants