33 Commits
Author SHA1 Message Date
dandanalaa 1897a5276f Actualiser scripts/deliver.sh 2026-11-19 15:45:03 +00:00
dandanalaa 81a709daae Actualiser public/sitemap.xml 2026-11-19 15:43:51 +00:00
dandanalaa c89d5aea87 Actualiser public/sitemap-0.xml 2026-11-19 15:42:42 +00:00
dandanalaa 5b597a87e3 Actualiser public/robots.txt 2026-11-19 15:41:16 +00:00
dandanalaa 3b6e459981 Actualiser next-sitemap.config.js 2026-11-19 15:39:45 +00:00
dandanalaa b50267076a Actualiser .env
changement domaine
2026-11-19 14:38:00 +00:00
dandanalaa 6af3b8c308 Actualiser Jenkinsfile
changement nom de domaine
2026-11-19 14:35:42 +00:00
dandanalaa 385ce16b96 Mise à jour de 'Jenkinsfile' 2023-08-07 15:52:48 +00:00
dandanalaa 4d0c341152 Mise à jour de '.env' 2023-08-07 15:48:36 +00:00
dandanalaa 2d8ad1c893 Mise à jour de 'Jenkinsfile' 2023-08-07 15:44:20 +00:00
dandanalaa 42a7a4068a Mise à jour de 'Jenkinsfile' 2023-08-07 15:37:54 +00:00
dandanalaa 08d1c258c2 Mise à jour de 'Jenkinsfile' 2023-08-07 15:34:27 +00:00
dandanalaa c6c2e107de Mise à jour de '.env' 2023-08-07 15:30:32 +00:00
dandanalaa 5981f0a755 corr test 2022-12-16 11:52:32 +01:00
dandanalaa 70fc723093 Merge branch 'master' of https://git.dsp-archiwebo21-ad-ec-cb-mt.fr/cedric/The_Tip_Top 2022-12-16 11:32:42 +01:00
dandanalaa cf298c2272 test 2022-12-16 11:32:11 +01:00
cedric 6679b75642 Merge branch 'master' of https://git.dsp-archiwebo21-ad-ec-cb-mt.fr/cedric/The_Tip_Top 2022-12-16 10:57:05 +01:00
cedric 3e289ed731 fix : alt image tester cadeau 2022-12-16 10:56:27 +01:00
dandanalaa 578ebb51e2 mis a jour nav barre 2022-12-16 09:09:00 +01:00
dandanalaa dbec1917a7 modification navbarre 2022-12-16 09:03:07 +01:00
cedric ff7024a788 ajout sitemap 2022-12-15 21:44:16 +01:00
cedric 5ef737b8ee ajout robots txt 2022-12-15 21:15:42 +01:00
eric 401935d703 💄 fix - page admin 2022-12-15 18:34:56 +01:00
eric eda530cce6 ⚡️ fix - typo 2022-12-15 17:19:10 +01:00
eric 60d701ac07 Merge branch 'develop' 2022-12-15 16:35:29 +01:00
eric 34700a46d9 fix - modifications importantes 2022-12-15 15:16:47 +01:00
dandanalaa 87490d6263 Mise à jour de 'scripts/deliver.sh'
modification script delivrer
2022-12-13 17:29:35 +00:00
C 10e415e53e add - cookie consent 2022-12-13 10:20:27 +01:00
C deb3cc922b add - vertical margin des input admin et mon compte 2022-12-13 09:49:27 +01:00
C 98dc6c4f64 fix - image tout savoir caché quand navbar mobile ouvert 2022-12-12 14:56:33 +01:00
C 9ed7de368f fix : image tout savoir en premier plan pour pouvoir cliquer dessus en mobile 2022-12-12 13:49:15 +01:00
C ffc2cb37a2 add google tag manager 2022-12-12 11:45:10 +01:00
C 1d6abb05c1 add -ga sur index, mentions-legales, cgu, 404, tout-savoir, connexion 2022-12-12 11:37:46 +01:00
30 changed files with 538 additions and 371 deletions

No files matched your search

