Viewing Active Loans
Access your currently borrowed books to track due dates and manage returns.Open My Books
Click the “MY BOOKS” button in the navigation bar. The system automatically loads your loan records when the page opens.
Review currently checked out books
The “Currently Checked Out” section displays all active loans with:
- Book cover thumbnail (48px × 64px)
- Title (bold white text)
- Author name (gray text)
- Due date or overdue status
- Renew button
If you have no active loans, you’ll see a green checkmark icon with the message: “No books currently checked out”
Due Date Detection
The system automatically calculates and displays due date status:On-Time Books
- Text color: Blue (
text-blue-400) - Format: “Due: [Date]”
- Condition:
due_date >= datetime.now() - Date format: “Month DD, YYYY” (e.g., “March 18, 2026”)
Overdue Books
- Text color: Red (
text-red-400) - Format: “OVERDUE: [Date]”
- Condition:
due_date < datetime.now() - Visual indicator: Red text with bold font weight
Book Renewal
Extend your loan period by renewing books directly from the My Books page.Locate the book to renew
Find the book in your “Currently Checked Out” list. Each book card has a “RENEW” button on the right side.
Click Renew
Click the blue “RENEW” button. The system will:
- Calculate a new due date (14 days from today)
- Update the loan record in the database
- Refresh the My Books display
- Show a success notification
The renewal extends the due date by 14 days from the current date, not from the original due date.
Renewal Restrictions
The Renew button has specific availability rules: Enabled (Blue)- Book is not overdue
- Styling:
bg-blue-600/20 text-blue-400 hover:bg-blue-500/30 - Fully clickable and functional
- Book is overdue
- Styling:
bg-slate-800 text-slate-500 - Button is not clickable
- Overdue books cannot be renewed
Borrowing History
View your complete library activity with returned books and return dates.History Display
The “Borrowing History” section shows all previously returned books:- Book cover (40px × 56px, smaller than active loans)
- Title and author
- Return date formatted as “Returned: Month DD, YYYY”
- Reduced opacity (70%) to visually distinguish from active loans
- Lighter background (
bg-white/[0.03]) for subtle appearance
History items are sorted by checkout date in descending order, showing most recent activity first.
Empty History State
If you’ve never returned a book, you’ll see:- History icon (clock/history symbol)
- Message: “No borrowing history yet”
- Gray styling with 40% opacity
Data Display Format
The My Books page pulls data from the loans table joined with book metadata:Loan records are fetched in real-time when you open the My Books page, ensuring you always see current data.
Renewal Policy Details
When you renew a book:- Extension period: 14 days
- Calculation:
new_due_date = datetime.now() + timedelta(days=14) - Database update:
UPDATE loans SET due_date = ? WHERE id = ? - Validation: System checks that the loan is active (not returned)
Renewals can be performed multiple times on the same book as long as it’s not overdue.
Auto-Refresh Behavior
The My Books display automatically refreshes after:- Renewing a book
- Returning a book (updates history)
- Navigating to the My Books tab
The page does not auto-refresh while you’re viewing it. Click “MY BOOKS” again to manually refresh if needed.
Visual Organization
The page uses clear visual hierarchy:- Section header: “MY BORROWED BOOKS” in blue tracking-wide text
- Active loans section:
- Title: “Currently Checked Out”
- Count indicator
- List of active loans with renewal buttons
- Divider line: Horizontal gray separator
- History section:
- Title: “Borrowing History”
- List of returned books with return dates
Troubleshooting
“Could not renew book” error- The book may have been returned already
- Check that the book is still in your active loans
- Refresh the My Books page and try again
- The page auto-refreshes after renewal
- If the date doesn’t change, manually refresh by clicking “MY BOOKS” again
- Due dates are compared against the current server time
- Verify your system clock is correct
- Overdue status updates in real-time on page load
- This is intentional for overdue books
- Return the book, then check it out again if still needed
- Only on-time books can be renewed