edit interface TS
This commit is contained in:
@@ -11,14 +11,14 @@ interface TextInputProps extends InputHTMLAttributes<HTMLInputElement> {
|
||||
}
|
||||
|
||||
const TextInput = ({
|
||||
placeholder,
|
||||
onChange,
|
||||
value,
|
||||
borderStyle = "square",
|
||||
password,
|
||||
className = "",
|
||||
...props
|
||||
}: TextInputProps) => {
|
||||
placeholder = "",
|
||||
onChange,
|
||||
value = "",
|
||||
borderStyle = "square",
|
||||
password = false,
|
||||
className = "",
|
||||
...props
|
||||
}: TextInputProps) => {
|
||||
const [showPassword, setShowPassword] = useState<boolean>(false);
|
||||
|
||||
let inputBorderStyle = styles.square;
|
||||
@@ -28,15 +28,16 @@ const TextInput = ({
|
||||
setShowPassword((prev) => !prev);
|
||||
};
|
||||
|
||||
if (password)
|
||||
if (password) {
|
||||
return (
|
||||
<div className={styles.passwordContainer}>
|
||||
<TextInput
|
||||
<input
|
||||
type={showPassword ? "text" : "password"}
|
||||
value={value}
|
||||
placeholder={placeholder}
|
||||
onChange={onChange}
|
||||
className={styles.passwordInput}
|
||||
className={`${styles.input} ${styles.passwordInput} ${inputBorderStyle} ${className}`}
|
||||
{...props}
|
||||
/>
|
||||
<button
|
||||
type="button"
|
||||
@@ -47,6 +48,7 @@ const TextInput = ({
|
||||
</button>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<input
|
||||
|
||||
@@ -1,8 +1,3 @@
|
||||
/*import { createContext } from "react";
|
||||
|
||||
export const EventContext = createContext(null);*/
|
||||
|
||||
|
||||
import { createContext } from "react";
|
||||
|
||||
export type Task = {
|
||||
|
||||
@@ -7,8 +7,6 @@ import deleteOtherUser from "../../../../utils/users/deleteOtherUser.js";
|
||||
import { PendingMembersContext } from "../../../../contexts/pendingMembers/PendingMembersContext";
|
||||
|
||||
function PendingMembers() {
|
||||
|
||||
|
||||
const [open, setOpen] = useState(false);
|
||||
const [message, setMessage] = 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 styles from "./eventList.module.css";
|
||||
import EventItem from "./eventItem";
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* Conteneur principal */
|
||||
.container {
|
||||
width: 100%;
|
||||
padding: 12px;
|
||||
@@ -113,7 +112,6 @@
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
/* Conteneur des informations principales */
|
||||
.topDescription {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
@@ -122,14 +120,12 @@
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
/* Bloc d'informations */
|
||||
.infoBlock {
|
||||
width: 100%;
|
||||
padding: 12px;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
/* Conteneur pour les paramètres */
|
||||
.settingImage {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
@@ -137,7 +133,6 @@
|
||||
margin-top: 16px;
|
||||
}
|
||||
|
||||
/* Adaptation pour tablette et PC */
|
||||
@media (min-width: 768px) {
|
||||
.contentWrapper {
|
||||
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 {
|
||||
if (!d) return "Date inconnue";
|
||||
|
||||
|
||||
@@ -2,4 +2,4 @@ import fetchWrapper from "./fetchWrapper.js";
|
||||
|
||||
export default async function getUser() {
|
||||
return fetchWrapper("/api/users/me", null, "GET");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user