mirror of
https://github.com/hicccc77/WeFlow.git
synced 2026-03-25 07:16:51 +00:00
fix(export): align sns timeline dialog with sns page rendering
This commit is contained in:
@@ -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;
|
||||||
|
|||||||
@@ -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">
|
if (isVideo) {
|
||||||
{post.media.slice(0, 9).map((media, mediaIndex) => {
|
void window.electronAPI.window.openVideoPlayerWindow(src)
|
||||||
const mediaUrl = String(media?.url || media?.thumb || '')
|
} else {
|
||||||
const previewUrl = String(media?.thumb || media?.url || '')
|
void window.electronAPI.window.openImageViewerWindow(src, liveVideoPath || undefined)
|
||||||
if (!mediaUrl || !previewUrl) return null
|
}
|
||||||
const isVideo = isSnsVideoMediaUrl(mediaUrl)
|
}}
|
||||||
return (
|
onDebug={() => {}}
|
||||||
<button
|
hideAuthorMeta
|
||||||
className="sns-post-media-item"
|
/>
|
||||||
key={`${post.id}-media-${mediaIndex}`}
|
|
||||||
type="button"
|
|
||||||
onClick={() => {
|
|
||||||
if (isVideo) {
|
|
||||||
void window.electronAPI.window.openVideoPlayerWindow(mediaUrl)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
void window.electronAPI.window.openImageViewerWindow(
|
|
||||||
mediaUrl,
|
|
||||||
media?.livePhoto?.url || undefined
|
|
||||||
)
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<img src={previewUrl} alt="" loading="lazy" referrerPolicy="no-referrer" />
|
|
||||||
{isVideo && <span className="sns-post-media-video-tag">视频</span>}
|
|
||||||
</button>
|
|
||||||
)
|
|
||||||
})}
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
</article>
|
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|||||||
Reference in New Issue
Block a user