Files
Glimmer/internal/server/static/style.css
T
lucioandClaude Opus 4.8 87477556e2 Redesign admin Pastes page as Xiaohongshu-style cards with previews
- Replace the pastes table with a masonry card grid: each card shows the
  paste's first image as a thumbnail, a short plain-text summary, meta badges,
  and Copy link / Edit / QR / Delete actions.
- Clicking anywhere on a card (except the action buttons) opens an in-page
  preview modal with the rendered paste in an iframe; it can be expanded to the
  main content area or closed (Esc/backdrop/button). Keyboard accessible.
- Generate and cache 512px (long side) JPEG thumbnails for uploaded images on
  first request (GET /uploads/thumb/{filename}); also generated at upload time
  and invalidated on resize/delete. WebP falls back to the original.
- Sync the public paste pages (bin_view, bin_token) to the dark theme so they
  match the rest of the app and the preview iframe.
- Relax framing headers to same-origin (X-Frame-Options SAMEORIGIN,
  frame-ancestors 'self') so the same-origin preview iframe can load; cross-site
  framing stays blocked.
- Document the new thumbnail route in the README routes table.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
2026-06-05 00:23:51 -07:00

645 lines
12 KiB
CSS

:root {
--pico-font-size: 16px;
}
body > nav {
padding: 0.5rem 1rem;
}
.container {
max-width: 640px;
margin: 0 auto;
padding: 2rem 1rem;
}
.result-box {
background: var(--pico-card-background-color);
border: 2px solid var(--pico-primary);
border-radius: var(--pico-border-radius);
padding: 1rem;
display: flex;
align-items: center;
gap: 0.5rem;
margin-top: 1rem;
}
.result-box code {
flex: 1;
word-break: break-all;
font-size: 1.1rem;
}
.result-box button {
width: auto;
margin: 0;
padding: 0.4rem 0.8rem;
}
table td {
max-width: 300px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.actions {
display: flex;
gap: 0.25rem;
}
.actions form {
margin: 0;
}
.actions a, .actions button {
padding: 0.25rem 0.5rem;
font-size: 0.85rem;
margin: 0;
}
[role="group"] form {
margin: 0;
display: flex;
}
[role="group"] a[role="button"],
[role="group"] form button,
[role="group"] button {
padding: 0.25rem 0.5rem;
font-size: 0.85rem;
margin: 0;
white-space: nowrap;
}
h1 a {
text-decoration: none;
color: inherit;
}
.tile-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
gap: 0.5rem;
margin-bottom: 1rem;
}
.tile {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
gap: 0.2rem;
padding: 0.75rem 0.5rem;
border-radius: var(--pico-border-radius);
background: var(--pico-card-background-color);
border: 1px solid var(--pico-muted-border-color);
text-decoration: none;
text-align: center;
transition: border-color 0.15s, box-shadow 0.15s;
}
.tile:hover {
border-color: var(--pico-primary);
box-shadow: 0 4px 16px rgba(0,0,0,0.25), inset 0 0 0 1px var(--pico-primary);
}
.tile-slug {
font-weight: 600;
font-size: 1rem;
color: var(--pico-primary);
}
.tile-favicon {
width: 20px;
height: 20px;
border-radius: 3px;
margin-bottom: 0.1rem;
}
.tile-dest {
font-size: 0.72rem;
color: var(--pico-muted-color);
max-width: 100%;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.tile-clicks {
font-size: 0.72rem;
color: var(--pico-muted-color);
font-variant-numeric: tabular-nums;
}
/* Admin tab navigation */
.admin-tabs {
display: flex;
gap: 0;
padding: 0 1rem;
border-bottom: 2px solid var(--pico-muted-border-color);
background: var(--pico-background-color);
}
.tab-link {
display: inline-block;
padding: 0.6rem 1.25rem;
text-decoration: none;
color: var(--pico-muted-color);
font-weight: 500;
border-bottom: 2px solid transparent;
margin-bottom: -2px;
transition: color 0.15s, border-color 0.15s;
}
.tab-link:hover {
color: var(--pico-primary);
}
.tab-link.active {
color: var(--pico-primary);
border-bottom-color: var(--pico-primary);
}
/* Paste view */
.paste-header {
display: flex;
justify-content: space-between;
align-items: flex-start;
gap: 1rem;
flex-wrap: wrap;
margin-bottom: 0.5rem;
}
.paste-toolbar {
display: flex;
gap: 0.5rem;
align-items: center;
flex-shrink: 0;
}
.paste-toolbar button,
.paste-toolbar a {
margin: 0;
}
.format-badge {
display: inline-block;
padding: 0.1rem 0.4rem;
border-radius: var(--pico-border-radius);
background: var(--pico-card-background-color);
border: 1px solid var(--pico-muted-border-color);
font-size: 0.75rem;
font-family: monospace;
}
/* Paste rendered markdown body */
.paste-body {
line-height: 1.7;
}
.paste-body pre {
background: var(--pico-card-background-color);
border: 1px solid var(--pico-muted-border-color);
border-radius: var(--pico-border-radius);
padding: 1rem;
overflow-x: auto;
}
.paste-body code {
font-size: 0.9em;
}
.paste-body pre code {
background: none;
padding: 0;
}
.paste-body blockquote {
border-left: 4px solid var(--pico-muted-border-color);
margin: 0;
padding-left: 1rem;
color: var(--pico-muted-color);
}
.paste-body table {
width: 100%;
border-collapse: collapse;
}
.paste-body th, .paste-body td {
border: 1px solid var(--pico-muted-border-color);
padding: 0.4rem 0.75rem;
text-align: left;
max-width: none;
white-space: normal;
overflow: visible;
text-overflow: clip;
}
/* ── Admin redesign components ───────────────────────────────────────── */
/* Stats bar */
.stats-bar {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
gap: 1rem;
margin-bottom: 1.5rem;
}
.stats-card {
background: var(--pico-card-background-color);
border: 1px solid var(--pico-muted-border-color);
border-radius: var(--pico-border-radius);
padding: 1rem 1.25rem;
text-align: center;
}
.stats-card .stats-value {
font-size: 2rem;
font-weight: 700;
color: var(--pico-primary);
line-height: 1.1;
display: block;
}
.stats-card .stats-label {
font-size: 0.8rem;
color: var(--pico-muted-color);
text-transform: uppercase;
letter-spacing: 0.04em;
display: block;
margin-top: 0.25rem;
}
/* Section header (title left, action button right) */
.section-header {
display: flex;
align-items: center;
justify-content: space-between;
gap: 1rem;
padding: 1rem 1.25rem 0;
}
.section-header hgroup {
margin: 0;
}
/* Card-wrapped table: no padding so table runs edge-to-edge */
.card-table {
padding: 0;
overflow: hidden;
}
.card-table figure {
margin: 0.75rem 0 0;
}
/* Empty state */
.empty-state {
padding: 3rem 1rem;
text-align: center;
color: var(--pico-muted-color);
}
.empty-state .empty-icon {
font-size: 2.5rem;
display: block;
margin-bottom: 0.75rem;
}
.empty-state p {
margin: 0 0 1rem;
}
/* Badges */
mark.badge-format {
background: var(--pico-card-background-color);
color: var(--pico-primary);
border: 1px solid var(--pico-primary);
padding: 0.1rem 0.45rem;
font-size: 0.72rem;
font-family: monospace;
border-radius: var(--pico-border-radius);
}
mark.badge-token {
background: color-mix(in srgb, var(--pico-ins-color) 15%, transparent);
color: var(--pico-ins-color);
border: 1px solid var(--pico-ins-color);
padding: 0.1rem 0.45rem;
font-size: 0.72rem;
border-radius: var(--pico-border-radius);
}
mark.badge-public {
background: transparent;
color: var(--pico-muted-color);
border: 1px solid var(--pico-muted-border-color);
padding: 0.1rem 0.45rem;
font-size: 0.72rem;
border-radius: var(--pico-border-radius);
}
mark.badge-hidden {
background: color-mix(in srgb, var(--pico-del-color) 15%, transparent);
color: var(--pico-del-color);
border: 1px solid var(--pico-del-color);
padding: 0.1rem 0.45rem;
font-size: 0.72rem;
border-radius: var(--pico-border-radius);
}
/* Centered login card */
.login-wrap {
min-height: calc(100vh - 80px);
display: flex;
align-items: center;
justify-content: center;
padding: 2rem 1rem;
}
.login-card {
width: 100%;
max-width: 420px;
}
/* Alert helpers (replace repeated inline styles) */
.alert-success {
border-left: 4px solid var(--pico-ins-color);
padding: 0.75rem 1rem;
background: color-mix(in srgb, var(--pico-ins-color) 10%, transparent);
}
.alert-error {
border-left: 4px solid var(--pico-del-color);
padding: 0.75rem 1rem;
background: color-mix(in srgb, var(--pico-del-color) 10%, transparent);
}
/* Small button utility */
.btn-sm {
margin: 0;
padding: 0.25rem 0.75rem;
font-size: 0.85rem;
}
/* Image upload controls */
.upload-controls {
display: flex;
align-items: center;
gap: 0.5rem;
margin-bottom: 0.25rem;
}
.upload-controls button {
width: auto;
margin: 0;
padding: 0.3rem 0.75rem;
font-size: 0.85rem;
}
#upload-status {
color: var(--pico-muted-color);
font-size: 0.8rem;
}
.ext-chip {
display: inline-block;
font-family: var(--pico-font-family-monospace);
font-size: 0.7rem;
font-weight: 600;
text-transform: uppercase;
letter-spacing: 0.03em;
padding: 0.1rem 0.4rem;
border-radius: 4px;
background: var(--pico-primary-background);
color: var(--pico-primary-inverse);
min-width: 2.5rem;
text-align: center;
}
/* ── Pastes masonry cards (Xiaohongshu style) ───────────────────────── */
.pcard-grid {
columns: 240px;
column-gap: 1rem;
margin-top: 1rem;
}
.pcard {
break-inside: avoid;
display: inline-block;
width: 100%;
margin: 0 0 1rem;
padding: 0;
background: var(--pico-card-background-color);
border: 1px solid var(--pico-muted-border-color);
border-radius: var(--pico-border-radius);
overflow: hidden;
cursor: pointer;
transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}
.pcard:hover {
transform: translateY(-2px);
}
.pcard:focus-visible {
outline: 2px solid var(--pico-primary);
outline-offset: 2px;
}
.pcard:hover .pcard-img {
opacity: 0.92;
}
.pcard:hover {
border-color: var(--pico-primary);
box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}
.pcard-imgwrap {
display: block;
width: 100%;
margin: 0;
padding: 0;
border: 0;
background: none;
cursor: pointer;
line-height: 0;
}
.pcard-img {
width: 100%;
height: auto;
display: block;
transition: opacity 0.15s;
}
.pcard-imgwrap:hover .pcard-img {
opacity: 0.9;
}
.pcard-body {
padding: 0.75rem;
}
.pcard-title {
display: block;
width: 100%;
margin: 0 0 0.35rem;
padding: 0;
border: 0;
background: none;
text-align: left;
font-weight: 600;
font-size: 1rem;
line-height: 1.3;
color: var(--pico-color);
cursor: pointer;
}
.pcard-title:hover {
color: var(--pico-primary);
}
.pcard-summary {
margin: 0 0 0.5rem;
font-size: 0.85rem;
line-height: 1.45;
color: var(--pico-muted-color);
display: -webkit-box;
-webkit-line-clamp: 3;
-webkit-box-orient: vertical;
overflow: hidden;
}
.pcard-meta {
display: flex;
flex-wrap: wrap;
align-items: center;
gap: 0.3rem;
margin-bottom: 0.6rem;
font-size: 0.72rem;
color: var(--pico-muted-color);
}
.pcard-date {
margin-left: auto;
font-variant-numeric: tabular-nums;
}
.pcard-actions {
display: flex;
flex-wrap: wrap;
gap: 0.25rem;
cursor: default;
}
.pcard-actions form {
margin: 0;
display: flex;
}
.pcard-actions a[role="button"],
.pcard-actions button {
margin: 0;
padding: 0.2rem 0.5rem;
font-size: 0.78rem;
white-space: nowrap;
}
/* ── In-page paste preview modal ────────────────────────────────────── */
.preview-dialog {
width: min(820px, 94vw);
height: min(80vh, 920px);
max-width: none;
max-height: none;
padding: 0;
border: 1px solid var(--pico-muted-border-color);
border-radius: 16px;
background: var(--pico-card-background-color);
box-shadow: 0 24px 70px rgba(0, 0, 0, 0.55);
overflow: hidden;
transition: width 0.22s ease, height 0.22s ease;
}
/* dialog is only laid out when open; scope flex so closed state stays hidden */
.preview-dialog[open] {
display: flex;
flex-direction: column;
}
/* Expanded fills the main content area, not the whole viewport. */
.preview-dialog.expanded {
width: min(1180px, 94vw);
height: 88vh;
}
.preview-dialog::backdrop {
background: rgba(0, 0, 0, 0.55);
backdrop-filter: blur(3px);
}
.preview-head {
flex: 0 0 auto;
display: flex;
align-items: center;
gap: 0.75rem;
padding: 0.55rem 0.6rem 0.55rem 1rem;
background: var(--pico-card-background-color);
border-bottom: 1px solid var(--pico-muted-border-color);
}
.preview-title {
flex: 1;
min-width: 0;
font-weight: 600;
font-size: 0.95rem;
color: var(--pico-color);
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.preview-actions {
flex: 0 0 auto;
display: flex;
gap: 0.4rem;
align-items: center;
}
.preview-actions a,
.preview-actions button {
margin: 0;
border-radius: 8px;
}
/* square icon buttons for expand / close */
#preview-expand,
.preview-close {
width: 2rem;
padding: 0.25rem 0;
text-align: center;
line-height: 1;
font-size: 0.95rem;
}
.preview-close {
background: transparent;
border: 1px solid var(--pico-muted-border-color);
color: var(--pico-muted-color);
}
.preview-close:hover {
background: var(--pico-del-color);
border-color: var(--pico-del-color);
color: #fff;
}
.preview-frame {
flex: 1 1 auto;
width: 100%;
border: 0;
background: var(--pico-background-color);
}