Merge branch 'features/registerMember' into 'dev'
Features/registermember See merge request sae-but2/2025-26/gestion-benevoles-association/Frontend!76
This commit is contained in:
commit
d57b8195ee
33 files changed
+308
-108
No files matched your search
@@ -1,5 +1,5 @@
|
|||||||
import styles from "./Filter.module.css";
|
import styles from "./Filter.module.css";
|
||||||
import Button from "../ui/button/button.jsx"
|
import Button from "../ui/button/button.tsx"
|
||||||
|
|
||||||
function Filter({isFilterVisible, filters, setFilters}){
|
function Filter({isFilterVisible, filters, setFilters}){
|
||||||
const setAlphabeticalOrder = (order) => {
|
const setAlphabeticalOrder = (order) => {
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import styles from "./Footer.module.css"
|
import styles from "./Footer.module.css"
|
||||||
import {Link} from "react-router";
|
import {Link} from "react-router";
|
||||||
import {useState} from "react";
|
import {useState} from "react";
|
||||||
import Modal from "../ui/modal/modal.jsx";
|
import Modal from "../ui/modal/modal.tsx";
|
||||||
import Button from "../ui/button/button.jsx";
|
import Button from "../ui/button/button.tsx";
|
||||||
import scrollToTop from "../../utils/scrollToTop.js";
|
import scrollToTop from "../../utils/scrollToTop.js";
|
||||||
|
|
||||||
export default function Footer(){
|
export default function Footer(){
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import Filter from "../Filter/Filter.jsx";
|
|||||||
import {useContext, useEffect, useState} from "react";
|
import {useContext, useEffect, useState} from "react";
|
||||||
import SearchBar from "../SearchBar/SearchBar.jsx";
|
import SearchBar from "../SearchBar/SearchBar.jsx";
|
||||||
import CreateEventBtn from "../createEventBtn/CreateEventBtn.jsx";
|
import CreateEventBtn from "../createEventBtn/CreateEventBtn.jsx";
|
||||||
import Button from "../ui/button/button.jsx";
|
import Button from "../ui/button/button.tsx";
|
||||||
import {AuthContext} from "../../contexts/auth/AuthContext.js";
|
import {AuthContext} from "../../contexts/auth/AuthContext.js";
|
||||||
|
|
||||||
function ToolBar({setFilters, filters, showCreate = true}) {
|
function ToolBar({setFilters, filters, showCreate = true}) {
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import styles from "./createEventBtn.module.css"
|
import styles from "./createEventBtn.module.css"
|
||||||
import { useState, useContext } from "react";
|
import { useState, useContext } from "react";
|
||||||
import Modal from "../ui/modal/modal.jsx";
|
import Modal from "../ui/modal/modal.tsx";
|
||||||
import Button from "../ui/button/button.jsx";
|
import Button from "../ui/button/button.tsx";
|
||||||
import TextInput from "../ui/input/input.jsx";
|
import TextInput from "../ui/input/input.tsx";
|
||||||
import { EventContext } from "../../contexts/events/EventContext.js";
|
import { EventContext } from "../../contexts/events/EventContext.js";
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,16 +0,0 @@
|
|||||||
import styles from "./button.module.css";
|
|
||||||
|
|
||||||
const Button = ({ children, variant = "primary", onClick, className }) => {
|
|
||||||
let btnStyle;
|
|
||||||
|
|
||||||
if (variant === "primary") btnStyle = styles.primary;
|
|
||||||
else if (variant === "danger") btnStyle = styles.danger;
|
|
||||||
else if(variant === "transparent") btnStyle = styles.transparent;
|
|
||||||
else btnStyle = styles.default;
|
|
||||||
|
|
||||||
return <div className={`${styles.btn} ${btnStyle} ${className}`} onClick={onClick}>
|
|
||||||
{children}
|
|
||||||
</div>;
|
|
||||||
};
|
|
||||||
|
|
||||||
export default Button;
|
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
import { ReactNode, MouseEventHandler } from "react";
|
||||||
|
import styles from "./button.module.css";
|
||||||
|
|
||||||
|
type ButtonVariant = "primary" | "danger" | "transparent" | "default";
|
||||||
|
|
||||||
|
interface ButtonProps {
|
||||||
|
children: ReactNode;
|
||||||
|
variant?: ButtonVariant;
|
||||||
|
onClick?: MouseEventHandler<HTMLDivElement>;
|
||||||
|
className?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
const Button = ({
|
||||||
|
children,
|
||||||
|
variant = "primary",
|
||||||
|
onClick,
|
||||||
|
className = "",
|
||||||
|
}: ButtonProps) => {
|
||||||
|
let btnStyle: string;
|
||||||
|
|
||||||
|
if (variant === "primary") { // @ts-ignore
|
||||||
|
btnStyle = styles.primary;
|
||||||
|
}
|
||||||
|
else if (variant === "danger") { // @ts-ignore
|
||||||
|
btnStyle = styles.danger;
|
||||||
|
}
|
||||||
|
else if (variant === "transparent") { // @ts-ignore
|
||||||
|
btnStyle = styles.transparent;
|
||||||
|
}
|
||||||
|
else { // @ts-ignore
|
||||||
|
btnStyle = styles.default;
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div
|
||||||
|
className={`${styles.btn} ${btnStyle} ${className}`}
|
||||||
|
onClick={onClick}
|
||||||
|
>
|
||||||
|
{children}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default Button;
|
||||||
@@ -1,38 +0,0 @@
|
|||||||
import styles from "./input.module.css";
|
|
||||||
import { useState } from "react";
|
|
||||||
|
|
||||||
const TextInput = ({ placeholder, onChange, value, borderStyle, password, className, ...props }) => {
|
|
||||||
|
|
||||||
const [showPassword, setShowPassword] = useState(false);
|
|
||||||
|
|
||||||
let inputBorderStyle = styles.square;
|
|
||||||
if (borderStyle === "square") inputBorderStyle = styles.square;
|
|
||||||
if(borderStyle === "rounded") inputBorderStyle = styles.rounded;
|
|
||||||
|
|
||||||
const toggleShowPassword = () => {
|
|
||||||
setShowPassword(!showPassword);
|
|
||||||
};
|
|
||||||
|
|
||||||
if(password) return (
|
|
||||||
<div className={styles.passwordContainer}>
|
|
||||||
<TextInput
|
|
||||||
type={showPassword ? "text" : "password"}
|
|
||||||
value={value}
|
|
||||||
placeholder={placeholder}
|
|
||||||
onChange={onChange}
|
|
||||||
className={styles.passwordInput}
|
|
||||||
/>
|
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
onClick={toggleShowPassword}
|
|
||||||
className={styles.passwordBtn}
|
|
||||||
>
|
|
||||||
{showPassword ? '👁️' : '🔒'}
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
|
|
||||||
return <input className={`${styles.input} ${inputBorderStyle} ${className}`} onChange={onChange} placeholder={placeholder} value={value} {...props} />
|
|
||||||
};
|
|
||||||
|
|
||||||
export default TextInput;
|
|
||||||
@@ -0,0 +1,62 @@
|
|||||||
|
import styles from "./input.module.css";
|
||||||
|
import { useState, ChangeEvent, InputHTMLAttributes } from "react";
|
||||||
|
|
||||||
|
interface TextInputProps extends InputHTMLAttributes<HTMLInputElement> {
|
||||||
|
placeholder?: string;
|
||||||
|
value?: string;
|
||||||
|
onChange?: (e: ChangeEvent<HTMLInputElement>) => void;
|
||||||
|
borderStyle?: "square" | "rounded";
|
||||||
|
password?: boolean;
|
||||||
|
className?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
const TextInput = ({
|
||||||
|
placeholder,
|
||||||
|
onChange,
|
||||||
|
value,
|
||||||
|
borderStyle = "square",
|
||||||
|
password,
|
||||||
|
className = "",
|
||||||
|
...props
|
||||||
|
}: TextInputProps) => {
|
||||||
|
const [showPassword, setShowPassword] = useState<boolean>(false);
|
||||||
|
|
||||||
|
let inputBorderStyle = styles.square;
|
||||||
|
if (borderStyle === "rounded") inputBorderStyle = styles.rounded;
|
||||||
|
|
||||||
|
const toggleShowPassword = () => {
|
||||||
|
setShowPassword((prev) => !prev);
|
||||||
|
};
|
||||||
|
|
||||||
|
if (password)
|
||||||
|
return (
|
||||||
|
<div className={styles.passwordContainer}>
|
||||||
|
<TextInput
|
||||||
|
type={showPassword ? "text" : "password"}
|
||||||
|
value={value}
|
||||||
|
placeholder={placeholder}
|
||||||
|
onChange={onChange}
|
||||||
|
className={styles.passwordInput}
|
||||||
|
/>
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
onClick={toggleShowPassword}
|
||||||
|
className={styles.passwordBtn}
|
||||||
|
>
|
||||||
|
{showPassword ? "👁️" : "🔒"}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<input
|
||||||
|
className={`${styles.input} ${inputBorderStyle} ${className}`}
|
||||||
|
onChange={onChange}
|
||||||
|
placeholder={placeholder}
|
||||||
|
value={value}
|
||||||
|
{...props}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default TextInput;
|
||||||
@@ -1,16 +1,23 @@
|
|||||||
|
import { ReactNode, MouseEvent } from "react";
|
||||||
import { createPortal } from "react-dom";
|
import { createPortal } from "react-dom";
|
||||||
import styles from "./modal.module.css";
|
import styles from "./modal.module.css";
|
||||||
import Button from "../button/button.jsx";
|
import Button from "../button/button";
|
||||||
|
|
||||||
const Modal = ({ open, onClose, children, title }) => {
|
interface ModalProps {
|
||||||
|
open: boolean;
|
||||||
|
onClose: () => void;
|
||||||
|
children: ReactNode;
|
||||||
|
title?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
const Modal = ({ open, onClose, children, title }: ModalProps) => {
|
||||||
if (!open) return null;
|
if (!open) return null;
|
||||||
|
|
||||||
const handleOverlayClick = () => {
|
const handleOverlayClick = () => {
|
||||||
onClose();
|
onClose();
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleModalClick = (e) => {
|
const handleModalClick = (e: MouseEvent<HTMLDivElement>) => {
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
import Button from "../button/button.jsx";
|
import Button from "../button/button.tsx";
|
||||||
import { useState, useEffect } from "react";
|
import { useState, useEffect } from "react";
|
||||||
import styles from "./ThemeSwitcher.module.css";
|
import styles from "./ThemeSwitcher.module.css";
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,4 @@
|
|||||||
|
export default interface Response<T> {
|
||||||
|
status: number;
|
||||||
|
data: T;
|
||||||
|
}
|
||||||
@@ -1,10 +1,10 @@
|
|||||||
import { useState, useContext } from "react";
|
import { useContext } from "react";
|
||||||
import styles from "./AdminPage.module.css";
|
import styles from "./AdminPage.module.css";
|
||||||
import ParticipationChart from "./components/chart/ParticipationChart.jsx";
|
|
||||||
import IncompleteEvents from "./components/IncompleteEvent/IncompleteEvent.jsx";
|
import IncompleteEvents from "./components/IncompleteEvent/IncompleteEvent.jsx";
|
||||||
import PendingMembers from "./components/pendingMembers/PendingMembers.jsx";
|
import PendingMembers from "./components/pendingMembers/PendingMembers.jsx";
|
||||||
import { AuthContext } from "../../contexts/auth/AuthContext.js";
|
import { AuthContext } from "../../contexts/auth/AuthContext.js";
|
||||||
import { useNavigate } from "react-router";
|
import { useNavigate } from "react-router";
|
||||||
|
import RegisterMember from "./components/registerMember/registerMember.tsx";
|
||||||
|
|
||||||
|
|
||||||
function AdminPage() {
|
function AdminPage() {
|
||||||
@@ -12,18 +12,11 @@ function AdminPage() {
|
|||||||
const { user } = useContext(AuthContext);
|
const { user } = useContext(AuthContext);
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
|
||||||
const [selected, setSelected] = useState("3");
|
|
||||||
const [participationRate] = useState(89);
|
|
||||||
|
|
||||||
if(!user.isAdmin) navigate("/");
|
if(!user.isAdmin) navigate("/");
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={styles.container}>
|
<div className={styles.container}>
|
||||||
<ParticipationChart
|
<RegisterMember />
|
||||||
selected={selected}
|
|
||||||
setSelected={setSelected}
|
|
||||||
participationRate={participationRate}
|
|
||||||
/>
|
|
||||||
<div className={styles.rightSection}>
|
<div className={styles.rightSection}>
|
||||||
<IncompleteEvents />
|
<IncompleteEvents />
|
||||||
<PendingMembers />
|
<PendingMembers />
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import React, {useState, useEffect} from "react";
|
import React, {useState, useEffect} from "react";
|
||||||
import Button from "../../../../components/ui/button/button.jsx";
|
import Button from "../../../../components/ui/button/button.tsx";
|
||||||
import styles from "./PendingMembers.module.css";
|
import styles from "./PendingMembers.module.css";
|
||||||
import Modal from "../../../../components/ui/modal/modal.jsx";
|
import Modal from "../../../../components/ui/modal/modal.tsx";
|
||||||
import getUserToValidate from "../../../../utils/users/getUserToValidate.js";
|
import getUserToValidate from "../../../../utils/users/getUserToValidate.js";
|
||||||
import getUserById from "../../../../utils/users/getUserById.js";
|
import getUserById from "../../../../utils/users/getUserById.js";
|
||||||
import validateUser from "../../../../utils/users/validateUser.js";
|
import validateUser from "../../../../utils/users/validateUser.js";
|
||||||
|
|||||||
@@ -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 styles from "./Event.module.css";
|
||||||
import { useState, useEffect } from "react";
|
import { useState, useEffect } from "react";
|
||||||
import { useNavigate } from "react-router";
|
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}){
|
function Event({event}){
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import { useState, useContext } from "react";
|
import { useState, useContext } from "react";
|
||||||
import styles from "./loginForm.module.css";
|
import styles from "./loginForm.module.css";
|
||||||
import Button from "../../../../components/ui/button/button.jsx";
|
import Button from "../../../../components/ui/button/button.tsx";
|
||||||
import Input from "../../../../components/ui/input/input.jsx";
|
import Input from "../../../../components/ui/input/input.tsx";
|
||||||
import Modal from "../../../../components/ui/modal/modal.jsx";
|
import Modal from "../../../../components/ui/modal/modal.tsx";
|
||||||
import { useNavigate } from "react-router";
|
import { useNavigate } from "react-router";
|
||||||
import { AuthContext } from "../../../../contexts/auth/AuthContext.js";
|
import { AuthContext } from "../../../../contexts/auth/AuthContext.js";
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
import Modal from "../../../../components/ui/modal/modal.jsx";
|
import Modal from "../../../../components/ui/modal/modal.tsx";
|
||||||
import Button from "../../../../components/ui/button/button.jsx";
|
import Button from "../../../../components/ui/button/button.tsx";
|
||||||
import styles from "./SettingsModal.module.css"
|
import styles from "./SettingsModal.module.css"
|
||||||
import { useContext, useState } from "react";
|
import { useContext, useState } from "react";
|
||||||
import ThemeSwitcher from "../../../../components/ui/themeSwitcher/ThemeSwitcher.jsx";
|
import ThemeSwitcher from "../../../../components/ui/themeSwitcher/ThemeSwitcher.jsx";
|
||||||
import { AuthContext } from "../../../../contexts/auth/AuthContext.js";
|
import { AuthContext } from "../../../../contexts/auth/AuthContext.js";
|
||||||
import TextInput from "../../../../components/ui/input/input.jsx";
|
import TextInput from "../../../../components/ui/input/input.tsx";
|
||||||
import updateUser from "../../../../utils/users/updateUser.js";
|
import updateUser from "../../../../utils/users/updateUser.js";
|
||||||
import deleteUser from "../../../../utils/users/deleteUser.js";
|
import deleteUser from "../../../../utils/users/deleteUser.js";
|
||||||
|
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
import styles from "./RegisterPage.module.css";
|
import styles from "./RegisterPage.module.css";
|
||||||
import Background from "../../components/background/background.jsx";
|
import Background from "../../components/background/background.jsx";
|
||||||
import Input from "../../components/ui/input/input.jsx";
|
import Input from "../../components/ui/input/input.tsx";
|
||||||
import Button from "../../components/ui/button/button.jsx";
|
import Button from "../../components/ui/button/button.tsx";
|
||||||
import {useContext, useEffect, useState} from "react";
|
import {useContext, useEffect, useState} from "react";
|
||||||
import register from "../../utils/register.js";
|
import register from "../../utils/register.js";
|
||||||
import { useNavigate } from "react-router";
|
import { useNavigate } from "react-router";
|
||||||
import { AuthContext } from "../../contexts/auth/AuthContext.js";
|
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() {
|
function RegisterPage() {
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import Button from "../../../../components/ui/button/button.jsx";
|
import Button from "../../../../components/ui/button/button.tsx";
|
||||||
import Modal from "../../../../components/ui/modal/modal.jsx";
|
import Modal from "../../../../components/ui/modal/modal.tsx";
|
||||||
import {useContext, useState} from "react";
|
import {useContext, useState} from "react";
|
||||||
import styles from "./manageMember.module.css"
|
import styles from "./manageMember.module.css"
|
||||||
import DeactivateMemberBtn from "./deactivateMember/deactivateMemberBtn.jsx";
|
import DeactivateMemberBtn from "./deactivateMember/deactivateMemberBtn.jsx";
|
||||||
|
|||||||
+2
-2
@@ -1,5 +1,5 @@
|
|||||||
import Button from "../../../../../components/ui/button/button.jsx";
|
import Button from "../../../../../components/ui/button/button.tsx";
|
||||||
import Modal from "../../../../../components/ui/modal/modal.jsx";
|
import Modal from "../../../../../components/ui/modal/modal.tsx";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import deactivateUser from "../../../../../utils/users/deactivateUser.js"
|
import deactivateUser from "../../../../../utils/users/deactivateUser.js"
|
||||||
import { useNavigate } from "react-router";
|
import { useNavigate } from "react-router";
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
import styles from "../manageMember.module.css";
|
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 modifyRole from "../../../../../utils/users/modifyRole.js";
|
||||||
import { useState, useEffect } from "react";
|
import { useState, useEffect } from "react";
|
||||||
import getRoles from "../../../../../utils/getRoles.js";
|
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 }) {
|
export default function ModifyRole({ user }) {
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import React, {useState} from "react";
|
|||||||
import styles from "./VolunteersPage.module.css";
|
import styles from "./VolunteersPage.module.css";
|
||||||
import formatDate from "../../utils/date/formatDate.js";
|
import formatDate from "../../utils/date/formatDate.js";
|
||||||
import { useNavigate } from "react-router";
|
import { useNavigate } from "react-router";
|
||||||
import Button from "../../components/ui/button/button.jsx";
|
import Button from "../../components/ui/button/button.tsx";
|
||||||
|
|
||||||
export default function VolunteerCard({ user }) {
|
export default function VolunteerCard({ user }) {
|
||||||
|
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
import styles from "./eventTask.module.css";
|
import styles from "./eventTask.module.css";
|
||||||
import { formatDateLetter } from "../../../../utils/date/formatDateLetter.js";
|
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 assign from "../../../../utils/tasks/assign.js";
|
||||||
import unAssign from "../../../../utils/tasks/unAssign.js";
|
import unAssign from "../../../../utils/tasks/unAssign.js";
|
||||||
import { useContext, useEffect, useState } from "react";
|
import { useContext, useEffect, useState } from "react";
|
||||||
import isAssigned from "../../../../utils/tasks/isAssigned.js";
|
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 { AuthContext } from "../../../../contexts/auth/AuthContext.js";
|
||||||
import DeleteTaskBtn from "../deleteTaskBtn/deleteTaskBtn.jsx";
|
import DeleteTaskBtn from "../deleteTaskBtn/deleteTaskBtn.jsx";
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import styles from "../../eventDetail.module.css";
|
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 {useContext, useState} from "react";
|
||||||
import TextInput from "../../../../components/ui/input/input.jsx";
|
import TextInput from "../../../../components/ui/input/input.tsx";
|
||||||
import Modal from "../../../../components/ui/modal/modal.jsx";
|
import Modal from "../../../../components/ui/modal/modal.tsx";
|
||||||
import createTaskApi from "../../../../utils/tasks/createTask.js";
|
import createTaskApi from "../../../../utils/tasks/createTask.js";
|
||||||
import {EventDetailContext} from "../../../../contexts/eventDetail/eventDetail.js";
|
import {EventDetailContext} from "../../../../contexts/eventDetail/eventDetail.js";
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import styles from "../../eventDetail.module.css";
|
import styles from "../../eventDetail.module.css";
|
||||||
import Button from "../../../../components/ui/button/button.jsx";
|
import Button from "../../../../components/ui/button/button.tsx";
|
||||||
import Modal from "../../../../components/ui/modal/modal.jsx";
|
import Modal from "../../../../components/ui/modal/modal.tsx";
|
||||||
import { useContext, useState } from "react";
|
import { useContext, useState } from "react";
|
||||||
import { EventDetailContext } from "../../../../contexts/eventDetail/eventDetail.js";
|
import { EventDetailContext } from "../../../../contexts/eventDetail/eventDetail.js";
|
||||||
import { EventContext } from "../../../../contexts/events/EventContext.js";
|
import { EventContext } from "../../../../contexts/events/EventContext.js";
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
import { useContext } from "react";
|
import { useContext } from "react";
|
||||||
import { AuthContext } from "../../../../contexts/auth/AuthContext.js";
|
import { AuthContext } from "../../../../contexts/auth/AuthContext.js";
|
||||||
import { EventDetailContext } from "../../../../contexts/eventDetail/eventDetail.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 { 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";
|
import styles from "../../eventDetail.module.css";
|
||||||
|
|
||||||
export default function DeleteTaskBtn({ taskId, eventId, taskName }) {
|
export default function DeleteTaskBtn({ taskId, eventId, taskName }) {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import styles from "./validationErrorPage.module.css"
|
import styles from "./validationErrorPage.module.css"
|
||||||
import Background from "../../components/background/background.jsx";
|
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 { useContext } from "react";
|
||||||
import { AuthContext } from "../../contexts/auth/AuthContext.js";
|
import { AuthContext } from "../../contexts/auth/AuthContext.js";
|
||||||
import { Navigate, useNavigate, Link } from "react-router";
|
import { Navigate, useNavigate, Link } from "react-router";
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { fn } from 'storybook/test';
|
import { fn } from 'storybook/test';
|
||||||
|
|
||||||
import Button from '../components/ui/button/button.jsx';
|
import Button from '../components/ui/button/button.tsx';
|
||||||
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import TextInput from "../components/ui/input/input.jsx";
|
import TextInput from "../components/ui/input/input.tsx";
|
||||||
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import Modal from "../components/ui/modal/modal.jsx";
|
import Modal from "../components/ui/modal/modal.tsx";
|
||||||
import Button from "../components/ui/button/button.jsx";
|
import Button from "../components/ui/button/button.tsx";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
|||||||
@@ -0,0 +1,14 @@
|
|||||||
|
import fetchWrapper from "../fetchWrapper.js";
|
||||||
|
import getXSRFToken from "../getXSRF.js";
|
||||||
|
import Response from "../../interfaces/response.interface";
|
||||||
|
|
||||||
|
export default async function adminCreateUser(email: string, name: string, lastname: string, phone: string): Promise<Response> {
|
||||||
|
const csrfToken = await getXSRFToken();
|
||||||
|
|
||||||
|
return fetchWrapper(
|
||||||
|
"/api/users/create",
|
||||||
|
{ email, name, lastname, phone },
|
||||||
|
"POST",
|
||||||
|
{ "X-XSRF-TOKEN": csrfToken }
|
||||||
|
);
|
||||||
|
}
|
||||||
Reference in new issue
Block a user