Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

07 — Component Library (Library Module)

Module-specific widgets on top of 00-shared/03. Each lists the server binding and the shared components it composes. All are pure-presentational; state lives in the Cubits (13_State_Management.md).


1. AvailabilityBadge

PurposeShow copy availability at a glance
InputsavailableCopies, totalCopies, status: BookStatus
RendersAppBadge; color by state: availableCopies > 0 → green "3/5"; 0 → red "0/5 — all on loan"; `status == damaged
SourceBook.availableCopies/totalCopies/status (book.schema.ts:34-41)
Used inS1 rows, S2 header, S4 sheet footer

2. FineChip

PurposeShow fine amount + status on borrow records
InputsfineAmount, fineStatus?: FineStatus
Rendersamber "20 · pending" (with optional Pay action), green "20 · paid", grey "waived" (borrow-record.schema.ts:14-18); no chip when fineStatus is unset (on-time returns, library.service.ts:166)
SourceBorrowRecord.fineAmount/fineStatus (borrow-record.schema.ts:47-54)
Used inS5 cards, S6 result, S7 rows

3. OverdueTag

PurposeFlag a late loan
InputsdueDate, borrowStatus
Logicvisible iff borrowStatus == 'active' && now > dueDateclient-derived; server never writes BorrowStatus.OVERDUE today (OQ-2, borrow-record.schema.ts:9-11)
Rendersred AppBadge "Overdue by N d" (+ optional fine estimate)
a11ysemantics "overdue by N days"
Used inS5, S7

4. CopyStepper

PurposeAdjust totalCopies in the book form
InputstotalCopies, availableCopies, `mode: create
Renders[−] 3 [+] with live projection: create → available = total (library.service.ts:41-46); edit → available = max(0, available + Δ) (library.service.ts:87-90)
Validation@Min(1) mirrors create-book.dto.ts:34-35; floor 0 on available
Used inS3

5. BookRow

PurposeCatalog list row
Compositioncover thumb (or letter avatar), title (max 2 lines), "author · ISBN", AvailabilityBadge + status badge
SourceBook doc (book.schema.ts:15-48)
Used inS1, S7 (with student line)

6. BorrowRecordCard

PurposeOne loan on the Borrowed-by-Me / Overdue screens
CompositionAppCard: book title (populated bookId, borrow-record.repository.ts:31,42), borrowedAt, dueDate (prominent), OverdueTag, FineChip, actions [Return] (staff) / [Pay]
SourceBorrowRecord doc (borrow-record.schema.ts:20-58)
Used inS5, S6 trigger, S7

7. StudentPicker

PurposeSelect a student when issuing
CompositionAppPicker over the Students profile cache; free-text search, single select
SourceStudents module state (id → studentId in IssueBookDto, issue-book.dto.ts:7-8); no dedicated picker endpoint
Used inS4

8. DueDateField

PurposePick a due date for issue
CompositionAppDateField (native date picker); client enforces future dates (server accepts any IsDateStringissue-book.dto.ts:14-15); default +14 days
Used inS4, S6 (read-only display)

9. FineSummaryPanel

PurposeReturn-form fine computation explainer
Composition"Days overdue: N → N × 5/day = 20" plus editable fineAmount (staff only) and note "server recomputes at return"
Sourcerule library.service.ts:211-217, override return-book.dto.ts:9-13
Used inS6

Shared components reused verbatim (00-shared/03)

AppButton, AppTextField, AppSnackbar, AppCard, AppListTile, AppBottomSheet, AppDialog, AppMenu, AppSkeleton, AppEmptyState, AppOfflineBanner, AppFAB, AppBadge, AppChips, AppSearchBar, AppAvatar, AppDateField, AppPicker.

Component → screen matrix

S1S2S3S4S5S6S7
AvailabilityBadge
FineChip
OverdueTag
CopyStepper
BookRow
BorrowRecordCard
StudentPicker
DueDateField
FineSummaryPanel