Archived
- Backend: Django REST Framework API with Bookmark and Note models - ViewSets with user-scoped querysets and select_related for N+1 prevention - Create/List/Detail/Update/Delete endpoints - Batch delete operations - Unique constraint on user+book+page for bookmarks - IsOwner permission class for object-level access control - Full serializer validation (page > 0, non-empty content, duplicate check) - 30+ pytest-django tests covering CRUD, auth, filtering, edge cases - Frontend: React TypeScript components - AnnotationsContext with useReducer for state management - BookmarkList, NoteList, AddAnnotationForm, AnnotationsDashboard - Inline note editing with immediate save - Batch delete support - API client with JWT auto-refresh interceptors - Paginated query hook for infinite scroll support - Responsive CSS with loading/empty states - Infrastructure: Django project with custom User model, JWT auth, CORS - PostgreSQL database models with proper FK and indexes - Django admin configuration for all models
515 lines
8.9 KiB
CSS
515 lines
8.9 KiB
CSS
/* ============================================================
|
|
Cloud Reader — Book Search & Discovery Styles
|
|
============================================================ */
|
|
|
|
/* --- Reset & Base --- */
|
|
*,
|
|
*::before,
|
|
*::after {
|
|
box-sizing: border-box;
|
|
margin: 0;
|
|
padding: 0;
|
|
}
|
|
|
|
:root {
|
|
--color-bg: #0f1117;
|
|
--color-surface: #1a1d27;
|
|
--color-surface-hover: #242736;
|
|
--color-border: #2a2d3a;
|
|
--color-text: #e1e4ed;
|
|
--color-text-secondary: #8b8fa3;
|
|
--color-primary: #6c8cff;
|
|
--color-primary-hover: #8ba3ff;
|
|
--color-accent-green: #34d399;
|
|
--color-accent-yellow: #fbbf24;
|
|
--color-accent-blue: #60a5fa;
|
|
--color-accent-gray: #6b7280;
|
|
--radius: 8px;
|
|
--radius-lg: 12px;
|
|
--shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
|
|
}
|
|
|
|
body {
|
|
font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
|
|
sans-serif;
|
|
background: var(--color-bg);
|
|
color: var(--color-text);
|
|
line-height: 1.6;
|
|
min-height: 100vh;
|
|
}
|
|
|
|
.app {
|
|
max-width: 960px;
|
|
margin: 0 auto;
|
|
padding: 24px 16px;
|
|
}
|
|
|
|
/* --- Library Header --- */
|
|
.library-header {
|
|
margin-bottom: 24px;
|
|
}
|
|
|
|
.library-header h1 {
|
|
font-size: 1.75rem;
|
|
font-weight: 700;
|
|
color: var(--color-text);
|
|
margin-bottom: 4px;
|
|
}
|
|
|
|
.library-header p {
|
|
color: var(--color-text-secondary);
|
|
font-size: 0.95rem;
|
|
}
|
|
|
|
/* --- Search Bar --- */
|
|
.search-bar {
|
|
position: relative;
|
|
margin-bottom: 16px;
|
|
}
|
|
|
|
.search-icon {
|
|
position: absolute;
|
|
left: 14px;
|
|
top: 50%;
|
|
transform: translateY(-50%);
|
|
color: var(--color-text-secondary);
|
|
pointer-events: none;
|
|
}
|
|
|
|
.search-input {
|
|
width: 100%;
|
|
padding: 12px 16px 12px 44px;
|
|
background: var(--color-surface);
|
|
border: 1px solid var(--color-border);
|
|
border-radius: var(--radius-lg);
|
|
color: var(--color-text);
|
|
font-size: 1rem;
|
|
font-family: inherit;
|
|
outline: none;
|
|
transition: border-color 0.2s;
|
|
}
|
|
|
|
.search-input:focus {
|
|
border-color: var(--color-primary);
|
|
}
|
|
|
|
.search-input::placeholder {
|
|
color: var(--color-text-secondary);
|
|
}
|
|
|
|
/* --- Filters --- */
|
|
.book-filters {
|
|
display: flex;
|
|
flex-wrap: wrap;
|
|
gap: 12px;
|
|
margin-bottom: 20px;
|
|
align-items: flex-end;
|
|
}
|
|
|
|
.filter-group {
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: 4px;
|
|
}
|
|
|
|
.filter-group label {
|
|
font-size: 0.8rem;
|
|
font-weight: 600;
|
|
color: var(--color-text-secondary);
|
|
text-transform: uppercase;
|
|
letter-spacing: 0.04em;
|
|
}
|
|
|
|
.filter-group select {
|
|
padding: 8px 12px;
|
|
background: var(--color-surface);
|
|
border: 1px solid var(--color-border);
|
|
border-radius: var(--radius);
|
|
color: var(--color-text);
|
|
font-size: 0.9rem;
|
|
font-family: inherit;
|
|
outline: none;
|
|
cursor: pointer;
|
|
min-width: 140px;
|
|
}
|
|
|
|
.filter-group select:focus {
|
|
border-color: var(--color-primary);
|
|
}
|
|
|
|
.clear-filters-btn {
|
|
padding: 8px 16px;
|
|
background: transparent;
|
|
border: 1px solid var(--color-border);
|
|
border-radius: var(--radius);
|
|
color: var(--color-text-secondary);
|
|
font-size: 0.85rem;
|
|
cursor: pointer;
|
|
transition: all 0.2s;
|
|
}
|
|
|
|
.clear-filters-btn:hover {
|
|
border-color: var(--color-primary);
|
|
color: var(--color-primary);
|
|
}
|
|
|
|
/* --- Book Grid --- */
|
|
.book-list {
|
|
margin-top: 8px;
|
|
}
|
|
|
|
.result-count {
|
|
color: var(--color-text-secondary);
|
|
font-size: 0.9rem;
|
|
margin-bottom: 12px;
|
|
}
|
|
|
|
.book-grid {
|
|
display: grid;
|
|
grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
|
|
gap: 12px;
|
|
}
|
|
|
|
.book-card {
|
|
display: flex;
|
|
gap: 14px;
|
|
padding: 14px;
|
|
background: var(--color-surface);
|
|
border: 1px solid var(--color-border);
|
|
border-radius: var(--radius-lg);
|
|
cursor: pointer;
|
|
text-align: left;
|
|
color: inherit;
|
|
font-family: inherit;
|
|
transition: all 0.2s;
|
|
width: 100%;
|
|
}
|
|
|
|
.book-card:hover {
|
|
background: var(--color-surface-hover);
|
|
border-color: var(--color-primary);
|
|
transform: translateY(-1px);
|
|
box-shadow: var(--shadow);
|
|
}
|
|
|
|
.book-card-cover {
|
|
flex-shrink: 0;
|
|
width: 60px;
|
|
height: 90px;
|
|
border-radius: 4px;
|
|
overflow: hidden;
|
|
background: var(--color-bg);
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
}
|
|
|
|
.book-card-cover img {
|
|
width: 100%;
|
|
height: 100%;
|
|
object-fit: cover;
|
|
}
|
|
|
|
.cover-placeholder {
|
|
color: var(--color-text-secondary);
|
|
opacity: 0.5;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
}
|
|
|
|
.book-card-info {
|
|
flex: 1;
|
|
min-width: 0;
|
|
}
|
|
|
|
.book-card-title {
|
|
font-size: 1rem;
|
|
font-weight: 600;
|
|
margin-bottom: 2px;
|
|
line-height: 1.3;
|
|
display: -webkit-box;
|
|
-webkit-line-clamp: 2;
|
|
-webkit-box-orient: vertical;
|
|
overflow: hidden;
|
|
}
|
|
|
|
.book-card-author {
|
|
font-size: 0.85rem;
|
|
color: var(--color-text-secondary);
|
|
margin-bottom: 4px;
|
|
}
|
|
|
|
.book-card-genre {
|
|
font-size: 0.8rem;
|
|
color: var(--color-primary);
|
|
margin-bottom: 6px;
|
|
}
|
|
|
|
/* --- Status Badges --- */
|
|
.status-badge {
|
|
display: inline-block;
|
|
font-size: 0.75rem;
|
|
font-weight: 600;
|
|
padding: 2px 8px;
|
|
border-radius: 100px;
|
|
text-transform: capitalize;
|
|
}
|
|
|
|
.status-want_to_read {
|
|
background: rgba(96, 165, 250, 0.15);
|
|
color: var(--color-accent-blue);
|
|
}
|
|
|
|
.status-reading {
|
|
background: rgba(52, 211, 153, 0.15);
|
|
color: var(--color-accent-green);
|
|
}
|
|
|
|
.status-finished {
|
|
background: rgba(107, 114, 128, 0.15);
|
|
color: var(--color-accent-gray);
|
|
}
|
|
|
|
.status-dnf {
|
|
background: rgba(251, 191, 36, 0.15);
|
|
color: var(--color-accent-yellow);
|
|
}
|
|
|
|
/* --- Empty State --- */
|
|
.empty-state {
|
|
text-align: center;
|
|
padding: 48px 24px;
|
|
color: var(--color-text-secondary);
|
|
}
|
|
|
|
.empty-state svg {
|
|
margin-bottom: 16px;
|
|
opacity: 0.4;
|
|
}
|
|
|
|
.empty-state h3 {
|
|
font-size: 1.2rem;
|
|
color: var(--color-text);
|
|
margin-bottom: 8px;
|
|
}
|
|
|
|
.empty-state p {
|
|
max-width: 360px;
|
|
margin: 0 auto;
|
|
line-height: 1.5;
|
|
}
|
|
|
|
/* --- Loading --- */
|
|
.loading-spinner {
|
|
text-align: center;
|
|
padding: 48px 24px;
|
|
color: var(--color-text-secondary);
|
|
}
|
|
|
|
.spinner {
|
|
width: 32px;
|
|
height: 32px;
|
|
border: 3px solid var(--color-border);
|
|
border-top-color: var(--color-primary);
|
|
border-radius: 50%;
|
|
animation: spin 0.7s linear infinite;
|
|
margin: 0 auto 12px;
|
|
}
|
|
|
|
@keyframes spin {
|
|
to {
|
|
transform: rotate(360deg);
|
|
}
|
|
}
|
|
|
|
/* --- Pagination --- */
|
|
.pagination {
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
gap: 16px;
|
|
margin-top: 24px;
|
|
padding-top: 16px;
|
|
border-top: 1px solid var(--color-border);
|
|
}
|
|
|
|
.pagination-btn {
|
|
padding: 8px 18px;
|
|
background: var(--color-surface);
|
|
border: 1px solid var(--color-border);
|
|
border-radius: var(--radius);
|
|
color: var(--color-text);
|
|
font-size: 0.9rem;
|
|
cursor: pointer;
|
|
transition: all 0.2s;
|
|
font-family: inherit;
|
|
}
|
|
|
|
.pagination-btn:hover:not(:disabled) {
|
|
border-color: var(--color-primary);
|
|
color: var(--color-primary);
|
|
}
|
|
|
|
.pagination-btn:disabled {
|
|
opacity: 0.4;
|
|
cursor: not-allowed;
|
|
}
|
|
|
|
.page-indicator {
|
|
font-size: 0.9rem;
|
|
color: var(--color-text-secondary);
|
|
}
|
|
|
|
/* --- Book Detail --- */
|
|
.book-detail {
|
|
max-width: 720px;
|
|
margin: 0 auto;
|
|
}
|
|
|
|
.back-button {
|
|
display: inline-flex;
|
|
align-items: center;
|
|
gap: 6px;
|
|
padding: 8px 14px;
|
|
background: var(--color-surface);
|
|
border: 1px solid var(--color-border);
|
|
border-radius: var(--radius);
|
|
color: var(--color-text-secondary);
|
|
font-size: 0.9rem;
|
|
cursor: pointer;
|
|
margin-bottom: 24px;
|
|
transition: all 0.2s;
|
|
font-family: inherit;
|
|
}
|
|
|
|
.back-button:hover {
|
|
border-color: var(--color-primary);
|
|
color: var(--color-primary);
|
|
}
|
|
|
|
.book-detail-content {
|
|
display: flex;
|
|
gap: 28px;
|
|
}
|
|
|
|
.book-detail-cover {
|
|
flex-shrink: 0;
|
|
width: 180px;
|
|
border-radius: var(--radius);
|
|
overflow: hidden;
|
|
background: var(--color-surface);
|
|
}
|
|
|
|
.book-detail-cover img {
|
|
width: 100%;
|
|
display: block;
|
|
}
|
|
|
|
.cover-placeholder.large {
|
|
width: 180px;
|
|
height: 270px;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
color: var(--color-text-secondary);
|
|
opacity: 0.3;
|
|
}
|
|
|
|
.book-detail-info {
|
|
flex: 1;
|
|
}
|
|
|
|
.book-detail-title {
|
|
font-size: 1.6rem;
|
|
font-weight: 700;
|
|
margin-bottom: 4px;
|
|
line-height: 1.3;
|
|
}
|
|
|
|
.book-detail-author {
|
|
font-size: 1.1rem;
|
|
color: var(--color-text-secondary);
|
|
margin-bottom: 8px;
|
|
}
|
|
|
|
.book-detail-genre {
|
|
display: inline-block;
|
|
font-size: 0.85rem;
|
|
color: var(--color-primary);
|
|
margin-bottom: 12px;
|
|
}
|
|
|
|
.book-detail-status {
|
|
margin-bottom: 20px;
|
|
font-size: 0.95rem;
|
|
color: var(--color-text-secondary);
|
|
}
|
|
|
|
.book-detail-status .status-badge {
|
|
margin-left: 6px;
|
|
}
|
|
|
|
.book-detail-description {
|
|
margin-bottom: 20px;
|
|
}
|
|
|
|
.book-detail-description h2 {
|
|
font-size: 1.1rem;
|
|
font-weight: 600;
|
|
margin-bottom: 8px;
|
|
}
|
|
|
|
.book-detail-description p {
|
|
color: var(--color-text-secondary);
|
|
line-height: 1.7;
|
|
}
|
|
|
|
.book-detail-meta {
|
|
font-size: 0.85rem;
|
|
color: var(--color-text-secondary);
|
|
opacity: 0.7;
|
|
}
|
|
|
|
.book-detail-meta p {
|
|
margin-bottom: 4px;
|
|
}
|
|
|
|
/* --- Error State --- */
|
|
.error-state {
|
|
text-align: center;
|
|
padding: 48px 24px;
|
|
color: #ef4444;
|
|
}
|
|
|
|
.error-state p {
|
|
margin-bottom: 16px;
|
|
}
|
|
|
|
/* --- Responsive --- */
|
|
@media (max-width: 640px) {
|
|
.book-grid {
|
|
grid-template-columns: 1fr;
|
|
}
|
|
|
|
.book-detail-content {
|
|
flex-direction: column;
|
|
}
|
|
|
|
.book-detail-cover {
|
|
width: 140px;
|
|
}
|
|
|
|
.cover-placeholder.large {
|
|
width: 140px;
|
|
height: 210px;
|
|
}
|
|
|
|
.book-filters {
|
|
flex-direction: column;
|
|
}
|
|
|
|
.filter-group select {
|
|
width: 100%;
|
|
}
|
|
} |