move utils files

This commit is contained in:
2025-12-17 14:16:08 +01:00
parent 883b9b6c4b
commit 0aaafed26a
13 changed files with 58 additions and 9 deletions
+25 -2
View File
@@ -1,8 +1,9 @@
import styles from "./Header.module.css"
import { Link, NavLink } from "react-router";
import { useEffect, useRef, useState } from "react";
import getUserNotifications from "../../utils/getUserNotifications.js";
import getUserNotifications from "../../utils/notifications/getUserNotifications.js";
import getUser from "../../utils/getUser.js";
import deleteNotificationUser from "../../utils/notifications/deleteNotificationUser.js";
function Header() {
const [notificationMenu, setnotificationMenu] = useState(false);
@@ -37,6 +38,28 @@ function Header() {
};
}, []);
async function deleteNotification(notificationId) {
try {
const user = await getUser();
const result = await deleteNotificationUser(user.id, notificationId);
console.log(result);
if (result) {
setNotifications(prev => prev.filter(n => n.id !== notificationId));
}
} catch (err) {
console.error('Erreur suppression notification :', err);
}
}
return (
<div className={styles.headerContainer}>
<header className={`${styles.header} glassCard`}>
@@ -114,7 +137,7 @@ function Header() {
<p>{notification.content}</p>
<button
className={styles.closeBtn}
onClick={() => setNotifications(prev => prev.filter((_, i) => i !== index))}
onClick={() => deleteNotification(notification.id)}
>
<img src="close.svg" alt="supprimer la notification"/>
</button>
+2 -2
View File
@@ -1,8 +1,8 @@
import styles from "./SearchBar.module.css"
import {Link} from "react-router";
import {useEffect, useState} from "react";
import searchEvents from "../../utils/searchEvents.js";
import searchUsers from "../../utils/searchUsers.js";
import searchEvents from "../../utils/events/searchEvents.js";
import searchUsers from "../../utils/users/searchUsers.js";
import { useLocation } from "react-router";
+1 -1
View File
@@ -1,5 +1,5 @@
import React, {useEffect, useState} from "react";
import getEventById from "../../utils/event/getEventById.js";
import getEventById from "../../utils/events/getEventById.js";
import styles from "./Task.module.css";
import formatDate from "../../utils/date/formatDate.js";
@@ -3,7 +3,7 @@ import { useState } from "react";
import Modal from "../ui/modal/modal.jsx";
import Button from "../ui/button/button.jsx";
import TextInput from "../ui/input/input.jsx";
import createEvent from "../../utils/event/createEvent.js"
import createEvent from "../../utils/events/createEvent.js"
export default function CreateEventBtn() {