Merge branch 'dev' into refactor/filesName
# Conflicts: # src/pages/Login/components/LoginForm/loginForm.jsx
This commit is contained in:
commit
41d59b336b
11 files changed
+88
-34
No files matched your search
@@ -2,7 +2,6 @@
|
||||
width: 100%;
|
||||
padding: 12px;
|
||||
margin-bottom: 10px;
|
||||
border-radius: 8px;
|
||||
}
|
||||
|
||||
.content {
|
||||
|
||||
@@ -52,7 +52,7 @@ const Task: React.FC<TaskProps> = ({ task }) => {
|
||||
}, [task.events_id]);
|
||||
|
||||
return (
|
||||
<div className={`${styles.task} glassCard`}>
|
||||
<div className={`${styles.task} glassBorder`}>
|
||||
<div className={styles.content}>
|
||||
<div>
|
||||
<h2>
|
||||
|
||||
@@ -11,7 +11,7 @@ function IncompleteEvent() {
|
||||
<h2>Derniers événements</h2>
|
||||
<div className={styles.eventsContainer}>
|
||||
{events.map((event) => (
|
||||
<div key={event.id} className={`glassCard ${styles.eventCard}`}>
|
||||
<div key={event.id} className={`glassBorder ${styles.eventCard}`}>
|
||||
<h3>{event.name}</h3>
|
||||
<p className={styles.eventDate}>
|
||||
{new Date(event.start).toLocaleDateString("fr-FR")} - {new Date(event.end).toLocaleDateString("fr-FR")}
|
||||
|
||||
@@ -29,17 +29,18 @@
|
||||
transform: translateX(20px);
|
||||
animation: slideInEvent 1s ease forwards;
|
||||
flex-shrink: 0;
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
.eventCard ul {
|
||||
align-items: center;
|
||||
margin-left: 8%;
|
||||
padding-left: 15px;
|
||||
margin-left: 5%;
|
||||
}
|
||||
|
||||
.eventCard ul li {
|
||||
text-align: left;
|
||||
list-style-type: circle;
|
||||
list-style: none;
|
||||
}
|
||||
|
||||
.eventCard > h3 {
|
||||
|
||||
@@ -58,7 +58,7 @@ function PendingMembers() {
|
||||
|
||||
{pendingMembers.map((member, index) => (
|
||||
|
||||
<div key={index} className={`glassCard ${styles.memberCard}`}>
|
||||
<div key={index} className={`glassBorder ${styles.memberCard}`}>
|
||||
|
||||
<p>{member.name} {member.lastname}</p>
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import styles from "./HomePage.module.css";
|
||||
import Calendar from "./components/Calendar/Calendar.jsx";
|
||||
import EventList from "./components/EventList/EventList.tsx";
|
||||
import EventList from "./components/EventList/EventList";
|
||||
|
||||
function HomePage() {
|
||||
|
||||
|
||||
@@ -4,10 +4,11 @@ import {formatDateLetterJS} from "../../../../utils/date/formatDateLetter.js";
|
||||
import Button from "../../../../components/ui/Button/Button";
|
||||
import {AuthContext} from "../../../../contexts/Auth/AuthContext.ts";
|
||||
|
||||
function Calendar() {
|
||||
|
||||
function
|
||||
Calendar() {
|
||||
const { user } = useContext(AuthContext);
|
||||
|
||||
const calendarUrl = `${import.meta.env.VITE_API_URL}/api/export/ics/${user.id}`;
|
||||
|
||||
const monthNames = [
|
||||
"Janvier", "Février", "Mars", "Avril", "Mai", "Juin",
|
||||
@@ -17,17 +18,17 @@ function Calendar() {
|
||||
const today = new Date();
|
||||
|
||||
const [currentMonth, setCurrentMonth] = useState(today.getMonth());
|
||||
const [currentYear] = useState(today.getFullYear());
|
||||
const [currentYear, setCurrentYear] = useState(today.getFullYear());
|
||||
const [selectedDay, setSelectedDay] = useState(null);
|
||||
|
||||
const eventsByDate = useMemo(() => {
|
||||
if (!user?.tasks) return {};
|
||||
return user.tasks.reduce((acc, task) => {
|
||||
if (!task?.start) return acc;
|
||||
return user.tasks.reduce((eventsByDate, task) => {
|
||||
if (!task?.start) return eventsByDate;
|
||||
const dateKey = task.start.split(" ")[0];
|
||||
if (!acc[dateKey]) acc[dateKey] = [];
|
||||
acc[dateKey].push(task);
|
||||
return acc;
|
||||
if (!eventsByDate[dateKey]) eventsByDate[dateKey] = [];
|
||||
eventsByDate[dateKey].push(task);
|
||||
return eventsByDate;
|
||||
}, {});
|
||||
}, [user]);
|
||||
|
||||
@@ -66,9 +67,31 @@ function Calendar() {
|
||||
<div className={styles.calendarContainer}>
|
||||
|
||||
<div className={styles.calendarHeader}>
|
||||
<button onClick={() => setCurrentMonth(m => m === 0 ? 11 : m - 1)}>◀</button>
|
||||
<button
|
||||
onClick={() => {
|
||||
if (currentMonth === 0) {
|
||||
setCurrentMonth(11);
|
||||
setCurrentYear(y => y - 1);
|
||||
} else {
|
||||
setCurrentMonth(m => m - 1);
|
||||
}
|
||||
}}
|
||||
>
|
||||
◀
|
||||
</button>
|
||||
<p>{monthNames[currentMonth]} {currentYear}</p>
|
||||
<button onClick={() => setCurrentMonth(m => m === 11 ? 0 : m + 1)}>▶</button>
|
||||
<button
|
||||
onClick={() => {
|
||||
if (currentMonth === 11) {
|
||||
setCurrentMonth(0);
|
||||
setCurrentYear(y => y + 1);
|
||||
} else {
|
||||
setCurrentMonth(m => m + 1);
|
||||
}
|
||||
}}
|
||||
>
|
||||
▶
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<table className={styles.calendar}>
|
||||
@@ -128,17 +151,20 @@ function Calendar() {
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
<div className={`${styles.exportbox} glassBorder`}>
|
||||
<p><b>votre lien d'agenda:</b> {calendarUrl}</p>
|
||||
<Button className={styles.exportbtn}
|
||||
variant={"primary"}
|
||||
onClick={() => {
|
||||
window.location.href =
|
||||
`http://localhost/api/export/ics/${user.id}`;
|
||||
window.open(
|
||||
"https://calendar.google.com/calendar/u/0/r/settings/addbyurl"
|
||||
);
|
||||
}}
|
||||
>
|
||||
Exporter mon agenda
|
||||
Exporter
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -150,10 +150,22 @@
|
||||
display: none;
|
||||
}
|
||||
|
||||
.exportbtn{
|
||||
.exportbox{
|
||||
width: 100%;
|
||||
padding: 15px;
|
||||
margin-top: 16px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.exportbtn {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
max-height: 30px;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@media (max-width: 768px) {
|
||||
.glassCard {
|
||||
width: 100%;
|
||||
|
||||
@@ -68,9 +68,12 @@ h2{
|
||||
}
|
||||
|
||||
.eventTasks {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: space-between;
|
||||
list-style: none;
|
||||
margin: 10px;
|
||||
}
|
||||
|
||||
.taskDate{
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import styles from "./LoginPage.module.css";
|
||||
import LoginForm from "./components/LoginForm/LoginForm.tsx";
|
||||
import LoginForm from "./components/LoginForm/LoginForm";
|
||||
import Background from "../../components/Background/Background.jsx";
|
||||
import { useEffect, useContext } from "react";
|
||||
import { AuthContext } from "../../contexts/Auth/AuthContext.js";
|
||||
|
||||
@@ -64,7 +64,6 @@ function ProfilePage() {
|
||||
|
||||
useEffect(() => {
|
||||
(async () => {
|
||||
console.log(JSON.stringify(import.meta.env.VITE_API_URL));
|
||||
if (!isOwnProfile && id) {
|
||||
const res = await getUserById(id);
|
||||
if (res.status === 404) {
|
||||
@@ -77,11 +76,10 @@ function ProfilePage() {
|
||||
}
|
||||
setProfileUser(res.data);
|
||||
} else {
|
||||
//update();
|
||||
update();
|
||||
setProfileUser(user);
|
||||
if (user?.profile_photo_path) {
|
||||
setProfilePicture(`${import.meta.env.VITE_API_URL}/storage/${user.profile_photo_path}`);
|
||||
//setProfilePicture(`${import.meta.env.VITE_API_URL}/${user.profile_photo_path}`);
|
||||
}
|
||||
}
|
||||
})();
|
||||
@@ -93,6 +91,7 @@ function ProfilePage() {
|
||||
}
|
||||
};
|
||||
|
||||
// Remplacé : handleFileChange extrait vers utils/users/uploadProfilePhoto
|
||||
const handleFileChange = async (e: React.ChangeEvent<HTMLInputElement>) => {
|
||||
const file = e.target.files?.[0];
|
||||
if (!file) return;
|
||||
@@ -101,7 +100,6 @@ function ProfilePage() {
|
||||
const res = await uploadProfilePhoto(file);
|
||||
if (res.ok) {
|
||||
setProfilePicture(`${import.meta.env.VITE_API_URL}/storage/${res.data.profile_photo_path}`);
|
||||
//setProfilePicture(`${import.meta.env.VITE_API_URL}/${res.data.profile_photo_path}`);
|
||||
setSuccess("Photo mise à jour !");
|
||||
setError(null);
|
||||
await update();
|
||||
@@ -114,10 +112,24 @@ function ProfilePage() {
|
||||
setSuccess(null);
|
||||
}
|
||||
};
|
||||
const handleDeletePicture = async () => {
|
||||
|
||||
deleteProfilePhoto();
|
||||
// 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 (
|
||||
@@ -138,7 +150,7 @@ function ProfilePage() {
|
||||
Modifier la photo
|
||||
</button>
|
||||
{user?.profile_photo_path && (
|
||||
<button onClick={handleDeletePicture} className={styles.editPictureButton}>
|
||||
<button onClick={handleDeletePicture} className={styles.deletePictureButton}>
|
||||
Supprimer
|
||||
</button>
|
||||
)}
|
||||
@@ -168,7 +180,8 @@ function ProfilePage() {
|
||||
<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>
|
||||
<p><strong>Membre depuis :</strong> {profileUser && formatDate(profileUser.created_at)}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div className={`${styles.infoBlock} glassBorder`}>
|
||||
|
||||
Reference in new issue
Block a user