mirror of
https://github.com/calibrain/shelfmark.git
synced 2026-09-24 19:50:29 +01:00
This PR was coauthored by alexhb1 and davidemarcoli. It builds on the FE rework created by alex, but adds a myriad of additional tweaks and optimizations to make the frontend feel modern, fast, and responsive. The summary of the changes is as follows: ### Architecture Changes React/TypeScript Migration: Refactored frontend from template/JS structure to React/TypeScript application for better maintainability and scalability WebSocket Integration: Implemented real-time updates for download status and progress with automatic fallback to polling Gevent Worker: Configured production WebSocket support ### UI/UX Improvements <img width="1502" height="890" alt="Screenshot 2025-11-10 at 10 02 59 AM" src="https://github.com/user-attachments/assets/86bf8649-623f-413c-b8e5-656e687e55a8" /> Downloads Sidebar: Replaced bottom downloads section with sidebar interface for better organization <img width="201" height="450" alt="Screenshot 2025-11-10 at 10 07 52 AM" src="https://github.com/user-attachments/assets/92b98e7c-c3bc-4b7e-80f1-252c3a760e33" /> Status Badges: Color-coded download status indicators instead of plain text Pinned Header: Fixed header position for consistent navigation Enhanced Book Cards: Improved layout and hover states with info modal button <img width="1474" height="899" alt="Screenshot 2025-11-10 at 10 08 18 AM" src="https://github.com/user-attachments/assets/9216d8a3-f662-434d-80e6-2a69b96abc31" /> Download Progress: Circular progress indicator on download buttons Toast Notifications: Added user feedback for actions Spinner Feedback: Loading indicators on search and download buttons Animations: Smooth transitions and fluid progress updates ### Mobile & Responsive Design Mobile-friendly Layouts: Optimized book cards and search interface for mobile <img width="225" height="450" alt="Screenshot 2025-11-10 at 10 05 49 AM" src="https://github.com/user-attachments/assets/c8236c1c-5837-4309-9577-46db7292a54b" /> Keyboard Handling: Improved mobile keyboard behavior with proper input types PWA Improvements: Enhanced progressive web app functionality Responsive Search: Better search box width and positioning across devices ### Developer Experience Development Mode: Separate frontend dev server that works with existing backend container Makefile: Added build automation and development commands Documentation: Updated README with frontend architecture details ### Bug Fixes Fixed "Clear completed" functionality Fixed dark mode toggle text Fixed sticky header behavior Fixed mobile search box positioning Removed active downloads requirement for initial state view ### Additional Features ESC Key: Close downloads sidebar with ESC key Calibre-Web Button: Direct link to Calibre-Web instance <img width="282" height="83" alt="Screenshot 2025-11-11 at 9 38 05 AM" src="https://github.com/user-attachments/assets/273075be-9743-4e13-9e48-5bf498f6c067" /> Granular Status Tracking: More detailed download progress information obtained via websockets --------- Co-authored-by: Alex <alex.bilbie1@gmail.com> Co-authored-by: Zack Yancey <yanceyz@proton.me> Co-authored-by: davidemarcoli <davide@marcoli.ch>
560 lines
13 KiB
CSS
560 lines
13 KiB
CSS
/* Base styles and CSS reset */
|
|
@tailwind base;
|
|
@tailwind components;
|
|
@tailwind utilities;
|
|
|
|
/* Disable transitions on initial load to prevent flash */
|
|
html.preload *,
|
|
html.preload *::before,
|
|
html.preload *::after {
|
|
transition: none !important;
|
|
animation-duration: 0s !important;
|
|
}
|
|
|
|
/* Smooth theme transitions for all elements using CSS variables */
|
|
header, footer, section,
|
|
input, select, textarea, button,
|
|
.details-container, .modal-overlay {
|
|
transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
|
|
}
|
|
|
|
:root {
|
|
/* Light theme variables */
|
|
--primary-color: oklch(44.3% 0.11 240.79);
|
|
--primary-dark: oklch(39.1% 0.09 240.876);
|
|
--text-color: #333;
|
|
--background-color: #f8f8f8;
|
|
--border-color: #e5e5e5;
|
|
--loading-overlay: rgba(0, 0, 0, 0.5);
|
|
--card-background: #fff;
|
|
--input-background: #fff;
|
|
--heading-color: #333;
|
|
|
|
/* Modern UI alias tokens */
|
|
--bg: var(--background-color);
|
|
--text: var(--text-color);
|
|
--border-muted: var(--border-color);
|
|
--bg-soft: var(--card-background);
|
|
}
|
|
|
|
[data-theme="dark"] {
|
|
/* Dark theme variables with improved contrast */
|
|
--background-color: #121212;
|
|
--text-color: #ffffff;
|
|
--heading-color: #ffffff;
|
|
--card-background: #1e1e1e;
|
|
--border-color: #404040;
|
|
--input-background: #2d2d2d;
|
|
}
|
|
|
|
* {
|
|
margin: 0;
|
|
padding: 0;
|
|
box-sizing: border-box;
|
|
}
|
|
|
|
/* Typography */
|
|
html, body {
|
|
min-height: 100vh;
|
|
/* Support for iOS notch/dynamic island - extend to full viewport */
|
|
min-height: 100dvh;
|
|
margin: 0;
|
|
padding: 0;
|
|
}
|
|
|
|
html {
|
|
/* Transition on root element ensures smooth theme changes */
|
|
transition: background-color 0.2s ease, color 0.2s ease;
|
|
/* Extend background color to safe areas (status bar area) */
|
|
background-color: var(--background-color);
|
|
}
|
|
|
|
body {
|
|
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
|
|
line-height: 1.6;
|
|
color: var(--text-color);
|
|
background: var(--background-color);
|
|
transition: background-color 0.2s ease, color 0.2s ease;
|
|
display: flex;
|
|
flex-direction: column;
|
|
/* Safe areas handled by individual components (Header, Footer, Sidebar) */
|
|
/* Left/right safe areas still needed for notched devices in landscape */
|
|
padding-left: env(safe-area-inset-left);
|
|
padding-right: env(safe-area-inset-right);
|
|
}
|
|
|
|
#root {
|
|
display: flex;
|
|
flex-direction: column;
|
|
flex: 1;
|
|
min-height: 100vh;
|
|
min-height: 100dvh;
|
|
transition: background-color 0.2s ease;
|
|
background-color: var(--background-color);
|
|
}
|
|
|
|
main {
|
|
flex: 1;
|
|
min-height: 100%;
|
|
background: var(--background-color);
|
|
display: flex;
|
|
flex-direction: column;
|
|
transition: background-color 0.2s ease;
|
|
}
|
|
|
|
/* Layout */
|
|
footer {
|
|
text-align: center;
|
|
padding: 1rem;
|
|
margin-top: auto;
|
|
}
|
|
|
|
.spinner {
|
|
display: inline-block;
|
|
width: 1.25rem;
|
|
height: 1.25rem;
|
|
border: 3px solid rgba(255, 255, 255, 0.3);
|
|
border-radius: 50%;
|
|
border-top-color: white;
|
|
animation: spin 1s linear infinite;
|
|
}
|
|
|
|
@keyframes spin {
|
|
to { transform: rotate(360deg); }
|
|
}
|
|
|
|
@keyframes slide-up {
|
|
from {
|
|
opacity: 0;
|
|
transform: translateY(30px);
|
|
}
|
|
to {
|
|
opacity: 1;
|
|
transform: translateY(0);
|
|
}
|
|
}
|
|
|
|
@keyframes fade-in-up {
|
|
from {
|
|
opacity: 0;
|
|
transform: translateY(10px);
|
|
}
|
|
to {
|
|
opacity: 1;
|
|
transform: translateY(0);
|
|
}
|
|
}
|
|
|
|
.animate-slide-up {
|
|
animation: slide-up 0.5s ease-out;
|
|
}
|
|
|
|
.animate-fade-in-up {
|
|
animation: fade-in-up 0.4s ease-out;
|
|
}
|
|
|
|
/* Button spinner styles */
|
|
#search-spinner {
|
|
border-radius: 50%;
|
|
animation: spin 0.8s linear infinite;
|
|
transition: opacity 0.2s ease;
|
|
}
|
|
|
|
#search-icon {
|
|
transition: opacity 0.2s ease;
|
|
}
|
|
|
|
#search-button:disabled {
|
|
cursor: not-allowed;
|
|
}
|
|
|
|
/* Download button spinner styles */
|
|
.download-spinner {
|
|
border-radius: 50%;
|
|
animation: spin 0.8s linear infinite;
|
|
transition: opacity 0.2s ease;
|
|
flex-shrink: 0;
|
|
}
|
|
|
|
.details-spinner {
|
|
border-radius: 50%;
|
|
animation: spin 0.8s linear infinite;
|
|
transition: opacity 0.2s ease;
|
|
flex-shrink: 0;
|
|
}
|
|
|
|
/* Modal Styles */
|
|
.modal-overlay {
|
|
display: none;
|
|
position: fixed;
|
|
top: 0;
|
|
left: 0;
|
|
width: 100%;
|
|
height: 100%;
|
|
background: var(--loading-overlay);
|
|
z-index: 1000;
|
|
}
|
|
|
|
.modal-overlay.active {
|
|
display: flex;
|
|
justify-content: center;
|
|
align-items: center;
|
|
}
|
|
|
|
.details-container {
|
|
background: var(--card-background);
|
|
color: var(--text-color);
|
|
padding: 1.5rem;
|
|
border-radius: 4px;
|
|
max-width: 800px;
|
|
width: 90%;
|
|
max-height: 90vh;
|
|
overflow-y: auto;
|
|
position: relative;
|
|
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
|
|
}
|
|
|
|
.details-header {
|
|
display: grid;
|
|
grid-template-columns: auto 1fr;
|
|
gap: 2rem;
|
|
margin-bottom: 1.5rem;
|
|
}
|
|
|
|
.details-header img {
|
|
max-width: 200px;
|
|
height: auto;
|
|
border-radius: 4px;
|
|
}
|
|
|
|
.details-info h3 {
|
|
margin-bottom: 1rem;
|
|
color: var(--text-color);
|
|
}
|
|
|
|
.details-info p {
|
|
margin-bottom: 0.5rem;
|
|
}
|
|
|
|
.details-actions {
|
|
display: flex;
|
|
gap: 1rem;
|
|
margin-top: 1.5rem;
|
|
justify-content: flex-end;
|
|
}
|
|
|
|
.details-actions button {
|
|
padding: 0.75rem 1.5rem;
|
|
border: none;
|
|
border-radius: 4px;
|
|
cursor: pointer;
|
|
font-size: 1rem;
|
|
transition: background-color 0.3s ease;
|
|
}
|
|
|
|
.details-actions button:first-child {
|
|
background: var(--primary-color);
|
|
color: white;
|
|
}
|
|
|
|
.details-actions button:last-child {
|
|
background: #f5f5f5;
|
|
color: var(--text-color);
|
|
}
|
|
|
|
.details-actions button:hover {
|
|
opacity: 0.9;
|
|
}
|
|
|
|
/* Responsive Design */
|
|
@media (max-width: 768px) {
|
|
.details-header {
|
|
grid-template-columns: 1fr;
|
|
text-align: center;
|
|
}
|
|
|
|
.details-header img {
|
|
margin: 0 auto;
|
|
}
|
|
|
|
.details-actions {
|
|
flex-direction: column;
|
|
}
|
|
|
|
/* Minimal equal padding for details container on mobile */
|
|
.details-container {
|
|
padding: 1rem;
|
|
}
|
|
}
|
|
|
|
/* Accessibility */
|
|
.visually-hidden {
|
|
position: absolute;
|
|
width: 1px;
|
|
height: 1px;
|
|
padding: 0;
|
|
margin: -1px;
|
|
overflow: hidden;
|
|
clip: rect(0, 0, 0, 0);
|
|
white-space: nowrap;
|
|
border: 0;
|
|
}
|
|
|
|
/* Toast Notification Styles */
|
|
#toast-container {
|
|
max-width: 400px;
|
|
pointer-events: none;
|
|
}
|
|
|
|
.toast-notification {
|
|
opacity: 0;
|
|
transform: translateX(100%);
|
|
max-width: 100%;
|
|
word-wrap: break-word;
|
|
pointer-events: auto;
|
|
}
|
|
|
|
.toast-notification.toast-visible {
|
|
opacity: 1;
|
|
transform: translateX(0);
|
|
}
|
|
|
|
/* Disabled button styles for queued/downloading states */
|
|
button:disabled {
|
|
opacity: 0.6;
|
|
cursor: not-allowed;
|
|
}
|
|
|
|
/* Search wrapper and input - base styles */
|
|
.search-wrapper {
|
|
width: 100%;
|
|
}
|
|
|
|
.search-input {
|
|
min-width: 0; /* Allow input to shrink on mobile flex containers */
|
|
}
|
|
|
|
/* ============================================
|
|
MOBILE: Full viewport width, no fixed widths
|
|
============================================ */
|
|
@media (max-width: 639px) {
|
|
/* Break search section out to full viewport width, escaping the centered main container */
|
|
#search-section {
|
|
position: relative;
|
|
left: 50%;
|
|
right: 50%;
|
|
margin-left: -50vw;
|
|
margin-right: -50vw;
|
|
width: 100vw;
|
|
padding-left: 1rem;
|
|
padding-right: 1rem;
|
|
box-sizing: border-box;
|
|
}
|
|
|
|
/* Remove any width constraints on search wrapper */
|
|
.search-wrapper {
|
|
width: 100% !important;
|
|
min-width: 0 !important;
|
|
max-width: none !important;
|
|
}
|
|
|
|
/* Ensure flex containers are full width */
|
|
.search-wrapper > .flex,
|
|
#search-filters {
|
|
width: 100%;
|
|
max-width: 100%;
|
|
min-width: 0;
|
|
}
|
|
}
|
|
|
|
/* ============================================
|
|
DESKTOP: Fixed px widths for consistency
|
|
============================================ */
|
|
/* Medium screens (small tablets/large phones): 640px - 1023px */
|
|
@media (min-width: 640px) and (max-width: 1023px) {
|
|
.search-wrapper {
|
|
width: 600px; /* Fixed width for medium screens */
|
|
max-width: 600px; /* Prevent expansion */
|
|
}
|
|
}
|
|
|
|
/* Large screens (desktop): 1024px+ */
|
|
@media (min-width: 1024px) {
|
|
.search-wrapper {
|
|
width: 800px; /* Fixed width for large screens */
|
|
max-width: 800px; /* Prevent expansion */
|
|
}
|
|
}
|
|
|
|
/* Search section base styles - always center horizontally on desktop */
|
|
#search-section {
|
|
display: flex;
|
|
flex-direction: column;
|
|
align-items: center; /* Keep search box centered horizontally */
|
|
}
|
|
|
|
/* Center search section vertically when in initial state (no results, no queue) */
|
|
/* Responsive to different window sizes */
|
|
.search-initial-state {
|
|
flex: 1;
|
|
justify-content: center; /* Only add vertical centering in initial state */
|
|
}
|
|
|
|
/* Mobile-friendly book card layout */
|
|
/* On mobile (below 640px), use horizontal layout: image left, text right, buttons below */
|
|
/* Desktop remains unchanged - full width, full height artwork via Tailwind classes */
|
|
@media (max-width: 639px) {
|
|
.book-card-content {
|
|
flex-direction: row !important;
|
|
gap: 0.75rem !important;
|
|
align-items: flex-start;
|
|
}
|
|
|
|
.book-card-cover {
|
|
width: 50% !important;
|
|
height: auto !important;
|
|
flex-shrink: 0;
|
|
aspect-ratio: 2/3; /* Maintain book cover proportions */
|
|
}
|
|
|
|
.book-card-text {
|
|
width: 50% !important;
|
|
flex-shrink: 0;
|
|
padding-left: 0.5rem;
|
|
}
|
|
|
|
.book-card-buttons {
|
|
width: 100%;
|
|
margin-top: 0.5rem;
|
|
}
|
|
}
|
|
|
|
/* Desktop: align details and buttons to bottom, artwork stays at top */
|
|
@media (min-width: 640px) {
|
|
.book-card {
|
|
/* Ensure card can grow to accommodate content */
|
|
display: flex;
|
|
flex-direction: column;
|
|
height: 100%; /* Ensure card fills grid cell height */
|
|
}
|
|
|
|
.book-card-content {
|
|
/* Grow to fill available space, pushing buttons to bottom */
|
|
flex: 1;
|
|
display: flex;
|
|
flex-direction: column;
|
|
min-height: 0; /* Allow flex shrinking */
|
|
}
|
|
|
|
.book-card-cover {
|
|
/* Artwork stays at top, doesn't grow */
|
|
flex-shrink: 0;
|
|
}
|
|
|
|
.book-card-text {
|
|
/* Push text to bottom of content area, right above buttons */
|
|
margin-top: auto;
|
|
flex: 0 0 auto !important; /* Override flex-1 from HTML, don't grow or shrink */
|
|
}
|
|
}
|
|
|
|
/* Fix download button text clipping on mobile */
|
|
.download-button-text {
|
|
white-space: nowrap;
|
|
overflow: visible;
|
|
flex-shrink: 0;
|
|
display: inline-block;
|
|
}
|
|
|
|
/* Ensure download buttons can accommodate their text content */
|
|
[data-action="download"],
|
|
#download-button {
|
|
min-width: 0;
|
|
overflow: visible;
|
|
width: 100%;
|
|
}
|
|
|
|
/* On mobile, ensure button text is fully visible */
|
|
@media (max-width: 639px) {
|
|
/* Ensure button container allows overflow */
|
|
.book-card-buttons {
|
|
overflow: visible;
|
|
}
|
|
|
|
/* Make sure download buttons can expand to fit their content */
|
|
[data-action="download"],
|
|
#download-button {
|
|
min-width: 0;
|
|
flex: 1 1 auto;
|
|
overflow: visible;
|
|
box-sizing: border-box;
|
|
}
|
|
|
|
/* Make text span flexible to use available space */
|
|
.download-button-text {
|
|
white-space: nowrap;
|
|
overflow: visible;
|
|
/* Take up all available space in the button, allow shrinking if needed */
|
|
flex: 1 1 0%;
|
|
min-width: 0;
|
|
display: block;
|
|
/* Center text within its available space */
|
|
text-align: center;
|
|
box-sizing: border-box;
|
|
/* Force layout recalculation by ensuring the element is treated as a flex item */
|
|
position: relative;
|
|
}
|
|
|
|
/* Ensure button's flex container properly distributes space on mobile */
|
|
[data-action="download"].flex,
|
|
#download-button.flex {
|
|
/* Ensure gap doesn't cause issues */
|
|
gap: 0.5rem;
|
|
}
|
|
|
|
/* Ensure spinner doesn't interfere with text layout */
|
|
.download-spinner {
|
|
flex-shrink: 0;
|
|
flex-grow: 0;
|
|
width: 1rem;
|
|
height: 1rem;
|
|
}
|
|
}
|
|
|
|
/* Sticky Header with Gradient Fade Effect */
|
|
.header-with-fade {
|
|
overflow: visible;
|
|
}
|
|
|
|
.header-with-fade::after {
|
|
content: '';
|
|
position: absolute;
|
|
bottom: -20px;
|
|
left: 0;
|
|
right: 0;
|
|
height: 20px;
|
|
/* Use background-color instead of gradient with CSS variables for smooth transitions */
|
|
background: var(--bg);
|
|
opacity: 1;
|
|
pointer-events: none;
|
|
/* Create fade effect using mask instead of gradient */
|
|
mask-image: linear-gradient(to bottom, black 0%, black 20%, transparent 100%);
|
|
-webkit-mask-image: linear-gradient(to bottom, black 0%, black 20%, transparent 100%);
|
|
transition: background-color 0.2s ease, opacity 0.2s ease;
|
|
}
|
|
|
|
/* Skeleton Loader Animation */
|
|
@keyframes shimmer {
|
|
0% {
|
|
background-position: -200% 0;
|
|
}
|
|
100% {
|
|
background-position: 200% 0;
|
|
}
|
|
}
|
|
|
|
.animate-pulse {
|
|
background-size: 200% 100%;
|
|
animation: shimmer 2s ease-in-out infinite;
|
|
}
|