fix(export): align sns timeline dialog with sns page rendering

This commit is contained in:
aits2026
2026-03-05 18:27:30 +08:00
parent c301f36912
commit d5dbcd3f80
2 changed files with 28 additions and 43 deletions

View File

@@ -2273,6 +2273,14 @@
padding: 12px 14px 14px; padding: 12px 14px 14px;
} }
.export-session-sns-posts-list {
gap: 14px;
}
.post-header-actions {
display: none;
}
.sns-post-list { .sns-post-list {
display: flex; display: flex;
flex-direction: column; flex-direction: column;

View File

@@ -38,6 +38,7 @@ import {
onOpenSingleExport onOpenSingleExport
} from '../services/exportBridge' } from '../services/exportBridge'
import { useContactTypeCountsStore } from '../stores/contactTypeCountsStore' import { useContactTypeCountsStore } from '../stores/contactTypeCountsStore'
import { SnsPostItem } from '../components/Sns/SnsPostItem'
import type { SnsPost } from '../types/sns' import type { SnsPost } from '../types/sns'
import './ExportPage.scss' import './ExportPage.scss'
@@ -431,12 +432,6 @@ const isSingleContactSession = (sessionId: string): boolean => {
return true return true
} }
const isSnsVideoMediaUrl = (url?: string): boolean => {
if (!url) return false
const lower = url.toLowerCase()
return (lower.includes('snsvideodownload') || lower.includes('.mp4') || lower.includes('video')) && !lower.includes('vweixinthumb')
}
const formatPathBrief = (value: string, maxLength = 52): string => { const formatPathBrief = (value: string, maxLength = 52): string => {
const normalized = String(value || '') const normalized = String(value || '')
if (normalized.length <= maxLength) return normalized if (normalized.length <= maxLength) return normalized
@@ -2085,7 +2080,7 @@ function ExportPage() {
} }
void loadSessionSnsTimelinePosts(target, { reset: true }) void loadSessionSnsTimelinePosts(target, { reset: true })
void loadSnsUserPostCounts() void loadSnsUserPostCounts({ force: true })
}, [ }, [
loadSessionSnsTimelinePosts, loadSessionSnsTimelinePosts,
loadSnsUserPostCounts, loadSnsUserPostCounts,
@@ -4658,8 +4653,11 @@ function ExportPage() {
if (!sessionId) return if (!sessionId) return
detailStatsPriorityRef.current = true detailStatsPriorityRef.current = true
setShowSessionDetailPanel(true) setShowSessionDetailPanel(true)
if (isSingleContactSession(sessionId)) {
void loadSnsUserPostCounts({ force: true })
}
void loadSessionDetail(sessionId) void loadSessionDetail(sessionId)
}, [loadSessionDetail]) }, [loadSessionDetail, loadSnsUserPostCounts])
useEffect(() => { useEffect(() => {
if (!showSessionDetailPanel) return if (!showSessionDetailPanel) return
@@ -5785,42 +5783,21 @@ function ExportPage() {
<div className="sns-dialog-body"> <div className="sns-dialog-body">
{sessionSnsTimelinePosts.length > 0 && ( {sessionSnsTimelinePosts.length > 0 && (
<div className="sns-post-list"> <div className="posts-list author-timeline-posts-list export-session-sns-posts-list">
{sessionSnsTimelinePosts.map((post) => ( {sessionSnsTimelinePosts.map((post) => (
<article className="sns-post-card" key={post.id}> <SnsPostItem
<div className="sns-post-time">{formatYmdHmDateTime(post.createTime * 1000)}</div> key={post.id}
{post.contentDesc && <div className="sns-post-content">{post.contentDesc}</div>} post={post}
{Array.isArray(post.media) && post.media.length > 0 && ( onPreview={(src, isVideo, liveVideoPath) => {
<div className="sns-post-media-grid">
{post.media.slice(0, 9).map((media, mediaIndex) => {
const mediaUrl = String(media?.url || media?.thumb || '')
const previewUrl = String(media?.thumb || media?.url || '')
if (!mediaUrl || !previewUrl) return null
const isVideo = isSnsVideoMediaUrl(mediaUrl)
return (
<button
className="sns-post-media-item"
key={`${post.id}-media-${mediaIndex}`}
type="button"
onClick={() => {
if (isVideo) { if (isVideo) {
void window.electronAPI.window.openVideoPlayerWindow(mediaUrl) void window.electronAPI.window.openVideoPlayerWindow(src)
return } else {
void window.electronAPI.window.openImageViewerWindow(src, liveVideoPath || undefined)
} }
void window.electronAPI.window.openImageViewerWindow(
mediaUrl,
media?.livePhoto?.url || undefined
)
}} }}
> onDebug={() => {}}
<img src={previewUrl} alt="" loading="lazy" referrerPolicy="no-referrer" /> hideAuthorMeta
{isVideo && <span className="sns-post-media-video-tag"></span>} />
</button>
)
})}
</div>
)}
</article>
))} ))}
</div> </div>
)} )}