Notes Sidebar Component (notes-sidebar.tsx)

This file defines a React component for viewing and editing notes associated with a specific image in a user's case. It provides a detailed form for entering case, class, index, and support information, as well as additional notes.

Types

NotesSidebarProps

Props for the NotesSidebar component:

  • currentCase: string – The currently selected case number.

  • onReturn: () => void – Callback to return to case management.

  • user: User – The current authenticated user.

  • imageId: string – The ID of the selected image.

NotesData

Represents the structure of a notes object, including:

  • Case and item identifiers (leftCase, rightCase, leftItem, rightItem)

  • Font color, class type, custom class, class note, subclass flag

  • Index type, number, color

  • Support level, confirmation flag, additional notes

  • updatedAt: Timestamp of last update


Component

NotesSidebar(props: NotesSidebarProps)

A sidebar UI for editing and saving notes for a selected image.

State:

  • Form fields for all note properties (case numbers, items, font color, class type, etc.)

  • isLoading: Whether notes are being loaded.

  • loadError: Error message for loading failures.

  • saveSuccess: Whether notes were saved successfully.

  • isModalOpen: Whether the additional notes modal is open.

Effects:

  • Loads existing notes for the selected image and case on mount or when dependencies change.

  • Updates left/right case fields if "use current case" is toggled.

Features:

  • Case Information:

    • Inputs for left/right case and item numbers.

    • Option to auto-fill with the current case number.

    • Font color selection using ColorSelector.

  • Class Characteristics:

    • Select class type (Bullet, Cartridge Case, Other).

    • Input for custom class and class notes.

    • Checkbox for subclass indication.

  • Indexing:

    • Select index type (color or number).

    • Input or color picker for index value.

  • Support Level:

    • Select support level (ID, Exclusion, Inconclusive).

    • Checkbox to include a confirmation field.

  • Additional Notes:

    • Opens a modal for entering extra notes.
  • Save/Return:

    • Button to save notes (calls backend).

    • Button to return to case management.

  • Feedback:

    • Displays loading, error, and success messages.
Updated on