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-4481: Add Location to animal inventory UI #3527

Open
wants to merge 18 commits into
base: integration
Choose a base branch
from

Conversation

SayakaOno
Copy link
Collaborator

@SayakaOno SayakaOno commented Nov 12, 2024

Description

Inventory table

  • Move the Location type to a common file
  • Add location_id to Animal and AnimalBatch types and adjust mockData
  • Update useAnimalInventory to include location
  • Add Location column to animal inventory table
  • Update useFilteredInventory to handle locations filter
  • Add location string to animal inventory searchable string
  • Update Plain cell component to take content(ReactNode) for greater flexibility
  • Update "none" text style in the group column to normal font (it was previously in italic)
  • Fix broken story

Header

  • Modify AnimalSingleViewHeader's props (separated locationText from animalOrBatch) and adjust stories
  • Send locationText to AnimalSingleViewHeader

Jira link: https://lite-farm.atlassian.net/browse/LF-4481

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

@SayakaOno SayakaOno self-assigned this Nov 12, 2024
@SayakaOno SayakaOno added enhancement New feature or request Blocked labels Nov 12, 2024
@SayakaOno SayakaOno changed the title LF-4481: Add Location to animal inventory UI [WIP] LF-4481: Add Location to animal inventory UI Nov 13, 2024
@SayakaOno SayakaOno changed the title [WIP] LF-4481: Add Location to animal inventory UI LF-4481: Add Location to animal inventory UI Nov 20, 2024
@SayakaOno SayakaOno force-pushed the LF-4481/Add_Location_to_animal_inventory_UI branch from 9e1037f to ff9c721 Compare November 27, 2024 23:50
@SayakaOno SayakaOno changed the base branch from integration to LF-4384/End-to-End_Animal_Details November 27, 2024 23:51
Base automatically changed from LF-4384/End-to-End_Animal_Details to integration November 28, 2024 16:21
@SayakaOno SayakaOno force-pushed the LF-4481/Add_Location_to_animal_inventory_UI branch from ff9c721 to 1da9b44 Compare November 28, 2024 16:24
@SayakaOno SayakaOno removed the Blocked label Nov 28, 2024
@SayakaOno SayakaOno marked this pull request as ready for review November 28, 2024 16:24
@SayakaOno SayakaOno requested review from a team as code owners November 28, 2024 16:24
@SayakaOno SayakaOno requested review from antsgar and removed request for a team November 28, 2024 16:24
@SayakaOno SayakaOno requested review from Duncan-Brain and removed request for a team November 28, 2024 16:24
@antsgar
Copy link
Collaborator

antsgar commented Nov 29, 2024

Looks/works great, it's all coming together!! 🙌

antsgar
antsgar previously approved these changes Nov 29, 2024
Duncan-Brain
Duncan-Brain previously approved these changes Nov 29, 2024
Copy link
Collaborator

@Duncan-Brain Duncan-Brain left a comment

Choose a reason for hiding this comment

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

Everything works great!

I might have preferred to keep the PLAIN cell kind very text specific, and adapt ICON_TEXT instead, or not use standardized Cell at all. <Cell /> is not necessary if making something single use and custom. But I will leave it up to you!

const Plain = ({ text }: PlainCellProps) => {
return <div className={clsx(styles.text, styles.overflowText)}>{text}</div>;
const Plain = ({ content }: PlainCellProps) => {
return <div className={clsx(styles.text, styles.overflowText)}>{content}</div>;
Copy link
Collaborator

Choose a reason for hiding this comment

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

There are also these styles which were meant to only specified for text.

label: t('ANIMAL.ANIMAL_LOCATIONS').toLocaleUpperCase(),
format: (d: AnimalInventory) => (
<Cell
kind={CellKind.PLAIN}
Copy link
Collaborator

Choose a reason for hiding this comment

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

There is a cell kind of "ICON_TEXT" did it not work?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I just tried it out. We would need to work around the text (the component requires ICON_NAME, and the location needs to be the text Unknown for undefined locations) and pass custom styles. I think it's better not to use the Cell.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yup up to you!

I think

d.location ? <Cell kind={ICONTEXT} text iconName  ../> : <Cell kind={PLAIN} text /> 

Would also work to keep text styles same across cells but I am good with anything.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The location text style is unique 😅

Copy link
Collaborator

Choose a reason for hiding this comment

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

Hmm 🤔 . Yeah, it is unique.... Is it designed to be different than all other cells? It seems strange to me to have one cell have different size, color, and weight of text.

The whole point of <Cell /> was to enforce the same text and other styles -- its almost useless otherwise haha.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I believe the difference is intentional. I don’t have a strong sense of design, but it doesn’t seem strange to me :)

@SayakaOno SayakaOno dismissed stale reviews from Duncan-Brain and antsgar via 3b5c511 November 29, 2024 20:32
@SayakaOno
Copy link
Collaborator Author

Thank you for your input Duncan!

I've reverted the changes to the Plain cell component and updated the location column to avoid using Cell.
Thank you in advance for re-reviewing!

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.

3 participants