Merge branch 'features/ts' into dev
This commit is contained in:
@@ -11,14 +11,14 @@ interface TextInputProps extends InputHTMLAttributes<HTMLInputElement> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const TextInput = ({
|
const TextInput = ({
|
||||||
placeholder,
|
placeholder = "",
|
||||||
onChange,
|
onChange,
|
||||||
value,
|
value = "",
|
||||||
borderStyle = "square",
|
borderStyle = "square",
|
||||||
password,
|
password = false,
|
||||||
className = "",
|
className = "",
|
||||||
...props
|
...props
|
||||||
}: TextInputProps) => {
|
}: TextInputProps) => {
|
||||||
const [showPassword, setShowPassword] = useState<boolean>(false);
|
const [showPassword, setShowPassword] = useState<boolean>(false);
|
||||||
|
|
||||||
let inputBorderStyle = styles.square;
|
let inputBorderStyle = styles.square;
|
||||||
@@ -28,15 +28,16 @@ const TextInput = ({
|
|||||||
setShowPassword((prev) => !prev);
|
setShowPassword((prev) => !prev);
|
||||||
};
|
};
|
||||||
|
|
||||||
if (password)
|
if (password) {
|
||||||
return (
|
return (
|
||||||
<div className={styles.passwordContainer}>
|
<div className={styles.passwordContainer}>
|
||||||
<TextInput
|
<input
|
||||||
type={showPassword ? "text" : "password"}
|
type={showPassword ? "text" : "password"}
|
||||||
value={value}
|
value={value}
|
||||||
placeholder={placeholder}
|
placeholder={placeholder}
|
||||||
onChange={onChange}
|
onChange={onChange}
|
||||||
className={styles.passwordInput}
|
className={`${styles.input} ${styles.passwordInput} ${inputBorderStyle} ${className}`}
|
||||||
|
{...props}
|
||||||
/>
|
/>
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
@@ -47,6 +48,7 @@ const TextInput = ({
|
|||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<input
|
<input
|
||||||
|
|||||||
@@ -1,8 +1,3 @@
|
|||||||
/*import { createContext } from "react";
|
|
||||||
|
|
||||||
export const EventContext = createContext(null);*/
|
|
||||||
|
|
||||||
|
|
||||||
import { createContext } from "react";
|
import { createContext } from "react";
|
||||||
|
|
||||||
export type Task = {
|
export type Task = {
|
||||||
|
|||||||
@@ -7,8 +7,6 @@ import deleteOtherUser from "../../../../utils/users/deleteOtherUser.js";
|
|||||||
import { PendingMembersContext } from "../../../../contexts/PendingMembers/PendingMembersContext";
|
import { PendingMembersContext } from "../../../../contexts/PendingMembers/PendingMembersContext";
|
||||||
|
|
||||||
function PendingMembers() {
|
function PendingMembers() {
|
||||||
|
|
||||||
|
|
||||||
const [open, setOpen] = useState(false);
|
const [open, setOpen] = useState(false);
|
||||||
const [message, setMessage] = useState("");
|
const [message, setMessage] = useState("");
|
||||||
const [title, setTitle] = useState("");
|
const [title, setTitle] = useState("");
|
||||||
|
|||||||
@@ -1,38 +1,3 @@
|
|||||||
/*import { useMemo } from "react";
|
|
||||||
import styles from "./eventList.module.css";
|
|
||||||
import EventItem from "./eventItem.jsx";
|
|
||||||
import { EventContext } from "../../../../contexts/events/EventContext.js";
|
|
||||||
import { useContext } from "react";
|
|
||||||
|
|
||||||
function EventList() {
|
|
||||||
// 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>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
export default EventList;*/
|
|
||||||
import { useMemo, useContext } from "react";
|
import { useMemo, useContext } from "react";
|
||||||
import styles from "./EventList.module.css";
|
import styles from "./EventList.module.css";
|
||||||
import EventItem from "./EventItem";
|
import EventItem from "./EventItem";
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
/* Conteneur principal */
|
|
||||||
.container {
|
.container {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
padding: 12px;
|
padding: 12px;
|
||||||
@@ -113,7 +112,6 @@
|
|||||||
margin: 0;
|
margin: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Conteneur des informations principales */
|
|
||||||
.topDescription {
|
.topDescription {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
@@ -122,14 +120,12 @@
|
|||||||
margin-bottom: 20px;
|
margin-bottom: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Bloc d'informations */
|
|
||||||
.infoBlock {
|
.infoBlock {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
padding: 12px;
|
padding: 12px;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Conteneur pour les paramètres */
|
|
||||||
.settingImage {
|
.settingImage {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
display: flex;
|
display: flex;
|
||||||
@@ -137,7 +133,6 @@
|
|||||||
margin-top: 16px;
|
margin-top: 16px;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Adaptation pour tablette et PC */
|
|
||||||
@media (min-width: 768px) {
|
@media (min-width: 768px) {
|
||||||
.contentWrapper {
|
.contentWrapper {
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
|
|||||||
@@ -1,35 +1,3 @@
|
|||||||
|
|
||||||
|
|
||||||
/*export function formatDateLetter(d) {
|
|
||||||
if (!d) return "Date inconnue";
|
|
||||||
|
|
||||||
const dateObj = new Date(d);
|
|
||||||
if (isNaN(dateObj.getTime())) return "Date invalide";
|
|
||||||
|
|
||||||
const monthNames = [
|
|
||||||
"Janvier", "Février", "Mars", "Avril", "Mai", "Juin",
|
|
||||||
"Juillet", "Août", "Septembre", "Octobre", "Novembre", "Décembre"
|
|
||||||
];
|
|
||||||
|
|
||||||
const day = dateObj.getDate().toString().padStart(2, "0");
|
|
||||||
const month = monthNames[dateObj.getMonth()];
|
|
||||||
const year = dateObj.getFullYear();
|
|
||||||
const hours = dateObj.getHours().toString().padStart(2, "0");
|
|
||||||
const minutes = dateObj.getMinutes().toString().padStart(2, "0");
|
|
||||||
|
|
||||||
return `${day} ${month} ${year} à ${hours}:${minutes}`;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
export function formatDateLetterJS(d) {
|
|
||||||
const monthNames = [
|
|
||||||
"Janvier", "Février", "Mars", "Avril", "Mai", "Juin",
|
|
||||||
"Juillet", "Août", "Septembre", "Octobre", "Novembre", "Décembre"
|
|
||||||
];
|
|
||||||
const [year, month, day] = d.split('-');
|
|
||||||
return `${day} ${monthNames[parseInt(month) - 1]} ${year}`;
|
|
||||||
}*/
|
|
||||||
|
|
||||||
export function formatDateLetter(d: string | Date | null | undefined): string {
|
export function formatDateLetter(d: string | Date | null | undefined): string {
|
||||||
if (!d) return "Date inconnue";
|
if (!d) return "Date inconnue";
|
||||||
|
|
||||||
|
|||||||
@@ -2,4 +2,4 @@ import fetchWrapper from "./fetchWrapper.js";
|
|||||||
|
|
||||||
export default async function getUser() {
|
export default async function getUser() {
|
||||||
return fetchWrapper("/api/users/me", null, "GET");
|
return fetchWrapper("/api/users/me", null, "GET");
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user