Convert NotificationCard to Typescript

This commit is contained in:
T'JAMPENS QUENTIN p2406187
2026-03-18 20:58:30 +01:00
parent 5787f941fd
commit 724ae99b29
3 changed files with 16 additions and 12 deletions
+2 -8
View File
@@ -7,17 +7,11 @@ import initEcho from "../../utils/echo/initEcho.js"
import readNotifications from "../../utils/notifications/readNotifications.js";
import { userCreatedListener } from "../../utils/echo/listeners/userCreatedListener";
import { userNotificationsListener } from "../../utils/echo/listeners/userNotificationsListener.js";
import NotificationCard from "../NotificationCard/NotificationCard.jsx";
import NotificationCard from "../NotificationCard/NotificationCard";
import { EventContext } from "../../contexts/Events/EventContext.js";
import { AuthContext } from "../../contexts/Auth/AuthContext.js";
import { PendingMembersContext } from "../../contexts/PendingMembers/PendingMembersContext";
interface Notification {
id: number;
content: string;
created_at: string | number;
pivot: { unread: number };
}
import Notification from "../../interfaces/notification.interface";
function Header() {
@@ -1,16 +1,20 @@
import formatDate from "../../utils/date/formatDate.js";
import formatTime from "../../utils/date/formatTime.js";
import styles from "./NotificationCard.module.css"
import Notification from "../../interfaces/notification.interface";
interface NotificationCardProps {
notifications: Notification[];
deleteNotification: (id: number) => void;
}
function NotificationCard({notifications, deleteNotification}) {
function NotificationCard({ notifications, deleteNotification }: NotificationCardProps) {
return (
notifications.map((notification, index) => (
<div className={styles.notificationCard} key={index}>
<div className={styles.cardHeader}>
<span className={styles.timeTag}>
Le {formatDate(notification.created_at)} à {formatTime(notification.created_at)}
Le {formatDate(String(notification.created_at))} à {formatTime(String(notification.created_at))}
</span>
<button
className={styles.closeIconButton}
@@ -31,4 +35,4 @@ function NotificationCard({notifications, deleteNotification}) {
);
}
export default NotificationCard;
export default NotificationCard;
+6
View File
@@ -0,0 +1,6 @@
export default interface Notification {
id: number;
content: string;
created_at: string | number;
pivot: { unread: number };
}