refactor(sns): reuse shared contact timeline dialog in sns page

This commit is contained in:
aits2026
2026-03-06 10:34:16 +08:00
parent 0a5cf005a1
commit ef05466d6d
2 changed files with 21 additions and 264 deletions

View File

@@ -26,6 +26,8 @@ interface ContactSnsTimelineDialogProps {
onClose: () => void
initialTotalPosts?: number | null
initialTotalPostsLoading?: boolean
isProtected?: boolean
onDeletePost?: (postId: string, username: string) => void
}
const normalizeTotalPosts = (value?: number | null): number | null => {
@@ -90,7 +92,9 @@ export function ContactSnsTimelineDialog({
target,
onClose,
initialTotalPosts = null,
initialTotalPostsLoading = false
initialTotalPostsLoading = false,
isProtected = false,
onDeletePost
}: ContactSnsTimelineDialogProps) {
const [timelinePosts, setTimelinePosts] = useState<SnsPost[]>([])
const [timelineLoading, setTimelineLoading] = useState(false)
@@ -536,7 +540,7 @@ export function ContactSnsTimelineDialog({
{timelinePosts.map((post) => (
<SnsPostItem
key={post.id}
post={post}
post={{ ...post, isProtected }}
onPreview={(src, isVideo, liveVideoPath) => {
if (isVideo) {
void window.electronAPI.window.openVideoPlayerWindow(src)
@@ -545,6 +549,7 @@ export function ContactSnsTimelineDialog({
}
}}
onDebug={() => {}}
onDelete={onDeletePost}
hideAuthorMeta
/>
))}