1
Fork 0
mirror of https://github.com/thegeneralist01/archivr synced 2026-07-22 03:05:32 +02:00

feat: entry previews (video, tweet, article, iframe, image, audio bar)

- Add PreviewPanel dispatch hub routing by entity_kind + artifact extension
- VideoPreview: HTML5 <video> for YouTube/Instagram/TikTok/Reddit/X posts
- TweetPreview: tweet card, thread, and X article renderer (ported from x-article-renderer)
- IframePreview: sandboxed iframe for SingleFile web pages and PDFs
- ImagePreview: image viewer with click-to-open-fullsize
- AudioBar: persistent fixed-bottom player (Spotify-style) that survives entry navigation
- Lift entryDetail to App.jsx, shared between PreviewPanel and ContextRail
- 3-column layout (workspace | 300px preview | 340px rail) when preview active
- Stale-guard fixes: seq incremented before early returns in all async effects
- handleRearchive: capture startSeq/entryUid at call time, guard every async resume
- TweetPreview: reset loading/error/tweets before early-return branches
This commit is contained in:
TheGeneralist 2026-07-11 18:29:36 +02:00
parent 2779afee2d
commit 5de9e291b0
Signed by: thegeneralist01
SSH key fingerprint: SHA256:pp9qddbCNmVNoSjevdvQvM5z0DHN7LTa8qBMbcMq/R4
13 changed files with 1974 additions and 69 deletions

View file

