diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..5a976ad --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,7 @@ +{ + "workbench.colorCustomizations": { + "activityBar.background": "#521342", + "titleBar.activeBackground": "#731B5D", + "titleBar.activeForeground": "#FDF8FC" + } +} \ No newline at end of file diff --git a/components/Content.tsx b/components/Content.tsx index 58732f9..ed84e6e 100644 --- a/components/Content.tsx +++ b/components/Content.tsx @@ -58,9 +58,7 @@ const Content = ({ children }: Props) => { />
-
- {children} -
+ {children}
{
- + thetiptop navigation logo {
diff --git a/package-lock.json b/package-lock.json index dee8bcf..1f3d0e6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12,15 +12,18 @@ "@hookform/resolvers": "^2.9.10", "@next-auth/prisma-adapter": "1.0.5", "@prisma/client": "^4.6.1", + "@types/nodemailer": "^6.4.6", "bootstrap": "^5.2.2", "chance": "^1.1.9", "next": "13.0.2", "next-auth": "4.16.4", + "nodemailer": "^6.8.0", "react": "18.2.0", "react-dom": "18.2.0", "react-hook-form": "^7.39.2", "react-icons": "^4.6.0", "react-markdown": "8.0.3", + "react-toastify": "^9.1.1", "yup": "^0.32.11" }, "devDependencies": { @@ -450,8 +453,15 @@ "node_modules/@types/node": { "version": "18.11.9", "resolved": "https://registry.npmjs.org/@types/node/-/node-18.11.9.tgz", - "integrity": "sha512-CRpX21/kGdzjOpFsZSkcrXMGIBWMGNIHXXBVFSH+ggkftxg+XYP20TESbh+zFvFj3EQOl5byk0HTRn1IL6hbqg==", - "dev": true + "integrity": "sha512-CRpX21/kGdzjOpFsZSkcrXMGIBWMGNIHXXBVFSH+ggkftxg+XYP20TESbh+zFvFj3EQOl5byk0HTRn1IL6hbqg==" + }, + "node_modules/@types/nodemailer": { + "version": "6.4.6", + "resolved": "https://registry.npmjs.org/@types/nodemailer/-/nodemailer-6.4.6.tgz", + "integrity": "sha512-pD6fL5GQtUKvD2WnPmg5bC2e8kWCAPDwMPmHe/ohQbW+Dy0EcHgZ2oCSuPlWNqk74LS5BVMig1SymQbFMPPK3w==", + "dependencies": { + "@types/node": "*" + } }, "node_modules/@types/prop-types": { "version": "15.7.5", @@ -766,6 +776,14 @@ "node": ">=12" } }, + "node_modules/clsx": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/clsx/-/clsx-1.2.1.tgz", + "integrity": "sha512-EcR6r5a8bj6pu3ycsa/E/cKVGuTgZJZdsyUYHOksG/UHIiKfjxzRxYJpyVBwYaQeOvghal9fcc4PidlgzugAQg==", + "engines": { + "node": ">=6" + } + }, "node_modules/color-convert": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", @@ -1761,8 +1779,6 @@ "version": "6.8.0", "resolved": "https://registry.npmjs.org/nodemailer/-/nodemailer-6.8.0.tgz", "integrity": "sha512-EjYvSmHzekz6VNkNd12aUqAco+bOkRe3Of5jVhltqKhEsjw/y0PYPJfp83+s9Wzh1dspYAkUW/YNQ350NATbSQ==", - "optional": true, - "peer": true, "engines": { "node": ">=6.0.0" } @@ -1980,9 +1996,9 @@ } }, "node_modules/react-hook-form": { - "version": "7.39.2", - "resolved": "https://registry.npmjs.org/react-hook-form/-/react-hook-form-7.39.2.tgz", - "integrity": "sha512-rCeCa1+sIcgI9PjgGmev9bVqHCwYwhjkbsXitr+giQ/P0mf/AGwUBtCdKC1lRu7egrxbLwqO9cWNWpXW4FrsHA==", + "version": "7.39.3", + "resolved": "https://registry.npmjs.org/react-hook-form/-/react-hook-form-7.39.3.tgz", + "integrity": "sha512-H/vwk1vBf+TiXuyW6+hWz+zCujiDO6NqHlN5sPE/a+NGKKGK95XTM65DZz3NmEgs2M20Wka+g4uv4VD367wDBA==", "engines": { "node": ">=12.22.0" }, @@ -2037,6 +2053,18 @@ "react": ">=16" } }, + "node_modules/react-toastify": { + "version": "9.1.1", + "resolved": "https://registry.npmjs.org/react-toastify/-/react-toastify-9.1.1.tgz", + "integrity": "sha512-pkFCla1z3ve045qvjEmn2xOJOy4ZciwRXm1oMPULVkELi5aJdHCN/FHnuqXq8IwGDLB7PPk2/J6uP9D8ejuiRw==", + "dependencies": { + "clsx": "^1.1.1" + }, + "peerDependencies": { + "react": ">=16", + "react-dom": ">=16" + } + }, "node_modules/reflect-metadata": { "version": "0.1.13", "resolved": "https://registry.npmjs.org/reflect-metadata/-/reflect-metadata-0.1.13.tgz", @@ -2996,8 +3024,15 @@ "@types/node": { "version": "18.11.9", "resolved": "https://registry.npmjs.org/@types/node/-/node-18.11.9.tgz", - "integrity": "sha512-CRpX21/kGdzjOpFsZSkcrXMGIBWMGNIHXXBVFSH+ggkftxg+XYP20TESbh+zFvFj3EQOl5byk0HTRn1IL6hbqg==", - "dev": true + "integrity": "sha512-CRpX21/kGdzjOpFsZSkcrXMGIBWMGNIHXXBVFSH+ggkftxg+XYP20TESbh+zFvFj3EQOl5byk0HTRn1IL6hbqg==" + }, + "@types/nodemailer": { + "version": "6.4.6", + "resolved": "https://registry.npmjs.org/@types/nodemailer/-/nodemailer-6.4.6.tgz", + "integrity": "sha512-pD6fL5GQtUKvD2WnPmg5bC2e8kWCAPDwMPmHe/ohQbW+Dy0EcHgZ2oCSuPlWNqk74LS5BVMig1SymQbFMPPK3w==", + "requires": { + "@types/node": "*" + } }, "@types/prop-types": { "version": "15.7.5", @@ -3213,6 +3248,11 @@ "wrap-ansi": "^7.0.0" } }, + "clsx": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/clsx/-/clsx-1.2.1.tgz", + "integrity": "sha512-EcR6r5a8bj6pu3ycsa/E/cKVGuTgZJZdsyUYHOksG/UHIiKfjxzRxYJpyVBwYaQeOvghal9fcc4PidlgzugAQg==" + }, "color-convert": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", @@ -3811,9 +3851,7 @@ "nodemailer": { "version": "6.8.0", "resolved": "https://registry.npmjs.org/nodemailer/-/nodemailer-6.8.0.tgz", - "integrity": "sha512-EjYvSmHzekz6VNkNd12aUqAco+bOkRe3Of5jVhltqKhEsjw/y0PYPJfp83+s9Wzh1dspYAkUW/YNQ350NATbSQ==", - "optional": true, - "peer": true + "integrity": "sha512-EjYvSmHzekz6VNkNd12aUqAco+bOkRe3Of5jVhltqKhEsjw/y0PYPJfp83+s9Wzh1dspYAkUW/YNQ350NATbSQ==" }, "oauth": { "version": "0.9.15", @@ -3978,9 +4016,9 @@ } }, "react-hook-form": { - "version": "7.39.2", - "resolved": "https://registry.npmjs.org/react-hook-form/-/react-hook-form-7.39.2.tgz", - "integrity": "sha512-rCeCa1+sIcgI9PjgGmev9bVqHCwYwhjkbsXitr+giQ/P0mf/AGwUBtCdKC1lRu7egrxbLwqO9cWNWpXW4FrsHA==", + "version": "7.39.3", + "resolved": "https://registry.npmjs.org/react-hook-form/-/react-hook-form-7.39.3.tgz", + "integrity": "sha512-H/vwk1vBf+TiXuyW6+hWz+zCujiDO6NqHlN5sPE/a+NGKKGK95XTM65DZz3NmEgs2M20Wka+g4uv4VD367wDBA==", "requires": {} }, "react-icons": { @@ -4016,6 +4054,14 @@ "vfile": "^5.0.0" } }, + "react-toastify": { + "version": "9.1.1", + "resolved": "https://registry.npmjs.org/react-toastify/-/react-toastify-9.1.1.tgz", + "integrity": "sha512-pkFCla1z3ve045qvjEmn2xOJOy4ZciwRXm1oMPULVkELi5aJdHCN/FHnuqXq8IwGDLB7PPk2/J6uP9D8ejuiRw==", + "requires": { + "clsx": "^1.1.1" + } + }, "reflect-metadata": { "version": "0.1.13", "resolved": "https://registry.npmjs.org/reflect-metadata/-/reflect-metadata-0.1.13.tgz", diff --git a/package.json b/package.json index 3d20ad7..337d9a9 100644 --- a/package.json +++ b/package.json @@ -15,15 +15,18 @@ "@hookform/resolvers": "^2.9.10", "@next-auth/prisma-adapter": "1.0.5", "@prisma/client": "^4.6.1", + "@types/nodemailer": "^6.4.6", "bootstrap": "^5.2.2", "chance": "^1.1.9", "next": "13.0.2", "next-auth": "4.16.4", + "nodemailer": "^6.8.0", "react": "18.2.0", "react-dom": "18.2.0", "react-hook-form": "^7.39.2", "react-icons": "^4.6.0", "react-markdown": "8.0.3", + "react-toastify": "^9.1.1", "yup": "^0.32.11" }, "devDependencies": { diff --git a/pages/_app.tsx b/pages/_app.tsx index 6c14d61..9a88c49 100644 --- a/pages/_app.tsx +++ b/pages/_app.tsx @@ -4,6 +4,8 @@ import { useEffect } from "react"; import 'bootstrap/dist/css/bootstrap.css' import "../styles/globals.css"; +import 'react-toastify/dist/ReactToastify.css'; +import { ToastContainer } from 'react-toastify'; import Layout from "../components/Layout"; const App = ({ Component, pageProps }: AppProps) => { @@ -15,7 +17,9 @@ const App = ({ Component, pageProps }: AppProps) => { + + ); }; diff --git a/pages/api/auth/[...nextauth].ts b/pages/api/auth/[...nextauth].ts index a815d9e..452f9c6 100644 --- a/pages/api/auth/[...nextauth].ts +++ b/pages/api/auth/[...nextauth].ts @@ -39,6 +39,7 @@ const options = { return session } - } + }, + error: '/error', } diff --git a/pages/connexion.tsx b/pages/connexion.tsx new file mode 100644 index 0000000..284aa84 --- /dev/null +++ b/pages/connexion.tsx @@ -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({ + 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 ( + <> + + Connexion + + + + +
+ + +

Connexion

+ + +
+
+ +
+ + +
+
+ +
+ + + + +
+ +
+ +
+ +
+ + + +
+ +
+ +
+
{errors.acceptTerms?.message}
+
{errors.email?.message}
+
+ + + + + ) +}; + +export default MainPage; + + diff --git a/pages/login.tsx b/pages/login.tsx deleted file mode 100644 index a7a3215..0000000 --- a/pages/login.tsx +++ /dev/null @@ -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({ - resolver: yupResolver(validationSchema) - }); - - const onSubmit = async (data: CodeSubmitForm) => { - - if (!session) { - return -

Vous devez vous connecter pour tester votre !

-
- } - - - - // 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 ( - <> - - Home App - - - - -
-
- thetiptop feuille Gauche -
-
- thetiptop feuille Droite -
-
- thetiptop jeu Concours -
-
- thetiptop cadeau -
- -
- -
- - -
- thetiptop navigation logo -
- - - - - - -
- -
- - - - Code à usage unique -
{errors.codeCadeau?.message}
- -
-
- -
-
-
- - {/*
-

A gagner

-
-
- coffret de thé marron rempli de sachets de toutes couleurs -
-
-
-
- coffret de thé marron rempli de sachets de toutes couleurs -
-
-
-
- coffret de thé marron rempli de sachets de toutes couleurs -
-
-
-
- Et bien d'autres ! -
-
-
*/} -
-
- - {/*
-

Présentation du jeu concours

-

- Gagnez de superbes cadeaux en achetant nos produits ! -
- Pour participer, il vous suffit d'effectuer un achat en boutique d'une valeur supérieure à XXX euros. Retrouvez votre code sur la facture ! -
- Saisissez votre code ... Félicitations ! Vous avez gagné un cadeau ! Il nous vous reste plus qu'à le récupérer en magasin. -
- 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. -

-
-
-

Présentation de Thé Tip Top

-

- Thé Tip Top est une entreprise de thé [XXX ajouter des spécifications en se basant sur le cahier des charges] -

-
*/} - - ); -}; - -export default MainPage; diff --git a/pages/produit b/pages/produit new file mode 100644 index 0000000..ae4bf29 --- /dev/null +++ b/pages/produit @@ -0,0 +1,56 @@ + {/*
+

A gagner

+
+
+ coffret de thé marron rempli de sachets de toutes couleurs +
+
+
+
+ coffret de thé marron rempli de sachets de toutes couleurs +
+
+
+
+ coffret de thé marron rempli de sachets de toutes couleurs +
+
+
+
+ Et bien d'autres ! +
+
+
*/} + + + + {/*
+

Présentation du jeu concours

+

+ Gagnez de superbes cadeaux en achetant nos produits ! +
+ Pour participer, il vous suffit d'effectuer un achat en boutique d'une valeur supérieure à XXX euros. Retrouvez votre code sur la facture ! +
+ Saisissez votre code ... Félicitations ! Vous avez gagné un cadeau ! Il nous vous reste plus qu'à le récupérer en magasin. +
+ 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. +

+
+
+

Présentation de Thé Tip Top

+

+ Thé Tip Top est une entreprise de thé [XXX ajouter des spécifications en se basant sur le cahier des charges] +

+
*/} \ No newline at end of file diff --git a/public/images/connexion_image.png b/public/images/connexion_image.png new file mode 100644 index 0000000..0630c6d Binary files /dev/null and b/public/images/connexion_image.png differ diff --git a/styles/Connexion.module.css b/styles/Connexion.module.css new file mode 100644 index 0000000..24c099c --- /dev/null +++ b/styles/Connexion.module.css @@ -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; +} \ No newline at end of file diff --git a/styles/Content.module.css b/styles/Content.module.css index f9e0e78..6ebf7c8 100644 --- a/styles/Content.module.css +++ b/styles/Content.module.css @@ -45,7 +45,7 @@ background-position: 50% 50%; background-repeat: no-repeat; background-size: contain; - animation: zoomInOut 3s ease-in-out infinite; + /* animation: zoomInOut 3s ease-in-out infinite; */ z-index: 8888 } @@ -179,7 +179,7 @@ position: absolute; top: 0px; left: 0px; - z-index: 9999; + z-index: 9000; width: 25vw; } @@ -187,7 +187,7 @@ position: absolute; bottom: 0px; right: 0px; - z-index: 9999; + z-index: 9000; width: 25vw; } @@ -195,14 +195,14 @@ position: absolute; bottom: 0px; left: 0px; - z-index: 9999; + z-index: 9000; } .jeuConcours { position: absolute; top: 0px; right: 0px; - z-index: 9999; + z-index: 9000; } .footerGrass { @@ -224,7 +224,7 @@ position: absolute; top: 1px; left: 1px; - z-index: 9999; + z-index: 9000; width: 25vw; } @@ -232,7 +232,7 @@ position: absolute; bottom: 15px; right: 15px; - z-index: 9999; + z-index: 9000; width: 25vw; } @@ -240,13 +240,13 @@ position: absolute; bottom: 0px; left: 0px; - z-index: 9999; + z-index: 9000; } .jeuConcours { position: absolute; top: 15px; right: 15px; - z-index: 9999; + z-index: 9000; } } \ No newline at end of file diff --git a/styles/Index.module.css b/styles/Index.module.css index b3bb04e..f9a5b7f 100644 --- a/styles/Index.module.css +++ b/styles/Index.module.css @@ -6,7 +6,7 @@ background-repeat: no-repeat; background-size: contain; animation: zoomInOut 4s ease-in-out infinite; - z-index: 9999; + z-index: 9000; } .zoomInOutCadeau { diff --git a/styles/NavBar.module.css b/styles/NavBar.module.css index 9affd21..04c7f68 100644 --- a/styles/NavBar.module.css +++ b/styles/NavBar.module.css @@ -1,6 +1,6 @@ .customcss { background-color: transparent !important; - z-index: 9999; + z-index: 9001; position: absolute; }