feature/page-admin
parent
8f9ff8fc74
commit
cb847b8ed9
@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"workbench.colorCustomizations": {
|
||||||
|
"activityBar.background": "#521342",
|
||||||
|
"titleBar.activeBackground": "#731B5D",
|
||||||
|
"titleBar.activeForeground": "#FDF8FC"
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,165 @@
|
|||||||
|
import React from "react";
|
||||||
|
import prisma from '../lib/prisma'
|
||||||
|
|
||||||
|
import Image from 'next/image';
|
||||||
|
import * as Yup from 'yup';
|
||||||
|
import Head from "next/head";
|
||||||
|
import { signIn, useSession } from "next-auth/react";
|
||||||
|
import { yupResolver } from "@hookform/resolvers/yup";
|
||||||
|
import { useForm } from "react-hook-form";
|
||||||
|
|
||||||
|
import { AiOutlineGoogle } from 'react-icons/ai'
|
||||||
|
|
||||||
|
import Router from "next/router";
|
||||||
|
|
||||||
|
|
||||||
|
import style from '../styles/Connexion.module.css';
|
||||||
|
|
||||||
|
import imageConnexion from '../public/images/connexion_image.png'
|
||||||
|
|
||||||
|
|
||||||
|
import Link from "next/link";
|
||||||
|
|
||||||
|
import { SiGnuprivacyguard } from 'react-icons/si'
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
type LoginSubmitForm = {
|
||||||
|
email: string,
|
||||||
|
acceptTerms: boolean
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
const MainPage = () => {
|
||||||
|
const { data: session } = useSession();
|
||||||
|
|
||||||
|
const validationSchema = Yup.object().shape({
|
||||||
|
email: Yup.string().email(),
|
||||||
|
acceptTerms: Yup.bool().oneOf(
|
||||||
|
[true],
|
||||||
|
"Accepter les conditions est obligatoire"
|
||||||
|
)
|
||||||
|
})
|
||||||
|
|
||||||
|
const {
|
||||||
|
register,
|
||||||
|
handleSubmit,
|
||||||
|
watch,
|
||||||
|
trigger,
|
||||||
|
formState: { errors }
|
||||||
|
} = useForm<LoginSubmitForm>({
|
||||||
|
resolver: yupResolver(validationSchema)
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
const term = watch("acceptTerms")
|
||||||
|
const connexionWithGoogle = async () => {
|
||||||
|
if (term) {
|
||||||
|
signIn("google");
|
||||||
|
}
|
||||||
|
//relance une vérification de la checkbox
|
||||||
|
await trigger("acceptTerms");
|
||||||
|
}
|
||||||
|
|
||||||
|
const onSubmit = async (data: LoginSubmitForm) => {
|
||||||
|
|
||||||
|
|
||||||
|
// try {
|
||||||
|
// const body = { bioValue: data.bio };
|
||||||
|
// await fetch(`/api/profile`, {
|
||||||
|
// method: "POST",
|
||||||
|
// headers: { "Content-Type": "application/json" },
|
||||||
|
// body: JSON.stringify(body),
|
||||||
|
// })
|
||||||
|
// .then((res) => res.json())
|
||||||
|
// .then((data) => {
|
||||||
|
// setResponse(data);
|
||||||
|
// console.log('response', data);
|
||||||
|
// })
|
||||||
|
// await Router.push("/profile");
|
||||||
|
// } catch (error) {
|
||||||
|
// console.error(error);
|
||||||
|
// }
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<Head>
|
||||||
|
<title>Connexion</title>
|
||||||
|
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
||||||
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossOrigin="" />
|
||||||
|
</Head>
|
||||||
|
|
||||||
|
<div className={`${style['bloc-content']} col-12 col-lg-6`}>
|
||||||
|
|
||||||
|
|
||||||
|
<h1 className="fw-light">Connexion</h1>
|
||||||
|
<SiGnuprivacyguard size={50} />
|
||||||
|
|
||||||
|
<form onSubmit={handleSubmit(onSubmit)}>
|
||||||
|
<div className="form-group mx-auto my-3 w-100">
|
||||||
|
|
||||||
|
<div className="mb-3">
|
||||||
|
|
||||||
|
<input
|
||||||
|
type="email"
|
||||||
|
className={`form-control ${errors.email ? 'is-invalid' : ''}`}
|
||||||
|
placeholder="Email..."
|
||||||
|
|
||||||
|
{...register("email")}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div className="d-grid">
|
||||||
|
<button type="submit" className="btn btn-primary">
|
||||||
|
Se connecter avec mon email
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<hr />
|
||||||
|
|
||||||
|
<div className="d-grid">
|
||||||
|
<button onClick={connexionWithGoogle} type="button" className={`btn btn-primary ${style.loginButton}`} style={{ backgroundColor: "#dd4b39" }}>
|
||||||
|
<span className={style.logo}><AiOutlineGoogle /></span>Se connecter avec google
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="form-check">
|
||||||
|
<label
|
||||||
|
htmlFor="acceptTerms"
|
||||||
|
className="form-check-label"
|
||||||
|
>
|
||||||
|
J'ai lu et j'accepte les
|
||||||
|
conditions
|
||||||
|
</label>
|
||||||
|
<input
|
||||||
|
type="checkbox"
|
||||||
|
className="form-check-input"
|
||||||
|
{...register("acceptTerms")}
|
||||||
|
name="acceptTerms"
|
||||||
|
/>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</form>
|
||||||
|
<div className="invalid-feedback alert alert-danger">{errors.acceptTerms?.message}</div>
|
||||||
|
<div className="invalid-feedback alert alert-danger">{errors.email?.message}</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</>)
|
||||||
|
};
|
||||||
|
|
||||||
|
export default MainPage;
|
||||||
|
|
||||||
|
|
||||||
@ -1,221 +0,0 @@
|
|||||||
import React from "react";
|
|
||||||
import Layout from "../components/Layout";
|
|
||||||
import prisma from '../lib/prisma'
|
|
||||||
|
|
||||||
import Image from 'next/image';
|
|
||||||
import * as Yup from 'yup';
|
|
||||||
import Head from "next/head";
|
|
||||||
import { useSession } from "next-auth/react";
|
|
||||||
import { yupResolver } from "@hookform/resolvers/yup";
|
|
||||||
import { useForm } from "react-hook-form";
|
|
||||||
import Router from "next/router";
|
|
||||||
|
|
||||||
import Section from '../components/Section';
|
|
||||||
import style from '../styles/Index.module.css';
|
|
||||||
|
|
||||||
import rotatingLeftImage from '../public/images/coffret-degustation-mousselines-individuelles-n3-PhotoRoom.png';
|
|
||||||
import rotatingRightImage from '../public/images/coffret-the-PhotoRoom.png';
|
|
||||||
import Link from "next/link";
|
|
||||||
|
|
||||||
import testerCodeCadeau from '../public/images/testerlecode.png'
|
|
||||||
import feuilleGauche from '../public/images/feuilleGauche.png'
|
|
||||||
import feuilleDroite from '../public/images/feuilleBasDroite.png'
|
|
||||||
import unAnDeThe from '../public/images/unandethé.png'
|
|
||||||
import sablier from '../public/images/sablier.png'
|
|
||||||
import cadeau from '../public/images/cadeau.png'
|
|
||||||
import jeuConcours from '../public/images/jeuconcours.png'
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
type CodeSubmitForm = {
|
|
||||||
codeCadeau: string;
|
|
||||||
};
|
|
||||||
|
|
||||||
const MainPage = () => {
|
|
||||||
const { data: session } = useSession();
|
|
||||||
|
|
||||||
const validationSchema = Yup.object().shape({
|
|
||||||
codeCadeau: Yup.string().trim().required("Vous n'avez pas rentrer de code cadeau !"),
|
|
||||||
});
|
|
||||||
|
|
||||||
const {
|
|
||||||
register,
|
|
||||||
handleSubmit,
|
|
||||||
formState: { errors }
|
|
||||||
} = useForm<CodeSubmitForm>({
|
|
||||||
resolver: yupResolver(validationSchema)
|
|
||||||
});
|
|
||||||
|
|
||||||
const onSubmit = async (data: CodeSubmitForm) => {
|
|
||||||
|
|
||||||
if (!session) {
|
|
||||||
return <Layout>
|
|
||||||
<p>Vous devez vous connecter pour tester votre !</p>
|
|
||||||
</Layout>
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// try {
|
|
||||||
// const body = { bioValue: data.bio };
|
|
||||||
// await fetch(`/api/profile`, {
|
|
||||||
// method: "POST",
|
|
||||||
// headers: { "Content-Type": "application/json" },
|
|
||||||
// body: JSON.stringify(body),
|
|
||||||
// })
|
|
||||||
// .then((res) => res.json())
|
|
||||||
// .then((data) => {
|
|
||||||
// setResponse(data);
|
|
||||||
// console.log('response', data);
|
|
||||||
// })
|
|
||||||
// await Router.push("/profile");
|
|
||||||
// } catch (error) {
|
|
||||||
// console.error(error);
|
|
||||||
// }
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
<Head>
|
|
||||||
<title>Home App</title>
|
|
||||||
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
|
||||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossOrigin="" />
|
|
||||||
</Head>
|
|
||||||
|
|
||||||
<header className={`${style['masthead']} d-flex justify-content-center align-items-center text-center`}>
|
|
||||||
<div className={`${style['feuilleGauche']}`}>
|
|
||||||
<Image
|
|
||||||
src={feuilleGauche}
|
|
||||||
alt="thetiptop feuille Gauche"
|
|
||||||
layout="responsive"
|
|
||||||
className={`${style['rotatingSlow']}`}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<div className={`${style['feuilleDroite']}`}>
|
|
||||||
<Image
|
|
||||||
src={feuilleDroite}
|
|
||||||
alt="thetiptop feuille Droite"
|
|
||||||
layout="responsive"
|
|
||||||
className={`${style['rotatingSlow']}`}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<div className={`${style['jeuConcours']}`}>
|
|
||||||
<Image
|
|
||||||
src={jeuConcours}
|
|
||||||
alt="thetiptop jeu Concours"
|
|
||||||
layout="responsive"
|
|
||||||
className={`${style['zoomInOutCadeau']}`}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<div className={`${style['cadeau']}`}>
|
|
||||||
<Image
|
|
||||||
src={cadeau}
|
|
||||||
alt="thetiptop cadeau"
|
|
||||||
layout="responsive"
|
|
||||||
className={`${style['zoomInOutJeuConcours']}`}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div className="container align-items-center d-flex flex-column">
|
|
||||||
|
|
||||||
<div className={`${style['bloc-content']} col-12 col-lg-6`}>
|
|
||||||
|
|
||||||
|
|
||||||
<div className={`${style['imageWrapper']}`}>
|
|
||||||
<Image
|
|
||||||
src={testerCodeCadeau}
|
|
||||||
alt="thetiptop navigation logo"
|
|
||||||
layout="responsive"
|
|
||||||
className={`${style['rotatingImage']}`}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<form onSubmit={handleSubmit(onSubmit)}>
|
|
||||||
|
|
||||||
<div className="form-group mx-auto my-3 w-100">
|
|
||||||
|
|
||||||
|
|
||||||
<input type="text"
|
|
||||||
id="codeInput" aria-describedby="codeHelp"
|
|
||||||
placeholder="A293049430..."
|
|
||||||
{...register('codeCadeau')}
|
|
||||||
className={`form-control ${errors.codeCadeau ? 'is-invalid' : ''}`}
|
|
||||||
|
|
||||||
/>
|
|
||||||
<small id="codeHelp" className="form-text text-muted">Code à usage unique</small>
|
|
||||||
<div className="invalid-feedback">{errors.codeCadeau?.message}</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<div className="form-group mx-auto my-3 w-100">
|
|
||||||
<button type="submit" className={`${style['aButton']} btn btn-primary`}>Découvrir mon cadeau !</button>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{/* <div className={`${style['bloc-content']} col-12 col-lg-10 d-flex row my-2 mx-0 py-2 py-lg-2 px-0 px-lg-3 `}>
|
|
||||||
<h2 className="col-12 my-2">A gagner</h2>
|
|
||||||
<div className="col d-flex justify-content-center">
|
|
||||||
<div className={`${style['productToGain']}`}>
|
|
||||||
<Image
|
|
||||||
src={rotatingRightImage}
|
|
||||||
alt="coffret de thé marron rempli de sachets de toutes couleurs"
|
|
||||||
fill
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div className="col d-flex justify-content-center">
|
|
||||||
<div className={`${style['productToGain']}`}>
|
|
||||||
<Image
|
|
||||||
src={rotatingRightImage}
|
|
||||||
alt="coffret de thé marron rempli de sachets de toutes couleurs"
|
|
||||||
fill
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div className="col d-flex justify-content-center">
|
|
||||||
<div className={`${style['productToGain']}`}>
|
|
||||||
<Image
|
|
||||||
src={rotatingRightImage}
|
|
||||||
alt="coffret de thé marron rempli de sachets de toutes couleurs"
|
|
||||||
fill
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div className="col-12">
|
|
||||||
<div className='btn btn-primary my-2'>
|
|
||||||
<Link href="shop">Et bien d'autres !</Link>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div> */}
|
|
||||||
</div>
|
|
||||||
</header >
|
|
||||||
|
|
||||||
{/* <Section backgroundImagePath={'/images/three-cups-of-tea-steeping.png'}>
|
|
||||||
<h2>Présentation du jeu concours</h2>
|
|
||||||
<h4 className="fw-light">
|
|
||||||
Gagnez de superbes cadeaux en achetant nos produits !
|
|
||||||
<br />
|
|
||||||
Pour participer, il vous suffit d'effectuer un achat en boutique d'une valeur supérieure à XXX euros. Retrouvez votre code sur la facture !
|
|
||||||
<br />
|
|
||||||
Saisissez votre code ... Félicitations ! Vous avez gagné un cadeau ! Il nous vous reste plus qu'à le récupérer en magasin.
|
|
||||||
<br />
|
|
||||||
Après la [XXX période], vous participerez au jeu concours final afin de gagner XXX. Un participation par personne est comptabilisée pour le concours final.
|
|
||||||
</h4>
|
|
||||||
</Section>
|
|
||||||
<Section backgroundImagePath={'/images/top-view-of-a-tea-towel-and-container-holding-grain.png'}>
|
|
||||||
<h2>Présentation de Thé Tip Top</h2>
|
|
||||||
<h4 className="fw-light">
|
|
||||||
Thé Tip Top est une entreprise de thé [XXX ajouter des spécifications en se basant sur le cahier des charges]
|
|
||||||
</h4>
|
|
||||||
</Section> */}
|
|
||||||
</>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
export default MainPage;
|
|
||||||
@ -0,0 +1,56 @@
|
|||||||
|
{/* <div className={`${style['bloc-content']} col-12 col-lg-10 d-flex row my-2 mx-0 py-2 py-lg-2 px-0 px-lg-3 `}>
|
||||||
|
<h2 className="col-12 my-2">A gagner</h2>
|
||||||
|
<div className="col d-flex justify-content-center">
|
||||||
|
<div className={`${style['productToGain']}`}>
|
||||||
|
<Image
|
||||||
|
src={rotatingRightImage}
|
||||||
|
alt="coffret de thé marron rempli de sachets de toutes couleurs"
|
||||||
|
fill
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div className="col d-flex justify-content-center">
|
||||||
|
<div className={`${style['productToGain']}`}>
|
||||||
|
<Image
|
||||||
|
src={rotatingRightImage}
|
||||||
|
alt="coffret de thé marron rempli de sachets de toutes couleurs"
|
||||||
|
fill
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div className="col d-flex justify-content-center">
|
||||||
|
<div className={`${style['productToGain']}`}>
|
||||||
|
<Image
|
||||||
|
src={rotatingRightImage}
|
||||||
|
alt="coffret de thé marron rempli de sachets de toutes couleurs"
|
||||||
|
fill
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div className="col-12">
|
||||||
|
<div className='btn btn-primary my-2'>
|
||||||
|
<Link href="shop">Et bien d'autres !</Link>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div> */}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
{/* <Section backgroundImagePath={'/images/three-cups-of-tea-steeping.png'}>
|
||||||
|
<h2>Présentation du jeu concours</h2>
|
||||||
|
<h4 className="fw-light">
|
||||||
|
Gagnez de superbes cadeaux en achetant nos produits !
|
||||||
|
<br />
|
||||||
|
Pour participer, il vous suffit d'effectuer un achat en boutique d'une valeur supérieure à XXX euros. Retrouvez votre code sur la facture !
|
||||||
|
<br />
|
||||||
|
Saisissez votre code ... Félicitations ! Vous avez gagné un cadeau ! Il nous vous reste plus qu'à le récupérer en magasin.
|
||||||
|
<br />
|
||||||
|
Après la [XXX période], vous participerez au jeu concours final afin de gagner XXX. Un participation par personne est comptabilisée pour le concours final.
|
||||||
|
</h4>
|
||||||
|
</Section>
|
||||||
|
<Section backgroundImagePath={'/images/top-view-of-a-tea-towel-and-container-holding-grain.png'}>
|
||||||
|
<h2>Présentation de Thé Tip Top</h2>
|
||||||
|
<h4 className="fw-light">
|
||||||
|
Thé Tip Top est une entreprise de thé [XXX ajouter des spécifications en se basant sur le cahier des charges]
|
||||||
|
</h4>
|
||||||
|
</Section> */}
|
||||||
|
After Width: | Height: | Size: 15 KiB |
@ -0,0 +1,14 @@
|
|||||||
|
.bloc-content {
|
||||||
|
padding: 10vh;
|
||||||
|
border-radius: 10px;
|
||||||
|
background-position: 50% 50%;
|
||||||
|
background-repeat: no-repeat;
|
||||||
|
background-size: contain;
|
||||||
|
background-color: rgba(255, 255, 255, 0.329);
|
||||||
|
/* animation: zoomInOut 3s ease-in-out infinite; */
|
||||||
|
z-index: 8888
|
||||||
|
}
|
||||||
|
|
||||||
|
.imageWrapper {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
Loading…
Reference in new issue