mirror of
https://github.com/R0m1k3/Socialflow.git
synced 2026-10-21 05:58:12 +02:00
4 files changed
+23
-28
No files matched your search
Binary file not shown.
|
After Width: | Height: | Size: 61 KiB |
File renamed without changes.
@@ -1,6 +1,5 @@
|
|||||||
import { Button } from "@/components/ui/button";
|
|
||||||
import { useQuery } from "@tanstack/react-query";
|
import { useQuery } from "@tanstack/react-query";
|
||||||
import { Plus, Users } from "lucide-react";
|
import { Users } from "lucide-react";
|
||||||
import { SiFacebook, SiInstagram } from "react-icons/si";
|
import { SiFacebook, SiInstagram } from "react-icons/si";
|
||||||
|
|
||||||
export default function ManagedPages() {
|
export default function ManagedPages() {
|
||||||
@@ -24,25 +23,16 @@ export default function ManagedPages() {
|
|||||||
return (
|
return (
|
||||||
<div className="bg-card rounded-2xl border border-border/50 overflow-hidden shadow-lg">
|
<div className="bg-card rounded-2xl border border-border/50 overflow-hidden shadow-lg">
|
||||||
<div className="border-b border-border/50 p-6 bg-gradient-to-r from-primary/5 to-secondary/5">
|
<div className="border-b border-border/50 p-6 bg-gradient-to-r from-primary/5 to-secondary/5">
|
||||||
<div className="flex items-center justify-between">
|
<div className="flex items-center gap-4">
|
||||||
<div className="flex items-center gap-4">
|
<div className="w-12 h-12 rounded-xl bg-gradient-to-br from-primary to-secondary flex items-center justify-center shadow-lg">
|
||||||
<div className="w-12 h-12 rounded-xl bg-gradient-to-br from-primary to-secondary flex items-center justify-center shadow-lg">
|
<Users className="text-white w-6 h-6" />
|
||||||
<Users className="text-white w-6 h-6" />
|
</div>
|
||||||
</div>
|
<div>
|
||||||
<div>
|
<h3 className="text-lg font-semibold text-foreground">Pages gérées</h3>
|
||||||
<h3 className="text-lg font-semibold text-foreground">Pages gérées</h3>
|
<p className="text-sm text-muted-foreground">
|
||||||
<p className="text-sm text-muted-foreground">
|
{(pages as any[])?.length || 0} page(s) connectée(s)
|
||||||
{(pages as any[])?.length || 0} page(s) connectée(s)
|
</p>
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<Button
|
|
||||||
className="bg-gradient-to-r from-primary to-secondary hover:opacity-90 rounded-xl"
|
|
||||||
data-testid="button-connect-page"
|
|
||||||
>
|
|
||||||
<Plus className="w-4 h-4 mr-2" />
|
|
||||||
Connecter une page
|
|
||||||
</Button>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -92,11 +82,7 @@ export default function ManagedPages() {
|
|||||||
<div className="w-20 h-20 rounded-2xl bg-muted/30 flex items-center justify-center mx-auto mb-6">
|
<div className="w-20 h-20 rounded-2xl bg-muted/30 flex items-center justify-center mx-auto mb-6">
|
||||||
<Users className="w-10 h-10 text-muted-foreground opacity-50" />
|
<Users className="w-10 h-10 text-muted-foreground opacity-50" />
|
||||||
</div>
|
</div>
|
||||||
<p className="text-muted-foreground mb-6 text-lg">Aucune page connectée</p>
|
<p className="text-muted-foreground text-lg">Aucune page connectée</p>
|
||||||
<Button className="bg-gradient-to-r from-primary to-secondary hover:opacity-90 rounded-xl">
|
|
||||||
<Plus className="w-4 h-4 mr-2" />
|
|
||||||
Connecter votre première page
|
|
||||||
</Button>
|
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
+12
-3
@@ -185,11 +185,12 @@ export class DatabaseStorage implements IStorage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Scheduled Posts
|
// Scheduled Posts
|
||||||
async getScheduledPosts(userId: string, startDate?: Date, endDate?: Date): Promise<ScheduledPost[]> {
|
async getScheduledPosts(userId: string, startDate?: Date, endDate?: Date): Promise<any[]> {
|
||||||
let query = db
|
let query = db
|
||||||
.select()
|
.select()
|
||||||
.from(scheduledPosts)
|
.from(scheduledPosts)
|
||||||
.innerJoin(posts, eq(scheduledPosts.postId, posts.id))
|
.innerJoin(posts, eq(scheduledPosts.postId, posts.id))
|
||||||
|
.leftJoin(socialPages, eq(scheduledPosts.pageId, socialPages.id))
|
||||||
.where(eq(posts.userId, userId));
|
.where(eq(posts.userId, userId));
|
||||||
|
|
||||||
if (startDate && endDate) {
|
if (startDate && endDate) {
|
||||||
@@ -199,11 +200,19 @@ export class DatabaseStorage implements IStorage {
|
|||||||
const scheduledAt = new Date(r.scheduled_posts.scheduledAt);
|
const scheduledAt = new Date(r.scheduled_posts.scheduledAt);
|
||||||
return scheduledAt >= startDate && scheduledAt <= endDate;
|
return scheduledAt >= startDate && scheduledAt <= endDate;
|
||||||
})
|
})
|
||||||
.map(r => r.scheduled_posts);
|
.map(r => ({
|
||||||
|
...r.scheduled_posts,
|
||||||
|
post: r.posts,
|
||||||
|
page: r.social_pages,
|
||||||
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
const results = await query;
|
const results = await query;
|
||||||
return results.map(r => r.scheduled_posts);
|
return results.map(r => ({
|
||||||
|
...r.scheduled_posts,
|
||||||
|
post: r.posts,
|
||||||
|
page: r.social_pages,
|
||||||
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
async getScheduledPost(id: string): Promise<ScheduledPost | undefined> {
|
async getScheduledPost(id: string): Promise<ScheduledPost | undefined> {
|
||||||
|
|||||||
Reference in new issue
Block a user