+4 -4
View File
@@ -10,11 +10,11 @@ GOOGLE_CLIENT_ID=965228443747-049kq59pm43bd23aplfu9ja2333dpo5s.apps.googleuserco
GOOGLE_CLIENT_SECRET=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
# Email (magic link)
EMAIL_SERVER_USER=contact@dsp-archiwebo21-ad-ec-cb-mt.fr
EMAIL_SERVER_PASSWORD=Acem@2022a
EMAIL_SERVER_HOST=mail50.lwspanel.com
EMAIL_SERVER_USER=contact@dandan.re
EMAIL_SERVER_PASSWORD=Le300490@221
EMAIL_SERVER_HOST=mail.dandan.re
EMAIL_SERVER_PORT=587
EMAIL_FROM=contact@dsp-archiwebo21-ad-ec-cb-mt.fr
EMAIL_FROM=contact@dandan.re
DATABASE_URL="postgres://postgres:postgrespwd@127.0.0.1:5454/thetiptop"
-5
View File
@@ -1,7 +1,2 @@
{
"workbench.colorCustomizations": {
"activityBar.background": "#4C1F25",
"titleBar.activeBackground": "#6A2C34",
"titleBar.activeForeground": "#FEFCFC"
}
}
Vendored
+6 -6
View File
@@ -4,8 +4,8 @@ pipeline {
stage('Env reinit') {
steps {
sh '''echo "
NEXTAUTH_URL=\'https://devops.dsp-archiwebo21-ad-ec-cb-mt.fr\'
DATABASE_URL="postgres://postgres:dandanalaa@212.227.206.140:5454/thetiptop"
NEXTAUTH_URL=\'https://devops.dandan.re\'
DATABASE_URL="postgres://postgres:dandanalaa@127.0.0.1:5454/thetiptop"
GITHUB_ID=YOUR_GITHUB_CLIENT_ID
GITHUB_SECRET=YOUR_GITHUB_CLIENT_SECRET
@@ -13,11 +13,11 @@ pipeline {
GOOGLE_CLIENT_ID=965228443747-049kq59pm43bd23aplfu9ja2333dpo5s.apps.googleusercontent.com
GOOGLE_CLIENT_SECRET=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
EMAIL_SERVER_USER=contact@dsp-archiwebo21-ad-ec-cb-mt.fr
EMAIL_SERVER_PASSWORD=Acem@2022a
EMAIL_SERVER_HOST=mail50.lwspanel.com
EMAIL_SERVER_USER=contact@dandan.re
EMAIL_SERVER_PASSWORD=Le300490@221
EMAIL_SERVER_HOST=mail.dandan.re
EMAIL_SERVER_PORT=587
EMAIL_FROM=contact@dsp-archiwebo21-ad-ec-cb-mt.fr
EMAIL_FROM=contact@dandan.re
SECRET=thetiptop123
+7
View File
@@ -2,6 +2,8 @@ import React, { ReactNode } from "react";
import NavBar from "./NavBar";
import Footer from "./Footer";
import CookieConsent from "react-cookie-consent";
type Props = {
children?: React.ReactNode;
};
@@ -10,6 +12,11 @@ const Layout = ({ children }: Props) =>
<div className="layout-container">
<NavBar />
{children}
<CookieConsent
buttonText="Je comprends"
style={{ zIndex: "100000", justifyContent:"center" }}
buttonStyle={{color:"white",background:"#76AE0D"}}>
Ce site web utilise des cookies pour améliorer l'expérience de l'utilisateur.</CookieConsent>
<Footer />
</div>
+6
View File
@@ -29,6 +29,10 @@ const NavBar = () => {
const checkRole = () => {
const isAdmin = ['SELLER', 'ADMIN', 'SUPERADMIN'].includes(session?.user['role']);
console.log('isAdmin', isAdmin);
console.log('role', session?.user['role']);
return isAdmin ? setIsAdmin(true) : setIsAdmin(false);
}
@@ -39,12 +43,14 @@ const NavBar = () => {
let visitor = (
<nav className={`${style['navbar']}`}>
<div className="d-flex justify-content-center">
<Link href="/" legacyBehavior><a>
<Image
src={logo}
alt="thetiptop navigation logo big"
width={250}
height={100}
/>
</a></Link>
</div>
<div className={`justify-content-center text-center ${style['hidden-mobile']}`}>
<Link href="/" legacyBehavior><a className={style.link} >Accueil</a></Link><p>|</p>
+5
View File
@@ -0,0 +1,5 @@
/** @type {import('next-sitemap').IConfig} */
module.exports = {
siteUrl: process.env.NEXTAUTH_URL || 'https://dandan.re/',
generateRobotsTxt: true
}
+104
View File
@@ -22,9 +22,11 @@
"js-confetti": "^0.11.0",
"next": "13.0.2",
"next-auth": "4.16.4",
"next-sitemap": "^3.1.42",
"nodemailer": "^6.8.0",
"react": "18.2.0",
"react-chartjs-2": "^5.0.1",
"react-cookie-consent": "^8.0.1",
"react-dom": "18.2.0",
"react-hook-form": "^7.39.2",
"react-icons": "^4.6.0",
@@ -42,6 +44,7 @@
"@testing-library/user-event": "^14.4.3",
"@tomfreudenberg/next-auth-mock": "^0.5.5",
"@types/chance": "^1.1.3",
"@types/dateformat": "^5.0.0",
"@types/jest": "^29.2.4",
"@types/next-auth": "3.13.0",
"@types/node": "^18.11.9",
@@ -665,6 +668,11 @@
"integrity": "sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==",
"dev": true
},
"node_modules/@corex/deepmerge": {
"version": "4.0.29",
"resolved": "https://registry.npmjs.org/@corex/deepmerge/-/deepmerge-4.0.29.tgz",
"integrity": "sha512-q/yVUnqckA8Do+EvAfpy7RLdumnBy9ZsducMUtZTvpdbJC7azEf1hGtnYYxm0QfphYxjwggv6XtH64prvS1W+A=="
},
"node_modules/@cspotcode/source-map-support": {
"version": "0.8.1",
"resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz",
@@ -1959,6 +1967,12 @@
"integrity": "sha512-X6c6ghhe4/sQh4XzcZWSFaTAUOda38GQHmq9BUanYkOE/EO7ZrkazwKmtsj3xzTjkLWmwULE++23g3d3CCWaWw==",
"dev": true
},
"node_modules/@types/dateformat": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/@types/dateformat/-/dateformat-5.0.0.tgz",
"integrity": "sha512-SZg4JdHIWHQGEokbYGZSDvo5wA4TLYPXaqhigs/wH+REDOejcJzgH+qyY+HtEUtWOZxEUkbhbdYPqQDiEgrXeA==",
"dev": true
},
"node_modules/@types/debug": {
"version": "4.1.7",
"resolved": "https://registry.npmjs.org/@types/debug/-/debug-4.1.7.tgz",
@@ -5574,6 +5588,11 @@
"resolved": "https://registry.npmjs.org/js-confetti/-/js-confetti-0.11.0.tgz",
"integrity": "sha512-Hc7I3VI4r4H0nq5q/oQK+JJwGoYRYVHK72fGk8E9Ay1dbh+aiZ9yl0yFp1K4oYeq7YFDQAndYChwqLPA3QWQuA=="
},
"node_modules/js-cookie": {
"version": "2.2.1",
"resolved": "https://registry.npmjs.org/js-cookie/-/js-cookie-2.2.1.tgz",
"integrity": "sha512-HvdH2LzI/EAZcUwA8+0nKNtWHqS+ZmijLA30RwZA0bo7ToCckjK5MkGhjED9KoRcXO6BaGI3I9UIzSA1FKFPOQ=="
},
"node_modules/js-tokens": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz",
@@ -6411,6 +6430,14 @@
"node": "*"
}
},
"node_modules/minimist": {
"version": "1.2.7",
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.7.tgz",
"integrity": "sha512-bzfL1YUZsP41gmu/qjrEk0Q6i2ix/cVeAhbCbqH9u3zYutS1cLg00qhrD0M2MVdCcx4Sc0UpP2eBWo9rotpq6g==",
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/mkdirp": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz",
@@ -6559,6 +6586,31 @@
"url": "https://github.com/sponsors/panva"
}
},
"node_modules/next-sitemap": {
"version": "3.1.42",
"resolved": "https://registry.npmjs.org/next-sitemap/-/next-sitemap-3.1.42.tgz",
"integrity": "sha512-z/m440ZDCTxoE3FWbBWZLK66ZEh9e2R+j/Bm0d1Vo4PFkMi4yhWdIjWqhj//kyFyBvMYk3YWs8QQqVCCe15E6g==",
"funding": [
{
"url": "https://github.com/iamvishnusankar/next-sitemap.git"
}
],
"dependencies": {
"@corex/deepmerge": "^4.0.29",
"minimist": "^1.2.7"
},
"bin": {
"next-sitemap": "bin/next-sitemap.mjs",
"next-sitemap-cjs": "bin/next-sitemap.cjs"
},
"engines": {
"node": ">=14.18"
},
"peerDependencies": {
"@next/env": "*",
"next": "*"
}
},
"node_modules/nice-try": {
"version": "1.0.5",
"resolved": "https://registry.npmjs.org/nice-try/-/nice-try-1.0.5.tgz",
@@ -7272,6 +7324,20 @@
"react": "^16.8.0 || ^17.0.0 || ^18.0.0"
}
},
"node_modules/react-cookie-consent": {
"version": "8.0.1",
"resolved": "https://registry.npmjs.org/react-cookie-consent/-/react-cookie-consent-8.0.1.tgz",
"integrity": "sha512-4A2jzPQDFfBhtxIz4hYX+vJ0QnOknGdOXpEoetXzgwUrMtxVJVow8YgBsGerNt5rJI7WhKkHwr8LmxekxgVejg==",
"dependencies": {
"js-cookie": "^2.2.1"
},
"engines": {
"node": ">=10"
},
"peerDependencies": {
"react": ">=16"
}
},
"node_modules/react-dom": {
"version": "18.2.0",
"resolved": "https://registry.npmjs.org/react-dom/-/react-dom-18.2.0.tgz",
@@ -9362,6 +9428,11 @@
"integrity": "sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==",
"dev": true
},
"@corex/deepmerge": {
"version": "4.0.29",
"resolved": "https://registry.npmjs.org/@corex/deepmerge/-/deepmerge-4.0.29.tgz",
"integrity": "sha512-q/yVUnqckA8Do+EvAfpy7RLdumnBy9ZsducMUtZTvpdbJC7azEf1hGtnYYxm0QfphYxjwggv6XtH64prvS1W+A=="
},
"@cspotcode/source-map-support": {
"version": "0.8.1",
"resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz",
@@ -10335,6 +10406,12 @@
"integrity": "sha512-X6c6ghhe4/sQh4XzcZWSFaTAUOda38GQHmq9BUanYkOE/EO7ZrkazwKmtsj3xzTjkLWmwULE++23g3d3CCWaWw==",
"dev": true
},
"@types/dateformat": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/@types/dateformat/-/dateformat-5.0.0.tgz",
"integrity": "sha512-SZg4JdHIWHQGEokbYGZSDvo5wA4TLYPXaqhigs/wH+REDOejcJzgH+qyY+HtEUtWOZxEUkbhbdYPqQDiEgrXeA==",
"dev": true
},
"@types/debug": {
"version": "4.1.7",
"resolved": "https://registry.npmjs.org/@types/debug/-/debug-4.1.7.tgz",
@@ -13024,6 +13101,11 @@
"resolved": "https://registry.npmjs.org/js-confetti/-/js-confetti-0.11.0.tgz",
"integrity": "sha512-Hc7I3VI4r4H0nq5q/oQK+JJwGoYRYVHK72fGk8E9Ay1dbh+aiZ9yl0yFp1K4oYeq7YFDQAndYChwqLPA3QWQuA=="
},
"js-cookie": {
"version": "2.2.1",
"resolved": "https://registry.npmjs.org/js-cookie/-/js-cookie-2.2.1.tgz",
"integrity": "sha512-HvdH2LzI/EAZcUwA8+0nKNtWHqS+ZmijLA30RwZA0bo7ToCckjK5MkGhjED9KoRcXO6BaGI3I9UIzSA1FKFPOQ=="
},
"js-tokens": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz",
@@ -13547,6 +13629,11 @@
"brace-expansion": "^1.1.7"
}
},
"minimist": {
"version": "1.2.7",
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.7.tgz",
"integrity": "sha512-bzfL1YUZsP41gmu/qjrEk0Q6i2ix/cVeAhbCbqH9u3zYutS1cLg00qhrD0M2MVdCcx4Sc0UpP2eBWo9rotpq6g=="
},
"mkdirp": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz",
@@ -13639,6 +13726,15 @@
}
}
},
"next-sitemap": {
"version": "3.1.42",
"resolved": "https://registry.npmjs.org/next-sitemap/-/next-sitemap-3.1.42.tgz",
"integrity": "sha512-z/m440ZDCTxoE3FWbBWZLK66ZEh9e2R+j/Bm0d1Vo4PFkMi4yhWdIjWqhj//kyFyBvMYk3YWs8QQqVCCe15E6g==",
"requires": {
"@corex/deepmerge": "^4.0.29",
"minimist": "^1.2.7"
}
},
"nice-try": {
"version": "1.0.5",
"resolved": "https://registry.npmjs.org/nice-try/-/nice-try-1.0.5.tgz",
@@ -14162,6 +14258,14 @@
"integrity": "sha512-u38C9OxynlNCBp+79grgXRs7DSJ9w8FuQ5/HO5FbYBbri8HSZW+9SWgjVshLkbXBfXnMGWakbHEtvN0nL2UG7Q==",
"requires": {}
},
"react-cookie-consent": {
"version": "8.0.1",
"resolved": "https://registry.npmjs.org/react-cookie-consent/-/react-cookie-consent-8.0.1.tgz",
"integrity": "sha512-4A2jzPQDFfBhtxIz4hYX+vJ0QnOknGdOXpEoetXzgwUrMtxVJVow8YgBsGerNt5rJI7WhKkHwr8LmxekxgVejg==",
"requires": {
"js-cookie": "^2.2.1"
}
},
"react-dom": {
"version": "18.2.0",
"resolved": "https://registry.npmjs.org/react-dom/-/react-dom-18.2.0.tgz",
+5 -1
View File
@@ -10,7 +10,8 @@
"build": "next build",
"start": "next start",
"db": "npx prisma migrate reset --force",
"test": "playwright test"
"test": "playwright test",
"postbuild": "next-sitemap"
},
"dependencies": {
"@hookform/resolvers": "^2.9.10",
@@ -26,9 +27,11 @@
"js-confetti": "^0.11.0",
"next": "13.0.2",
"next-auth": "4.16.4",
"next-sitemap": "^3.1.42",
"nodemailer": "^6.8.0",
"react": "18.2.0",
"react-chartjs-2": "^5.0.1",
"react-cookie-consent": "^8.0.1",
"react-dom": "18.2.0",
"react-hook-form": "^7.39.2",
"react-icons": "^4.6.0",
@@ -46,6 +49,7 @@
"@testing-library/user-event": "^14.4.3",
"@tomfreudenberg/next-auth-mock": "^0.5.5",
"@types/chance": "^1.1.3",
"@types/dateformat": "^5.0.0",
"@types/jest": "^29.2.4",
"@types/next-auth": "3.13.0",
"@types/node": "^18.11.9",
+17
View File
@@ -1,6 +1,7 @@
import React from "react";
import Head from "next/head";
import style from '../styles/404.module.css'
import Script from "next/script";
const NotFound = () => {
return (
@@ -16,6 +17,22 @@ const NotFound = () => {
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossOrigin="" />
</Head>
<Script async src="https://www.googletagmanager.com/gtag/js?id=G-QNZD85D13X"></Script>
<Script>
{`
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-QNZD85D13X');
`}
</Script>
<Script>{`(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-MMHM9HX');`}</Script>
{/* backgroundImagePath={'/images/ugh.png'} */}
<div className="body-content position-relative">
<div className={`${style['footer-separator']}`}></div>
+123 -118
View File
@@ -21,11 +21,18 @@ import { Token } from "nodemailer/lib/xoauth2";
import { isGeneratorFunction } from "util/types";
import { UserProps } from "../types/user";
import { UserGainProps } from "../types/userGain";
import { Gain, Produit, Role, TicketsRestants, User } from "@prisma/client";
import { Gain, Produit, Role, User } from "@prisma/client";
import { Doughnut } from "react-chartjs-2";
import { Chart as ChartJS, ArcElement, Tooltip, Legend, RadialLinearScale } from 'chart.js';
import { PolarArea } from 'react-chartjs-2';
import {
Chart as ChartJS,
CategoryScale,
LinearScale,
BarElement,
Title,
Tooltip,
Legend,
} from 'chart.js';
import { Bar } from 'react-chartjs-2';
type FormData = {
email: string;
@@ -61,8 +68,26 @@ export async function getServerSideProps(context) {
}
});
const tickets = await prisma.gain.findMany({})
const totalTirageRestant = await prisma.ticketsRestants.findFirst({})
const ticketRestants = await prisma.gain.count({
where: {
dateAchat: {
not: null,
}
}
})
const ticketsSaisis = await prisma.gain.count({
where: {
codeActif: false,
},
})
const gainsRetires = await prisma.gain.count({
where: {
retrait: true
},
})
const produits = await prisma.produit.findMany({})
return {
@@ -70,8 +95,9 @@ export async function getServerSideProps(context) {
user: JSON.parse(JSON.stringify(user)),
produits: JSON.parse(JSON.stringify(produits)),
users: JSON.parse(JSON.stringify(users)),
tickets: JSON.parse(JSON.stringify(tickets)),
totalTirageRestant: JSON.parse(JSON.stringify(totalTirageRestant))
ticketRestants: JSON.parse(JSON.stringify(ticketRestants)),
ticketsSaisis: JSON.parse(JSON.stringify(ticketsSaisis)),
gainsRetires: JSON.parse(JSON.stringify(gainsRetires)),
},
}
}
@@ -80,10 +106,12 @@ type Props = {
user: User;
produits: Produit[];
users: any,
tickets: Gain[]
totalTirageRestant: TicketsRestants
ticketRestants: number,
ticketsSaisis: number,
gainsRetires: number,
}
const Admin = (props: Props) => {
const { data: session, status } = useSession();
const [response, setResponse] = useState(null)
@@ -93,58 +121,56 @@ const Admin = (props: Props) => {
const [query, setQuery] = useState("");
const router = useRouter()
const isAdmin = session?.user['role'] === Role.ADMIN
const isSuperAdmin = session?.user['role'] === Role.SUPERADMIN
const bigWinner = users?.find((user) => user?.isBigWinner)
ChartJS.register(RadialLinearScale, ArcElement, Tooltip, Legend);
ChartJS.register(
CategoryScale,
LinearScale,
BarElement,
Title,
Tooltip,
Legend
);
const TicketRestants = props.tickets?.filter(ticket => ticket.codeActif === true).length
console.log("🚀 ~ file: admin.tsx:103 ~ Admin ~ TicketRestants", TicketRestants)
const TicketUtilise = props.tickets?.filter(ticket => ticket.codeActif === false).length
console.log("🚀 ~ file: admin.tsx:104 ~ Admin ~ TicketUtilise", TicketUtilise)
const TicketTotal = props.totalTirageRestant.total;
console.log("🚀 ~ file: admin.tsx:107 ~ Admin ~ TicketTotal", TicketTotal)
const labels = ['Tickets générés', 'Codes saisis', 'Cadeaux récupérés'];
const TotalTirageRestant = props.totalTirageRestant?.total;
const ticketDataChart = {
labels: ['Tickets généré utlisés', 'Tickets généré restants'],
datasets: [
{
label: 'Tickets restants généré',
data: [TicketUtilise, TicketRestants],
backgroundColor: [
'rgba(255, 99, 132, 0.2)',
'rgba(54, 162, 235, 0.2)',
],
borderColor: [
'rgba(255, 99, 132, 1)',
'rgba(54, 162, 235, 1)',
],
borderWidth: 1,
},
],
const data = {
labels: labels,
datasets: [{
data: [props.ticketRestants, props.ticketsSaisis, props.gainsRetires],
backgroundColor: [
'rgba(255, 99, 132, 0.2)',
'rgba(255, 159, 64, 0.2)',
'rgba(255, 205, 86, 0.2)',
],
borderColor: [
'rgb(255, 99, 132)',
'rgb(255, 159, 64)',
'rgb(255, 205, 86)',
],
borderWidth: 1
}]
};
const TotalTirageRestantData = {
labels: ['Total tirage restant'],
datasets: [
{
label: 'Tirage de ticket',
data: [TotalTirageRestant],
backgroundColor: [
'rgba(54, 162, 235, 0.5)',
],
borderWidth: 1,
const options = {
responsive: true,
plugins: {
legend: {
display: false
},
],
title: {
display: false,
},
},
};
const numberWithSpaces = (x: number): string => {
return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, " ");
}
const { register, setValue, handleSubmit, formState: { errors } } = useForm<FormData>({
});
@@ -160,28 +186,10 @@ const Admin = (props: Props) => {
setResponse(data);
callback;
if (data.err) {
toast.error(data.err, {
position: "top-center",
autoClose: 2000,
hideProgressBar: false,
closeOnClick: true,
pauseOnHover: true,
draggable: true,
progress: undefined,
theme: "light",
});
toastError(data.err);
return;
}
toast.success(data.message, {
position: "top-center",
autoClose: 5000,
hideProgressBar: false,
closeOnClick: true,
pauseOnHover: true,
draggable: true,
progress: undefined,
theme: "light",
});
toastSuccess(data.message);
})
}
catch (error) {
@@ -189,6 +197,32 @@ const Admin = (props: Props) => {
}
}
const toastError = (text: string) => {
toast.error(text, {
position: "top-center",
autoClose: 2000,
hideProgressBar: false,
closeOnClick: true,
pauseOnHover: true,
draggable: true,
progress: undefined,
theme: "light",
});
}
const toastSuccess = (text: string) => {
toast.success(text, {
position: "top-center",
autoClose: 5000,
hideProgressBar: false,
closeOnClick: true,
pauseOnHover: true,
draggable: true,
progress: undefined,
theme: "light",
});
}
const onSubmit = async ({
email,
name,
@@ -218,19 +252,13 @@ const Admin = (props: Props) => {
const onDeleteUser = async (userEmail: string) => {
const body = { selectedUserEmail: userEmail }
if (props.user.email === userEmail) {
toast.error('Vous devez être déconnecté pour supprimer votre compte', {
position: "top-center",
autoClose: 2000,
hideProgressBar: false,
closeOnClick: true,
pauseOnHover: true,
draggable: true,
progress: undefined,
theme: "light",
});
toastError('Vous devez être déconnecté pour supprimer votre compte')
return;
}
fetcher('/api/user/delete', 'DELETE', body)
setTimeout(() => {
router.refresh();
}, 2000)
};
const selectUser = (user: any) => {
@@ -256,38 +284,19 @@ const Admin = (props: Props) => {
const customers = users.filter((user) => user.role === 'USER')
if (users.length <= 0) {
toast.error("Il n'y a pas encore d'utilisateur", {
position: "top-center",
autoClose: 2000,
hideProgressBar: false,
closeOnClick: true,
pauseOnHover: true,
draggable: true,
progress: undefined,
theme: "light",
});
toastError("Il n'y a pas encore d'utilisateur")
return;
}
const customersWithTicket = customers.filter((user) => user.gains.length >= 1)
if (customersWithTicket.length <= 0) {
toast.error("Il n'y a pas encore d'utilisateurs ayant joué", {
position: "top-center",
autoClose: 2000,
hideProgressBar: false,
closeOnClick: true,
pauseOnHover: true,
draggable: true,
progress: undefined,
theme: "light",
});
toastError("Il n'y a pas encore d'utilisateurs ayant joué");
return;
}
const winUser = customersWithTicket[Math.floor(Math.random() * customersWithTicket.length)]
const body = { selectedUserEmail: winUser.email }
console.log(body)
fetcher('/api/user/bigwinner', 'PUT', body)
setTimeout(() => {
router.refresh();
@@ -306,7 +315,7 @@ const Admin = (props: Props) => {
const filtered = searchFilter(props.users)
const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {
setQuery(e.target.value)
setQuery(e.target.value);
}
return (
@@ -324,17 +333,13 @@ const Admin = (props: Props) => {
<hr />
<h1 className="fw-light">Dashboard Administration</h1>
<hr />
<div className="container" style={{ width: '30vw' }}>
<div className="row">
<div className="col-12 justify-content-center">
<p>Total tirages restant 📈 {props.totalTirageRestant?.total?.toString()}</p>
<Doughnut
data={ticketDataChart} />
<p>Total tirages restant 📈 {numberWithSpaces(props.ticketRestants).toString()}</p>
<Bar options={options} data={data} />
</div>
</div>
</div>
@@ -361,7 +366,7 @@ const Admin = (props: Props) => {
<th scope="col">Nom</th>
<th scope="col">Prénom</th>
<th scope="col">Email</th>
<th scope="col">Types</th>
{session?.user['role'] !== Role.SELLER && <th scope="col">Types</th>}
</tr>
</thead>
<tbody>
@@ -371,7 +376,7 @@ const Admin = (props: Props) => {
<td>{info.surname}</td>
<td>{info.name}</td>
<td>{info.isBigWinner && '🎁'}{info.email}</td>
{info.role !== Role.SELLER && <td>
{session?.user['role'] !== Role.SELLER && <td>
<select className="custom-select" defaultValue={info.role} onChange={(e) => onChangeRole(e, info)}>
<option value="USER">Client</option>
<option value="SELLER">Vendeur</option>
@@ -379,7 +384,7 @@ const Admin = (props: Props) => {
{isSuperAdmin && <option value="SUPERADMIN">SuperAdmin</option>}
</select>
</td>}
{info.role !== Role.SELLER && <td><button className="btn btn-primary" onClick={() => onDeleteUser(info.email)}>Supprimer</button></td>}
{session?.user['role'] !== Role.SELLER && <td><button className="btn btn-primary" onClick={() => onDeleteUser(info.email)}>Supprimer</button></td>}
</tr>;
})}
</tbody>
@@ -397,14 +402,14 @@ const Admin = (props: Props) => {
{currentUser && <form onSubmit={handleSubmit(onSubmit)}>
<div className="form-group">
<div className="form-group row">
<div className="form-group row my-1">
<label htmlFor="staticEmail" className="col-sm-3 col-form-label">Email :</label>
<div className="col-sm-9">
<input type="text" readOnly className="form-control-plaintext text-sm-center" id="staticEmail" value={currentUser?.email || ''} />
</div>
</div>
<div className="form-group row">
<div className="form-group row my-1">
<label htmlFor="inputName" className="col-sm-3 col-form-label">Nom :</label>
<div className="col-sm-9">
<input {...register("name")} className={`form-control ${errors.name ? 'is-invalid' : ''}`} defaultValue={currentUser?.name || ''} id="inputName" placeholder="John..." />
@@ -412,7 +417,7 @@ const Admin = (props: Props) => {
</div>
</div>
<div className="form-group row">
<div className="form-group row my-1">
<label htmlFor="surname" className="col-sm-3 col-form-label">Prenom :</label>
<div className="col-sm-9">
<input {...register("surname")} className={`form-control ${errors.surname ? 'is-invalid' : ''}`} defaultValue={currentUser?.surname || ''} id="surname" placeholder="Doe..." />
@@ -420,7 +425,7 @@ const Admin = (props: Props) => {
</div>
</div>
<div className="form-group row">
<div className="form-group row my-1">
<label htmlFor="address" className="col-sm-3 col-form-label">Adresse :</label>
<div className="col-sm-9">
<input {...register("address")} className={`form-control ${errors.address ? 'is-invalid' : ''}`} defaultValue={currentUser?.address || ''} id="address" placeholder="1 rue de la paix..." />
@@ -428,7 +433,7 @@ const Admin = (props: Props) => {
</div>
</div>
<div className="form-group row">
<div className="form-group row my-1">
<label htmlFor="zipCode" className="col-sm-3 col-form-label">Code postale :</label>
<div className="col-sm-9">
<input {...register("zipCode")} className={`form-control ${errors.zipCode ? 'is-invalid' : ''}`} defaultValue={currentUser?.zipCode || ''} id="zipCode" placeholder="95000..." />
@@ -436,7 +441,7 @@ const Admin = (props: Props) => {
</div>
</div>
<div className="form-group row">
<div className="form-group row my-1">
<label htmlFor="phoneNumber" className="col-sm-3 col-form-label">Téléphone :</label>
<div className="col-sm-9">
<input {...register("phoneNumber")} className={`form-control ${errors.phoneNumber ? 'is-invalid' : ''}`} defaultValue={currentUser?.phoneNumber || ''} id="phoneNumber" placeholder="0123456789..." />
-99
View File
@@ -1,99 +0,0 @@
import prisma from '../../../lib/prisma';
import chance from 'chance'
import cryptoRandomString from 'crypto-random-string';
import { NextApiRequest, NextApiResponse } from 'next';
import { getSession } from 'next-auth/react';
import { Cadeaux } from '../../../enum/cadeaux.enum';
import { Role } from '../../../enum/role.enum';
import process from 'process';
//API gain qui va generer un code cadeau qui sera sur la facture du client
//On part du principe qu'une 'API caisse'(qu'on ne gere pas) déclenche l'appel à l'API gain
//--> http://localhost:3000/api/apiGain?pass=... (a effacer)
export default async function apiGain(req: NextApiRequest, res: NextApiResponse) {
const { pass } = req.query;
const goodPassword = pass === 'P9RDK2b47x1XQV5s3fSaW6erGpzTNudk8jZwCycJYtMHAqhEnm';
if (!process.env.ACTION_API) {
return res.status(401).send({ message: 'Unauthorized' })
}
//récuperation des tickets disponible
const getTickets = await prisma.ticketsRestants.findFirst({
where: {
id: 1
},
})
const { total } = getTickets;
const isTicketsAvaible = total > 0;
if (isTicketsAvaible && goodPassword) {
//creation d'un numéro de gain aléatoire
const gainNumber = cryptoRandomString({ length: 10, type: 'distinguishable' });
//création d'un id de produit de façon pondérée
let weightedRandomGainId = chance().weighted([
Cadeaux.GrandCoffretDecouverte,
Cadeaux.CoffretDecouverte,
Cadeaux.TheSignature,
Cadeaux.TheDetox,
Cadeaux.Infuseur],
[4, 6, 10, 20, 60]);
//création d'un gain
const gainCreated = await prisma.gain.create({
data: {
codeCadeau: gainNumber,
}
})
//mise à jour du gain avec l'id de produit pondéré
const gainResult = await prisma.gain.update({
where: { id: gainCreated.id },
data: {
produitId: weightedRandomGainId,
}
})
//on retire 1 ticket
await prisma.ticketsRestants.update({
where: {
id: getTickets.id
},
data: {
total: {
decrement: 1
}
}
})
return res.status(200).send({ message: 'Gain has been generated !', result: gainResult });
} else {
return res.status(401).send({ message: 'Unauthorized' })
}
}
+11 -16
View File
@@ -23,7 +23,7 @@ export default async function testCode(req: NextApiRequest, res: NextApiResponse
//est-ce que le code tapé par l'utilisateur est valide ?
const isValidCodeCadeau = codeCadeau.match(regex);
if (!isValidCodeCadeau) {
res.status(401).json({ err: 'Ce code est invalide' });
res.status(406).json({ err: 'Ce code est invalide' });
return
}
@@ -32,9 +32,15 @@ export default async function testCode(req: NextApiRequest, res: NextApiResponse
where: { codeCadeau }
})
//si l'API gain n'a pas instancié une date pour ce gain
if (!codeCadeauInfo.dateAchat) {
res.status(406).json({ err: 'Ce code est invalide' });
return;
}
//check si le code a déja été utilisé
if (!codeCadeauInfo.codeActif) {
res.status(401).json({ err: 'Ce code a déja été utilisé' });
res.status(406).json({ err: 'Ce code a déja été utilisé' });
return;
}
@@ -45,27 +51,16 @@ export default async function testCode(req: NextApiRequest, res: NextApiResponse
})
//ajout du gain au profil de l'utilisateur
const joinGain = await prisma.gain.update({
await prisma.gain.update({
where: { codeCadeau: codeCadeauInfo.codeCadeau },
data: {
userId: getCurrentUser[0].id
}
})
//retire un ticket du total de ticket restant
const ticketUpdate = await prisma.ticketsRestants.update({
where: {
id: 1
},
data: {
total: {
decrement: 1
}
}
})
//passage du code en non-actif
const codeUpdate = await prisma.gain.update({
await prisma.gain.update({
where: {
id: codeCadeauInfo.id
},
@@ -80,7 +75,7 @@ export default async function testCode(req: NextApiRequest, res: NextApiResponse
id: codeCadeauInfo.produitId
}
})
return res.status(200).send({ success: 'Vous avez gagner un gain !', winProduct });
return res.status(200).send({ success: 'Vous avez gagné un gain !', winProduct });
}
+49
View File
@@ -0,0 +1,49 @@
import prisma from '../../../lib/prisma';
import { NextApiRequest, NextApiResponse } from 'next';
import { getSession } from 'next-auth/react';
export default async function updateOrCreate(req: NextApiRequest, res: NextApiResponse) {
const session = await getSession({ req })
const { targetUserMail } = req.body;
// est-ce la méthode est un POST ou PUT?
if (!(['POST'].indexOf(req.method) > -1)) {
throw new Error(
`The HTTP ${req.method} method is not supported at this route.`
);
}
// est-ce que utilisateur est connecté ?
if (!session) {
res.status(401).json({ err: "Vous devez être connecté" });
return;
}
//récupération des informations de l'utilisateur connecté
const user = await prisma.user.findFirst({
where: { email: targetUserMail },
})
res.status(200).send({ message: 'user :', res: user });
}
+1 -1
View File
@@ -51,7 +51,7 @@ export default async function updtateGift(req: NextApiRequest, res: NextApiRespo
include: { gains: true }
})
return res.status(200).send({ message: `Le gain a ont été mis à jour !`, res: updatedCurrentUser });
return res.status(200).send({ message: `Le gain a été mis à jour !`, res: updatedCurrentUser });
}
+18 -1
View File
@@ -1,5 +1,6 @@
import React from "react";
import Head from "next/head";
import Script from "next/script";
const Cgu = () => {
return (
@@ -14,7 +15,23 @@ const Cgu = () => {
<meta name="msnbot" content="index, follow" />
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossOrigin="" />
</Head>
</Head>
<Script async src="https://www.googletagmanager.com/gtag/js?id=G-QNZD85D13X"></Script>
<Script>
{`
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-QNZD85D13X');
`}
</Script>
<Script>{`(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-MMHM9HX');`}</Script>
<div className="container py-2 py-md-3">
<h1 className="text-center py-2 py-md-3">Conditions générales d’utilisation du site et des services proposés.</h1>
<p>
+18 -1
View File
@@ -6,6 +6,7 @@ import { AiOutlineGoogle } from 'react-icons/ai'
import style from '../styles/Connexion.module.css';
import { SiGnuprivacyguard } from 'react-icons/si'
import { toast } from "react-toastify";
import Script from "next/script";
type LoginSubmitForm = {
email: string,
@@ -62,7 +63,23 @@ const Connexion = () => {
<title>Connexion</title>
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossOrigin="" />
</Head>
</Head>
<Script async src="https://www.googletagmanager.com/gtag/js?id=G-QNZD85D13X"></Script>
<Script>
{`
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-QNZD85D13X');
`}
</Script>
<Script>{`(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-MMHM9HX');`}</Script>
<div className={`${style['masthead']} d-flex justify-content-center align-items-center text-center`}>
<div className="container align-items-center d-flex flex-column">
<div className={`${style['bloc-content']} col-12 col-md-6`}>
+4 -4
View File
@@ -32,11 +32,11 @@ const Contact = () => {
<h2 className="text-center">Nos coordonées</h2>
<hr />
<div className="px-2">
<h3>Par téléphone</h3>
<a href="tel:0165389423">01.65.38.94.23</a>
<h2>Par téléphone</h2>
<h2 className="mt-3">Par mail</h2>
<h3 className="mt-3">Par mail</h3>
<a href="mailto:contact@thetiptop.com">contact@thetiptop.com</a>
<h2 className="mt-3">Sur nos réseaux</h2>
<h3 className="mt-3">Sur nos réseaux</h3>
<Link href={'https://www.instagram.com/the_tip_top_acem/?hl=fr'}><div>Instagram</div></Link>
<Link href={'https://www.facebook.com/profile.php?id=100088390638593'}><div>Facebook</div></Link>
</div>
@@ -46,7 +46,7 @@ const Contact = () => {
<div className="col">
<h2 className="text-center">Notre siège</h2>
<hr />
<iframe width="200" height="200" id="gmap_canvas" src="https://maps.google.com/maps?q=18%20rue%20L%C3%A9on%20Frot,%2075%20011%20Paris&t=&z=17&ie=UTF8&iwloc=&output=embed" frameBorder="0" scrolling="no" marginHeight={0} marginWidth={0}>
<iframe width="250" height="250" id="gmap_canvas" src="https://maps.google.com/maps?q=18%20rue%20L%C3%A9on%20Frot,%2075%20011%20Paris&t=&z=17&ie=UTF8&iwloc=&output=embed" frameBorder="0" scrolling="no" marginHeight={0} marginWidth={0}>
</iframe>
</div>
+26 -18
View File
@@ -15,6 +15,7 @@ import { toast } from "react-toastify";
import arrowUp from '../public/images/png/arrowup.png'
import footerGrass from '../public/images/footer_image.webp'
import Link from "next/link";
import Script from "next/script";
type CodeSubmitForm = {
codeCadeau: string;
@@ -44,14 +45,6 @@ const Index = () => {
} = useForm<CodeSubmitForm>();
const onSubmit = async (data: CodeSubmitForm) => {
if (!errors) {
if (!session) {
return <Layout>
<p>Vous devez vous connecter pour tester votre code cadeau!</p>
</Layout>
}
}
try {
const body = { codeCadeau: data.codeCadeau };
await fetch(`/api/testcode`, {
@@ -82,7 +75,7 @@ const Index = () => {
} catch (error) {
console.error('ERROR :', error);
}
};
}
const confettiTime = async (): Promise<void> => {
const JSConfetti = (await import('js-confetti')).default
@@ -106,6 +99,21 @@ const Index = () => {
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossOrigin="" />
</Head>
<Script async src="https://www.googletagmanager.com/gtag/js?id=G-QNZD85D13X"></Script>
<Script>
{`
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-QNZD85D13X');
`}
</Script>
<Script>{`(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-MMHM9HX');`}</Script>
<div className={`${style['masthead']} body-content`}>
<div className="d-flex flex-wrap justify-content-center align-items-center text-center">
@@ -117,14 +125,14 @@ const Index = () => {
className={`${style['rotatingSlow']}`}
/>
</div>
<div className={`${style['jeuConcours']} ${style['imageContainer']}`}>
<Link href="/tout-savoir" legacyBehavior><a>
<Image
src={jeuConcours}
alt="thetiptop jeu Concours"
layout="responsive"
className={`${style['zoomInOutCadeau']}`}
/>
<div className={`${style['jeuConcours']} ${style['imageContainer']} ${style['zoomInOutCadeauContainer']}`}>
<Link href="/tout-savoir" legacyBehavior><a>
<Image
src={jeuConcours}
alt="thetiptop jeu concours, tout savoir"
layout="responsive"
className={`${style['zoomInOutCadeau']}`}
/>
</a></Link>
</div>
<div className={`${style['cadeau']} ${style['imageContainer']}`}>
@@ -149,7 +157,7 @@ const Index = () => {
<div className={`${style['imageWrapper']}`}>
<Image
src={testerCodeCadeau}
alt="thetiptop navigation logo"
alt="Tester le code cadeau"
layout="responsive"
className={`${style['rotatingImage']}`}
/>
+16
View File
@@ -1,6 +1,7 @@
import React from "react";
import Head from "next/head";
import style from "styled-jsx/style";
import Script from "next/script";
const MentionsLegales = () => {
return (
@@ -16,6 +17,21 @@ const MentionsLegales = () => {
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossOrigin="" />
</Head>
<Script async src="https://www.googletagmanager.com/gtag/js?id=G-QNZD85D13X"></Script>
<Script>
{`
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-QNZD85D13X');
`}
</Script>
<Script>{`(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-MMHM9HX');`}</Script>
<div className={`${style['navbar']}`}>
<div className="container py-2 py-md-3">
<h1 className="text-center py-2 py-md-3">Mentions légales</h1>
+6 -6
View File
@@ -167,41 +167,41 @@ const MonCompte = (props: Props) => {
<hr />
<form onSubmit={handleSubmit(onSubmit)}>
<div className="form-group">
<div className="form-group row">
<div className="form-group row my-1">
<label htmlFor="staticEmail" className="col-sm-3 col-form-label">Email :</label>
<div className="col-sm-9">
<input type="text" readOnly className="form-control-plaintext text-sm-center" id="staticEmail" value={session?.user.email || ''} />
</div>
</div>
<div className="form-group row">
<div className="form-group row my-1">
<label htmlFor="inputName" className="col-sm-3 col-form-label">Nom :</label>
<div className="col-sm-9">
<input {...register("name")} className={`form-control ${errors.name ? 'is-invalid' : ''}`} defaultValue={props.user?.name || ''} id="inputName" placeholder="John..." />
<div className="invalid-feedback alert alert-danger mt-2">{errors.name?.message}</div>
</div>
</div>
<div className="form-group row">
<div className="form-group row my-1">
<label htmlFor="surname" className="col-sm-3 col-form-label">Prenom :</label>
<div className="col-sm-9">
<input {...register("surname")} className={`form-control ${errors.surname ? 'is-invalid' : ''}`} defaultValue={props.user.surname || ''} id="surname" placeholder="Doe..." />
<div className="invalid-feedback alert alert-danger mt-2">{errors.surname?.message}</div>
</div>
</div>
<div className="form-group row">
<div className="form-group row my-1">
<label htmlFor="address" className="col-sm-3 col-form-label">Adresse :</label>
<div className="col-sm-9">
<input {...register("address")} className={`form-control ${errors.address ? 'is-invalid' : ''}`} defaultValue={props.user.address} id="address" placeholder="1 rue de la paix..." />
<div className="invalid-feedback alert alert-danger mt-2">{errors.address?.message}</div>
</div>
</div>
<div className="form-group row">
<div className="form-group row my-1">
<label htmlFor="zipCode" className="col-sm-3 col-form-label">Code postale :</label>
<div className="col-sm-9">
<input {...register("zipCode")} className={`form-control ${errors.zipCode ? 'is-invalid' : ''}`} defaultValue={props.user.zipCode} id="zipCode" placeholder="95000..." />
<div className="invalid-feedback alert alert-danger mt-2">{errors.zipCode?.message}</div>
</div>
</div>
<div className="form-group row">
<div className="form-group row my-1">
<label htmlFor="phoneNumber" className="col-sm-3 col-form-label">Téléphone :</label>
<div className="col-sm-9">
<input {...register("phoneNumber")} className={`form-control ${errors.phoneNumber ? 'is-invalid' : ''}`} defaultValue={props.user.phoneNumber} id="phoneNumber" placeholder="0123456789..." />
+17 -1
View File
@@ -5,6 +5,7 @@ import style from '../styles/ToutSavoir.module.css'
import test from '../public/images/tea-with-three-jars.webp';
import prisma from "../lib/prisma";
import Link from "next/link";
import Script from "next/script";
export async function getStaticProps() {
@@ -43,7 +44,22 @@ const ToutSavoir = ({ produits }: Props) => {
<meta name="msnbot" content="index, follow" />
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossOrigin="" />
</Head>
</Head>
<Script async src="https://www.googletagmanager.com/gtag/js?id=G-QNZD85D13X"></Script>
<Script>
{`
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-QNZD85D13X');
`}
</Script>
<Script>{`(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-MMHM9HX');`}</Script>
<div className="body-content">
+1 -5
View File
@@ -60,14 +60,10 @@ model User {
@@map(name: "users")
}
model TicketsRestants {
id Int @id @default(autoincrement())
total Int
}
model Gain {
id Int @id @default(autoincrement())
codeCadeau String @unique
dateAchat DateTime?
dateRetrait DateTime?
produit Produit? @relation(fields: [produitId], references: [id])
produitId Int?
-14
View File
@@ -1,7 +1,6 @@
import { PrismaClient } from '@prisma/client';
// import prisma from '../lib/prisma'
import { generateGains } from './seed/gains'
import { produitsData } from './seed/produits'
import { userData } from './seed/user'
@@ -10,14 +9,6 @@ const prisma = new PrismaClient();
async function main() {
console.log(`Start seeding ...`)
//création des tickets restants
const tickets = await prisma.ticketsRestants.create({
data: {
total: 1500000
},
})
console.log(`Created ticket: ${tickets.total}`)
//création des produits
for (const p of produitsData) {
@@ -37,11 +28,6 @@ async function main() {
console.log(`Created user with id: ${user.id}`)
}
//création de gains
for (let i = 1; i <= (50); i++) {
await generateGains();
}
console.log(`Seeding finished.`)
}
-52
View File
@@ -1,52 +0,0 @@
// import { produits } from './produits';
import prisma from '../../lib/prisma'
import { Chance } from 'chance'
import { Cadeaux } from '../../enum/cadeaux.enum';
import cryptoRandomString from 'crypto-random-string';
let chance = new Chance();
export const generateGains = async () => {
//génération d'un code cadeau
const randomNoGain = cryptoRandomString({ length: 10, type: 'distinguishable' });
//création d'un gain
const gainCreated = await prisma.gain.create({
data: {
codeCadeau: randomNoGain,
codeActif: true,
retrait: false
}
})
//crétion d'un id de produit de façon pondérée
let weightedRandomGain = chance.weighted([
Cadeaux.GrandCoffretDecouverte,
Cadeaux.CoffretDecouverte,
Cadeaux.TheSignature,
Cadeaux.TheDetox,
Cadeaux.Infuseur],
[4, 6, 10, 20, 60]);
//mise à jour du gain avec l'id de produit pondéré
const gainUpdated = await prisma.gain.update({
where: { id: gainCreated.id },
data: {
produitId: weightedRandomGain,
}
})
//on retire 1 ticket
await prisma.ticketsRestants.update({
where: {
id: 1
},
data: {
total: {
decrement: 1
}
}
})
console.log(`Created gain ! : ${gainUpdated.codeCadeau}`)
}
+56 -1
View File
@@ -11,7 +11,7 @@ export const userData: Prisma.UserCreateInput[] = [
name: 'John',
email: 'john@prisma.io',
createdAt: new Date(),
role: 'SELLER'
role: 'USER'
},
{
name: 'Mosse',
@@ -19,4 +19,59 @@ export const userData: Prisma.UserCreateInput[] = [
createdAt: new Date(),
role: 'USER'
},
{
name: 'doug',
email: 'doug@prisma.io',
createdAt: new Date(),
role: 'USER'
},
{
name: 'molda',
email: 'molda@prisma.io',
createdAt: new Date(),
role: 'USER'
},
{
name: 'pierro',
email: 'pierro@prisma.io',
createdAt: new Date(),
role: 'USER'
},
{
name: 'brian',
email: 'brian@prisma.io',
createdAt: new Date(),
role: 'USER'
},
{
name: 'benji',
email: 'benji@prisma.io',
createdAt: new Date(),
role: 'USER'
},
{
name: 'abdel',
email: 'abdel@prisma.io',
createdAt: new Date(),
role: 'USER'
},
{
name: 'guillaume',
email: 'guillaume@prisma.io',
createdAt: new Date(),
role: 'USER'
},
{
name: 'roger',
email: 'roger@prisma.io',
createdAt: new Date(),
role: 'USER'
},
{
name: 'jacko',
email: 'jacko@prisma.io',
createdAt: new Date(),
role: 'USER'
},
]
+11
View File
@@ -0,0 +1,11 @@
# *
User-agent: *
Allow: /*
Disallow: /admin
Disallow: /mon-compte
# Host
Host: https://dandan.re
# Sitemaps
Sitemap: https://dandan.re/sitemap.xml
+13
View File
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:news="http://www.google.com/schemas/sitemap-news/0.9" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:mobile="http://www.google.com/schemas/sitemap-mobile/1.0" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1" xmlns:video="http://www.google.com/schemas/sitemap-video/1.1">
<url><loc>https://dandan.re</loc><lastmod>2022-12-15T20:38:21.840Z</lastmod><changefreq>daily</changefreq><priority>0.7</priority></url>
<url><loc>https://dandan.re/admin</loc><lastmod>2022-12-15T20:38:21.840Z</lastmod><changefreq>daily</changefreq><priority>0.7</priority></url>
<url><loc>https://dandan.re/auth-error</loc><lastmod>2022-12-15T20:38:21.840Z</lastmod><changefreq>daily</changefreq><priority>0.7</priority></url>
<url><loc>https://dandan.re/cgu</loc><lastmod>2022-12-15T20:38:21.840Z</lastmod><changefreq>daily</changefreq><priority>0.7</priority></url>
<url><loc>https://dandan.re/connexion</loc><lastmod>2022-12-15T20:38:21.840Z</lastmod><changefreq>daily</changefreq><priority>0.7</priority></url>
<url><loc>https://dandan.re/contact</loc><lastmod>2022-12-15T20:38:21.840Z</lastmod><changefreq>daily</changefreq><priority>0.7</priority></url>
<url><loc>https://dandan.re/mentions-legales</loc><lastmod>2022-12-15T20:38:21.840Z</lastmod><changefreq>daily</changefreq><priority>0.7</priority></url>
<url><loc>https://dandan.re/mon-compte</loc><lastmod>2022-12-15T20:38:21.840Z</lastmod><changefreq>daily</changefreq><priority>0.7</priority></url>
<url><loc>https://dandan.re/tout-savoir</loc><lastmod>2022-12-15T20:38:21.840Z</lastmod><changefreq>daily</changefreq><priority>0.7</priority></url>
<url><loc>https://dandan.re/verify-request</loc><lastmod>2022-12-15T20:38:21.840Z</lastmod><changefreq>daily</changefreq><priority>0.7</priority></url>
</urlset>
+4
View File
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<sitemap><loc>https://dandan.re/sitemap-0.xml</loc></sitemap>
</sitemapindex>
+6 -17
View File
@@ -1,29 +1,18 @@
#!/usr/bin/env sh
echo 'The following "npm" command builds your Node.js/React application for'
echo 'production in the local "build" directory (i.e. within the'
echo '"/var/jenkins_home/workspace/simple-node-js-react-app" directory),'
echo 'correctly bundles React in production mode and optimizes the build for'
echo 'the best performance.'
set -x
npm run build
set +x
echo 'The following "npm" command runs your Node.js/React application in'
echo 'development mode and makes the application available for web browsing.'
echo 'The "npm start" command has a trailing ampersand so that the command runs'
echo 'as a background process (i.e. asynchronously). Otherwise, this command'
echo 'can pause running builds of CI/CD applications indefinitely. "npm start"'
echo 'is followed by another command that retrieves the process ID (PID) value'
echo 'of the previously run process (i.e. "npm start") and writes this value to'
echo 'the file ".pidfile".'
set -x
npm start &
sleep 1
echo $! > .pidfile
set +x
echo 'Now...'
echo 'Visit http://localhost:3000 to see your Node.js/React application in action.'
echo '(This is why you specified the "args ''-p 3000:3000''" parameter when you'
echo 'created your initial Pipeline as a Jenkinsfile.)'
echo 'Maintenant...'
echo 'Visiter https://devops.dandan.re/ '
echo 'L_application tourne sur le docker jenkins sur via le port 3000 voici un ip a'
ip a
echo 'Pour fermer l_application a appuyer sur le bouton proced'
+4 -1
View File
@@ -16,7 +16,7 @@
background-repeat: no-repeat;
background-size: contain;
/* animation: zoomInOut 4s ease-in-out infinite; */
z-index: 9000;
z-index: 8999;
}
@media (min-width: 992px) {
.bloc-content {
@@ -173,6 +173,9 @@
width: 20vw;
}
.imageContainer.zoomInOutCadeauContainer{
z-index:9000;
}
.feuilleGauche,
.feuilleDroite,