+ {loading ? (
+
+ ) : announcements.length === 0 ? (
+
+ No announcements available
+
+ ) : (
+ <>
+
+
+
+
+ {selectedAnnouncement && (
+
+
+ {selectedAnnouncement.title}
+
+ Posted by {selectedAnnouncement.author} on {new Date(selectedAnnouncement.createdAt).toLocaleDateString()}
+
+
+
+
+ {selectedAnnouncement.content}
+
+
+
+ )}
+ >
+ )}
+
+ );
+}
\ No newline at end of file
diff --git a/components/announcement/announcements-list.tsx b/components/announcement/announcements-list.tsx
new file mode 100644
index 00000000..99672cce
--- /dev/null
+++ b/components/announcement/announcements-list.tsx
@@ -0,0 +1,264 @@
+"use client";
+
+import { useState, useEffect } from "react";
+import {
+ Table,
+ TableBody,
+ TableCell,
+ TableHead,
+ TableHeader,
+ TableRow,
+} from "@/components/ui/table";
+import {
+ Card,
+ CardContent,
+ CardDescription,
+ CardHeader,
+ CardTitle,
+} from "@/components/ui/card";
+import { Button } from "@/components/ui/button";
+import { Badge } from "@/components/ui/badge";
+import {
+ Pencil,
+ Trash2,
+ Eye,
+ Search,
+ Plus,
+ Filter,
+ AlertTriangle
+} from "lucide-react";
+import { Input } from "@/components/ui/input";
+import {
+ Dialog,
+ DialogContent,
+ DialogDescription,
+ DialogHeader,
+ DialogTitle,
+ DialogFooter,
+ DialogTrigger
+} from "@/components/ui/dialog";
+import { Announcement } from "@/app/types/announcement";
+
+// Mock data for demo purposes
+const mockAnnouncements: Announcement[] = [
+ {
+ id: "1",
+ title: "System Maintenance",
+ content: "The system will be undergoing maintenance on Saturday from 2-4am.",
+ createdAt: "2023-06-01T10:00:00Z",
+ updatedAt: "2023-06-01T10:00:00Z",
+ author: "System Admin",
+ authorId: "admin1",
+ targetRoles: ["all"]
+ },
+ {
+ id: "2",
+ title: "New Feature Launch",
+ content: "We're excited to announce our new collaborative workspace feature launching next week!",
+ createdAt: "2023-06-02T14:30:00Z",
+ updatedAt: "2023-06-02T14:30:00Z",
+ author: "Product Team",
+ authorId: "product1",
+ targetRoles: ["admin", "entrepreneurship"]
+ },
+ {
+ id: "3",
+ title: "Team Meeting",
+ content: "There will be a team meeting on Monday at 10 AM to discuss the upcoming project milestones.",
+ createdAt: "2023-06-03T09:15:00Z",
+ updatedAt: "2023-06-03T09:15:00Z",
+ author: "Team Lead",
+ authorId: "lead1",
+ targetRoles: ["communication", "admin"]
+ }
+];
+
+interface AnnouncementsListProps {
+ userRole: string[];
+}
+
+export function AnnouncementsList({ userRole }: AnnouncementsListProps) {
+ const [announcements, setAnnouncements] = useState