Merge branch 'dev' into 'features/export'
# Conflicts: # src/pages/Home/components/Calendar/calendar.jsx
This commit is contained in:
commit
d6e6f478ff
84 files changed
+1909
-1289
No files matched your search
@@ -1,10 +1,10 @@
|
||||
import { useState, useContext } from "react";
|
||||
import { useContext } from "react";
|
||||
import styles from "./AdminPage.module.css";
|
||||
import ParticipationChart from "./components/chart/ParticipationChart.jsx";
|
||||
import IncompleteEvents from "./components/IncompleteEvent/IncompleteEvent.jsx";
|
||||
import PendingMembers from "./components/pendingMembers/PendingMembers.jsx";
|
||||
import { AuthContext } from "../../contexts/auth/AuthContext.js";
|
||||
import { useNavigate } from "react-router";
|
||||
import RegisterMember from "./components/registerMember/registerMember.tsx";
|
||||
|
||||
|
||||
function AdminPage() {
|
||||
@@ -12,18 +12,11 @@ function AdminPage() {
|
||||
const { user } = useContext(AuthContext);
|
||||
const navigate = useNavigate();
|
||||
|
||||
const [selected, setSelected] = useState("3");
|
||||
const [participationRate] = useState(89);
|
||||
|
||||
if(!user.isAdmin) navigate("/");
|
||||
|
||||
return (
|
||||
<div className={styles.container}>
|
||||
<ParticipationChart
|
||||
selected={selected}
|
||||
setSelected={setSelected}
|
||||
participationRate={participationRate}
|
||||
/>
|
||||
<RegisterMember />
|
||||
<div className={styles.rightSection}>
|
||||
<IncompleteEvents />
|
||||
<PendingMembers />
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
import React, {useState, useEffect} from "react";
|
||||
import Button from "../../../../components/ui/button/button.jsx";
|
||||
import React, {useState, useEffect, useContext} from "react";
|
||||
import Button from "../../../../components/ui/button/button.tsx";
|
||||
import styles from "./PendingMembers.module.css";
|
||||
import Modal from "../../../../components/ui/modal/modal.jsx";
|
||||
import getUserToValidate from "../../../../utils/users/getUserToValidate.js";
|
||||
import getUserById from "../../../../utils/users/getUserById.js";
|
||||
import Modal from "../../../../components/ui/modal/modal.tsx";
|
||||
import validateUser from "../../../../utils/users/validateUser.js";
|
||||
import deleteOtherUser from "../../../../utils/users/deleteOtherUser.js";
|
||||
import { PendingMembersContext } from "../../../../contexts/pendingMembers/PendingMembersContext";
|
||||
|
||||
function PendingMembers() {
|
||||
|
||||
@@ -13,23 +12,10 @@ function PendingMembers() {
|
||||
const [open, setOpen] = useState(false);
|
||||
const [message, setMessage] = useState("");
|
||||
const [title, setTitle] = useState("");
|
||||
|
||||
const [pendingMembers, setPendingMembers] = useState([]);
|
||||
|
||||
const fetchUsers = async () => {
|
||||
|
||||
const result = await getUserToValidate();
|
||||
const userIds = result.data;
|
||||
|
||||
if (userIds && userIds.length > 0) {
|
||||
const users = await Promise.all(userIds.map(id => getUserById(id)));
|
||||
const usersData = users.map(u => u.data);
|
||||
setPendingMembers(usersData);
|
||||
} else setPendingMembers([]);
|
||||
}
|
||||
const { pendingMembers, updatePendingMembers } = useContext(PendingMembersContext);
|
||||
|
||||
useEffect(() => {
|
||||
fetchUsers();
|
||||
updatePendingMembers();
|
||||
}, []);
|
||||
|
||||
const handleValidate = async (id, name) => {
|
||||
@@ -38,14 +24,12 @@ function PendingMembers() {
|
||||
if(result.status === 200) {
|
||||
setTitle("Utilisateur accepté avec succès")
|
||||
setMessage(`L'utilisateur ${name} a été accepté avec succès`)
|
||||
setOpen(true);
|
||||
} else {
|
||||
setTitle("Erreur")
|
||||
setMessage(`Une erreur est survenue durant l'acceptation de l'utilisateur ${name}`)
|
||||
setOpen(true);
|
||||
}
|
||||
|
||||
fetchUsers();
|
||||
setOpen(true);
|
||||
updatePendingMembers();
|
||||
}
|
||||
|
||||
const handleRefuse = async (id, name) => {
|
||||
@@ -61,7 +45,7 @@ function PendingMembers() {
|
||||
setOpen(true);
|
||||
}
|
||||
|
||||
fetchUsers();
|
||||
updatePendingMembers();
|
||||
}
|
||||
|
||||
return (
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
.leftBlock {
|
||||
width: 100%;
|
||||
max-width: 720px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
min-height: calc(100vh - 260px);
|
||||
box-sizing: border-box;
|
||||
padding: 20px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
.registerMemberHeader {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 100%;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.registerForm {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 16px;
|
||||
align-items: stretch;
|
||||
}
|
||||
|
||||
.registerForm input {
|
||||
width: 100%;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.registerForm button {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.modalContent {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
@media (min-width: 768px) {
|
||||
.leftBlock {
|
||||
width: 70%;
|
||||
}
|
||||
}
|
||||
|
||||
@media (min-width: 1024px) {
|
||||
.leftBlock {
|
||||
width: 40%;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
import React, { useState } from "react"
|
||||
import styles from "./registerMember.module.css"
|
||||
import TextInput from "../../../../components/ui/input/input"
|
||||
import Button from "../../../../components/ui/button/button";
|
||||
import Response from "../../../../interfaces/response.interface";
|
||||
import ResponseData from "./responseData.inteface";
|
||||
import adminCreateUser from "../../../../utils/users/adminCreateUser";
|
||||
import Modal from "../../../../components/ui/modal/modal";
|
||||
|
||||
|
||||
const RegisterMember: React.FC = () => {
|
||||
|
||||
const [name, setName] = useState<string>("");
|
||||
const [lastname, setLastName] = useState<string>("");
|
||||
const [email, setEmail] = useState<string>("");
|
||||
const [phone, setPhone] = useState<string>("");
|
||||
const [password, setPassword] = useState<string>("");
|
||||
|
||||
const [open, setOpen] = useState<boolean>(false);
|
||||
const [title, setTitle] = useState<string>("");
|
||||
const [message, setMessage] = useState<string>("");
|
||||
|
||||
|
||||
const handleCreate = async (): Promise<void> => {
|
||||
|
||||
if(name !== "" && lastname !== "" && email !== "" && phone !== "" ) {
|
||||
const response: Response<ResponseData> = await adminCreateUser(email, name, lastname, phone);
|
||||
if(response.status === 200) {
|
||||
setPassword(response.data.password);
|
||||
setTitle(`Utilisateur enregistré avec succès`);
|
||||
setMessage(`L'utilisateur ${name} ${lastname} a été enregistré avec le mot de passe: ${response.data.password}`);
|
||||
setOpen(true);
|
||||
} else {
|
||||
setTitle(`Erreur`);
|
||||
setMessage(`Une erreur est survenue lors de l'enregistrement de ${name} ${lastname}`);
|
||||
setOpen(true);
|
||||
}
|
||||
} else {
|
||||
setTitle("Erreur");
|
||||
setMessage("Un des champs n'a pas été rempli");
|
||||
setOpen(true);
|
||||
}
|
||||
}
|
||||
|
||||
const showPassword = (): void => {
|
||||
setTitle(`Mot de passe de ${name} ${lastname}`);
|
||||
setMessage(password);
|
||||
setOpen(true);
|
||||
}
|
||||
|
||||
return <div className={`${styles.leftBlock} glassCard`}>
|
||||
<div className={styles.registerMemberHeader}>
|
||||
<h2>Enregister un bénévole</h2>
|
||||
</div>
|
||||
|
||||
<div className={styles.registerForm}>
|
||||
<TextInput placeholder={"Prenom"} type={"text"} value={name} onChange={e => setName(e.target.value)} />
|
||||
<TextInput placeholder={"Nom"} type={"text"} value={lastname} onChange={e => setLastName(e.target.value)} />
|
||||
<TextInput placeholder={"Adresse Email"} type={"email"} value={email} onChange={e => setEmail(e.target.value)} />
|
||||
<TextInput placeholder={"Numéro de téléphone"} type={"tel"} value={phone} onChange={e => setPhone(e.target.value)} />
|
||||
|
||||
{password !== "" && <Button onClick={showPassword}> Afficher le mot de passe </Button>}
|
||||
|
||||
<Button variant={"default"} onClick={handleCreate}>Enregistrer</Button>
|
||||
</div>
|
||||
|
||||
<Modal open={open} onClose={() => setOpen(false)} title={title}>
|
||||
<p className={styles.modalContent}>{message}</p>
|
||||
</Modal>
|
||||
|
||||
</div>
|
||||
}
|
||||
|
||||
export default RegisterMember
|
||||
@@ -0,0 +1,4 @@
|
||||
export default interface ResponseData {
|
||||
message: string;
|
||||
password: string;
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
import styles from "./Event.module.css";
|
||||
import { useState, useEffect } from "react";
|
||||
import { useNavigate } from "react-router";
|
||||
import Button from "/src/components/ui/button/button.jsx"
|
||||
import Button from "/src/components/ui/button/button"
|
||||
|
||||
function Event({event}){
|
||||
|
||||
|
||||
@@ -4,33 +4,32 @@ import EventItem from "./eventItem.jsx";
|
||||
import { EventContext } from "../../../../contexts/events/EventContext.js";
|
||||
import { useContext } from "react";
|
||||
|
||||
|
||||
function EventList() {
|
||||
|
||||
const { events } = useContext(EventContext);
|
||||
// Utilise une valeur par défaut pour `events` si elle est `undefined`
|
||||
const { events = [] } = useContext(EventContext);
|
||||
|
||||
const sortedEvents = useMemo(() => {
|
||||
// Vérifie explicitement que `events` est un tableau avant de trier
|
||||
if (!Array.isArray(events)) return [];
|
||||
return [...events].sort(
|
||||
(a, b) => new Date(a.start) - new Date(b.start)
|
||||
);
|
||||
}, [events]);
|
||||
|
||||
|
||||
return (
|
||||
<div className={`${styles.glassCard} glassCard`}>
|
||||
<h2>Liste des événements à venir</h2>
|
||||
{sortedEvents.length > 0 ? (
|
||||
<div className={styles.eventList}>
|
||||
{sortedEvents.map((eventGroup, index) => (
|
||||
<EventItem eventGroup={eventGroup} key={index} />
|
||||
))}
|
||||
</div>
|
||||
) : (
|
||||
<p>Aucun événement planifié pour l'instant.</p>
|
||||
)}
|
||||
<h2>Liste des événements à venir</h2>
|
||||
{sortedEvents.length > 0 ? (
|
||||
<div className={styles.eventList}>
|
||||
{sortedEvents.map((eventGroup, index) => (
|
||||
<EventItem eventGroup={eventGroup} key={index} />
|
||||
))}
|
||||
</div>
|
||||
) : (
|
||||
<p>Aucun événement planifié pour l'instant.</p>
|
||||
)}
|
||||
</div>
|
||||
|
||||
);
|
||||
}
|
||||
|
||||
export default EventList;
|
||||
export default EventList;
|
||||
@@ -1,8 +1,8 @@
|
||||
import { useState, useContext } from "react";
|
||||
import styles from "./loginForm.module.css";
|
||||
import Button from "../../../../components/ui/button/button.jsx";
|
||||
import Input from "../../../../components/ui/input/input.jsx";
|
||||
import Modal from "../../../../components/ui/modal/modal.jsx";
|
||||
import Button from "../../../../components/ui/button/button.tsx";
|
||||
import Input from "../../../../components/ui/input/input.tsx";
|
||||
import Modal from "../../../../components/ui/modal/modal.tsx";
|
||||
import { useNavigate } from "react-router";
|
||||
import { AuthContext } from "../../../../contexts/auth/AuthContext.js";
|
||||
|
||||
|
||||
@@ -1,57 +1,95 @@
|
||||
/* Conteneur principal */
|
||||
.container {
|
||||
width: 100%;
|
||||
padding: 12px;
|
||||
box-sizing: border-box;
|
||||
width: 100%;
|
||||
padding: 12px;
|
||||
box-sizing: border-box;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
.profileboard {
|
||||
width: 100%;
|
||||
padding: 16px;
|
||||
border-radius: 20px;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.settingImage{
|
||||
width:100%;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
}
|
||||
.contentWrapper {
|
||||
|
||||
.settingImage {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.contentWrapper {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
width: 100%;
|
||||
gap: 20px;
|
||||
}
|
||||
|
||||
.profilePictureContainer {
|
||||
width: 120px;
|
||||
height: 120px;
|
||||
margin-bottom: 16px;
|
||||
width: 120px;
|
||||
height: 120px;
|
||||
margin-bottom: 0;
|
||||
position: relative;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.profilePicture {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
border-radius: 50%;
|
||||
object-fit: cover;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
border-radius: 50%;
|
||||
object-fit: cover;
|
||||
}
|
||||
|
||||
.editPictureButton {
|
||||
margin-top: 16px;
|
||||
padding-top: 12px;
|
||||
padding-bottom: 12px;
|
||||
background: rgba(255, 255, 255, 0.95);
|
||||
border: none;
|
||||
border-radius: 24px;
|
||||
cursor: pointer;
|
||||
font-size: 0.95rem;
|
||||
font-weight: 600;
|
||||
color: #e74c3c;
|
||||
box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15);
|
||||
transition: all 0.3s ease;
|
||||
backdrop-filter: blur(5px);
|
||||
white-space: nowrap;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 8px;
|
||||
width: auto;
|
||||
min-width: 140px;
|
||||
}
|
||||
|
||||
.editPictureButton:hover {
|
||||
background: rgba(255, 255, 255, 1);
|
||||
transform: translateY(-2px);
|
||||
box-shadow: 0 5px 12px rgba(0, 0, 0, 0.2);
|
||||
color: #c0392b;
|
||||
}
|
||||
|
||||
.description {
|
||||
width: 100%;
|
||||
text-align: left;
|
||||
width: 100%;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.headerProfile {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: 16px;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
|
||||
.description h2 {
|
||||
font-size: 1.6rem;
|
||||
margin-bottom: 10px;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
.description button {
|
||||
@@ -75,84 +113,91 @@
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
/* Conteneur des informations principales */
|
||||
.topDescription {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 12px;
|
||||
margin-bottom: 20px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 16px;
|
||||
width: 100%;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
/* Bloc d'informations */
|
||||
.infoBlock {
|
||||
width: 100%;
|
||||
padding: 12px;
|
||||
width: 100%;
|
||||
padding: 12px;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.eventTasks {
|
||||
max-height: 0;
|
||||
overflow: hidden;
|
||||
transition: max-height 0.3s ease, opacity 0.2s ease;
|
||||
opacity: 0;
|
||||
padding-left: 16px;
|
||||
}
|
||||
|
||||
.eventTasks.expanded {
|
||||
max-height: 500px;
|
||||
opacity: 1;
|
||||
margin-top: 10px;
|
||||
/* Conteneur pour les paramètres */
|
||||
.settingImage {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
margin-top: 16px;
|
||||
}
|
||||
|
||||
/* Adaptation pour tablette et PC */
|
||||
@media (min-width: 768px) {
|
||||
.contentWrapper {
|
||||
flex-direction: row;
|
||||
align-items: flex-start;
|
||||
}
|
||||
.contentWrapper {
|
||||
flex-direction: row;
|
||||
align-items: flex-start;
|
||||
gap: 24px;
|
||||
}
|
||||
|
||||
.profilePictureContainer {
|
||||
width: 150px;
|
||||
height: 150px;
|
||||
margin-right: 24px;
|
||||
margin-bottom: 0;
|
||||
}
|
||||
.profilePictureContainer {
|
||||
width: 150px;
|
||||
height: 150px;
|
||||
margin-right: 0;
|
||||
}
|
||||
|
||||
.description {
|
||||
width: calc(100% - 180px);
|
||||
}
|
||||
.description {
|
||||
width: calc(100% - 180px);
|
||||
}
|
||||
|
||||
.topDescription {
|
||||
flex-direction: row;
|
||||
justify-content: space-between;
|
||||
}
|
||||
.topDescription {
|
||||
flex-direction: row;
|
||||
justify-content: space-between;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.infoBlock {
|
||||
width: 48%;
|
||||
}
|
||||
.infoBlock {
|
||||
flex: 1;
|
||||
min-width: calc(50% - 8px);
|
||||
max-width: calc(50% - 8px);
|
||||
}
|
||||
|
||||
.description h2 {
|
||||
font-size: 1.8rem;
|
||||
}
|
||||
.editPictureButton {
|
||||
margin: 16px auto 0 auto;
|
||||
display: block;
|
||||
}
|
||||
|
||||
.headerProfile h2 {
|
||||
font-size: 1.8rem;
|
||||
}
|
||||
}
|
||||
|
||||
/* Adaptation pour grand écran */
|
||||
@media (min-width: 1024px) {
|
||||
.container {
|
||||
max-width: 1200px;
|
||||
margin: 0 auto;
|
||||
padding: 24px;
|
||||
}
|
||||
.container {
|
||||
max-width: 1200px;
|
||||
padding: 24px;
|
||||
}
|
||||
|
||||
.profileboard {
|
||||
padding: 28px;
|
||||
}
|
||||
.profileboard {
|
||||
padding: 28px;
|
||||
}
|
||||
|
||||
.profilePictureContainer {
|
||||
width: 180px;
|
||||
height: 180px;
|
||||
}
|
||||
.profilePictureContainer {
|
||||
width: 180px;
|
||||
height: 180px;
|
||||
}
|
||||
|
||||
.description {
|
||||
width: calc(100% - 220px);
|
||||
}
|
||||
.description {
|
||||
width: calc(100% - 220px);
|
||||
}
|
||||
|
||||
.description h2 {
|
||||
font-size: 2rem;
|
||||
}
|
||||
.headerProfile h2 {
|
||||
font-size: 2rem;
|
||||
}
|
||||
}
|
||||
+171
-123
@@ -1,42 +1,138 @@
|
||||
import { useContext, useEffect } from "react";
|
||||
import getXSRFToken from "../../utils/getXSRF.js";
|
||||
// import fetchWrapper from "../../utils/fetchWrapper";
|
||||
import {useContext, useEffect, useState} from "react";
|
||||
import styles from "./ProfilePage.module.css";
|
||||
|
||||
import { AuthContext } from "../../contexts/auth/AuthContext";
|
||||
import {AuthContext} from "../../contexts/auth/AuthContext";
|
||||
import formatDate from "../../utils/date/formatDate";
|
||||
import Task from "../../components/Task/Task";
|
||||
import SettingsModal from "./components/SettingsModal/SettingsModal";
|
||||
import {useParams} from "react-router";
|
||||
import {useNavigate} from "react-router";
|
||||
import {useRef} from "react";
|
||||
import getUserById from "../../utils/users/getUserById.js";
|
||||
import ManageMember from "./components/manageMember/ManageMember.jsx";
|
||||
|
||||
import uploadProfilePhoto from "../../utils/users/uploadProfilePhoto";
|
||||
import deleteProfilePhoto from "../../utils/users/deleteProfilePhoto.js";
|
||||
|
||||
//import Task from "../../components/Task/Task";
|
||||
//import SettingsModal from "./components/SettingsModal/SettingsModal";
|
||||
|
||||
interface TaskType {
|
||||
id: number;
|
||||
title?: string;
|
||||
completed?: boolean;
|
||||
[key: string]: unknown;
|
||||
name: string;
|
||||
description: string;
|
||||
location: string;
|
||||
start: string;
|
||||
end: string;
|
||||
max_participants: number;
|
||||
events_id: number;
|
||||
created_at: string;
|
||||
updated_at: string;
|
||||
pivot: {
|
||||
user_id: number;
|
||||
task_id: number;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
interface User {
|
||||
name: string;
|
||||
lastname: string;
|
||||
role: string;
|
||||
email: string;
|
||||
phone: string | null;
|
||||
created_at: string;
|
||||
tasks: TaskType[];
|
||||
id: number;
|
||||
name: string;
|
||||
lastname: string;
|
||||
role: string;
|
||||
email: string;
|
||||
phone: string | null;
|
||||
created_at: string;
|
||||
isAdmin: boolean;
|
||||
tasks: TaskType[];
|
||||
profile_photo_path?: string | null;
|
||||
}
|
||||
|
||||
interface AuthContextType {
|
||||
user: User | null;
|
||||
update: () => void;
|
||||
user: User | null;
|
||||
update: () => void;
|
||||
}
|
||||
|
||||
|
||||
|
||||
function ProfilePage(){
|
||||
function ProfilePage() {
|
||||
const navigate = useNavigate();
|
||||
const { id } = useParams();
|
||||
const { user, update } = useContext(AuthContext) as AuthContextType;
|
||||
const [profileUser, setProfileUser] = useState<User | null>(null);
|
||||
const [profilePicture, setProfilePicture] = useState<string | null>(null);
|
||||
const [error, setError] = useState<string | null>(null);
|
||||
const [success, setSuccess] = useState<string | null>(null);
|
||||
const fileInputRef = useRef<HTMLInputElement>(null);
|
||||
|
||||
const isOwnProfile = !id || user?.id.toString() === id;
|
||||
|
||||
useEffect(() => {
|
||||
update();
|
||||
}, []);
|
||||
(async () => {
|
||||
if (!isOwnProfile && id) {
|
||||
const res = await getUserById(id);
|
||||
if (res.status === 404) {
|
||||
navigate("/404");
|
||||
return;
|
||||
}
|
||||
if (res.status !== 200) {
|
||||
console.error("Erreur lors du chargement du profil", res);
|
||||
return;
|
||||
}
|
||||
setProfileUser(res.data);
|
||||
} else {
|
||||
update();
|
||||
setProfileUser(user);
|
||||
if (user?.profile_photo_path) {
|
||||
setProfilePicture(`${import.meta.env.VITE_API_URL}/storage/${user.profile_photo_path}`);
|
||||
}
|
||||
}
|
||||
})();
|
||||
}, [user, id]);
|
||||
|
||||
const handleEditPictureClick = () => {
|
||||
if (fileInputRef.current) {
|
||||
fileInputRef.current.click();
|
||||
}
|
||||
};
|
||||
|
||||
// Remplacé : handleFileChange extrait vers utils/users/uploadProfilePhoto
|
||||
const handleFileChange = async (e: React.ChangeEvent<HTMLInputElement>) => {
|
||||
const file = e.target.files?.[0];
|
||||
if (!file) return;
|
||||
|
||||
try {
|
||||
const res = await uploadProfilePhoto(file);
|
||||
if (res.ok) {
|
||||
setProfilePicture(`${import.meta.env.VITE_API_URL}/storage/${res.data.profile_photo_path}`);
|
||||
setSuccess("Photo mise à jour !");
|
||||
setError(null);
|
||||
await update();
|
||||
} else {
|
||||
setError(res.data?.message || res.error || "Erreur lors de l'upload.");
|
||||
setSuccess(null);
|
||||
}
|
||||
} catch (err) {
|
||||
setError("Erreur réseau.");
|
||||
setSuccess(null);
|
||||
}
|
||||
};
|
||||
|
||||
// Remplacé : handleDeletePicture extrait vers utils/users/deleteProfilePhoto
|
||||
const handleDeletePicture = async () => {
|
||||
try {
|
||||
const res = await deleteProfilePhoto();
|
||||
if (res.status >= 200 && res.status < 300) {
|
||||
setProfilePicture(null);
|
||||
setSuccess("Photo supprimée !");
|
||||
setError(null);
|
||||
await update();
|
||||
} else {
|
||||
setError(res.data?.message || "Erreur lors de la suppression.");
|
||||
setSuccess(null);
|
||||
}
|
||||
} catch (err) {
|
||||
setError("Erreur réseau.");
|
||||
setSuccess(null);
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<div className={styles.container}>
|
||||
@@ -44,117 +140,69 @@ function ProfilePage(){
|
||||
<div className={styles.contentWrapper}>
|
||||
<div className={styles.profilePictureContainer}>
|
||||
<img
|
||||
src="/react.svg"
|
||||
src={isOwnProfile ? (profilePicture || "/react.svg") : "/react.svg"}
|
||||
alt="Photo de profil"
|
||||
className={styles.profilePicture}
|
||||
/>
|
||||
</div>
|
||||
|
||||
{isOwnProfile && (
|
||||
<div className={styles.pictureButtons}>
|
||||
<button onClick={handleEditPictureClick} className={styles.editPictureButton}>
|
||||
Modifier la photo
|
||||
</button>
|
||||
{user?.profile_photo_path && (
|
||||
<button onClick={handleDeletePicture} className={styles.deletePictureButton}>
|
||||
Supprimer
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
|
||||
<input
|
||||
type="file"
|
||||
ref={fileInputRef}
|
||||
onChange={handleFileChange}
|
||||
accept="image/*"
|
||||
style={{ display: "none" }}
|
||||
/>
|
||||
{error && <p className={styles.errorMessage}>{error}</p>}
|
||||
{success && <p className={styles.successMessage}>{success}</p>}
|
||||
|
||||
<div className={styles.description}>
|
||||
<div className={styles.headerProfile}>
|
||||
<h2>
|
||||
{user?.name} {user?.lastname}
|
||||
{profileUser?.name} {profileUser?.lastname}
|
||||
</h2>
|
||||
</div>
|
||||
|
||||
<div className={styles.topDescription}>
|
||||
<div className={`${styles.infoBlock} glassBorder`}>
|
||||
<p>
|
||||
<strong>Role :</strong> {user?.role}
|
||||
</p>
|
||||
<p>
|
||||
<strong>Membre depuis :</strong>{" "}
|
||||
{user && formatDate(user.created_at)}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div className={`${styles.infoBlock} glassBorder`}>
|
||||
<p>
|
||||
<strong>Mail :</strong> {user?.email}
|
||||
</p>
|
||||
<p>
|
||||
<strong>Téléphone :</strong>{" "}
|
||||
{user?.phone ?? "Pas de numéro enregistré"}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div className={styles.settingImage}>
|
||||
{/* <SettingsModal />*/}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<h2>Tâches :</h2>
|
||||
|
||||
{/* {user && user.tasks.length > 0 ? (
|
||||
user.tasks.map((task) => (
|
||||
<Task key={task.id} task={task} />
|
||||
))
|
||||
) : (
|
||||
<p>Aucune tâche pour le moment.</p>
|
||||
)}*/}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default ProfilePage;
|
||||
|
||||
|
||||
/*import React, { useContext, useEffect } from "react";
|
||||
import styles from "./ProfilePage.module.css";
|
||||
import { AuthContext } from "../../contexts/auth/AuthContext.js";
|
||||
import formatDate from "../../utils/date/formatDate.js";
|
||||
import Task from "../../components/Task/Task";
|
||||
import SettingsModal from "./components/SettingsModal/SettingsModal.jsx";
|
||||
|
||||
function ProfilePage() {
|
||||
|
||||
const { user, update } = useContext(AuthContext);
|
||||
|
||||
useEffect(() => {
|
||||
update();
|
||||
}, [])
|
||||
|
||||
return (
|
||||
<div className={styles.container}>
|
||||
<div className={`${styles.profileboard} glassCard`}>
|
||||
<div className={styles.contentWrapper}>
|
||||
<div className={styles.profilePictureContainer}>
|
||||
<img
|
||||
src="/react.svg"
|
||||
alt="Photo de profil"
|
||||
className={styles.profilePicture}
|
||||
/>
|
||||
</div>
|
||||
<div className={styles.description}>
|
||||
<div className={styles.headerProfile}>
|
||||
<h2> {user?.name} {user?.lastname} </h2>
|
||||
</div>
|
||||
<div className={styles.topDescription}>
|
||||
<div className={`${styles.infoBlock} glassBorder`}>
|
||||
<p><strong>Role :</strong> {user?.role}</p>
|
||||
<p><strong>Membre depuis :</strong> {user && formatDate(user.created_at)}</p>
|
||||
</div>
|
||||
<div className={`${styles.infoBlock} glassBorder`}>
|
||||
<p><strong>Mail :</strong> {user?.email} </p>
|
||||
<p><strong>Téléphone :</strong> {user?.phone === null ? "Pas de numéro enregistré" : user?.phone}</p>
|
||||
</div>
|
||||
<div className={styles.settingImage}>
|
||||
<SettingsModal />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<h2>Tâches :</h2>
|
||||
{user && user.tasks.length > 0 ? (
|
||||
user.tasks.map((task, index) => (
|
||||
<Task key={index} task={task} />
|
||||
))
|
||||
) : (
|
||||
<p>Aucune tâche pour le moment.</p>
|
||||
{user?.isAdmin && profileUser && !isOwnProfile && (
|
||||
<ManageMember userToManage={profileUser} />
|
||||
)}
|
||||
</div>
|
||||
|
||||
<div className={styles.topDescription}>
|
||||
<div className={`${styles.infoBlock} glassBorder`}>
|
||||
<p><strong>Role :</strong> {profileUser?.role}</p>
|
||||
<p><strong>Membre depuis :</strong> {profileUser && formatDate(profileUser.created_at)}</p>
|
||||
</div>
|
||||
|
||||
<div className={`${styles.infoBlock} glassBorder`}>
|
||||
<p><strong>Mail :</strong> {profileUser?.email}</p>
|
||||
<p><strong>Téléphone :</strong> {profileUser?.phone ?? "Non renseigné"}</p>
|
||||
</div>
|
||||
|
||||
{isOwnProfile && (
|
||||
<div className={styles.settingImage}>
|
||||
<SettingsModal />
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
<h2>Tâches :</h2>
|
||||
{profileUser?.tasks.length ? (
|
||||
profileUser.tasks.map((task) => <Task key={task.id} task={task} />)
|
||||
) : (
|
||||
<p>Aucune tâche.</p>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -162,4 +210,4 @@ function ProfilePage() {
|
||||
);
|
||||
}
|
||||
|
||||
export default ProfilePage;*/
|
||||
export default ProfilePage;
|
||||
@@ -1,86 +0,0 @@
|
||||
import Modal from "../../../../components/ui/modal/modal.jsx";
|
||||
import Button from "../../../../components/ui/button/button.jsx";
|
||||
import styles from "./SettingsModal.module.css"
|
||||
import { useContext, useState } from "react";
|
||||
import ThemeSwitcher from "../../../../components/ui/themeSwitcher/ThemeSwitcher.jsx";
|
||||
import { AuthContext } from "../../../../contexts/auth/AuthContext.js";
|
||||
import TextInput from "../../../../components/ui/input/input.jsx";
|
||||
import updateUser from "../../../../utils/users/updateUser.js";
|
||||
import deleteUser from "../../../../utils/users/deleteUser.js";
|
||||
|
||||
|
||||
export default function SettingsModal() {
|
||||
|
||||
const { user, logout, update } = useContext(AuthContext);
|
||||
|
||||
const [open, setOpen] = useState(false);
|
||||
const [isDelete, setIsDelete] = useState(false);
|
||||
|
||||
const [name, setName] = useState(user?.name);
|
||||
const [lastname, setLastName] = useState(user?.lastname);
|
||||
const [phone, setPhone] = useState(user?.phone);
|
||||
|
||||
const handleLogout = () => {
|
||||
logout();
|
||||
}
|
||||
|
||||
const handleSubmit = async () => {
|
||||
await updateUser(name, lastname, phone);
|
||||
update();
|
||||
}
|
||||
|
||||
const handleDelete = async () => {
|
||||
await deleteUser();
|
||||
update();
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<Button variant={"transparent"} onClick={() => setOpen(!open)}>
|
||||
<img src={"/icons/settings-wheel.svg"} alt={"Modify btn"} className={styles.modifyIcon}/>
|
||||
</Button>
|
||||
|
||||
<Modal title={"Paramètres"} open={open} onClose={() => setOpen(false)}>
|
||||
<div className={styles.content}>
|
||||
|
||||
<div className={styles.section}>
|
||||
<h3>Compte</h3>
|
||||
<Button variant={"danger"} onClick={handleLogout}> Déconnexion </Button>
|
||||
<Button variant={"danger"} onClick={() => setIsDelete(true)}> Supprimer le compte </Button>
|
||||
|
||||
<div className={styles.section}>
|
||||
<h4>Changer de Prénom</h4>
|
||||
<TextInput value={name} onChange={e => setName(e.target.value)} type={"text"} />
|
||||
</div>
|
||||
|
||||
<div className={styles.section}>
|
||||
<h4>Changer de nom</h4>
|
||||
<TextInput value={lastname} onChange={e => setLastName(e.target.value)} type={"text"} />
|
||||
</div>
|
||||
|
||||
<div className={styles.section}>
|
||||
<h4>Changer de numéro de téléphone</h4>
|
||||
<TextInput value={phone} onChange={e => setPhone(e.target.value)} type={"text"} />
|
||||
</div>
|
||||
|
||||
<Button className={styles.submitBtn} onClick={handleSubmit}>Confirmer</Button>
|
||||
|
||||
</div>
|
||||
|
||||
<div className={styles.section}>
|
||||
<h3>Apparence</h3>
|
||||
<ThemeSwitcher />
|
||||
</div>
|
||||
</div>
|
||||
</Modal>
|
||||
|
||||
|
||||
<Modal title={"Validation"} open={isDelete} onClose={() => setIsDelete(false)}>
|
||||
<div className={styles.section}>
|
||||
<p className={styles.alignText}> Êtes vous vraiment sûr de vouloir supprimer votre compte ?</p>
|
||||
<Button variant={"danger"} className={styles.submitBtn} onClick={handleDelete}>Confirmer</Button>
|
||||
</div>
|
||||
</Modal>
|
||||
</>
|
||||
)
|
||||
}
|
||||
@@ -1,73 +1,98 @@
|
||||
.content {
|
||||
width: 100%;
|
||||
padding: 16px;
|
||||
padding: 20px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 20px;
|
||||
gap: 28px;
|
||||
}
|
||||
|
||||
.modifyIcon {
|
||||
height: 28px;
|
||||
width: 28px;
|
||||
height: 26px;
|
||||
width: 26px;
|
||||
transition: transform 0.2s ease, opacity 0.2s ease;
|
||||
}
|
||||
|
||||
.modifyIcon:hover {
|
||||
transform: rotate(15deg);
|
||||
opacity: 0.8;
|
||||
}
|
||||
|
||||
.section {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 12px;
|
||||
margin-top: 10px;
|
||||
gap: 16px;
|
||||
padding: 18px;
|
||||
border-radius: 12px;
|
||||
background: var(--glass-bg, rgba(255, 255, 255, 0.25));
|
||||
backdrop-filter: blur(6px);
|
||||
}
|
||||
|
||||
.section h3 {
|
||||
font-size: 1.1rem;
|
||||
margin-bottom: 5px;
|
||||
font-size: 1.15rem;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.section h4 {
|
||||
font-size: 0.95rem;
|
||||
font-size: 0.9rem;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.submitBtn {
|
||||
width: 100%;
|
||||
margin-top: 15px;
|
||||
opacity: 0.85;
|
||||
}
|
||||
|
||||
.section button {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
@media (min-width: 600px) {
|
||||
.submitBtn {
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
.alignText {
|
||||
text-align: center;
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
.section :global(input) {
|
||||
width: 100%;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
@media (min-width: 640px) {
|
||||
.content {
|
||||
padding: 24px;
|
||||
padding: 28px;
|
||||
gap: 32px;
|
||||
}
|
||||
|
||||
.section h3 {
|
||||
font-size: 1.2rem;
|
||||
.section {
|
||||
padding: 22px;
|
||||
gap: 18px;
|
||||
}
|
||||
|
||||
.submitBtn {
|
||||
width: auto;
|
||||
align-self: center;
|
||||
min-width: 200px;
|
||||
min-width: 220px;
|
||||
}
|
||||
|
||||
.section button {
|
||||
width: fit-content;
|
||||
}
|
||||
}
|
||||
|
||||
@media (min-width: 900px) {
|
||||
.content {
|
||||
padding: 30px;
|
||||
gap: 30px;
|
||||
padding: 36px;
|
||||
gap: 36px;
|
||||
}
|
||||
|
||||
.section {
|
||||
gap: 14px;
|
||||
padding: 26px;
|
||||
border-radius: 16px;
|
||||
}
|
||||
|
||||
.modifyIcon {
|
||||
height: 30px;
|
||||
width: 30px;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,167 @@
|
||||
import {useContext, useState, ChangeEvent} from "react";
|
||||
import Modal from "../../../../components/ui/modal/modal";
|
||||
import Button from "../../../../components/ui/button/button";
|
||||
import styles from "./SettingsModal.module.css";
|
||||
import ThemeSwitcher from "../../../../components/ui/themeSwitcher/ThemeSwitcher.jsx";
|
||||
import {AuthContext} from "../../../../contexts/auth/AuthContext";
|
||||
import TextInput from "../../../../components/ui/input/input";
|
||||
import updateUser from "../../../../utils/users/updateUser.js";
|
||||
import deleteUser from "../../../../utils/users/deleteUser.js";
|
||||
|
||||
interface TaskType {
|
||||
id: number;
|
||||
title?: string;
|
||||
completed?: boolean;
|
||||
|
||||
[key: string]: unknown;
|
||||
}
|
||||
|
||||
interface User {
|
||||
id: number;
|
||||
name: string;
|
||||
lastname: string;
|
||||
role: string;
|
||||
email: string;
|
||||
phone: string | null;
|
||||
created_at: string;
|
||||
isAdmin: boolean;
|
||||
tasks: TaskType[];
|
||||
}
|
||||
|
||||
interface AuthContextType {
|
||||
user: User;
|
||||
update: () => void;
|
||||
logout: () => void;
|
||||
}
|
||||
|
||||
export default function SettingsModal() {
|
||||
const {user, logout, update} = useContext(AuthContext) as AuthContextType;
|
||||
|
||||
const [open, setOpen] = useState<boolean>(false);
|
||||
const [isDelete, setIsDelete] = useState<boolean>(false);
|
||||
|
||||
const [name, setName] = useState<string>(user?.name ?? "");
|
||||
const [lastname, setLastName] = useState<string>(user?.lastname ?? "");
|
||||
const [phone, setPhone] = useState<string>(user?.phone ?? "");
|
||||
|
||||
const handleLogout = (): void => {
|
||||
logout();
|
||||
};
|
||||
|
||||
const handleSubmit = async (): Promise<void> => {
|
||||
await updateUser(name, lastname, phone || null);
|
||||
update();
|
||||
setOpen(false);
|
||||
};
|
||||
|
||||
const handleDelete = async (): Promise<void> => {
|
||||
await deleteUser();
|
||||
update();
|
||||
};
|
||||
|
||||
const handleNameChange = (e: ChangeEvent<HTMLInputElement>): void => {
|
||||
setName(e.target.value);
|
||||
};
|
||||
|
||||
const handleLastnameChange = (e: ChangeEvent<HTMLInputElement>): void => {
|
||||
setLastName(e.target.value);
|
||||
};
|
||||
|
||||
const handlePhoneChange = (e: ChangeEvent<HTMLInputElement>): void => {
|
||||
setPhone(e.target.value);
|
||||
};
|
||||
|
||||
|
||||
return (
|
||||
<>
|
||||
<Button variant="transparent" onClick={() => setOpen((prev) => !prev)}>
|
||||
<img
|
||||
src="/icons/settings-wheel.svg"
|
||||
alt="Modify btn"
|
||||
className={styles.modifyIcon}
|
||||
/>
|
||||
</Button>
|
||||
|
||||
<Modal
|
||||
title="Paramètres"
|
||||
open={open}
|
||||
onClose={() => setOpen(false)}
|
||||
>
|
||||
<div className={styles.content}>
|
||||
<div className={styles.section}>
|
||||
<h3>Compte</h3>
|
||||
|
||||
<Button variant="danger" onClick={handleLogout}>
|
||||
Déconnexion
|
||||
</Button>
|
||||
|
||||
<Button
|
||||
variant="danger"
|
||||
onClick={() => setIsDelete(true)}
|
||||
>
|
||||
Supprimer le compte
|
||||
</Button>
|
||||
|
||||
<div className={styles.section}>
|
||||
<h4>Changer de Prénom</h4>
|
||||
<TextInput
|
||||
value={name}
|
||||
onChange={handleNameChange}
|
||||
type="text"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className={styles.section}>
|
||||
<h4>Changer de nom</h4>
|
||||
<TextInput
|
||||
value={lastname}
|
||||
onChange={handleLastnameChange}
|
||||
type="text"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className={styles.section}>
|
||||
<h4>Changer de numéro de téléphone</h4>
|
||||
<TextInput
|
||||
value={phone}
|
||||
onChange={handlePhoneChange}
|
||||
type="text"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<Button
|
||||
className={styles.submitBtn}
|
||||
onClick={handleSubmit}
|
||||
>
|
||||
Confirmer
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
<div className={styles.section}>
|
||||
<h3>Apparence</h3>
|
||||
<ThemeSwitcher/>
|
||||
</div>
|
||||
</div>
|
||||
</Modal>
|
||||
|
||||
<Modal
|
||||
title="Validation"
|
||||
open={isDelete}
|
||||
onClose={() => setIsDelete(false)}
|
||||
>
|
||||
<div className={styles.section}>
|
||||
<p className={styles.alignText}>
|
||||
Êtes vous vraiment sûr de vouloir supprimer votre compte ?
|
||||
</p>
|
||||
<Button
|
||||
variant="danger"
|
||||
className={styles.submitBtn}
|
||||
onClick={handleDelete}
|
||||
>
|
||||
Confirmer
|
||||
</Button>
|
||||
</div>
|
||||
</Modal>
|
||||
</>
|
||||
);
|
||||
}
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
import Button from "../../../../components/ui/button/button.jsx";
|
||||
import Modal from "../../../../components/ui/modal/modal.jsx";
|
||||
import Button from "../../../../components/ui/button/button.tsx";
|
||||
import Modal from "../../../../components/ui/modal/modal.tsx";
|
||||
import {useContext, useState} from "react";
|
||||
import styles from "./manageMember.module.css"
|
||||
import DeactivateMemberBtn from "./deactivateMember/deactivateMemberBtn.jsx";
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
import Button from "../../../../../components/ui/button/button.jsx";
|
||||
import Modal from "../../../../../components/ui/modal/modal.jsx";
|
||||
import Button from "../../../../../components/ui/button/button.tsx";
|
||||
import Modal from "../../../../../components/ui/modal/modal.tsx";
|
||||
import { useState } from "react";
|
||||
import deactivateUser from "../../../../../utils/users/deactivateUser.js"
|
||||
import { useNavigate } from "react-router";
|
||||
File renamed without changes.
+2
-2
@@ -1,9 +1,9 @@
|
||||
import styles from "../manageMember.module.css";
|
||||
import Button from "../../../../../components/ui/button/button.jsx";
|
||||
import Button from "../../../../../components/ui/button/button.tsx";
|
||||
import modifyRole from "../../../../../utils/users/modifyRole.js";
|
||||
import { useState, useEffect } from "react";
|
||||
import getRoles from "../../../../../utils/getRoles.js";
|
||||
import Modal from "../../../../../components/ui/modal/modal.jsx";
|
||||
import Modal from "../../../../../components/ui/modal/modal.tsx";
|
||||
|
||||
export default function ModifyRole({ user }) {
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import styles from "./RegisterPage.module.css";
|
||||
import Background from "../../components/background/background.jsx";
|
||||
import Input from "../../components/ui/input/input.jsx";
|
||||
import Button from "../../components/ui/button/button.jsx";
|
||||
import Input from "../../components/ui/input/input.tsx";
|
||||
import Button from "../../components/ui/button/button.tsx";
|
||||
import {useContext, useEffect, useState} from "react";
|
||||
import register from "../../utils/register.js";
|
||||
import { useNavigate } from "react-router";
|
||||
import { AuthContext } from "../../contexts/auth/AuthContext.js";
|
||||
import Modal from "../../components/ui/modal/modal.jsx";
|
||||
import Modal from "../../components/ui/modal/modal.tsx";
|
||||
|
||||
|
||||
function RegisterPage() {
|
||||
|
||||
@@ -1,84 +0,0 @@
|
||||
import styles from "./VolunteerProfilePage.module.css";
|
||||
import { useParams, useNavigate } from "react-router";
|
||||
import { useEffect, useState, useContext } from "react";
|
||||
import getUserById from "../../utils/users/getUserById.js";
|
||||
import formatDate from "../../utils/date/formatDate.js";
|
||||
import Task from "../../components/Task/Task.jsx";
|
||||
import ManageMember from "./components/manageMember/ManageMember.jsx";
|
||||
import { AuthContext } from "../../contexts/auth/AuthContext.js";
|
||||
|
||||
export default function VolunteerProfilePage() {
|
||||
const { id } = useParams();
|
||||
const navigate = useNavigate();
|
||||
const { user: currentUser } = useContext(AuthContext);
|
||||
|
||||
const [user, setUser] = useState(null);
|
||||
|
||||
useEffect(() => {
|
||||
(async () => {
|
||||
const res = await getUserById(id);
|
||||
|
||||
if (res.status === 404) {
|
||||
navigate("/404");
|
||||
return;
|
||||
}
|
||||
|
||||
if (res.status !== 200) {
|
||||
console.error("Erreur lors du chargement du profil", res);
|
||||
return;
|
||||
}
|
||||
|
||||
setUser(res.data);
|
||||
})();
|
||||
}, [id, navigate]);
|
||||
|
||||
if (!user) return null;
|
||||
|
||||
return (
|
||||
<div className={styles.container}>
|
||||
<div className={`${styles.profileboard} glassCard`}>
|
||||
<div className={styles.contentWrapper}>
|
||||
<div className={styles.profilePictureContainer}>
|
||||
<img
|
||||
src="/react.svg"
|
||||
alt="Photo de profil"
|
||||
className={styles.profilePicture}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className={styles.description}>
|
||||
<div className={styles.headerProfile}>
|
||||
<h2>{user.name} {user.lastname}</h2>
|
||||
{currentUser?.isAdmin && (
|
||||
<ManageMember userToManage={user} />
|
||||
)}
|
||||
</div>
|
||||
|
||||
<div className={styles.topDescription}>
|
||||
<div className={`${styles.infoBlock} glassBorder`}>
|
||||
<p><strong>Role :</strong> {user.role}</p>
|
||||
<p><strong>Membre depuis :</strong> {formatDate(user.created_at)}</p>
|
||||
</div>
|
||||
<div className={`${styles.infoBlock} glassBorder`}>
|
||||
<p><strong>Mail :</strong> {user.email}</p>
|
||||
<p>
|
||||
<strong>Téléphone :</strong>{" "}
|
||||
{user.phone ?? "Pas de numéro enregistré"}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<h2>Tâches :</h2>
|
||||
{user.tasks?.length > 0 ? (
|
||||
user.tasks.map((task, index) => (
|
||||
<Task key={index} task={task} />
|
||||
))
|
||||
) : (
|
||||
<p>Aucune tâche pour le moment.</p>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -1,163 +0,0 @@
|
||||
.container {
|
||||
width: 100%;
|
||||
padding: 10px;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.profileboard {
|
||||
width: 100%;
|
||||
padding: 15px;
|
||||
border-radius: 20px;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.contentWrapper {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.profilePictureContainer {
|
||||
width: 120px;
|
||||
height: 120px;
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
|
||||
.profilePicture {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
border-radius: 50%;
|
||||
object-fit: cover;
|
||||
}
|
||||
|
||||
.description {
|
||||
width: 100%;
|
||||
text-align: left;
|
||||
margin-left:4%;
|
||||
}
|
||||
|
||||
.topDescription {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
|
||||
.infoBlock {
|
||||
width: 100%;
|
||||
background: rgba(255, 255, 255, 0.1);
|
||||
padding: 10px;
|
||||
border-radius: 5px;
|
||||
}
|
||||
|
||||
.eventTasks {
|
||||
max-height: 0;
|
||||
overflow: hidden;
|
||||
transition: max-height 0.3s ease-out, opacity 0.2s ease;
|
||||
opacity: 0;
|
||||
padding-left: 20px;
|
||||
}
|
||||
|
||||
.eventTasks.expanded {
|
||||
max-height: 500px;
|
||||
opacity: 1;
|
||||
margin-top: 10px;
|
||||
}
|
||||
.description h2{
|
||||
font-size:30px;
|
||||
|
||||
}
|
||||
.profilePicture{
|
||||
width:90%;
|
||||
}
|
||||
|
||||
.settingsBtns {
|
||||
display: flex;
|
||||
gap: 5px;
|
||||
justify-content: right;
|
||||
}
|
||||
|
||||
@media screen and (min-width: 768px) {
|
||||
.contentWrapper {
|
||||
flex-direction: row;
|
||||
justify-content: flex-start;
|
||||
align-items: flex-start;
|
||||
}
|
||||
|
||||
.profilePictureContainer {
|
||||
width: 150px;
|
||||
height: 150px;
|
||||
margin-right: 20px;
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.description {
|
||||
width: calc(100% - 170px);
|
||||
margin-left:4%;
|
||||
}
|
||||
|
||||
.topDescription {
|
||||
flex-direction: row;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.infoBlock {
|
||||
width: 48%;
|
||||
}
|
||||
|
||||
.event {
|
||||
padding: 15px;
|
||||
}
|
||||
.description h2{
|
||||
font-size:30px;
|
||||
}
|
||||
.profilePicture{
|
||||
width:90%;
|
||||
}
|
||||
}
|
||||
.description button{
|
||||
width:50px;
|
||||
height:50px;
|
||||
|
||||
}
|
||||
|
||||
.headerProfile {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
@media screen and (min-width: 1024px) {
|
||||
.container {
|
||||
max-width: 100%;
|
||||
margin: 0 auto;
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
.profileboard {
|
||||
padding: 25px;
|
||||
}
|
||||
|
||||
.profilePictureContainer {
|
||||
width: 30%;
|
||||
height:auto;
|
||||
}
|
||||
.profilePicture{
|
||||
width:90%;
|
||||
}
|
||||
.description {
|
||||
width: calc(100% - 200px);
|
||||
margin-left:4%;
|
||||
}
|
||||
|
||||
.event {
|
||||
padding: 18px;
|
||||
}
|
||||
.description h2{
|
||||
font-size:30px;
|
||||
}
|
||||
}
|
||||
@@ -1,78 +0,0 @@
|
||||
import React, {useState} from "react";
|
||||
import styles from "./VolunteersPage.module.css";
|
||||
import formatDate from "../../utils/date/formatDate.js";
|
||||
import { useNavigate } from "react-router";
|
||||
import Button from "../../components/ui/button/button.jsx";
|
||||
|
||||
export default function VolunteerCard({ user }) {
|
||||
|
||||
const [isExpanded, setIsExpanded] = useState(false);
|
||||
|
||||
const toggleExpand = () => {
|
||||
setIsExpanded(!isExpanded);
|
||||
};
|
||||
|
||||
const navigate = useNavigate();
|
||||
|
||||
return (
|
||||
<div className={`${styles.profileboard} glassCard`} onClick={(() => setIsExpanded(!isExpanded))}>
|
||||
|
||||
<div className={styles.header}>
|
||||
<h2 className={styles.userName}>
|
||||
<span className={styles.firstName}>{user?.name}</span>{" "}
|
||||
<span className={styles.lastName}>{user?.lastname}</span>
|
||||
</h2>
|
||||
|
||||
<Button
|
||||
variant={"transparent"}
|
||||
onClick={toggleExpand}
|
||||
className={`${isExpanded ? styles.moreButtonClicked : ""}`}
|
||||
>
|
||||
{">"}
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
<div className={styles.mainContent}>
|
||||
{!isExpanded ? (
|
||||
<div className={styles.basicInfo}>
|
||||
<p><strong>Rôle :</strong> {user?.role}</p>
|
||||
<p><strong>Membre depuis :</strong> {user?.created_at && formatDate(user.created_at)}</p>
|
||||
</div>
|
||||
) : (
|
||||
<div className={styles.expandedContent}>
|
||||
<div className={styles.profilePictureContainer}>
|
||||
<img src={"/react.svg"} alt="profile" className={styles.profilePicture} />
|
||||
</div>
|
||||
|
||||
<div className={styles.textInfo}>
|
||||
<div className={styles.basicInfo}>
|
||||
<p><strong>Rôle :</strong> {user?.role}</p>
|
||||
<p><strong>Membre depuis :</strong> {user?.created_at && formatDate(user.created_at)}</p>
|
||||
</div>
|
||||
|
||||
<div className={styles.contactInfo}>
|
||||
<p><strong>Email :</strong> {user?.email}</p>
|
||||
{user?.phone && <p><strong>Téléphone :</strong> {user.phone}</p>}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{isExpanded && (
|
||||
<div className={styles.bottomBar}>
|
||||
<Button
|
||||
onClick={() => navigate(`/profile/${user.id}`)}
|
||||
variant="primary"
|
||||
>
|
||||
Voir plus
|
||||
</Button>
|
||||
</div>
|
||||
)}
|
||||
|
||||
</div>
|
||||
);
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -1,53 +0,0 @@
|
||||
import { useState, useEffect } from "react";
|
||||
import styles from "./VolunteersPage.module.css";
|
||||
import VolunteerCard from "./VolunteerCard.jsx";
|
||||
import getAllUser from "../../utils/users/getAllUsers.js";
|
||||
import ToolBar from "../../components/ToolBar/ToolBar.jsx";
|
||||
import filter from "../../utils/filter.js";
|
||||
import getUserById from "../../utils/users/getUserById.js";
|
||||
|
||||
function VolunteerPage() {
|
||||
const [filters, setFilters] = useState({
|
||||
alphabetical: "asc",
|
||||
yearOrder: "desc",
|
||||
});
|
||||
const [users, setUsers] = useState([]);
|
||||
|
||||
useEffect(() => {
|
||||
(async () => {
|
||||
const result = await getAllUser();
|
||||
|
||||
if (result.status !== 200 || !Array.isArray(result.data)) {
|
||||
console.error("Erreur lors du chargement des utilisateurs", result);
|
||||
return;
|
||||
}
|
||||
|
||||
const usersData = await Promise.all(
|
||||
result.data.map(async (id) => {
|
||||
const res = await getUserById(id);
|
||||
|
||||
if (res.status === 200) {
|
||||
return res.data;
|
||||
}
|
||||
console.warn(`Utilisateur ${id} non récupéré`, res.status);
|
||||
return null;
|
||||
})
|
||||
);
|
||||
|
||||
setUsers(usersData.filter(Boolean));
|
||||
})();
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<div className={styles.container}>
|
||||
<ToolBar setFilters={setFilters} filters={filters} showCreate={false} />
|
||||
<div className={styles.usersList}>
|
||||
{filter(users, filters, "user").map((user, index) => (
|
||||
<VolunteerCard key={user.id ?? index} user={user} />
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default VolunteerPage;
|
||||
@@ -3,33 +3,18 @@
|
||||
position: relative;
|
||||
padding: 10px;
|
||||
}
|
||||
.userName {
|
||||
display: flex;
|
||||
gap: 5px;
|
||||
font-weight: bold;
|
||||
font-size: 1rem;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.firstName {
|
||||
white-space: nowrap;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.lastName {
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
flex-shrink: 1;
|
||||
max-width: 100px;
|
||||
}
|
||||
|
||||
.usersList {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
display: grid;
|
||||
gap: 16px;
|
||||
width: 100%;
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
|
||||
.usersList > * {
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.profileboard {
|
||||
width: 100%;
|
||||
max-width: 380px;
|
||||
@@ -140,12 +125,23 @@
|
||||
}
|
||||
}
|
||||
|
||||
.loading {
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
font-size: 1.1rem;
|
||||
opacity: 1;
|
||||
color: white;
|
||||
}
|
||||
|
||||
@media screen and (min-width: 1024px) {
|
||||
.container {
|
||||
padding: 20px;
|
||||
}
|
||||
.usersList {
|
||||
gap: 20px;
|
||||
grid-template-columns: repeat(3, 1fr);
|
||||
padding-right: 5em;
|
||||
padding-left: 5em;
|
||||
}
|
||||
.profileboard {
|
||||
max-width: 700px;
|
||||
|
||||
@@ -0,0 +1,81 @@
|
||||
import { useEffect, useState } from "react";
|
||||
import styles from "./VolunteersPage.module.css";
|
||||
import VolunteerCard from "./components/VolunteersCard/VolunteerCard";
|
||||
import getAllUser from "../../utils/users/getAllUsers";
|
||||
import ToolBar from "../../components/ToolBar/ToolBar";
|
||||
import filter from "../../utils/filter";
|
||||
import getUserById from "../../utils/users/getUserById";
|
||||
import User from "./interfaces/user.interface";
|
||||
import Loading from "../../components/ui/loading/loading";
|
||||
|
||||
interface Filters {
|
||||
alphabetical: "asc" | "desc";
|
||||
yearOrder: "asc" | "desc";
|
||||
}
|
||||
|
||||
const VolunteerPage: React.FC = () => {
|
||||
const [filters, setFilters] = useState<Filters>({
|
||||
alphabetical: "asc",
|
||||
yearOrder: "desc",
|
||||
});
|
||||
|
||||
const [users, setUsers] = useState<User[]>([]);
|
||||
const [loading, setLoading] = useState<boolean>(true);
|
||||
|
||||
useEffect(() => {
|
||||
const fetchUsers = async (): Promise<void> => {
|
||||
setLoading(true);
|
||||
|
||||
try {
|
||||
const result = await getAllUser();
|
||||
|
||||
if (result.status !== 200 || !Array.isArray(result.data)) {
|
||||
console.error("Erreur lors du chargement des utilisateurs", result);
|
||||
return;
|
||||
}
|
||||
|
||||
const usersData = await Promise.all(
|
||||
result.data.map(async (id: number): Promise<User | null> => {
|
||||
const res = await getUserById(id);
|
||||
|
||||
if (res.status === 200) {
|
||||
return res.data as User;
|
||||
}
|
||||
|
||||
console.warn(`Utilisateur ${id} non récupéré`, res.status);
|
||||
return null;
|
||||
})
|
||||
);
|
||||
|
||||
setUsers(usersData.filter((user): user is User => user !== null));
|
||||
} catch (error) {
|
||||
console.error("Erreur réseau", error);
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
};
|
||||
|
||||
fetchUsers();
|
||||
}, []);
|
||||
|
||||
if(loading) return <Loading />;
|
||||
|
||||
return (
|
||||
<div className={styles.container}>
|
||||
<ToolBar
|
||||
setFilters={setFilters}
|
||||
filters={filters}
|
||||
showCreate={false}
|
||||
/>
|
||||
|
||||
<div className={styles.usersList}>
|
||||
{filter(users, filters, "user").map((user: User) => (
|
||||
<VolunteerCard key={user.id} user={user} />
|
||||
))}
|
||||
</div>
|
||||
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default VolunteerPage;
|
||||
@@ -0,0 +1,29 @@
|
||||
import styles from "./VolunteersCard.module.css";
|
||||
import { useNavigate } from "react-router";
|
||||
import Button from "../../../../components/ui/button/button";
|
||||
import User from "../../interfaces/user.interface"
|
||||
|
||||
|
||||
interface VolunteersCardProps {
|
||||
user: User;
|
||||
}
|
||||
|
||||
export default function VolunteerCard({ user }: VolunteersCardProps) {
|
||||
|
||||
const navigate = useNavigate();
|
||||
|
||||
const handleNavigate = (): void => { navigate(`/profile/${user.id}`) }
|
||||
|
||||
return (
|
||||
<div className={`glassCard ${styles.volunteerCard}`}>
|
||||
<div className={styles.header}>
|
||||
<img src={"/react.svg"} alt="profile" className={styles.profilePicture} />
|
||||
<p> {user.name} {user.lastname} </p>
|
||||
</div>
|
||||
<div className={styles.content}>
|
||||
<p> {user.email} </p>
|
||||
<Button variant={"primary"} onClick={handleNavigate}>Voir</Button>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
.volunteerCard {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.header p {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
.content {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.content p {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
.content button {
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.profilePicture {
|
||||
background-color: #1d1d1f;
|
||||
border-radius: 20px;
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
export default interface Task {
|
||||
id: number;
|
||||
name: string;
|
||||
description: string;
|
||||
location: string;
|
||||
start: string;
|
||||
end: string;
|
||||
max_participants: number;
|
||||
events_id: number;
|
||||
created_at: string;
|
||||
updated_at: string;
|
||||
pivot: {
|
||||
user_id: number;
|
||||
task_id: number;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
import Task from "./task.interface";
|
||||
|
||||
export default interface User {
|
||||
id: number;
|
||||
name: string;
|
||||
lastname: string;
|
||||
email: string;
|
||||
role: string;
|
||||
isAdmin: boolean;
|
||||
phone: string | null;
|
||||
created_at: string;
|
||||
updated_at: string;
|
||||
verified_at: string | null;
|
||||
validate: number;
|
||||
tasks: Task[];
|
||||
}
|
||||
@@ -1,17 +1,17 @@
|
||||
import styles from "./eventTask.module.css";
|
||||
import { formatDateLetter } from "../../../../utils/date/formatDateLetter.js";
|
||||
import Button from "../../../../components/ui/button/button.jsx";
|
||||
import Button from "../../../../components/ui/button/button.tsx";
|
||||
import assign from "../../../../utils/tasks/assign.js";
|
||||
import unAssign from "../../../../utils/tasks/unAssign.js";
|
||||
import { useContext, useEffect, useState } from "react";
|
||||
import isAssigned from "../../../../utils/tasks/isAssigned.js";
|
||||
import Modal from "../../../../components/ui/modal/modal.jsx";
|
||||
import Modal from "../../../../components/ui/modal/modal.tsx";
|
||||
import { AuthContext } from "../../../../contexts/auth/AuthContext.js";
|
||||
import DeleteTaskBtn from "../deleteTaskBtn/deleteTaskBtn.jsx";
|
||||
|
||||
export default function EventTask({ task, index, eventId }) {
|
||||
|
||||
const { user } = useContext(AuthContext)
|
||||
const { update } = useContext(AuthContext)
|
||||
|
||||
const [assigned, setAssigned] = useState(false);
|
||||
const [open, setOpen] = useState(false);
|
||||
@@ -33,6 +33,7 @@ export default function EventTask({ task, index, eventId }) {
|
||||
|
||||
switch (res.status) {
|
||||
case 200:
|
||||
update()
|
||||
setTitle("Inscription réussie")
|
||||
setMessage(`Vous êtes maintenant inscrit à la tâche ${task.name}`);
|
||||
setOpen(true);
|
||||
@@ -58,6 +59,7 @@ export default function EventTask({ task, index, eventId }) {
|
||||
|
||||
switch (res.status) {
|
||||
case 200:
|
||||
update()
|
||||
setTitle("Désinscription réussie")
|
||||
setMessage(`Vous n'êtes plus inscrit à la tâche ${task.name}`);
|
||||
setOpen(true);
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import styles from "../../eventDetail.module.css";
|
||||
import Button from "../../../../components/ui/button/button.jsx";
|
||||
import Button from "../../../../components/ui/button/button.tsx";
|
||||
import {useContext, useState} from "react";
|
||||
import TextInput from "../../../../components/ui/input/input.jsx";
|
||||
import Modal from "../../../../components/ui/modal/modal.jsx";
|
||||
import TextInput from "../../../../components/ui/input/input.tsx";
|
||||
import Modal from "../../../../components/ui/modal/modal.tsx";
|
||||
import createTaskApi from "../../../../utils/tasks/createTask.js";
|
||||
import {EventDetailContext} from "../../../../contexts/eventDetail/eventDetail.js";
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import styles from "../../eventDetail.module.css";
|
||||
import Button from "../../../../components/ui/button/button.jsx";
|
||||
import Modal from "../../../../components/ui/modal/modal.jsx";
|
||||
import Button from "../../../../components/ui/button/button.tsx";
|
||||
import Modal from "../../../../components/ui/modal/modal.tsx";
|
||||
import { useContext, useState } from "react";
|
||||
import { EventDetailContext } from "../../../../contexts/eventDetail/eventDetail.js";
|
||||
import { EventContext } from "../../../../contexts/events/EventContext.js";
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { useContext } from "react";
|
||||
import { AuthContext } from "../../../../contexts/auth/AuthContext.js";
|
||||
import { EventDetailContext } from "../../../../contexts/eventDetail/eventDetail.js";
|
||||
import Button from "../../../../components/ui/button/button.jsx";
|
||||
import Button from "../../../../components/ui/button/button.tsx";
|
||||
import { useState } from "react";
|
||||
import Modal from "../../../../components/ui/modal/modal.jsx";
|
||||
import Modal from "../../../../components/ui/modal/modal.tsx";
|
||||
import styles from "../../eventDetail.module.css";
|
||||
|
||||
export default function DeleteTaskBtn({ taskId, eventId, taskName }) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import styles from "./validationErrorPage.module.css"
|
||||
import Background from "../../components/background/background.jsx";
|
||||
import Button from "../../components/ui/button/button.jsx";
|
||||
import Button from "../../components/ui/button/button.tsx";
|
||||
import { useContext } from "react";
|
||||
import { AuthContext } from "../../contexts/auth/AuthContext.js";
|
||||
import { Navigate, useNavigate, Link } from "react-router";
|
||||
|
||||
Reference in new issue
Block a user