feat: redesign admin album cards as grid tiles with large cover images

Replace the list-style album cards with a visual grid layout:
- Albums shown as tiles with square cover images (aspect-ratio: 1)
- Grid auto-fills with min 160px columns
- Edit/remove buttons appear as overlay on hover
- Album name and photo count shown below the cover
- Much more compact — multiple albums visible without scrolling
This commit is contained in:
ralksta
2026-05-29 17:24:53 +02:00
parent b4fa37d680
commit 276e9b3d68
2 changed files with 94 additions and 67 deletions

View File

@@ -487,88 +487,115 @@
color: var(--admin-text-secondary); color: var(--admin-text-secondary);
} }
/* Album List */ /* Album Grid */
.album-list { .album-list {
display: flex; display: grid;
flex-direction: column; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
gap: 0.4rem;
}
.album-card {
background: var(--admin-bg-raised);
border: 1px solid var(--admin-border);
border-radius: 8px;
overflow: hidden;
transition: border-color 0.15s;
}
.album-card:hover {
border-color: var(--admin-border-hover);
}
.album-card-main {
display: flex;
align-items: center;
justify-content: space-between;
padding: 0.6rem 0.75rem;
gap: 0.75rem; gap: 0.75rem;
} }
.album-card-thumb { .album-tile {
flex-shrink: 0; background: var(--admin-bg-raised);
width: 48px; border: 1px solid var(--admin-border);
height: 48px; border-radius: 10px;
border-radius: 6px;
overflow: hidden; overflow: hidden;
background: var(--admin-bg-elevated); transition: border-color 0.15s, box-shadow 0.15s;
} }
.album-card-thumb img { .album-tile:hover {
border-color: var(--admin-border-hover);
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}
.album-tile-cover {
position: relative;
aspect-ratio: 1;
background: var(--admin-bg-elevated);
overflow: hidden;
}
.album-tile-cover img {
width: 100%; width: 100%;
height: 100%; height: 100%;
object-fit: cover; object-fit: cover;
} }
.album-card-info { .album-tile-placeholder {
width: 100%;
height: 100%;
display: flex; display: flex;
align-items: baseline; align-items: center;
gap: 0.5rem; justify-content: center;
min-width: 0; font-size: 2rem;
flex: 1;
} }
.album-card-name { .album-tile-overlay {
position: absolute;
inset: 0;
background: rgba(0, 0, 0, 0.5);
display: flex;
align-items: center;
justify-content: center;
gap: 0.5rem;
opacity: 0;
transition: opacity 0.15s;
}
.album-tile:hover .album-tile-overlay {
opacity: 1;
}
.album-tile-btn {
background: rgba(255, 255, 255, 0.15);
backdrop-filter: blur(4px);
border: 1px solid rgba(255, 255, 255, 0.25);
color: #fff;
width: 32px;
height: 32px;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
font-size: 0.85rem; font-size: 0.85rem;
transition: background 0.1s;
}
.album-tile-btn:hover {
background: rgba(255, 255, 255, 0.3);
}
.album-tile-info {
padding: 0.5rem 0.6rem;
display: flex;
flex-direction: column;
gap: 0.1rem;
}
.album-tile-name {
font-size: 0.8rem;
font-weight: 500; font-weight: 500;
white-space: nowrap; white-space: nowrap;
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
} }
.album-card-count { .album-tile-count {
font-size: 0.7rem; font-size: 0.7rem;
color: var(--admin-text-muted); color: var(--admin-text-muted);
white-space: nowrap;
} }
.album-card-actions { .album-tile-details {
display: flex;
align-items: center;
gap: 0.25rem;
flex-shrink: 0;
}
.album-card-details {
padding: 0.75rem; padding: 0.75rem;
border-top: 1px solid var(--admin-border); border-top: 1px solid var(--admin-border);
background: var(--admin-bg); background: var(--admin-bg);
} }
.album-card-uuid { .album-tile-uuid {
margin-top: 0.5rem; margin-top: 0.5rem;
} }
.album-card-uuid code { .album-tile-uuid code {
font-size: 0.7rem; font-size: 0.7rem;
color: var(--admin-text-muted); color: var(--admin-text-muted);
word-break: break-all; word-break: break-all;

View File

@@ -791,36 +791,36 @@ function AlbumCard({ album, name, count, thumbnailId, onRemove, onUpdate }: Albu
const [expanded, setExpanded] = useState(false); const [expanded, setExpanded] = useState(false);
return ( return (
<div className="album-card"> <div className="album-tile">
<div className="album-card-main"> <div className="album-tile-cover">
{thumbnailId && ( {thumbnailId ? (
<div className="album-card-thumb"> <img
<img src={`/api/admin/thumbnail/${thumbnailId}`}
src={`/api/admin/thumbnail/${thumbnailId}`} alt=""
alt="" loading="lazy"
loading="lazy" />
/> ) : (
</div> <div className="album-tile-placeholder">📷</div>
)} )}
<div className="album-card-info"> <div className="album-tile-overlay">
<span className="album-card-name">{album.title || name}</span>
<span className="album-card-count">{count} photos</span>
</div>
<div className="album-card-actions">
<button <button
className="admin-btn-icon" className="album-tile-btn"
onClick={() => setExpanded(!expanded)} onClick={() => setExpanded(!expanded)}
title="Edit details" title="Edit details"
> >
✏️ ✏️
</button> </button>
<button className="admin-btn-icon" onClick={onRemove} title="Remove"> <button className="album-tile-btn" onClick={onRemove} title="Remove">
× ×
</button> </button>
</div> </div>
</div> </div>
<div className="album-tile-info">
<span className="album-tile-name">{album.title || name}</span>
<span className="album-tile-count">{count} photos</span>
</div>
{expanded && ( {expanded && (
<div className="album-card-details"> <div className="album-tile-details">
<div className="admin-field"> <div className="admin-field">
<label>Title override</label> <label>Title override</label>
<input <input
@@ -846,7 +846,7 @@ function AlbumCard({ album, name, count, thumbnailId, onRemove, onUpdate }: Albu
placeholder="Leave empty for public" placeholder="Leave empty for public"
/> />
</div> </div>
<div className="album-card-uuid"> <div className="album-tile-uuid">
<code>{album.id}</code> <code>{album.id}</code>
</div> </div>
</div> </div>