@ -1901,3 +1901,454 @@ select {
margin: 0 0 8px;
outline: none;
}
/*
ENTRY PREVIEWS
*/
/* ── 3-column layout when preview is active ─────────────────────── */
.app-shell.has-preview {
grid-template-columns: minmax(0, 1fr) 300px 340px;
}
.app-shell.audio-playing {
padding-bottom: 72px;
}
/* ── Preview pane ─────────────────────────────────────────────────── */
.preview-pane {
min-width: 0;
overflow: auto;
border-left: 1px solid var(--line);
background: var(--paper);
display: flex;
flex-direction: column;
}
.preview-panel {
flex: 1;
display: flex;
flex-direction: column;
min-height: 0;
height: 100%;
}
.preview-panel-loading,
.preview-panel-empty {
flex: 1;
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
gap: 8px;
color: var(--muted-2);
font-size: 14px;
text-align: center;
padding: 24px;
}
/* ── Video preview ────────────────────────────────────────────────── */
.preview-video-wrap {
flex: 1;
display: flex;
align-items: center;
justify-content: center;
background: #0d0d0b;
min-height: 200px;
}
.preview-video-wrap video {
max-width: 100%;
max-height: 100%;
width: 100%;
display: block;
}
/* ── Iframe preview ───────────────────────────────────────────────── */
.preview-iframe-wrap {
flex: 1;
display: flex;
flex-direction: column;
min-height: 0;
height: 100%;
}
.preview-iframe-toolbar {
display: flex;
align-items: center;
padding: 6px 12px;
background: var(--paper-3);
border-bottom: 1px solid var(--line);
gap: 8px;
flex-shrink: 0;
}
.preview-iframe-toolbar span {
font-size: 11px;
color: var(--muted-2);
text-transform: uppercase;
letter-spacing: 0.07em;
font-weight: 600;
}
.preview-iframe-toolbar a {
margin-left: auto;
color: var(--link);
font-size: 12px;
text-decoration: none;
padding: 3px 8px;
border: 1px solid var(--line);
border-radius: var(--r2);
background: var(--field);
transition: border-color 0.12s;
}
.preview-iframe-toolbar a:hover {
border-color: var(--accent);
text-decoration: none;
}
.preview-iframe-wrap iframe {
flex: 1;
width: 100%;
border: none;
background: white;
min-height: 0;
}
/* ── Image preview ────────────────────────────────────────────────── */
.preview-image-wrap {
flex: 1;
display: flex;
align-items: center;
justify-content: center;
padding: 20px;
background: var(--paper-2);
}
.preview-image-wrap img {
max-width: 100%;
max-height: 100%;
object-fit: contain;
border-radius: var(--r3);
cursor: zoom-in;
display: block;
box-shadow: 0 4px 24px rgba(0,0,0,0.1);
}
/* ── Tweet preview wrap ───────────────────────────────────────────── */
.preview-tweet-wrap {
flex: 1;
overflow-y: auto;
padding: 20px 16px;
background: var(--paper-2);
}
/* ── Tweet card ───────────────────────────────────────────────────── */
.tw-card {
border: 1px solid var(--line);
border-radius: 12px;
padding: 16px;
background: var(--paper);
max-width: 560px;
margin: 0 auto 12px;
}
.tw-thread {
max-width: 560px;
margin: 0 auto;
}
.tw-thread-item {
display: flex;
gap: 0;
margin-bottom: 0;
}
.tw-thread-connector {
display: flex;
flex-direction: column;
align-items: center;
flex-shrink: 0;
width: 52px;
padding-top: 2px;
}
.tw-thread-avatar-col {
display: flex;
flex-direction: column;
align-items: center;
flex-shrink: 0;
}
.tw-thread-line {
width: 2px;
background: var(--line);
flex: 1;
min-height: 16px;
margin: 4px 0;
}
.tw-thread-body {
flex: 1;
min-width: 0;
padding: 0 0 16px 12px;
}
.tw-thread-body:last-child { padding-bottom: 0; }
.tw-avatar {
width: 40px;
height: 40px;
border-radius: 50%;
object-fit: cover;
flex-shrink: 0;
display: block;
}
.tw-avatar-ph {
width: 40px;
height: 40px;
border-radius: 50%;
background: var(--paper-2);
border: 1px solid var(--line);
flex-shrink: 0;
}
.tw-header {
display: flex;
align-items: baseline;
gap: 6px;
flex-wrap: wrap;
margin-bottom: 6px;
}
.tw-author-name { font-size: 14.5px; font-weight: 700; color: var(--ink); }
.tw-author-handle { font-size: 13px; color: var(--muted-2); }
.tw-dot { color: var(--muted-2); font-size: 13px; }
.tw-date { font-size: 13px; color: var(--muted-2); }
.tw-text {
font-size: 15px;
line-height: 1.65;
color: var(--ink);
white-space: pre-line;
word-break: break-word;
margin-bottom: 10px;
}
.tw-text a { color: var(--link); text-decoration: none; }
.tw-text a:hover { text-decoration: underline; }
.tw-stats {
display: flex;
gap: 20px;
color: var(--muted-2);
font-size: 13px;
margin-top: 10px;
padding-top: 10px;
border-top: 1px solid var(--line-soft);
}
.tw-stats span { display: flex; align-items: center; gap: 4px; }
/* ── X Article styles ─────────────────────────────────────────────── */
.tw-article {
max-width: 598px;
margin: 0 auto;
}
.tw-article-cover {
width: 100%;
display: block;
object-fit: cover;
max-height: 380px;
}
.tw-article-meta { padding: 20px 16px 0; }
.tw-article-title {
font-size: 22px;
font-weight: 800;
letter-spacing: -0.3px;
color: var(--ink);
line-height: 1.3;
margin-bottom: 14px;
}
.tw-article-author-row {
display: flex;
align-items: center;
gap: 12px;
margin-bottom: 14px;
}
.tw-article-author-name { font-size: 14px; font-weight: 700; color: var(--ink); }
.tw-article-author-sub { font-size: 13px; color: var(--muted-2); }
.tw-article-divider { border: none; border-top: 1px solid var(--line); margin: 0; }
.tw-article-body { padding: 8px 16px 60px; }
.tw-b-h1 {
font-size: 24px; font-weight: 800; letter-spacing: -0.3px;
color: var(--ink); line-height: 1.25; margin: 22px 0 10px;
}
.tw-b-h2 {
font-size: 19px; font-weight: 700; letter-spacing: -0.15px;
color: var(--ink); line-height: 1.3; margin: 20px 0 8px;
}
.tw-b-p { font-size: 16px; color: var(--ink); line-height: 1.72; margin-bottom: 14px; }
.tw-b-p:empty { display: none; }
.tw-b-spacer { height: 6px; display: block; }
.tw-b-blockquote {
border-left: 3px solid var(--line);
padding: 2px 14px;
margin: 14px 0;
color: var(--muted);
font-size: 16px;
line-height: 1.65;
}
.tw-b-hr { border: none; border-top: 1px solid var(--line); margin: 24px 0; }
.tw-b-img { width: 100%; display: block; border-radius: 10px; margin: 14px 0; }
.tw-b-ul, .tw-b-ol { margin: 10px 0 14px; padding-left: 26px; }
.tw-b-li { font-size: 16px; color: var(--ink); line-height: 1.65; margin-bottom: 6px; }
.tw-b-code {
font-family: ui-monospace, 'SF Mono', Menlo, monospace;
font-size: 0.875em;
background: var(--paper-2);
padding: 2px 5px;
border-radius: 4px;
color: var(--ink);
}
.tw-b-pre {
background: var(--paper-2);
border: 1px solid var(--line);
border-radius: 8px;
padding: 14px 16px;
overflow-x: auto;
margin: 12px 0;
}
.tw-b-pre code {
font-family: ui-monospace, 'SF Mono', Menlo, monospace;
font-size: 13px;
line-height: 1.6;
}
.tw-b-tweet-link {
display: flex;
align-items: center;
gap: 10px;
border: 1px solid var(--line);
border-radius: 10px;
padding: 12px 14px;
margin: 12px 0;
color: var(--muted);
font-size: 14px;
text-decoration: none;
background: var(--paper-3);
transition: background 0.12s;
}
.tw-b-tweet-link:hover { background: var(--field); }
.tw-b-tweet-link svg { flex-shrink: 0; color: var(--ink); }
/* ── Audio bar ────────────────────────────────────────────────────── */
.audio-bar {
position: fixed;
bottom: 0;
left: 0;
right: 0;
height: 72px;
background: var(--paper);
border-top: 1px solid var(--line);
display: flex;
align-items: center;
gap: 20px;
padding: 0 24px;
z-index: 100;
box-shadow: 0 -2px 16px rgba(0,0,0,0.08);
}
.audio-bar-info {
display: flex;
align-items: center;
gap: 10px;
min-width: 0;
flex: 0 0 200px;
}
.audio-bar-icon {
flex-shrink: 0;
width: 20px;
height: 20px;
display: flex;
align-items: center;
justify-content: center;
}
.audio-bar-icon svg { width: 20px; height: 20px; }
.audio-bar-title {
font-size: 13px;
color: var(--ink);
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
min-width: 0;
font-weight: 500;
}
.audio-bar-controls {
flex: 1;
display: flex;
align-items: center;
gap: 12px;
min-width: 0;
}
.audio-bar-play-btn {
width: 38px;
height: 38px;
border-radius: 50%;
background: var(--accent);
color: var(--paper);
border: none;
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
flex-shrink: 0;
transition: background 0.12s, transform 0.1s;
}
.audio-bar-play-btn:hover { background: var(--accent-2); }
.audio-bar-play-btn:active { transform: scale(0.93); }
.audio-bar-play-btn svg { width: 15px; height: 15px; }
.audio-bar-seek {
flex: 1;
min-width: 0;
display: flex;
align-items: center;
gap: 8px;
}
.audio-bar-seek input[type="range"] {
flex: 1;
accent-color: var(--accent);
height: 4px;
cursor: pointer;
min-width: 0;
}
.audio-bar-time {
font-size: 11.5px;
color: var(--muted-2);
white-space: nowrap;
min-width: 80px;
text-align: right;
font-variant-numeric: tabular-nums;
}
.audio-bar-right {
flex: 0 0 auto;
display: flex;
align-items: center;
gap: 10px;
}
.audio-bar-volume {
display: flex;
align-items: center;
gap: 6px;
}
.audio-bar-volume svg { width: 14px; height: 14px; color: var(--muted-2); flex-shrink: 0; }
.audio-bar-volume input[type="range"] {
width: 72px;
accent-color: var(--accent);
cursor: pointer;
}
.audio-bar-close {
width: 28px;
height: 28px;
border-radius: 50%;
border: none;
background: transparent;
color: var(--muted-2);
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
font-size: 18px;
padding: 0;
line-height: 1;
transition: background 0.12s, color 0.12s;
}
.audio-bar-close:hover { background: var(--field); color: var(--ink); }
/* ── Responsive: hide preview on small screens ─────────────────── */
@media (max-width: 1100px) {
.app-shell.has-preview {
grid-template-columns: minmax(0, 1fr) 340px;
}
.preview-pane { display: none; }
}
@media (max-width: 900px) {
.app-shell.has-preview {
grid-template-columns: 1fr;
}
}