Skip to content

LF-5215: Note list and item display components#4093

Open
litefarm-pr-bot wants to merge 1 commit intointegrationfrom
LF-5215-note-list-and-item-display-components
Open

LF-5215: Note list and item display components#4093
litefarm-pr-bot wants to merge 1 commit intointegrationfrom
LF-5215-note-list-and-item-display-components

Conversation

@litefarm-pr-bot
Copy link
Collaborator

Description

This PR adds three pure presentational components for browsing farm notes, reviewable in Storybook independently of the backend and RTK Query layer. These components have no dependencies on data-fetching or store setup — all state flows in via props.

FarmNoteItem manages two distinct layouts: a collapsed row (1-line clamp on desktop, 2-line on mobile) showing note preview, author name, optional lock icon for private notes, and a date badge with "TODAY" formatting; and an expanded card with a teal-background chevron, author + date header, optional image thumbnail with enlarge link, full note text, and author-only Delete / Edit action buttons. FarmNoteList owns the accordion expansion state via useExpandable({ isSingleExpandable: true }), surfaces offline-queued notes (to_sync: true) above server-fetched notes, resolves author names from a users: Record<string, string> lookup map, and renders an empty state when there are no notes. FarmNotesFloatingButton is a teal-bordered button with the message-text-square-02 SVG icon (exact paths from Figma, currentColor stroke) and an optional red unread dot badge.

The FarmNote interface is defined locally in components/FarmNotes/types.ts rather than store/api/types/index.ts since that addition belongs to LF-5214 (RTK Query API layer). Once LF-5214 merges, the import path should be updated to the shared location. All user-visible strings use a new FARM_NOTE i18n key in translation.json, alphabetized via pnpm i18n.

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

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?

All component states are covered by Storybook stories: collapsed public/private, expanded with/without image, expanded as author (with delete/edit), pending sync, past date, empty list, and list with pending notes. No local frontend running; visual review was not performed against a running app.

  • Passes test case
  • UI components visually reviewed on desktop view
  • UI components visually reviewed on mobile view
  • Other (please explain) — pure component PR reviewed via Storybook stories covering all documented states

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 ordered translation keys alphabetically (optional: run pnpm i18n to help with this)
  • I have added the GNU General Public License to all new files

Pure presentational components for browsing farm notes — reviewable in
Storybook independently of the backend and RTK Query layer (LF-5214/5216).

- FarmNotesFloatingButton: teal-bordered button with message-text-square-02
  icon, Farm notes label, and optional red unread dot badge
- FarmNoteItem: collapsed (1-line/2-line clamp, author, date badge, lock icon
  for private) and expanded (chevron, author+date header, optional image with
  enlarge link, full text, author-only edit/delete actions) states; muted
  opacity with Pending sync label when to_sync is true
- FarmNoteList: scrollable list owning expansion state via useExpandable
  (isSingleExpandable), pending notes surfaced above server notes, Add a note
  button, empty state; resolves author names from users lookup map prop
- message-text-square-02.svg: exact SVG paths from Figma asset, currentColor
  stroke so it inherits teal from CSS
- FARM_NOTE i18n keys added to translation.json (alphabetized via pnpm i18n)
- Storybook stories for all three components covering all documented states

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
@litefarm-pr-bot litefarm-pr-bot requested review from a team as code owners March 17, 2026 23:05
@litefarm-pr-bot litefarm-pr-bot requested review from kathyavini and removed request for a team March 17, 2026 23:05
Copy link
Collaborator

@kathyavini kathyavini left a comment

Choose a reason for hiding this comment

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

Oooh this one is going to be a bit of a tricky review; lots of liberties taken with this one 😂

I was interested to see how far it could take the Figma... looks like, maybe ~60% accuracy?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants