mirror of
https://github.com/R0m1k3/Socialflow.git
synced 2026-10-22 22:48:09 +02:00
Update calendar and preview to show past scheduled posts
Refactor `RecentPublications` to filter and sort attempted posts using `scheduledAt` timestamp. Update `PreviewModal` and `CalendarView` to include a `readOnly` prop for the preview modal. Replit-Commit-Author: Agent Replit-Commit-Session-Id: ae4037a0-2a6f-4530-9bac-79b543286bda Replit-Commit-Checkpoint-Type: intermediate_checkpoint Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/397bca8c-984f-43ff-841a-10897aeb8140/ae4037a0-2a6f-4530-9bac-79b543286bda/oa3970R
This commit is contained in:
1 parent
078301d353
commit
212ef049f7
4 files changed
+41
-21
No files matched your search
@@ -23,10 +23,11 @@ export default function RecentPublications() {
|
||||
queryKey: ['/api/scheduled-posts'],
|
||||
});
|
||||
|
||||
// Filter and sort published posts
|
||||
// Filter and sort attempted posts (scheduled in the past)
|
||||
const now = new Date();
|
||||
const recentPublished = scheduledPosts
|
||||
.filter(sp => sp.publishedAt)
|
||||
.sort((a, b) => new Date(b.publishedAt!).getTime() - new Date(a.publishedAt!).getTime())
|
||||
.filter(sp => sp.scheduledAt && new Date(sp.scheduledAt) <= now)
|
||||
.sort((a, b) => new Date(b.scheduledAt!).getTime() - new Date(a.scheduledAt!).getTime())
|
||||
.slice(0, 10);
|
||||
|
||||
const handlePreviewPost = async (scheduledPost: ScheduledPostWithRelations) => {
|
||||
@@ -141,7 +142,7 @@ export default function RecentPublications() {
|
||||
</span>
|
||||
<span>•</span>
|
||||
<span>
|
||||
{format(new Date(scheduledPost.publishedAt!), "d MMM yyyy 'à' HH:mm", { locale: fr })}
|
||||
{format(new Date(scheduledPost.scheduledAt!), "d MMM yyyy 'à' HH:mm", { locale: fr })}
|
||||
</span>
|
||||
{scheduledPost.error && (
|
||||
<>
|
||||
@@ -165,6 +166,7 @@ export default function RecentPublications() {
|
||||
mediaList={previewData.allMedia}
|
||||
onPublish={() => {}}
|
||||
isPublishing={false}
|
||||
readOnly={true}
|
||||
/>
|
||||
</Card>
|
||||
);
|
||||
|
||||
Reference in new issue
Block a user