Files
Oxicloud/static/css/views/photos.css
T
Claude 75ee9b7cc4 feat(photos): justified (aspect-preserving) layout option
Adds a Grid/Justified toggle to the photos toolbar. Justified mode packs
tiles into Flickr-style rows scaled to the container width using each
photo's real aspect ratio (from the new /api/photos width/height, falling
back to 1:1 when missing). It composes with the virtualized renderer:
per-group materialization and the off-screen spacer height estimates are
both layout-aware. The choice persists in localStorage.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JW6ghFMDtnRYuYNzZhb47M
2026-06-19 10:21:00 +00:00

335 lines
7.6 KiB
CSS

/* Photos timeline view */
.photos-container {
padding: 0;
display: none;
}
.photos-container.active {
display: block;
}
/* Virtualized timeline: each date-group is a <section>; its grid is
materialized (tiles inserted) only while near the viewport — see photos.js. */
.photos-group {
display: block;
}
/* Toolbar with group mode toggle */
.photos-toolbar {
display: flex;
align-items: center;
justify-content: flex-end;
gap: var(--space-3);
padding: var(--space-2) var(--space-2) var(--space-1);
}
/* Toggle buttons — wider for text labels */
.photos-toolbar .toggle-btn {
width: auto;
padding: 0 var(--space-3-5);
font-size: var(--text-sm);
font-weight: var(--weight-medium);
}
/* Group header */
.photos-day-header {
padding: var(--space-4) var(--space-2) var(--space-2-5);
font-size: 15px;
font-weight: var(--weight-semibold);
color: var(--color-text);
}
.photos-day-header .photos-day-count {
font-weight: var(--weight-normal);
color: var(--color-text-faint);
font-size: var(--text-sm);
margin-left: var(--space-2);
}
/* Photo grid — base (daily mode) */
.photos-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
gap: var(--space-3);
padding: 0 var(--space-2);
margin-bottom: var(--space-4);
}
/* Justified (aspect-preserving) layout — the grid becomes a column of rows;
tile sizes are set inline by photos.js (see _justifiedRows). */
.photos-layout-justified .photos-grid {
display: flex;
flex-direction: column;
gap: var(--space-2);
}
.photos-jrow {
display: flex;
flex-direction: row;
gap: var(--space-2);
}
.photos-layout-justified .photo-tile {
aspect-ratio: auto;
flex: 0 0 auto;
}
/* Monthly mode — larger tiles, more breathing room */
.photos-group-monthly .photos-grid {
grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
gap: var(--space-3-5);
}
.photos-group-monthly .photos-day-header {
font-size: 17px;
padding: var(--space-5) var(--space-2) var(--space-3);
}
/* Yearly mode — smaller tiles, more items visible */
.photos-group-yearly .photos-grid {
grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
gap: var(--space-2-5);
}
.photos-group-yearly .photos-day-header {
font-size: var(--text-xl);
padding: var(--space-6) var(--space-2) var(--space-3-5);
}
/* Individual photo tile */
.photo-tile {
position: relative;
aspect-ratio: 1;
overflow: hidden;
border-radius: var(--radius-2xl);
border: 2px solid var(--color-border);
cursor: pointer;
background: var(--color-bg-muted);
box-shadow: 0 1px 3px var(--color-shadow-xs);
transition:
transform 0.2s ease,
box-shadow 0.2s ease,
border-color 0.2s ease;
}
.photo-tile img {
width: 100%;
height: 100%;
object-fit: cover;
border-radius: var(--radius-xl);
opacity: 0;
transition:
opacity 0.4s ease,
transform 0.2s ease;
}
.photo-tile img.is-loaded {
opacity: 1;
}
.photo-tile:hover {
transform: translateY(-2px);
box-shadow: 0 5px 15px var(--color-shadow-sm);
border-color: var(--color-border-medium);
}
.photo-tile:focus-visible {
outline: 2px solid var(--color-accent);
outline-offset: 2px;
}
.photo-tile:hover img {
transform: scale(1.03);
}
/* Selection checkbox */
.photo-tile .photo-check {
position: absolute;
top: 6px;
left: 6px;
width: 22px;
height: 22px;
border-radius: 50%;
border: 2px solid var(--color-photo-check-border);
background: var(--color-shadow-2xl);
opacity: 0;
transition: opacity 0.15s ease;
display: flex;
align-items: center;
justify-content: center;
color: var(--color-danger-text);
font-size: var(--text-2xs);
z-index: 2;
}
.photo-tile:hover .photo-check,
.photo-tile.selected .photo-check {
opacity: 1;
}
.photo-tile.selected .photo-check {
background: var(--color-accent);
border-color: var(--color-accent);
}
.photo-tile.selected {
border-color: var(--color-accent);
background: var(--color-item-selected);
box-shadow:
0 0 0 1px var(--color-accent-ring-dark),
0 4px 12px var(--color-accent-ring);
}
.photo-tile.selected img {
transform: scale(0.95);
}
/* Video badge */
.photo-tile .video-badge {
position: absolute;
bottom: 6px;
right: 6px;
width: 28px;
height: 28px;
border-radius: 50%;
background: var(--color-overlay-video);
display: flex;
align-items: center;
justify-content: center;
color: var(--color-danger-text);
font-size: var(--text-xs);
z-index: 2;
}
/* Duration badge for videos */
.photo-tile .video-duration {
position: absolute;
bottom: 6px;
left: 6px;
font-size: var(--text-2xs);
color: var(--color-danger-text);
background: var(--color-overlay-video);
padding: var(--space-0-5) var(--space-1-5);
border-radius: var(--radius-sm);
z-index: 2;
}
/* Empty state */
.photos-empty {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding: var(--space-20) var(--space-5);
text-align: center;
color: var(--color-text-faint);
}
.photos-empty i {
font-size: 56px;
margin-bottom: var(--space-4);
color: var(--color-border-medium);
}
.photos-empty p {
margin: var(--space-1) 0;
font-size: 15px;
}
.photos-empty .photos-empty-title {
font-size: var(--text-lg);
font-weight: var(--weight-semibold);
color: var(--color-text-subtle);
}
/* Infinite scroll sentinel */
.photos-sentinel {
height: 1px;
width: 100%;
}
/* Loading spinner */
.photos-loading {
display: flex;
align-items: center;
justify-content: center;
padding: var(--space-6);
color: var(--color-text-faint);
font-size: var(--text-base);
gap: var(--space-2);
}
.photos-loading i {
animation: spin 1s linear infinite;
}
/* @keyframes spin → base/animations.css (canonical, loaded via main.css). */
/* Selection bar */
.photos-selection-bar {
position: fixed;
bottom: 20px;
left: 50%;
transform: translateX(-50%);
background: var(--color-multiselect-bg);
color: var(--color-multiselect-text);
padding: var(--space-2-5) var(--space-5);
border-radius: var(--radius-2xl);
display: flex;
align-items: center;
gap: var(--space-4);
box-shadow: 0 8px 30px var(--color-shadow-3xl);
z-index: 1000;
font-size: var(--text-base);
}
.photos-selection-bar button {
background: none;
border: none;
color: var(--color-multiselect-text);
cursor: pointer;
padding: var(--space-1-5) var(--space-2-5);
border-radius: var(--radius-md);
font-size: var(--text-base);
transition: background 0.15s;
}
.photos-selection-bar button:hover {
background: var(--color-multiselect-action-hover);
}
.photos-selection-bar .selection-count {
font-weight: var(--weight-semibold);
}
/* Responsive */
@media (max-width: 768px) {
.photos-grid {
grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
gap: var(--space-0-5);
padding: 0 var(--space-0-5);
margin-bottom: var(--space-2);
}
.photos-group-monthly .photos-grid {
grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
}
.photos-group-yearly .photos-grid {
grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
}
.photo-tile .photo-check {
opacity: 1;
}
.photos-day-header {
font-size: var(--text-base);
padding: var(--space-2-5) var(--space-1) var(--space-1-5);
}
.photos-toolbar {
padding: var(--space-1-5) var(--space-1) var(--space-0-5);
}
}