Compare commits
35 Commits
main
...
feature/sc
@ -0,0 +1,20 @@
|
||||
services:
|
||||
|
||||
sonarqube-server:
|
||||
image: sonarqube:lts-community
|
||||
hostname: sonarqube
|
||||
container_name: sonarqube
|
||||
environment:
|
||||
SONAR_JDBC_URL: jdbc:postgresql://192.168.1.33:5433/sonar
|
||||
SONAR_JDBC_USERNAME: sonar
|
||||
SONAR_JDBC_PASSWORD: sonarpwd
|
||||
SONAR_SEARCH_JAVAADDITIONALOPTS: "-Dbootstrap.system_call_filter=false"
|
||||
volumes:
|
||||
- ./extensions:/opt/sonarqube/extensions
|
||||
- ./logs:/opt/sonarqube/logs
|
||||
ports:
|
||||
- "9000:9000"
|
||||
|
||||
networks:
|
||||
soanrqube-networks:
|
||||
driver: bridge
|
||||
@ -0,0 +1,21 @@
|
||||
services:
|
||||
|
||||
sonarqube-server:
|
||||
image: sonarqube:lts-community
|
||||
hostname: sonarqube
|
||||
container_name: sonarqube
|
||||
environment:
|
||||
SONAR_JDBC_URL: jdbc:postgresql://192.168.1.33:5433/sonar
|
||||
SONAR_JDBC_USERNAME: sonar
|
||||
SONAR_JDBC_PASSWORD: sonarpwd
|
||||
SONAR_SEARCH_JAVAADDITIONALOPTS: "-Dbootstrap.system_call_filter=false"
|
||||
volumes:
|
||||
- ./data:/opt/sonarqube/data
|
||||
- ./extensions:/opt/sonarqube/extensions
|
||||
- ./logs:/opt/sonarqube/logs
|
||||
ports:
|
||||
- "9000:9000"
|
||||
|
||||
networks:
|
||||
soanrqube-networks:
|
||||
driver: bridge
|
||||
@ -0,0 +1,23 @@
|
||||
services:
|
||||
|
||||
sonarqube-server:
|
||||
image: docker.io/bitnami/sonarqube:9
|
||||
hostname: sonarqube
|
||||
container_name: sonarqube
|
||||
environment:
|
||||
SONARQUBE_DATABASE_HOST: 192.168.1.33
|
||||
SONARQUBE_DATABASE_PORT_NUMBER: 5433
|
||||
SONARQUBE_DATABASE_USER: sonar
|
||||
SONARQUBE_DATABASE_NAME: sonar
|
||||
SONARQUBE_DATABASE_PASSWORD: sonarpwd
|
||||
SONAR_SEARCH_JAVAADDITIONALOPTS: "-Dbootstrap.system_call_filter=false"
|
||||
volumes:
|
||||
- ./data:/bitnami/sonarqube/data
|
||||
- ./extensions:/bitnami/sonarqube/extensions
|
||||
- ./logsé:/bitnami/sonarqube/logs
|
||||
ports:
|
||||
- "9000:9000"
|
||||
|
||||
networks:
|
||||
soanrqube-networks:
|
||||
driver: bridge
|
||||
@ -0,0 +1,45 @@
|
||||
services:
|
||||
|
||||
teamcity-server:
|
||||
image: jetbrains/teamcity-server
|
||||
container_name: teamcity-server-instance
|
||||
user: root
|
||||
ports:
|
||||
- 8111:8111
|
||||
networks:
|
||||
- teamcity-networks
|
||||
volumes:
|
||||
- ./server/datadir:/data/teamcity_server/datadir
|
||||
- ./server/logs:/opt/teamcity/logs
|
||||
|
||||
teamcity-agent-1:
|
||||
image: jacobpeddk/teamcity-agent-nodejs
|
||||
container_name: teamcity-agent-nodejs1
|
||||
user: root
|
||||
privileged: true
|
||||
networks:
|
||||
- teamcity-networks
|
||||
volumes:
|
||||
- ./agents/agent-1/conf:/data/teamcity_agent/conf
|
||||
- /var/run/docker.sock:/var/run/docker.sock
|
||||
environment:
|
||||
- SERVER_URL=http://teamcity-server:8111
|
||||
- DOCKER_IN_DOCKER=start
|
||||
|
||||
teamcity-agent-2:
|
||||
image: jacobpeddk/teamcity-agent-nodejs
|
||||
container_name: teamcity-agent-nodejs2
|
||||
user: root
|
||||
privileged: true
|
||||
networks:
|
||||
- teamcity-networks
|
||||
volumes:
|
||||
- ./agents/agent-2/conf:/data/teamcity_agent/conf
|
||||
- /var/run/docker.sock:/var/run/docker.sock
|
||||
environment:
|
||||
- SERVER_URL=http://teamcity-server:8111
|
||||
- DOCKER_IN_DOCKER=start
|
||||
|
||||
networks:
|
||||
teamcity-networks:
|
||||
driver: bridge
|
||||
@ -0,0 +1,9 @@
|
||||
#!/bin/sh
|
||||
|
||||
apt install wget
|
||||
wget https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-4.8.0.2856-linux.zip
|
||||
unzip sonar-scanner-cli-4.8.0.2856-linux.zip
|
||||
ls -la
|
||||
mv ./sonar-scanner-4.8.0.2856-linux ./sonarscanner
|
||||
cd apps
|
||||
../sonarscanner/bin/sonar-scanner -X -Dsonar.login=b6b66f8b798b46b693cc19f788215111871d5287
|
||||
@ -1,11 +0,0 @@
|
||||
/* eslint-disable */
|
||||
export default {
|
||||
displayName: 'client',
|
||||
preset: '../../jest.preset.js',
|
||||
transform: {
|
||||
'^(?!.*\\.(js|jsx|ts|tsx|css|json)$)': '@nrwl/react/plugins/jest',
|
||||
'^.+\\.[tj]sx?$': ['babel-jest', { presets: ['@nrwl/next/babel'] }],
|
||||
},
|
||||
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'],
|
||||
coverageDirectory: '../../coverage/apps/client',
|
||||
};
|
||||
@ -1,18 +0,0 @@
|
||||
import { AppProps } from 'next/app';
|
||||
import Head from 'next/head';
|
||||
import './styles.css';
|
||||
|
||||
function CustomApp({ Component, pageProps }: AppProps) {
|
||||
return (
|
||||
<>
|
||||
<Head>
|
||||
<title>Welcome to client!</title>
|
||||
</Head>
|
||||
<main className="app">
|
||||
<Component {...pageProps} />
|
||||
</main>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
export default CustomApp;
|
||||
@ -1,2 +0,0 @@
|
||||
.page {
|
||||
}
|
||||
@ -1,415 +0,0 @@
|
||||
import styles from './index.module.scss';
|
||||
|
||||
export function Index() {
|
||||
/*
|
||||
* Replace the elements below with your own.
|
||||
*
|
||||
* Note: The corresponding styles are in the ./index.scss file.
|
||||
*/
|
||||
return (
|
||||
<div className={styles.page}>
|
||||
<div className="wrapper">
|
||||
<div className="container">
|
||||
<div id="welcome">
|
||||
<h1>
|
||||
<span> Hello there, </span>
|
||||
Welcome client 👋
|
||||
</h1>
|
||||
</div>
|
||||
|
||||
<div id="hero" className="rounded">
|
||||
<div className="text-container">
|
||||
<h2>
|
||||
<svg
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
viewBox="0 0 24 24"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
>
|
||||
<path
|
||||
strokeLinecap="round"
|
||||
strokeLinejoin="round"
|
||||
strokeWidth="2"
|
||||
d="M9 12l2 2 4-4M7.835 4.697a3.42 3.42 0 001.946-.806 3.42 3.42 0 014.438 0 3.42 3.42 0 001.946.806 3.42 3.42 0 013.138 3.138 3.42 3.42 0 00.806 1.946 3.42 3.42 0 010 4.438 3.42 3.42 0 00-.806 1.946 3.42 3.42 0 01-3.138 3.138 3.42 3.42 0 00-1.946.806 3.42 3.42 0 01-4.438 0 3.42 3.42 0 00-1.946-.806 3.42 3.42 0 01-3.138-3.138 3.42 3.42 0 00-.806-1.946 3.42 3.42 0 010-4.438 3.42 3.42 0 00.806-1.946 3.42 3.42 0 013.138-3.138z"
|
||||
/>
|
||||
</svg>
|
||||
<span>You're up and running</span>
|
||||
</h2>
|
||||
<a href="#commands"> What's next? </a>
|
||||
</div>
|
||||
<div className="logo-container">
|
||||
<svg
|
||||
fill="currentColor"
|
||||
role="img"
|
||||
viewBox="0 0 24 24"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
>
|
||||
<path d="M11.987 14.138l-3.132 4.923-5.193-8.427-.012 8.822H0V4.544h3.691l5.247 8.833.005-3.998 3.044 4.759zm.601-5.761c.024-.048 0-3.784.008-3.833h-3.65c.002.059-.005 3.776-.003 3.833h3.645zm5.634 4.134a2.061 2.061 0 0 0-1.969 1.336 1.963 1.963 0 0 1 2.343-.739c.396.161.917.422 1.33.283a2.1 2.1 0 0 0-1.704-.88zm3.39 1.061c-.375-.13-.8-.277-1.109-.681-.06-.08-.116-.17-.176-.265a2.143 2.143 0 0 0-.533-.642c-.294-.216-.68-.322-1.18-.322a2.482 2.482 0 0 0-2.294 1.536 2.325 2.325 0 0 1 4.002.388.75.75 0 0 0 .836.334c.493-.105.46.36 1.203.518v-.133c-.003-.446-.246-.55-.75-.733zm2.024 1.266a.723.723 0 0 0 .347-.638c-.01-2.957-2.41-5.487-5.37-5.487a5.364 5.364 0 0 0-4.487 2.418c-.01-.026-1.522-2.39-1.538-2.418H8.943l3.463 5.423-3.379 5.32h3.54l1.54-2.366 1.568 2.366h3.541l-3.21-5.052a.7.7 0 0 1-.084-.32 2.69 2.69 0 0 1 2.69-2.691h.001c1.488 0 1.736.89 2.057 1.308.634.826 1.9.464 1.9 1.541a.707.707 0 0 0 1.066.596zm.35.133c-.173.372-.56.338-.755.639-.176.271.114.412.114.412s.337.156.538-.311c.104-.231.14-.488.103-.74z" />
|
||||
</svg>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="middle-content">
|
||||
<div id="learning-materials" className="rounded shadow">
|
||||
<h2>Learning materials</h2>
|
||||
<a
|
||||
href="https://nx.dev/getting-started/intro?utm_source=nx-project"
|
||||
target="_blank"
|
||||
rel="noreferrer"
|
||||
className="list-item-link"
|
||||
>
|
||||
<svg
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
viewBox="0 0 24 24"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
>
|
||||
<path
|
||||
strokeLinecap="round"
|
||||
strokeLinejoin="round"
|
||||
strokeWidth="2"
|
||||
d="M12 6.253v13m0-13C10.832 5.477 9.246 5 7.5 5S4.168 5.477 3 6.253v13C4.168 18.477 5.754 18 7.5 18s3.332.477 4.5 1.253m0-13C13.168 5.477 14.754 5 16.5 5c1.747 0 3.332.477 4.5 1.253v13C19.832 18.477 18.247 18 16.5 18c-1.746 0-3.332.477-4.5 1.253"
|
||||
/>
|
||||
</svg>
|
||||
<span>
|
||||
Documentation
|
||||
<span> Everything is in there </span>
|
||||
</span>
|
||||
<svg
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
viewBox="0 0 24 24"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
>
|
||||
<path
|
||||
strokeLinecap="round"
|
||||
strokeLinejoin="round"
|
||||
strokeWidth="2"
|
||||
d="M9 5l7 7-7 7"
|
||||
/>
|
||||
</svg>
|
||||
</a>
|
||||
<a
|
||||
href="https://blog.nrwl.io/?utm_source=nx-project"
|
||||
target="_blank"
|
||||
rel="noreferrer"
|
||||
className="list-item-link"
|
||||
>
|
||||
<svg
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
viewBox="0 0 24 24"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
>
|
||||
<path
|
||||
strokeLinecap="round"
|
||||
strokeLinejoin="round"
|
||||
strokeWidth="2"
|
||||
d="M19 20H5a2 2 0 01-2-2V6a2 2 0 012-2h10a2 2 0 012 2v1m2 13a2 2 0 01-2-2V7m2 13a2 2 0 002-2V9a2 2 0 00-2-2h-2m-4-3H9M7 16h6M7 8h6v4H7V8z"
|
||||
/>
|
||||
</svg>
|
||||
<span>
|
||||
Blog
|
||||
<span> Changelog, features & events </span>
|
||||
</span>
|
||||
<svg
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
viewBox="0 0 24 24"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
>
|
||||
<path
|
||||
strokeLinecap="round"
|
||||
strokeLinejoin="round"
|
||||
strokeWidth="2"
|
||||
d="M9 5l7 7-7 7"
|
||||
/>
|
||||
</svg>
|
||||
</a>
|
||||
<a
|
||||
href="https://www.youtube.com/c/Nrwl_io/videos?utm_source=nx-project&sub_confirmation=1"
|
||||
target="_blank"
|
||||
rel="noreferrer"
|
||||
className="list-item-link"
|
||||
>
|
||||
<svg
|
||||
role="img"
|
||||
viewBox="0 0 24 24"
|
||||
fill="currentColor"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
>
|
||||
<title>YouTube</title>
|
||||
<path d="M23.498 6.186a3.016 3.016 0 0 0-2.122-2.136C19.505 3.545 12 3.545 12 3.545s-7.505 0-9.377.505A3.017 3.017 0 0 0 .502 6.186C0 8.07 0 12 0 12s0 3.93.502 5.814a3.016 3.016 0 0 0 2.122 2.136c1.871.505 9.376.505 9.376.505s7.505 0 9.377-.505a3.015 3.015 0 0 0 2.122-2.136C24 15.93 24 12 24 12s0-3.93-.502-5.814zM9.545 15.568V8.432L15.818 12l-6.273 3.568z" />
|
||||
</svg>
|
||||
<span>
|
||||
YouTube channel
|
||||
<span> Nx Show, talks & tutorials </span>
|
||||
</span>
|
||||
<svg
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
viewBox="0 0 24 24"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
>
|
||||
<path
|
||||
strokeLinecap="round"
|
||||
strokeLinejoin="round"
|
||||
strokeWidth="2"
|
||||
d="M9 5l7 7-7 7"
|
||||
/>
|
||||
</svg>
|
||||
</a>
|
||||
<a
|
||||
href="https://nx.dev/react-tutorial/1-code-generation?utm_source=nx-project"
|
||||
target="_blank"
|
||||
rel="noreferrer"
|
||||
className="list-item-link"
|
||||
>
|
||||
<svg
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
viewBox="0 0 24 24"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
>
|
||||
<path
|
||||
strokeLinecap="round"
|
||||
strokeLinejoin="round"
|
||||
strokeWidth="2"
|
||||
d="M15 15l-2 5L9 9l11 4-5 2zm0 0l5 5M7.188 2.239l.777 2.897M5.136 7.965l-2.898-.777M13.95 4.05l-2.122 2.122m-5.657 5.656l-2.12 2.122"
|
||||
/>
|
||||
</svg>
|
||||
<span>
|
||||
Interactive tutorials
|
||||
<span> Create an app, step-by-step </span>
|
||||
</span>
|
||||
<svg
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
viewBox="0 0 24 24"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
>
|
||||
<path
|
||||
strokeLinecap="round"
|
||||
strokeLinejoin="round"
|
||||
strokeWidth="2"
|
||||
d="M9 5l7 7-7 7"
|
||||
/>
|
||||
</svg>
|
||||
</a>
|
||||
<a
|
||||
href="https://nxplaybook.com/?utm_source=nx-project"
|
||||
target="_blank"
|
||||
rel="noreferrer"
|
||||
className="list-item-link"
|
||||
>
|
||||
<svg
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
viewBox="0 0 24 24"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
>
|
||||
<path d="M12 14l9-5-9-5-9 5 9 5z" />
|
||||
<path d="M12 14l6.16-3.422a12.083 12.083 0 01.665 6.479A11.952 11.952 0 0012 20.055a11.952 11.952 0 00-6.824-2.998 12.078 12.078 0 01.665-6.479L12 14z" />
|
||||
<path
|
||||
strokeLinecap="round"
|
||||
strokeLinejoin="round"
|
||||
strokeWidth="2"
|
||||
d="M12 14l9-5-9-5-9 5 9 5zm0 0l6.16-3.422a12.083 12.083 0 01.665 6.479A11.952 11.952 0 0012 20.055a11.952 11.952 0 00-6.824-2.998 12.078 12.078 0 01.665-6.479L12 14zm-4 6v-7.5l4-2.222"
|
||||
/>
|
||||
</svg>
|
||||
<span>
|
||||
Video courses
|
||||
<span> Nx custom courses </span>
|
||||
</span>
|
||||
<svg
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
viewBox="0 0 24 24"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
>
|
||||
<path
|
||||
strokeLinecap="round"
|
||||
strokeLinejoin="round"
|
||||
strokeWidth="2"
|
||||
d="M9 5l7 7-7 7"
|
||||
/>
|
||||
</svg>
|
||||
</a>
|
||||
</div>
|
||||
<div id="other-links">
|
||||
<a
|
||||
id="nx-console"
|
||||
className="button-pill rounded shadow"
|
||||
href="https://marketplace.visualstudio.com/items?itemName=nrwl.angular-console&utm_source=nx-project"
|
||||
target="_blank"
|
||||
rel="noreferrer"
|
||||
>
|
||||
<svg
|
||||
fill="currentColor"
|
||||
role="img"
|
||||
viewBox="0 0 24 24"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
>
|
||||
<title>Visual Studio Code</title>
|
||||
<path d="M23.15 2.587L18.21.21a1.494 1.494 0 0 0-1.705.29l-9.46 8.63-4.12-3.128a.999.999 0 0 0-1.276.057L.327 7.261A1 1 0 0 0 .326 8.74L3.899 12 .326 15.26a1 1 0 0 0 .001 1.479L1.65 17.94a.999.999 0 0 0 1.276.057l4.12-3.128 9.46 8.63a1.492 1.492 0 0 0 1.704.29l4.942-2.377A1.5 1.5 0 0 0 24 20.06V3.939a1.5 1.5 0 0 0-.85-1.352zm-5.146 14.861L10.826 12l7.178-5.448v10.896z" />
|
||||
</svg>
|
||||
<span>
|
||||
Install Nx Console
|
||||
<span>Plugin for VSCode</span>
|
||||
</span>
|
||||
</a>
|
||||
<div id="nx-cloud" className="rounded shadow">
|
||||
<div>
|
||||
<svg
|
||||
viewBox="0 0 120 120"
|
||||
fill="none"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
>
|
||||
<path
|
||||
d="M120 15V30C103.44 30 90 43.44 90 60C90 76.56 76.56 90 60 90C43.44 90 30 103.44 30 120H15C6.72 120 0 113.28 0 105V15C0 6.72 6.72 0 15 0H105C113.28 0 120 6.72 120 15Z"
|
||||
fill="#0E2039"
|
||||
/>
|
||||
<path
|
||||
d="M120 30V105C120 113.28 113.28 120 105 120H30C30 103.44 43.44 90 60 90C76.56 90 90 76.56 90 60C90 43.44 103.44 30 120 30Z"
|
||||
fill="white"
|
||||
/>
|
||||
</svg>
|
||||
<h2>
|
||||
NxCloud
|
||||
<span>Enable faster CI & better DX</span>
|
||||
</h2>
|
||||
</div>
|
||||
<p>
|
||||
You can activate distributed tasks executions and caching by
|
||||
running:
|
||||
</p>
|
||||
<pre>nx connect-to-nx-cloud</pre>
|
||||
<a
|
||||
href="https://nx.app/?utm_source=nx-project"
|
||||
target="_blank"
|
||||
rel="noreferrer"
|
||||
>
|
||||
{' '}
|
||||
What is Nx Cloud?{' '}
|
||||
</a>
|
||||
</div>
|
||||
<a
|
||||
id="nx-repo"
|
||||
className="button-pill rounded shadow"
|
||||
href="https://github.com/nrwl/nx?utm_source=nx-project"
|
||||
target="_blank"
|
||||
rel="noreferrer"
|
||||
>
|
||||
<svg
|
||||
fill="currentColor"
|
||||
role="img"
|
||||
viewBox="0 0 24 24"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
>
|
||||
<path d="M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12" />
|
||||
</svg>
|
||||
<span>
|
||||
Nx is open source
|
||||
<span> Love Nx? Give us a star! </span>
|
||||
</span>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="commands" className="rounded shadow">
|
||||
<h2>Next steps</h2>
|
||||
<p>Here are some things you can do with Nx:</p>
|
||||
<details>
|
||||
<summary>
|
||||
<svg
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
viewBox="0 0 24 24"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
>
|
||||
<path
|
||||
strokeLinecap="round"
|
||||
strokeLinejoin="round"
|
||||
strokeWidth="2"
|
||||
d="M8 9l3 3-3 3m5 0h3M5 20h14a2 2 0 002-2V6a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z"
|
||||
/>
|
||||
</svg>
|
||||
Add UI library
|
||||
</summary>
|
||||
<pre>
|
||||
<span># Generate UI lib</span>
|
||||
nx g @nrwl/next:library ui
|
||||
<span># Add a component</span>
|
||||
nx g @nrwl/next:component button --project=ui
|
||||
</pre>
|
||||
</details>
|
||||
<details>
|
||||
<summary>
|
||||
<svg
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
viewBox="0 0 24 24"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
>
|
||||
<path
|
||||
strokeLinecap="round"
|
||||
strokeLinejoin="round"
|
||||
strokeWidth="2"
|
||||
d="M8 9l3 3-3 3m5 0h3M5 20h14a2 2 0 002-2V6a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z"
|
||||
/>
|
||||
</svg>
|
||||
View interactive project graph
|
||||
</summary>
|
||||
<pre>nx graph</pre>
|
||||
</details>
|
||||
<details>
|
||||
<summary>
|
||||
<svg
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
viewBox="0 0 24 24"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
>
|
||||
<path
|
||||
strokeLinecap="round"
|
||||
strokeLinejoin="round"
|
||||
strokeWidth="2"
|
||||
d="M8 9l3 3-3 3m5 0h3M5 20h14a2 2 0 002-2V6a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z"
|
||||
/>
|
||||
</svg>
|
||||
Run affected commands
|
||||
</summary>
|
||||
<pre>
|
||||
<span># see what's been affected by changes</span>
|
||||
nx affected:graph
|
||||
<span># run tests for current changes</span>
|
||||
nx affected:test
|
||||
<span># run e2e tests for current changes</span>
|
||||
nx affected:e2e
|
||||
</pre>
|
||||
</details>
|
||||
</div>
|
||||
|
||||
<p id="love">
|
||||
Carefully crafted with
|
||||
<svg
|
||||
fill="currentColor"
|
||||
stroke="none"
|
||||
viewBox="0 0 24 24"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
>
|
||||
<path
|
||||
strokeLinecap="round"
|
||||
strokeLinejoin="round"
|
||||
strokeWidth="2"
|
||||
d="M4.318 6.318a4.5 4.5 0 000 6.364L12 20.364l7.682-7.682a4.5 4.5 0 00-6.364-6.364L12 7.636l-1.318-1.318a4.5 4.5 0 00-6.364 0z"
|
||||
/>
|
||||
</svg>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default Index;
|
||||
@ -1,400 +0,0 @@
|
||||
html {
|
||||
-webkit-text-size-adjust: 100%;
|
||||
font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
|
||||
Segoe UI, Roboto, Helvetica Neue, Arial, Noto Sans, sans-serif,
|
||||
Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol, Noto Color Emoji;
|
||||
line-height: 1.5;
|
||||
tab-size: 4;
|
||||
scroll-behavior: smooth;
|
||||
}
|
||||
body {
|
||||
font-family: inherit;
|
||||
line-height: inherit;
|
||||
margin: 0;
|
||||
}
|
||||
h1,
|
||||
h2,
|
||||
p,
|
||||
pre {
|
||||
margin: 0;
|
||||
}
|
||||
*,
|
||||
::before,
|
||||
::after {
|
||||
box-sizing: border-box;
|
||||
border-width: 0;
|
||||
border-style: solid;
|
||||
border-color: currentColor;
|
||||
}
|
||||
h1,
|
||||
h2 {
|
||||
font-size: inherit;
|
||||
font-weight: inherit;
|
||||
}
|
||||
a {
|
||||
color: inherit;
|
||||
text-decoration: inherit;
|
||||
}
|
||||
pre {
|
||||
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
|
||||
Liberation Mono, Courier New, monospace;
|
||||
}
|
||||
svg {
|
||||
display: block;
|
||||
vertical-align: middle;
|
||||
shape-rendering: auto;
|
||||
text-rendering: optimizeLegibility;
|
||||
}
|
||||
pre {
|
||||
background-color: rgba(55, 65, 81, 1);
|
||||
border-radius: 0.25rem;
|
||||
color: rgba(229, 231, 235, 1);
|
||||
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
|
||||
Liberation Mono, Courier New, monospace;
|
||||
overflow: scroll;
|
||||
padding: 0.5rem 0.75rem;
|
||||
}
|
||||
|
||||
.shadow {
|
||||
box-shadow: 0 0 #0000, 0 0 #0000, 0 10px 15px -3px rgba(0, 0, 0, 0.1),
|
||||
0 4px 6px -2px rgba(0, 0, 0, 0.05);
|
||||
}
|
||||
.rounded {
|
||||
border-radius: 1.5rem;
|
||||
}
|
||||
.wrapper {
|
||||
width: 100%;
|
||||
}
|
||||
.container {
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
max-width: 768px;
|
||||
padding-bottom: 3rem;
|
||||
padding-left: 1rem;
|
||||
padding-right: 1rem;
|
||||
color: rgba(55, 65, 81, 1);
|
||||
width: 100%;
|
||||
}
|
||||
#welcome {
|
||||
margin-top: 2.5rem;
|
||||
}
|
||||
#welcome h1 {
|
||||
font-size: 3rem;
|
||||
font-weight: 500;
|
||||
letter-spacing: -0.025em;
|
||||
line-height: 1;
|
||||
}
|
||||
#welcome span {
|
||||
display: block;
|
||||
font-size: 1.875rem;
|
||||
font-weight: 300;
|
||||
line-height: 2.25rem;
|
||||
margin-bottom: 0.5rem;
|
||||
}
|
||||
#hero {
|
||||
align-items: center;
|
||||
background-color: hsla(214, 62%, 21%, 1);
|
||||
border: none;
|
||||
box-sizing: border-box;
|
||||
color: rgba(55, 65, 81, 1);
|
||||
display: grid;
|
||||
grid-template-columns: 1fr;
|
||||
margin-top: 3.5rem;
|
||||
}
|
||||
#hero .text-container {
|
||||
color: rgba(255, 255, 255, 1);
|
||||
padding: 3rem 2rem;
|
||||
}
|
||||
#hero .text-container h2 {
|
||||
font-size: 1.5rem;
|
||||
line-height: 2rem;
|
||||
position: relative;
|
||||
}
|
||||
#hero .text-container h2 svg {
|
||||
color: hsla(162, 47%, 50%, 1);
|
||||
height: 2rem;
|
||||
left: -0.25rem;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
width: 2rem;
|
||||
}
|
||||
#hero .text-container h2 span {
|
||||
margin-left: 2.5rem;
|
||||
}
|
||||
#hero .text-container a {
|
||||
background-color: rgba(255, 255, 255, 1);
|
||||
border-radius: 0.75rem;
|
||||
color: rgba(55, 65, 81, 1);
|
||||
display: inline-block;
|
||||
margin-top: 1.5rem;
|
||||
padding: 1rem 2rem;
|
||||
text-decoration: inherit;
|
||||
}
|
||||
#hero .logo-container {
|
||||
display: none;
|
||||
justify-content: center;
|
||||
padding-left: 2rem;
|
||||
padding-right: 2rem;
|
||||
}
|
||||
#hero .logo-container svg {
|
||||
color: rgba(255, 255, 255, 1);
|
||||
width: 66.666667%;
|
||||
}
|
||||
#middle-content {
|
||||
align-items: flex-start;
|
||||
display: grid;
|
||||
gap: 4rem;
|
||||
grid-template-columns: 1fr;
|
||||
margin-top: 3.5rem;
|
||||
}
|
||||
#learning-materials {
|
||||
padding: 2.5rem 2rem;
|
||||
}
|
||||
#learning-materials h2 {
|
||||
font-weight: 500;
|
||||
font-size: 1.25rem;
|
||||
letter-spacing: -0.025em;
|
||||
line-height: 1.75rem;
|
||||
padding-left: 1rem;
|
||||
padding-right: 1rem;
|
||||
}
|
||||
.list-item-link {
|
||||
align-items: center;
|
||||
border-radius: 0.75rem;
|
||||
display: flex;
|
||||
margin-top: 1rem;
|
||||
padding: 1rem;
|
||||
transition-property: background-color, border-color, color, fill, stroke,
|
||||
opacity, box-shadow, transform, filter, backdrop-filter,
|
||||
-webkit-backdrop-filter;
|
||||
transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
|
||||
transition-duration: 150ms;
|
||||
width: 100%;
|
||||
}
|
||||
.list-item-link svg:first-child {
|
||||
margin-right: 1rem;
|
||||
height: 1.5rem;
|
||||
transition-property: background-color, border-color, color, fill, stroke,
|
||||
opacity, box-shadow, transform, filter, backdrop-filter,
|
||||
-webkit-backdrop-filter;
|
||||
transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
|
||||
transition-duration: 150ms;
|
||||
width: 1.5rem;
|
||||
}
|
||||
.list-item-link > span {
|
||||
flex-grow: 1;
|
||||
font-weight: 400;
|
||||
transition-property: background-color, border-color, color, fill, stroke,
|
||||
opacity, box-shadow, transform, filter, backdrop-filter,
|
||||
-webkit-backdrop-filter;
|
||||
transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
|
||||
transition-duration: 150ms;
|
||||
}
|
||||
.list-item-link > span > span {
|
||||
color: rgba(107, 114, 128, 1);
|
||||
display: block;
|
||||
flex-grow: 1;
|
||||
font-size: 0.75rem;
|
||||
font-weight: 300;
|
||||
line-height: 1rem;
|
||||
transition-property: background-color, border-color, color, fill, stroke,
|
||||
opacity, box-shadow, transform, filter, backdrop-filter,
|
||||
-webkit-backdrop-filter;
|
||||
transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
|
||||
transition-duration: 150ms;
|
||||
}
|
||||
.list-item-link svg:last-child {
|
||||
height: 1rem;
|
||||
transition-property: all;
|
||||
transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
|
||||
transition-duration: 150ms;
|
||||
width: 1rem;
|
||||
}
|
||||
.list-item-link:hover {
|
||||
color: rgba(255, 255, 255, 1);
|
||||
background-color: hsla(162, 47%, 50%, 1);
|
||||
}
|
||||
.list-item-link:hover > span {
|
||||
}
|
||||
.list-item-link:hover > span > span {
|
||||
color: rgba(243, 244, 246, 1);
|
||||
}
|
||||
.list-item-link:hover svg:last-child {
|
||||
transform: translateX(0.25rem);
|
||||
}
|
||||
#other-links {
|
||||
}
|
||||
.button-pill {
|
||||
padding: 1.5rem 2rem;
|
||||
transition-duration: 300ms;
|
||||
transition-property: background-color, border-color, color, fill, stroke,
|
||||
opacity, box-shadow, transform, filter, backdrop-filter,
|
||||
-webkit-backdrop-filter;
|
||||
transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
|
||||
align-items: center;
|
||||
display: flex;
|
||||
}
|
||||
.button-pill svg {
|
||||
transition-property: background-color, border-color, color, fill, stroke,
|
||||
opacity, box-shadow, transform, filter, backdrop-filter,
|
||||
-webkit-backdrop-filter;
|
||||
transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
|
||||
transition-duration: 150ms;
|
||||
flex-shrink: 0;
|
||||
width: 3rem;
|
||||
}
|
||||
.button-pill > span {
|
||||
letter-spacing: -0.025em;
|
||||
font-weight: 400;
|
||||
font-size: 1.125rem;
|
||||
line-height: 1.75rem;
|
||||
padding-left: 1rem;
|
||||
padding-right: 1rem;
|
||||
}
|
||||
.button-pill span span {
|
||||
display: block;
|
||||
font-size: 0.875rem;
|
||||
font-weight: 300;
|
||||
line-height: 1.25rem;
|
||||
}
|
||||
.button-pill:hover svg,
|
||||
.button-pill:hover {
|
||||
color: rgba(255, 255, 255, 1) !important;
|
||||
}
|
||||
#nx-console:hover {
|
||||
background-color: rgba(0, 122, 204, 1);
|
||||
}
|
||||
#nx-console svg {
|
||||
color: rgba(0, 122, 204, 1);
|
||||
}
|
||||
#nx-repo:hover {
|
||||
background-color: rgba(24, 23, 23, 1);
|
||||
}
|
||||
#nx-repo svg {
|
||||
color: rgba(24, 23, 23, 1);
|
||||
}
|
||||
#nx-cloud {
|
||||
margin-bottom: 2rem;
|
||||
margin-top: 2rem;
|
||||
padding: 2.5rem 2rem;
|
||||
}
|
||||
#nx-cloud > div {
|
||||
align-items: center;
|
||||
display: flex;
|
||||
}
|
||||
#nx-cloud > div svg {
|
||||
border-radius: 0.375rem;
|
||||
flex-shrink: 0;
|
||||
width: 3rem;
|
||||
}
|
||||
#nx-cloud > div h2 {
|
||||
font-size: 1.125rem;
|
||||
font-weight: 400;
|
||||
letter-spacing: -0.025em;
|
||||
line-height: 1.75rem;
|
||||
padding-left: 1rem;
|
||||
padding-right: 1rem;
|
||||
}
|
||||
#nx-cloud > div h2 span {
|
||||
display: block;
|
||||
font-size: 0.875rem;
|
||||
font-weight: 300;
|
||||
line-height: 1.25rem;
|
||||
}
|
||||
#nx-cloud p {
|
||||
font-size: 1rem;
|
||||
line-height: 1.5rem;
|
||||
margin-top: 1rem;
|
||||
}
|
||||
#nx-cloud pre {
|
||||
margin-top: 1rem;
|
||||
}
|
||||
#nx-cloud a {
|
||||
color: rgba(107, 114, 128, 1);
|
||||
display: block;
|
||||
font-size: 0.875rem;
|
||||
line-height: 1.25rem;
|
||||
margin-top: 1.5rem;
|
||||
text-align: right;
|
||||
}
|
||||
#nx-cloud a:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
#commands {
|
||||
padding: 2.5rem 2rem;
|
||||
margin-top: 3.5rem;
|
||||
}
|
||||
#commands h2 {
|
||||
font-size: 1.25rem;
|
||||
font-weight: 400;
|
||||
letter-spacing: -0.025em;
|
||||
line-height: 1.75rem;
|
||||
padding-left: 1rem;
|
||||
padding-right: 1rem;
|
||||
}
|
||||
#commands p {
|
||||
font-size: 1rem;
|
||||
font-weight: 300;
|
||||
line-height: 1.5rem;
|
||||
margin-top: 1rem;
|
||||
padding-left: 1rem;
|
||||
padding-right: 1rem;
|
||||
}
|
||||
details {
|
||||
align-items: center;
|
||||
display: flex;
|
||||
margin-top: 1rem;
|
||||
padding-left: 1rem;
|
||||
padding-right: 1rem;
|
||||
width: 100%;
|
||||
}
|
||||
details pre > span {
|
||||
color: rgba(181, 181, 181, 1);
|
||||
display: block;
|
||||
}
|
||||
summary {
|
||||
border-radius: 0.5rem;
|
||||
display: flex;
|
||||
font-weight: 400;
|
||||
padding: 0.5rem;
|
||||
cursor: pointer;
|
||||
transition-property: background-color, border-color, color, fill, stroke,
|
||||
opacity, box-shadow, transform, filter, backdrop-filter,
|
||||
-webkit-backdrop-filter;
|
||||
transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
|
||||
transition-duration: 150ms;
|
||||
}
|
||||
summary:hover {
|
||||
background-color: rgba(243, 244, 246, 1);
|
||||
}
|
||||
summary svg {
|
||||
height: 1.5rem;
|
||||
margin-right: 1rem;
|
||||
width: 1.5rem;
|
||||
}
|
||||
#love {
|
||||
color: rgba(107, 114, 128, 1);
|
||||
font-size: 0.875rem;
|
||||
line-height: 1.25rem;
|
||||
margin-top: 3.5rem;
|
||||
opacity: 0.6;
|
||||
text-align: center;
|
||||
}
|
||||
#love svg {
|
||||
color: rgba(252, 165, 165, 1);
|
||||
width: 1.25rem;
|
||||
height: 1.25rem;
|
||||
display: inline;
|
||||
margin-top: -0.25rem;
|
||||
}
|
||||
@media screen and (min-width: 768px) {
|
||||
#hero {
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
}
|
||||
#hero .logo-container {
|
||||
display: flex;
|
||||
}
|
||||
#middle-content {
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
}
|
||||
}
|
||||
@ -1,63 +0,0 @@
|
||||
{
|
||||
"name": "client",
|
||||
"$schema": "../../node_modules/nx/schemas/project-schema.json",
|
||||
"sourceRoot": "apps/client",
|
||||
"projectType": "application",
|
||||
"targets": {
|
||||
"build": {
|
||||
"executor": "@nrwl/next:build",
|
||||
"outputs": ["{options.outputPath}"],
|
||||
"defaultConfiguration": "production",
|
||||
"options": {
|
||||
"root": "apps/client",
|
||||
"outputPath": "dist/apps/client"
|
||||
},
|
||||
"configurations": {
|
||||
"development": {
|
||||
"outputPath": "apps/client"
|
||||
},
|
||||
"production": {}
|
||||
}
|
||||
},
|
||||
"serve": {
|
||||
"executor": "@nrwl/next:server",
|
||||
"defaultConfiguration": "development",
|
||||
"options": {
|
||||
"buildTarget": "client:build",
|
||||
"dev": true
|
||||
},
|
||||
"configurations": {
|
||||
"development": {
|
||||
"buildTarget": "client:build:development",
|
||||
"dev": true
|
||||
},
|
||||
"production": {
|
||||
"buildTarget": "client:build:production",
|
||||
"dev": false
|
||||
}
|
||||
}
|
||||
},
|
||||
"export": {
|
||||
"executor": "@nrwl/next:export",
|
||||
"options": {
|
||||
"buildTarget": "client:build:production"
|
||||
}
|
||||
},
|
||||
"test": {
|
||||
"executor": "@nrwl/jest:jest",
|
||||
"outputs": ["{workspaceRoot}/coverage/{projectRoot}"],
|
||||
"options": {
|
||||
"jestConfig": "apps/client/jest.config.ts",
|
||||
"passWithNoTests": true
|
||||
}
|
||||
},
|
||||
"lint": {
|
||||
"executor": "@nrwl/linter:eslint",
|
||||
"outputs": ["{options.outputFile}"],
|
||||
"options": {
|
||||
"lintFilePatterns": ["apps/client/**/*.{ts,tsx,js,jsx}"]
|
||||
}
|
||||
}
|
||||
},
|
||||
"tags": []
|
||||
}
|
||||
@ -0,0 +1,34 @@
|
||||
sonar.host.url=https://sonarqube.naser.fr/
|
||||
sonar.projectKey=david:guitar-apps
|
||||
sonar.projectName=Apps Guitar School
|
||||
sonar.projectVersion=0.1.0-SNAPSHOT
|
||||
|
||||
# =====================================================
|
||||
# Meta-data for the project
|
||||
# =====================================================
|
||||
|
||||
sonar.links.homepage=https://gitea.naser.fr/sebsn86/nx-guitar-school
|
||||
sonar.links.ci=https://teamcity.naser.fr/buildConfiguration/NxGuitarSchool_GuitarSchool?mode=builds#all-projects
|
||||
sonar.links.issues=https://gitea.naser.fr/sebsn86/nx-guitar-school/issues
|
||||
|
||||
# =====================================================
|
||||
# Definition of the modules
|
||||
# =====================================================
|
||||
|
||||
sonar.modules=website
|
||||
|
||||
website.sonar.projectName=NextJS Guitar School
|
||||
|
||||
# =====================================================
|
||||
# Properties that will be shared amongst all modules
|
||||
# =====================================================
|
||||
|
||||
# Website properties
|
||||
website.sonar.projectBaseDir=./website
|
||||
website.sonar.sources=./
|
||||
website.sonar.exclusions=**/.next/**/.coverage/,**/.eslintrc.json,**/index.d.ts,**/jest.config.ts,**/next.config.js,**/postcss.config.js,**/tailwind.config.js,**/with-nx.js,**/*.css,**/*.scss,**/*.spec.ts,**/*.spec.tsx
|
||||
website.sonar.coverage.exclusions=**/.next/**/.coverage,**/.eslintrc.json,**/index.d.ts,**/jest.**/config.ts,**/next.config.js,**/postcss.config.js,**/tailwind.config.js,**/with-nx.js,**/*.css,**/*.scss
|
||||
website.sonar.language=ts
|
||||
website.sonar.tests=./tests
|
||||
website.sonar.javascript.lcov.reportPaths=./coverage/lcov.info
|
||||
website.sonar.sourceEncoding=UTF-8
|
||||
@ -0,0 +1,2 @@
|
||||
NX_STRAPI_URL_API=http://localhost:1337/api
|
||||
NX_STRAPI_URL=http://localhost:1337
|
||||
@ -0,0 +1,7 @@
|
||||
/*
|
||||
* Replace this with your own classes
|
||||
*
|
||||
* e.g.
|
||||
* .container {
|
||||
* }
|
||||
*/
|
||||
@ -0,0 +1,14 @@
|
||||
import styles from './carousel.module.scss';
|
||||
|
||||
/* eslint-disable-next-line */
|
||||
export interface CarouselProps {}
|
||||
|
||||
export function Carousel(props: CarouselProps) {
|
||||
return (
|
||||
<div className={styles['container']}>
|
||||
<h1>Welcome to Carousel!</h1>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default Carousel;
|
||||
@ -0,0 +1,7 @@
|
||||
/*
|
||||
* Replace this with your own classes
|
||||
*
|
||||
* e.g.
|
||||
* .container {
|
||||
* }
|
||||
*/
|
||||
@ -0,0 +1,36 @@
|
||||
import delve from "dlv";
|
||||
|
||||
export function Footer({items = []}) {
|
||||
|
||||
const generateItem = (item, index) => {
|
||||
const value = delve(item, 'attributes', {});
|
||||
|
||||
return (
|
||||
<li key={value.title + index}>
|
||||
<a href={value.url} target={value.target} className="mr-4 hover:underline md:mr-6 ">
|
||||
{value.title}
|
||||
</a>
|
||||
</li>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<footer className="p-4 bg-white rounded-lg shadow md:px-6 md:py-8 dark:bg-gray-900">
|
||||
<div className="sm:flex sm:items-center sm:justify-between">
|
||||
<a href="/" className="flex items-center mb-4 sm:mb-0">
|
||||
<img src="https://flowbite.com/docs/images/logo.svg" className="h-8 mr-3" alt="Flowbite Logo"/>
|
||||
<span className="self-center text-2xl font-semibold whitespace-nowrap dark:text-white">Flowbite</span>
|
||||
</a>
|
||||
<ul className="flex flex-wrap items-center mb-6 text-sm text-gray-500 sm:mb-0 dark:text-gray-400">
|
||||
{items.map((item, index: number) => generateItem(item, index))}
|
||||
</ul>
|
||||
</div>
|
||||
<hr className="my-6 border-gray-200 sm:mx-auto dark:border-gray-700 lg:my-8"/>
|
||||
<span className="block text-sm text-gray-500 sm:text-center dark:text-gray-400">© 3 <a
|
||||
href="https://flowbite.com/" className="hover:underline">Flowbite™</a>. All Rights Reserved.
|
||||
</span>
|
||||
</footer>
|
||||
);
|
||||
}
|
||||
|
||||
export default Footer;
|
||||
@ -0,0 +1,7 @@
|
||||
/*
|
||||
* Replace this with your own classes
|
||||
*
|
||||
* e.g.
|
||||
* .container {
|
||||
* }
|
||||
*/
|
||||
@ -0,0 +1,225 @@
|
||||
import {Collapse, Dropdown} from "flowbite";
|
||||
import {useEffect} from "react";
|
||||
import delve from "dlv";
|
||||
import {signOut, useSession} from "next-auth/react";
|
||||
import {FontAwesomeIcon} from '@fortawesome/react-fontawesome'
|
||||
|
||||
import {getBackendImg, hasAvatar} from "../../libs/api";
|
||||
import {faBagShopping, faRightToBracket, faUserPlus} from "@fortawesome/free-solid-svg-icons";
|
||||
import {siteConfig} from "../../config";
|
||||
|
||||
export function Header({items = []}) {
|
||||
const {data: session} = useSession();
|
||||
|
||||
useEffect(() => {
|
||||
if (session == null) {
|
||||
return;
|
||||
}
|
||||
}, [session]);
|
||||
|
||||
useEffect(function mount() {
|
||||
const menuButton = document.getElementById('menu-dropdown-button');
|
||||
const menuZone = document.getElementById('menu-dropdown');
|
||||
if (menuButton && menuZone) {
|
||||
new Dropdown(menuZone, menuButton);
|
||||
}
|
||||
|
||||
const userButton = document.getElementById('user-menu-button');
|
||||
const userZone = document.getElementById('user-dropdown');
|
||||
if (userButton && userZone) {
|
||||
new Dropdown(userZone, userButton);
|
||||
}
|
||||
|
||||
const burgerButton = document.getElementById('menu-button');
|
||||
const megaZone = document.getElementById('navbar-dropdown');
|
||||
if (burgerButton && megaZone) {
|
||||
new Collapse(megaZone, burgerButton);
|
||||
}
|
||||
});
|
||||
|
||||
const renderGenerateItem = (item, index, isActive = false) => {
|
||||
const value = delve(item, 'attributes', {});
|
||||
return (
|
||||
<li key={value.title + index}>
|
||||
{value.children.data.length > 0 ? renderDropdownItem(value, isActive) : renderRegularItem(value, isActive)}
|
||||
</li>
|
||||
);
|
||||
}
|
||||
|
||||
const renderRegularItem = (item, isActive = false) => {
|
||||
return (
|
||||
<a href={item.url}
|
||||
target={item.target}
|
||||
className={"text-gray-900 hover:text-blue-600 dark:text-gray-400 dark:hover:bg-transparent dark:hover:text-gray-500 " + (isActive ? 'text-blue-600 dark:text-gray-500' : '') + " block py-2 pl-3 pr-4 border-b border-gray-100 hover:bg-gray-50 md:hover:bg-transparent md:border-0 md:p-0"}
|
||||
aria-current="page">{item.title}</a>
|
||||
)
|
||||
}
|
||||
|
||||
const renderRegularDropdownItem = (item, index) => {
|
||||
const value = delve(item, 'attributes', {});
|
||||
return (
|
||||
<li key={value.title + index}>
|
||||
<a href={value.url}
|
||||
className="text-gray-900 dark:text-gray-400 hover:text-blue-600 dark:hover:text-gray-500">
|
||||
{value.title}
|
||||
</a>
|
||||
</li>
|
||||
);
|
||||
}
|
||||
|
||||
const renderDropdownItem = (item, isActive = false) => {
|
||||
return (
|
||||
<>
|
||||
<button id="menu-dropdown-button"
|
||||
data-dropdown-toggle="mega-menu-dropdown"
|
||||
className={"flex items-center justify-between w-full py-2 pl-3 pr-4 text-gray-900 dark:text-gray-400 " + (isActive ? 'text-blue-600 dark:text-gray-500' : '') + " font-medium border-b border-gray-100 md:w-auto hover:bg-gray-50 md:p-0 dark:border-transparent dark:hover:bg-transparent dark:hover:text-gray-500"}>
|
||||
{item.title}
|
||||
<svg aria-hidden="true"
|
||||
className="w-5 h-5 ml-1 md:w-4 md:h-4"
|
||||
fill="currentColor"
|
||||
viewBox="0 0 20 20"
|
||||
xmlns="http://www.w3.org/2000/svg">
|
||||
<path fillRule="evenodd"
|
||||
d="M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z"
|
||||
clipRule="evenodd"></path>
|
||||
</svg>
|
||||
</button>
|
||||
<div id="menu-dropdown"
|
||||
className="absolute z-10 grid hidden w-auto text-sm bg-white border border-gray-100 rounded-lg shadow-md dark:border-gray-700 dark:bg-gray-700">
|
||||
<div className="p-4 pb-0 text-gray-900 md:pb-4 dark:text-white">
|
||||
<ul className="space-y-4" aria-labelledby="mega-menu-dropdown-button">
|
||||
{item.children.data.map((children, index) => renderRegularDropdownItem(children, index))}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
const renderAnonymousUser = () => {
|
||||
return (
|
||||
<>
|
||||
<a href="/sign-in"
|
||||
className="text-gray-800 dark:text-white hover:bg-gray-50 focus:ring-4 focus:ring-gray-300 font-medium rounded-lg text-sm px-4 py-2 md:px-5 md:py-2.5 mr-1 md:mr-2 dark:hover:bg-gray-700 focus:outline-none dark:focus:ring-gray-800">
|
||||
<span className="hidden lg:block">Connexion</span>
|
||||
<span className="block lg:hidden">
|
||||
<FontAwesomeIcon icon={faRightToBracket}/>
|
||||
</span>
|
||||
</a>
|
||||
<a href="/sign-up"
|
||||
className="text-white bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:ring-blue-300 font-medium rounded-lg text-sm px-4 py-2 md:px-5 md:py-2.5 mr-1 md:mr-2 dark:bg-dark-600 dark:hover:bg-dark-500 focus:outline-none dark:focus:ring-blue-800">
|
||||
<span className="hidden lg:block">Inscription</span>
|
||||
<span className="block lg:hidden">
|
||||
<FontAwesomeIcon icon={faUserPlus}/>
|
||||
</span>
|
||||
</a>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
const renderConnectedUser = () => {
|
||||
return (
|
||||
<>
|
||||
<button type="button"
|
||||
className="flex mr-3 text-sm bg-gray-800 rounded-full md:mr-0 focus:ring-4 focus:ring-gray-300 dark:focus:ring-gray-600"
|
||||
id="user-menu-button"
|
||||
aria-expanded="false"
|
||||
data-dropdown-toggle="user-dropdown"
|
||||
data-dropdown-placement="bottom">
|
||||
<span className="sr-only">Open user menu</span>
|
||||
<img className="w-8 h-8 rounded-full"
|
||||
src={hasAvatar((session.user as any)) ? getBackendImg((session.user as any).avatar.formats.thumbnail.url) : siteConfig.defaultUserAvatar}
|
||||
alt="user photo"/>
|
||||
</button>
|
||||
<div
|
||||
className="z-50 hidden my-4 text-base list-none bg-white divide-y divide-gray-100 rounded shadow dark:bg-gray-700 dark:divide-gray-600"
|
||||
id="user-dropdown">
|
||||
<div className="px-4 py-3">
|
||||
<span className="block text-sm text-gray-900 dark:text-white">{(session.user as any).username}</span>
|
||||
<span
|
||||
className="block text-sm font-medium text-gray-500 truncate dark:text-gray-400">{session.user.email}</span>
|
||||
</div>
|
||||
<ul className="py-1" aria-labelledby="user-menu-button">
|
||||
<li>
|
||||
<a href="#"
|
||||
className="block px-4 py-2 text-sm text-gray-700 hover:bg-gray-100 dark:hover:bg-gray-600 dark:text-gray-200 dark:hover:text-white">
|
||||
Dashboard
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#"
|
||||
className="block px-4 py-2 text-sm text-gray-700 hover:bg-gray-100 dark:hover:bg-gray-600 dark:text-gray-200 dark:hover:text-white">
|
||||
Settings
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#"
|
||||
className="block px-4 py-2 text-sm text-gray-700 hover:bg-gray-100 dark:hover:bg-gray-600 dark:text-gray-200 dark:hover:text-white">
|
||||
Earnings
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#"
|
||||
// @ts-ignore
|
||||
onClick={signOut}
|
||||
className="block px-4 py-2 text-sm text-gray-700 hover:bg-gray-100 dark:hover:bg-gray-600 dark:text-gray-200 dark:hover:text-white">
|
||||
Sign out
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<nav
|
||||
className="bg-white fixed border-gray-200 rounded dark:bg-gray-800 w-full z-10 border-b-2 border-b-gray-50 dark:border-b-gray-700">
|
||||
<div className="flex mx-auto">
|
||||
<main className="w-full">
|
||||
<section
|
||||
className="flex bg-gray-50 dark:bg-gray-900 flex-wrap items-center justify-between w-full md:w-auto p-2 md:p-4"
|
||||
id="navbar-default">
|
||||
<a href="/" className="flex items-center">
|
||||
<img src="https://flowbite.com/docs/images/logo.svg" className="h-6 mr-3 sm:h-9" alt="Flowbite Logo"/>
|
||||
<span className="self-center text-xl font-semibold whitespace-nowrap dark:text-white">Flowbite</span>
|
||||
</a>
|
||||
|
||||
<div className="flex items-center">
|
||||
<button
|
||||
className="text-gray-700 border border-transparent hover:bg-gray-200 hover:text-white focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm p-2.5 text-center inline-flex items-center mr-2 dark:text-blue-500 dark:hover:text-white dark:focus:ring-blue-800">
|
||||
<FontAwesomeIcon icon={faBagShopping}/>
|
||||
</button>
|
||||
|
||||
{session ? renderConnectedUser() : renderAnonymousUser()}
|
||||
|
||||
<button id="menu-button"
|
||||
data-collapse-toggle="navbar-sticky"
|
||||
type="button"
|
||||
className="inline-flex items-center p-2 text-sm text-gray-500 rounded-lg md:hidden hover:bg-gray-100 focus:outline-none focus:ring-2 focus:ring-gray-200 dark:text-gray-400 dark:hover:bg-gray-700 dark:focus:ring-gray-600"
|
||||
aria-controls="navbar-sticky"
|
||||
aria-expanded="false">
|
||||
<span className="sr-only">Open main menu</span>
|
||||
<svg className="w-6 h-6" aria-hidden="true" fill="currentColor" viewBox="0 0 20 20"
|
||||
xmlns="http://www.w3.org/2000/svg">
|
||||
<path fillRule="evenodd"
|
||||
d="M3 5a1 1 0 011-1h12a1 1 0 110 2H4a1 1 0 01-1-1zM3 10a1 1 0 011-1h12a1 1 0 110 2H4a1 1 0 01-1-1zM3 15a1 1 0 011-1h12a1 1 0 110 2H4a1 1 0 01-1-1z"
|
||||
clipRule="evenodd"></path>
|
||||
</svg>
|
||||
</button>
|
||||
</div>
|
||||
</section>
|
||||
<hr className="border-gray-200 sm:mx-auto dark:border-gray-700"/>
|
||||
<section className="hidden w-full md:block md:w-auto" id="navbar-dropdown">
|
||||
<ul className="flex flex-col md:p-4 font-medium md:flex-row md:space-x-8 md:mt-0">
|
||||
{items.map((item, index: number) => renderGenerateItem(item, index))}
|
||||
</ul>
|
||||
</section>
|
||||
</main>
|
||||
|
||||
</div>
|
||||
</nav>
|
||||
);
|
||||
}
|
||||
|
||||
export default Header;
|
||||
@ -0,0 +1,71 @@
|
||||
/*
|
||||
* Replace this with your own classes
|
||||
*
|
||||
* e.g.
|
||||
* .container {
|
||||
* }
|
||||
*/
|
||||
.app-container {
|
||||
position: relative;
|
||||
min-height: 100vh;
|
||||
|
||||
.app-content {
|
||||
position: relative;
|
||||
padding-top: 75.5px;
|
||||
min-height: calc(100vh - 189px);
|
||||
}
|
||||
}
|
||||
|
||||
.without-headers {
|
||||
padding-top: 0;
|
||||
|
||||
.app-content {
|
||||
padding-top: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.without-footer {
|
||||
padding-top: 0;
|
||||
|
||||
.app-content {
|
||||
min-height: 100vh;
|
||||
}
|
||||
}
|
||||
|
||||
@media (min-width: 453px) {
|
||||
.app-container:not(.without-footer) {
|
||||
.app-content {
|
||||
min-height: calc(100vh - 169px);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@media (min-width: 640px) {
|
||||
.app-container:not(.without-footer) {
|
||||
.app-content {
|
||||
min-height: calc(100vh - 133px);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@media (min-width: 768px) {
|
||||
.app-container:not(.without-headers) {
|
||||
.app-content {
|
||||
padding-top: 128px;
|
||||
}
|
||||
}
|
||||
.app-container:not(.without-footer) {
|
||||
.app-content {
|
||||
min-height: calc(100vh - 165px);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@media (min-width: 1024px) {
|
||||
.app-container:not(.without-footer) {
|
||||
.app-content {
|
||||
padding-top: 135px;
|
||||
min-height: calc(100vh - 181px);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,36 @@
|
||||
import Header from "../header/header";
|
||||
import Footer from "../footer/footer";
|
||||
|
||||
import styles from './layout.module.scss';
|
||||
|
||||
export function Layout({showHeaders = true, showFooter = true, menuHeader = [], menuFooter = [], children = null, className = ''}) {
|
||||
|
||||
const renderHeaders = () => {
|
||||
if (showHeaders) {
|
||||
return (<Header items={menuHeader}/>)
|
||||
} else {
|
||||
return ('');
|
||||
}
|
||||
}
|
||||
const renderFooters = () => {
|
||||
if (showFooter) {
|
||||
return (<Footer items={menuFooter}/>)
|
||||
} else {
|
||||
return ('');
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
{renderHeaders()}
|
||||
<div className={'dark:bg-gray-900 ' + styles['app-container'] + ' ' + (showHeaders ? '' : styles['without-headers'])+ ' ' + (showFooter ? '' : styles['without-footer']) + ' ' + className}>
|
||||
<div className={styles['app-content'] + " container w-full mx-auto"}>
|
||||
{children}
|
||||
</div>
|
||||
{renderFooters()}
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
export default Layout;
|
||||
@ -0,0 +1,7 @@
|
||||
/*
|
||||
* Replace this with your own classes
|
||||
*
|
||||
* e.g.
|
||||
* .container {
|
||||
* }
|
||||
*/
|
||||
@ -0,0 +1,69 @@
|
||||
import delve from "dlv";
|
||||
|
||||
import {siteConfig} from "../../config";
|
||||
import Head from "next/head";
|
||||
|
||||
export const SeoConfig = ({metaDescription = null, lang = null, meta = [], metaTitle = null, SharedImage = null}) => {
|
||||
const description = metaDescription || siteConfig.siteDescription;
|
||||
const title = metaTitle || siteConfig.siteTitle;
|
||||
const metaImage = SharedImage ? delve(SharedImage, `media.data.attributes.formats.small.url`, siteConfig.siteLogo) : siteConfig.siteLogo;
|
||||
const metaLang = lang || siteConfig.siteLanguage;
|
||||
const metas = [
|
||||
{
|
||||
name: `description`,
|
||||
content: metaDescription
|
||||
},
|
||||
{
|
||||
property: `og:title`,
|
||||
content: metaTitle
|
||||
},
|
||||
{
|
||||
property: `og:description`,
|
||||
content: metaDescription
|
||||
},
|
||||
{
|
||||
property: `og:image`,
|
||||
content: metaImage
|
||||
},
|
||||
{
|
||||
property: `og:type`,
|
||||
content: 'website'
|
||||
},
|
||||
{
|
||||
name: `twitter:card`,
|
||||
content: `summary_large_image`
|
||||
},
|
||||
{
|
||||
name: `twitter:creator`,
|
||||
content: siteConfig.author
|
||||
},
|
||||
{
|
||||
name: `twitter:title`,
|
||||
content: metaTitle
|
||||
},
|
||||
{
|
||||
name: `twitter:description`,
|
||||
content: metaDescription
|
||||
|
||||
}
|
||||
];
|
||||
const metaList = meta && meta.length > 0 ? meta : metas;
|
||||
const type = 'website';
|
||||
|
||||
return (
|
||||
<Head>
|
||||
<title>{title}</title>
|
||||
<meta name="description"
|
||||
content={description}/>
|
||||
<meta property="og:title"
|
||||
content={title}/>
|
||||
<meta property="lang"
|
||||
content={lang}/>
|
||||
{metaList.map((meta, index) => (
|
||||
<meta key={meta + index} property={meta.name} content={meta.content}/>
|
||||
))}
|
||||
</Head>
|
||||
);
|
||||
}
|
||||
|
||||
export default SeoConfig;
|
||||
@ -0,0 +1,50 @@
|
||||
export const config = {
|
||||
env: {
|
||||
STRAPI_URL_API: process.env.NX_STRAPI_URL_API,
|
||||
STRAPI_URL: process.env.NX_STRAPI_URL,
|
||||
NEXTAUTH_SECRET: process.env.NX_NEXTAUTH_SECRET,
|
||||
NEXTAUTH_URL: process.env.NX_NEXTAUTH_URL,
|
||||
},
|
||||
mainApiEndpoint: 'https://conduit.productionready.io/api'
|
||||
}
|
||||
|
||||
export const theme = {
|
||||
colors: {
|
||||
primary: '#3b5998',
|
||||
secondary: '#8b9dc3',
|
||||
gray: '#f7f7f7'
|
||||
},
|
||||
width: {
|
||||
xl: 1200,
|
||||
l: 900,
|
||||
m: 750,
|
||||
s: 400
|
||||
}
|
||||
}
|
||||
|
||||
export const siteConfig = {
|
||||
siteTitle: 'Conduit', // Navigation and Site Title
|
||||
siteUrl: process.env.ROOT_URL || 'https://next.org', // Domain of your site. No trailing slash!
|
||||
siteLanguage: 'fr', // Language Tag on <html> element
|
||||
siteLogo: '/logo.png', // Used for SEO and manifest, path to your image you placed in the 'static' folder
|
||||
siteDescription: 'Real world example of nextjs SSR',
|
||||
author: 'arrlancore', // Author for schemaORGJSONLD
|
||||
organization: 'Open Source Organization',
|
||||
|
||||
userTwitter: '@arrlancore', // Twitter Username
|
||||
ogSiteName: 'Dwiki Arlan', // Facebook Site Name
|
||||
ogLanguage: 'en_US',
|
||||
googleAnalyticsID: process.env.GOOGLE_ANALYTIC_ID || 'UA-XXX123-1',
|
||||
|
||||
// Manifest and Progress color
|
||||
themeColor: '#4147DC',
|
||||
backgroundColor: '#231C42',
|
||||
defaultUserAvatar: '',
|
||||
|
||||
// Social component
|
||||
twitter: 'https://twitter.com/arrlancore/',
|
||||
twitterHandle: '@arrlancore',
|
||||
github: 'https://github.com/arrlancore/',
|
||||
youtube: 'https://www.youtube.com/',
|
||||
rss: 'https://next.org/blog/rss.xml'
|
||||
}
|
||||
@ -0,0 +1,5 @@
|
||||
export const environment = {
|
||||
strapiUrl: 'http://127.0.0.1:1337/',
|
||||
strapiApiUrl: 'http://127.0.0.1:1337/api',
|
||||
nextAuthSecret: "yBNW1wrb9CgOvEfbX6EQCvCDqiMkRBZP"
|
||||
}
|
||||
@ -0,0 +1,5 @@
|
||||
export const environment = {
|
||||
strapiUrl: 'https://admin.mecp.nasercloud.fr/',
|
||||
strapiApiUrl: 'https://admin.mecp.nasercloud.fr/api',
|
||||
nextAuthSecret: "yBNW1wrb9CgOvEfbX6EQCvCDqiMkRBZP"
|
||||
}
|
||||
@ -0,0 +1,5 @@
|
||||
export const environment = {
|
||||
strapiUrl: 'https://admin.mecp.nasercloud.fr/',
|
||||
strapiApiUrl: 'https://admin.mecp.nasercloud.fr/api',
|
||||
nextAuthSecret: "yBNW1wrb9CgOvEfbX6EQCvCDqiMkRBZP"
|
||||
}
|
||||
@ -0,0 +1,5 @@
|
||||
export const environment = {
|
||||
strapiUrl: 'http://127.0.0.1:1337/',
|
||||
strapiApiUrl: 'http://127.0.0.1:1337/api',
|
||||
nextAuthSecret: "yBNW1wrb9CgOvEfbX6EQCvCDqiMkRBZP"
|
||||
}
|
||||
@ -0,0 +1,16 @@
|
||||
/* eslint-disable */
|
||||
export default {
|
||||
displayName: 'website',
|
||||
preset: '../../jest.preset.js',
|
||||
transform: {
|
||||
'^(?!.*\\.(js|jsx|ts|tsx|css|json)$)': '@nrwl/react/plugins/jest',
|
||||
'^.+\\.[tj]sx?$': ['babel-jest', {presets: ['@nrwl/next/babel']}],
|
||||
},
|
||||
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'],
|
||||
collectCoverage: true,
|
||||
coverageReporters: ["text", ["lcov", {"projectRoot": "./apps/website"}]],
|
||||
coverageDirectory: './coverage',
|
||||
moduleNameMapper: {
|
||||
'^@/(.*)$': '<rootDir>/$1',
|
||||
},
|
||||
};
|
||||
@ -0,0 +1,46 @@
|
||||
import axios from "axios";
|
||||
import * as _ from 'lodash';
|
||||
|
||||
import {environment} from "../environments/environment";
|
||||
import {config} from "../config";
|
||||
|
||||
export type Inputs = {
|
||||
email: string,
|
||||
username: string,
|
||||
password: string,
|
||||
passwordConfirmation: string,
|
||||
agreement: boolean,
|
||||
newsletter: boolean,
|
||||
}
|
||||
|
||||
export type LostPasswordInputs = {
|
||||
email: string;
|
||||
}
|
||||
|
||||
export type ResetPasswordInputs = {
|
||||
password: string,
|
||||
passwordConfirmation: string,
|
||||
code: string
|
||||
}
|
||||
|
||||
export const hasAvatar = (user) => {
|
||||
return !_.isNil(user.avatar);
|
||||
}
|
||||
|
||||
export const getBackendImg = (imageUrl: string) => {
|
||||
return `${environment.strapiUrl}${imageUrl}`;
|
||||
}
|
||||
|
||||
export const signUpRequest = async (inputs: Inputs) => {
|
||||
try {
|
||||
const registerResponse = await axios.post(`${environment.strapiApiUrl}/auth/local/register`, {
|
||||
email: inputs.email,
|
||||
password: inputs.password,
|
||||
username: inputs.username,
|
||||
newsletter: inputs.newsletter
|
||||
});
|
||||
return registerResponse.data;
|
||||
} catch (err) {
|
||||
return Promise.reject('Internal error');
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,50 @@
|
||||
import axios from 'axios';
|
||||
import {signIn} from "next-auth/react";
|
||||
import * as _ from 'lodash';
|
||||
|
||||
import {config} from "../config";
|
||||
import {environment} from "../environments/environment";
|
||||
|
||||
export async function createJwtToken(email, password) {
|
||||
return await signIn('credentials', {
|
||||
redirect: false,
|
||||
email,
|
||||
password,
|
||||
});
|
||||
}
|
||||
|
||||
export async function signInStrapi({email, password}) {
|
||||
const res = await axios.post(`${environment.strapiApiUrl}/auth/local`, {
|
||||
identifier: email,
|
||||
password,
|
||||
});
|
||||
if (res && res.data) {
|
||||
const user = await axios.get(`${environment.strapiApiUrl}/users/${res.data.user.id}?populate=deep`);
|
||||
if (user && user.data) {
|
||||
res.data.user = {...res.data.user, ...user.data};
|
||||
}
|
||||
}
|
||||
return res.data;
|
||||
}
|
||||
|
||||
export async function lostPasswordStrapi({email}) {
|
||||
const res = await axios.post(`${environment.strapiApiUrl}/auth/forgot-password`, {email});
|
||||
if (res && res.data) {
|
||||
return res.data.ok;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
export async function resetPasswordStrapi({password, passwordConfirmation, code}) {
|
||||
const res = await axios.post(`${environment.strapiApiUrl}/auth/reset-password`, {
|
||||
password,
|
||||
passwordConfirmation,
|
||||
code
|
||||
});
|
||||
if (res && res.data) {
|
||||
return !_.isNil(res.data.jwt);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -1,16 +1,19 @@
|
||||
//@ts-check
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
||||
const { withNx } = require('@nrwl/next/plugins/with-nx');
|
||||
const {withNx} = require('./with-nx.js');
|
||||
|
||||
/**
|
||||
* @type {import('@nrwl/next/plugins/with-nx').WithNxOptions}
|
||||
**/
|
||||
const nextConfig = {
|
||||
reactStrictMode: true,
|
||||
poweredByHeader: false,
|
||||
output: 'standalone',
|
||||
nx: {
|
||||
// Set this to true if you would like to to use SVGR
|
||||
// See: https://github.com/gregberge/svgr
|
||||
svgr: false,
|
||||
svgr: false
|
||||
},
|
||||
};
|
||||
|
||||
@ -0,0 +1,14 @@
|
||||
{
|
||||
"name": "website",
|
||||
"version": "0.0.1",
|
||||
"dependencies": {
|
||||
"@nrwl/next": "15.5.1",
|
||||
"next": "13.1.1",
|
||||
"react": "18.2.0",
|
||||
"react-dom": "18.2.0",
|
||||
"typescript": "4.8.4"
|
||||
},
|
||||
"scripts": {
|
||||
"start": "next start"
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,24 @@
|
||||
import {AppProps} from 'next/app';
|
||||
import {SessionProvider} from "next-auth/react";
|
||||
import { library } from "@fortawesome/fontawesome-svg-core";
|
||||
import { config } from '@fortawesome/fontawesome-svg-core';
|
||||
import '@fortawesome/fontawesome-svg-core/styles.css';
|
||||
import {faBagShopping, faRightToBracket, faUserPlus} from "@fortawesome/free-solid-svg-icons";
|
||||
|
||||
config.autoAddCss = false;
|
||||
|
||||
library.add(faRightToBracket);
|
||||
library.add(faUserPlus);
|
||||
library.add(faBagShopping);
|
||||
|
||||
import './styles.css';
|
||||
|
||||
function CustomApp({Component, pageProps: {session, ...pageProps}}: AppProps) {
|
||||
return (
|
||||
<SessionProvider session={session}>
|
||||
<Component {...pageProps} />
|
||||
</SessionProvider>
|
||||
);
|
||||
}
|
||||
|
||||
export default CustomApp;
|
||||
@ -0,0 +1,13 @@
|
||||
import {Head, Html, Main, NextScript} from 'next/document';
|
||||
|
||||
export default function Document() {
|
||||
return (
|
||||
<Html lang='en'>
|
||||
<Head/>
|
||||
<body>
|
||||
<Main/>
|
||||
<NextScript/>
|
||||
</body>
|
||||
</Html>
|
||||
)
|
||||
};
|
||||
@ -0,0 +1,65 @@
|
||||
import NextAuth, {Session, User} from 'next-auth';
|
||||
import CredentialsProvider from 'next-auth/providers/credentials';
|
||||
import {JWT} from "next-auth/jwt";
|
||||
import {AdapterUser} from "next-auth/adapters";
|
||||
|
||||
import {environment} from "../../../environments/environment";
|
||||
import {signInStrapi} from '../../../libs/auth';
|
||||
|
||||
export default NextAuth({
|
||||
|
||||
// Configure one or more authentication providers
|
||||
providers: [
|
||||
CredentialsProvider({
|
||||
name: 'Sign in with Email',
|
||||
credentials: {
|
||||
email: {label: 'Email', type: 'text'},
|
||||
password: {label: 'Password', type: 'password'},
|
||||
},
|
||||
async authorize(credentials, req) {
|
||||
/**
|
||||
* This function is used to define if the user is authenticated or not.
|
||||
* If authenticated, the function should return an object contains the user data.
|
||||
* If not, the function should return `null`.
|
||||
*/
|
||||
if (credentials == null) return null;
|
||||
/**
|
||||
* credentials is defined in the config above.
|
||||
* We can expect it contains two properties: `email` and `password`
|
||||
*/
|
||||
try {
|
||||
const {user, jwt} = await signInStrapi({
|
||||
email: credentials.email,
|
||||
password: credentials.password,
|
||||
});
|
||||
return {...user, jwt};
|
||||
} catch (error) {
|
||||
// Sign In Fail
|
||||
return null;
|
||||
}
|
||||
},
|
||||
}),
|
||||
],
|
||||
callbacks: {
|
||||
session: async ({session, token}: {session: Session, token: JWT}) => {
|
||||
(session as any).id = token.id;
|
||||
(session as any).jwt = token.jwt;
|
||||
(session as any).user = {
|
||||
avatar: (token.user as any).avatar,
|
||||
username: (token.user as any).username,
|
||||
email: (token.user as any).email,
|
||||
};
|
||||
return Promise.resolve(session);
|
||||
},
|
||||
jwt: async ({token, user}: {token: JWT, user: User | AdapterUser}) => {
|
||||
const isSignIn = user ? true : false;
|
||||
if (isSignIn) {
|
||||
token.id = user.id;
|
||||
token.jwt = (user as any).jwt;
|
||||
token.user = (user as any);
|
||||
}
|
||||
return Promise.resolve(token);
|
||||
},
|
||||
},
|
||||
secret: environment.nextAuthSecret
|
||||
});
|
||||
@ -0,0 +1,7 @@
|
||||
/*
|
||||
* Replace this with your own classes
|
||||
*
|
||||
* e.g.
|
||||
* .container {
|
||||
* }
|
||||
*/
|
||||
@ -0,0 +1,44 @@
|
||||
import axios from "axios";
|
||||
import delve from "dlv";
|
||||
|
||||
import SeoConfig from "../../components/seo-config/seo-config";
|
||||
import Layout from "../../components/layout/layout";
|
||||
import {config} from "../../config";
|
||||
import {environment} from "../../environments/environment";
|
||||
|
||||
const getPageMetadata = async (path) => {
|
||||
try {
|
||||
return await axios.get(`${environment.strapiApiUrl}/pages?filters[slug]=${path === '/' ? 'home' : path.slice(1, path.length)}&populate=deep`);
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
return Promise.resolve({})
|
||||
}
|
||||
}
|
||||
|
||||
export const getServerSideProps = async (context) => {
|
||||
const path = context.resolvedUrl;
|
||||
const menuHeader = await axios.get(`${environment.strapiApiUrl}/menus/1?nested&populate=deep`);
|
||||
const menuFooter = await axios.get(`${environment.strapiApiUrl}/menus/2?nested&populate=deep`);
|
||||
const page = await getPageMetadata(path);
|
||||
return {
|
||||
props: {
|
||||
menuHeader: delve(menuHeader, 'data.data.attributes.items.data', []),
|
||||
menuFooter: delve(menuFooter, 'data.data.attributes.items.data', []),
|
||||
page: delve(page, "data.data.0.attributes", {}),
|
||||
seo: delve(page, "data.data.0.attributes.seo", {})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export function Home({menuHeader, menuFooter, page, seo}) {
|
||||
return (
|
||||
<>
|
||||
<SeoConfig {...seo}/>
|
||||
<Layout menuHeader={menuHeader} menuFooter={menuFooter}>
|
||||
<p>Page d'accueil</p>
|
||||
</Layout>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
export default Home;
|
||||
@ -0,0 +1,6 @@
|
||||
@import 'tailwindcss/base.css';
|
||||
@import 'tailwindcss/components.css';
|
||||
@import 'tailwindcss/utilities.css';
|
||||
|
||||
.page {
|
||||
}
|
||||
@ -0,0 +1,45 @@
|
||||
import axios from "axios";
|
||||
import delve from "dlv";
|
||||
|
||||
import SeoConfig from "../components/seo-config/seo-config";
|
||||
|
||||
import Layout from "../components/layout/layout";
|
||||
import {config} from "../config";
|
||||
import {environment} from "../environments/environment";
|
||||
|
||||
const getPageMetadata = async (path) => {
|
||||
try {
|
||||
return await axios.get(`${environment.strapiApiUrl}/pages?filters[slug]=${path === '/' ? 'home' : path.slice(1, path.length)}&populate=deep`);
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
return Promise.resolve({})
|
||||
}
|
||||
}
|
||||
|
||||
export const getServerSideProps = async (context) => {
|
||||
const path = context.resolvedUrl;
|
||||
const menuHeader = await axios.get(`${environment.strapiApiUrl}/menus/1?nested&populate=deep`);
|
||||
const menuFooter = await axios.get(`${environment.strapiApiUrl}/menus/2?nested&populate=deep`);
|
||||
const page = await getPageMetadata(path);
|
||||
return {
|
||||
props: {
|
||||
menuHeader: delve(menuHeader, 'data.data.attributes.items.data', []),
|
||||
menuFooter: delve(menuFooter, 'data.data.attributes.items.data', []),
|
||||
page: delve(page, "data.data.0.attributes", {}),
|
||||
seo: delve(page, "data.data.0.attributes.seo", {})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export function Index({menuHeader, menuFooter, page, seo}) {
|
||||
return (
|
||||
<>
|
||||
<SeoConfig {...seo}/>
|
||||
<Layout menuHeader={menuHeader} menuFooter={menuFooter}>
|
||||
<p>Page d'accueil</p>
|
||||
</Layout>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
export default Index;
|
||||
@ -0,0 +1,7 @@
|
||||
/*
|
||||
* Replace this with your own classes
|
||||
*
|
||||
* e.g.
|
||||
* .container {
|
||||
* }
|
||||
*/
|
||||
@ -0,0 +1,134 @@
|
||||
import axios from "axios";
|
||||
import delve from "dlv";
|
||||
import {useState} from "react";
|
||||
import {SubmitHandler, useForm} from "react-hook-form";
|
||||
|
||||
import SeoConfig from "../../components/seo-config/seo-config";
|
||||
import Layout from "../../components/layout/layout";
|
||||
import {environment} from "../../environments/environment";
|
||||
import {LostPasswordInputs} from "../../libs/api";
|
||||
import {lostPasswordStrapi} from "../../libs/auth";
|
||||
|
||||
import styles from "../sign-up/index.module.scss";
|
||||
|
||||
const getPageMetadata = async (path) => {
|
||||
try {
|
||||
return await axios.get(`${environment.strapiApiUrl}/pages?filters[slug]=${path === '/' ? 'home' : path.slice(1, path.length)}&populate=deep`);
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
return Promise.resolve({})
|
||||
}
|
||||
}
|
||||
|
||||
export const getServerSideProps = async (context) => {
|
||||
const path = context.resolvedUrl;
|
||||
const menuHeader = await axios.get(`${environment.strapiApiUrl}/menus/1?nested&populate=deep`);
|
||||
const menuFooter = await axios.get(`${environment.strapiApiUrl}/menus/2?nested&populate=deep`);
|
||||
const page = await getPageMetadata(path);
|
||||
return {
|
||||
props: {
|
||||
menuHeaders: delve(menuHeader, 'data.data.attributes.items.data', []),
|
||||
menuFooter: delve(menuFooter, 'data.data.attributes.items.data', []),
|
||||
page: delve(page, "data.data.0.attributes", {}),
|
||||
seo: delve(page, "data.data.0.attributes.seo", {})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export function LostPassword({menuHeaders, menuFooter, page, seo}) {
|
||||
const {register, handleSubmit, formState: {errors}} = useForm({
|
||||
defaultValues: {
|
||||
email: ""
|
||||
}
|
||||
});
|
||||
const [isSent, setIsSent] = useState(null);
|
||||
|
||||
const onSubmit: SubmitHandler<LostPasswordInputs> = async (data: LostPasswordInputs) => {
|
||||
try {
|
||||
const result = await lostPasswordStrapi({email: data.email});
|
||||
setIsSent(result);
|
||||
} catch (e) {
|
||||
setIsSent(false);
|
||||
}
|
||||
}
|
||||
|
||||
const hasErrors = () => Object.keys(errors).length > 0;
|
||||
|
||||
const isBoolean = (val) => typeof val === "boolean";
|
||||
|
||||
return (
|
||||
<>
|
||||
<SeoConfig {...seo}/>
|
||||
<Layout menuHeader={menuHeaders} menuFooter={menuFooter}>
|
||||
<div className={styles['page-sign-up']}>
|
||||
<section className={styles['section']}>
|
||||
<div className="container px-6 py-4 md:py-12 h-full mx-auto">
|
||||
<div className="flex justify-center items-center flex-wrap h-full g-6 text-gray-800">
|
||||
<div className="md:w-8/12 lg:w-6/12">
|
||||
<div
|
||||
className="w-full max-w-[560px] p-4 bg-white border border-gray-200 rounded-lg shadow-md sm:p-6 md:p-8 dark:bg-gray-800 dark:border-gray-700">
|
||||
<form className="space-y-6" onSubmit={handleSubmit(onSubmit)}>
|
||||
<header className="text-left block">
|
||||
<h3 className="text-3xl font-normal dark:text-white mb-6">Mot de passe oublié</h3>
|
||||
<p className="mb-6 text-base font-normal text-gray-500 dark:text-gray-400">
|
||||
Veuillez saisir votre addresse email ci-dessous et nous vous enverrons un courriel pour
|
||||
changer votre mot de passe.
|
||||
</p>
|
||||
</header>
|
||||
<main>
|
||||
{isBoolean(isSent) && isSent ? (<div
|
||||
className="p-4 mb-4 text-sm text-green-800 rounded-lg bg-green-50 dark:bg-gray-800 dark:text-green-400"
|
||||
role="alert">
|
||||
<span className="font-medium">Email envoyé !</span> Vérifiez votre boite de réception ou vos
|
||||
courrier indésirables.
|
||||
</div>) : ('')}
|
||||
{isBoolean(isSent) && !isSent ? (<div
|
||||
className="p-4 mb-4 text-sm text-red-800 rounded-lg bg-red-50 dark:bg-gray-800 dark:text-red-400"
|
||||
role="alert">
|
||||
<span className="font-medium">Oups !</span> Une erreur est survenue durant l'envoi de l'email.
|
||||
Rapprochez vous de nos équipes pour en savoir plus.
|
||||
</div>) : ('')}
|
||||
<section className="grid grid-cols-1 gap-4 mb-4">
|
||||
<div>
|
||||
<label htmlFor="email"
|
||||
className="block mb-2 text-sm font-medium text-gray-900 dark:text-white">
|
||||
E-mail
|
||||
</label>
|
||||
<div className="relative">
|
||||
<input type="email"
|
||||
name="email"
|
||||
id="email"
|
||||
{...register("email", {required: "L'email est requis"})}
|
||||
className={errors.email ? 'bg-red-50 border border-red-500 text-red-900 placeholder-red-700 text-sm rounded-lg focus:ring-red-500 dark:bg-gray-700 focus:border-red-500 block w-full p-2.5 dark:text-red-500 dark:placeholder-red-500 dark:border-red-500' : 'bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full pr-10 p-2.5 dark:bg-gray-600 dark:border-gray-500 dark:placeholder-gray-400 dark:text-white'}
|
||||
placeholder="name@company.com"/>
|
||||
{errors.email && (
|
||||
<p className="mt-2 text-sm text-red-600 dark:text-red-500">{errors.email.message}</p>)}
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<section className="flex items-center pt-5">
|
||||
<button type="submit"
|
||||
className="text-white bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:ring-blue-300 font-medium rounded-lg text-sm px-5 py-2.5 mb-2 dark:bg-blue-600 dark:hover:bg-blue-700 focus:outline-none dark:focus:ring-blue-800 w-full disabled:bg-gray-500 focus:disabled:bg-gray-500 hover:disabled:bg-gray-500"
|
||||
data-mdb-ripple="true"
|
||||
data-mdb-ripple-color="light" disabled={hasErrors()}>
|
||||
Envoyer le code par email
|
||||
</button>
|
||||
</section>
|
||||
</main>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<div className="md:w-8/12 lg:w-6/12 mb-12 md:mb-0 hidden md:block">
|
||||
<img src="/images/page-lost-password.png"
|
||||
className="w-full" alt="Phone image"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</Layout>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
export default LostPassword;
|
||||
@ -0,0 +1,7 @@
|
||||
/*
|
||||
* Replace this with your own classes
|
||||
*
|
||||
* e.g.
|
||||
* .container {
|
||||
* }
|
||||
*/
|
||||
@ -0,0 +1,170 @@
|
||||
import delve from "dlv";
|
||||
import axios from "axios";
|
||||
import {SubmitHandler, useForm} from "react-hook-form";
|
||||
|
||||
import SeoConfig from "../../components/seo-config/seo-config";
|
||||
import Layout from "../../components/layout/layout";
|
||||
import {environment} from "../../environments/environment";
|
||||
import {ResetPasswordInputs} from "../../libs/api";
|
||||
|
||||
import styles from './index.module.scss';
|
||||
import {useRouter} from "next/router";
|
||||
import {useState} from "react";
|
||||
import {resetPasswordStrapi} from "../../libs/auth";
|
||||
|
||||
const getPageMetadata = async (path) => {
|
||||
try {
|
||||
return await axios.get(`${environment.strapiApiUrl}/pages?filters[slug]=${path === '/' ? 'home' : path.slice(1, path.length)}&populate=deep`);
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
return Promise.resolve({})
|
||||
}
|
||||
}
|
||||
|
||||
export const getServerSideProps = async (context) => {
|
||||
const path = context.resolvedUrl;
|
||||
const menuHeader = await axios.get(`${environment.strapiApiUrl}/menus/1?nested&populate=deep`);
|
||||
const menuFooter = await axios.get(`${environment.strapiApiUrl}/menus/2?nested&populate=deep`);
|
||||
const page = await getPageMetadata(path);
|
||||
return {
|
||||
props: {
|
||||
menuHeaders: delve(menuHeader, 'data.data.attributes.items.data', []),
|
||||
menuFooter: delve(menuFooter, 'data.data.attributes.items.data', []),
|
||||
page: delve(page, "data.data.0.attributes", {}),
|
||||
seo: delve(page, "data.data.0.attributes.seo", {})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export function ResetPassword({menuHeaders, menuFooter, page, seo}) {
|
||||
const router = useRouter();
|
||||
const [success, setSuccess] = useState(null);
|
||||
|
||||
const {register, handleSubmit, getValues, formState: {errors}} = useForm({
|
||||
defaultValues: {
|
||||
password: null,
|
||||
passwordConfirmation: null,
|
||||
code: router.query ? router.query.code : null
|
||||
}
|
||||
});
|
||||
|
||||
const onSubmit: SubmitHandler<ResetPasswordInputs> = async (data: ResetPasswordInputs) => {
|
||||
try {
|
||||
const result = await resetPasswordStrapi({
|
||||
password: data.password,
|
||||
passwordConfirmation: data.passwordConfirmation,
|
||||
code: data.code
|
||||
});
|
||||
setSuccess(result);
|
||||
setTimeout(() => router.push('/sign-in'), 5000);
|
||||
} catch (e) {
|
||||
setSuccess(false);
|
||||
}
|
||||
}
|
||||
|
||||
const hasErrors = () => Object.keys(errors).length > 0;
|
||||
|
||||
const isBoolean = (val) => typeof val === "boolean";
|
||||
|
||||
return (
|
||||
<>
|
||||
<SeoConfig {...seo}/>
|
||||
<Layout menuHeader={menuHeaders} menuFooter={menuFooter}>
|
||||
<div className={styles['page-sign-up']}>
|
||||
<section className={styles['section']}>
|
||||
<div className="container px-6 py-4 md:py-12 h-full mx-auto">
|
||||
<div className="flex justify-center items-center flex-wrap h-full g-6 text-gray-800">
|
||||
<div className="md:w-8/12 lg:w-6/12 mb-12 md:mb-0 hidden md:block">
|
||||
<img src="/images/page-lost-password.png"
|
||||
className="w-full" alt="Phone image"/>
|
||||
</div>
|
||||
<div className="md:w-8/12 lg:w-6/12 flex justify-end">
|
||||
<div
|
||||
className="w-full max-w-[560px] p-4 bg-white border border-gray-200 rounded-lg shadow-md sm:p-6 md:p-8 dark:bg-gray-800 dark:border-gray-700">
|
||||
<form className="space-y-6" onSubmit={handleSubmit(onSubmit)}>
|
||||
<header className="text-left block">
|
||||
<h3 className="text-3xl font-normal dark:text-white mb-6">Changer votre mot de passe</h3>
|
||||
<p className="mb-6 text-base font-normal text-gray-500 dark:text-gray-400">
|
||||
Indiquez votre nouveau mot de passe
|
||||
</p>
|
||||
</header>
|
||||
{isBoolean(success) && success ? (<div
|
||||
className="p-4 mb-4 text-sm text-green-800 rounded-lg bg-green-50 dark:bg-gray-800 dark:text-green-400"
|
||||
role="alert">
|
||||
<span className="font-medium">Mot de passe changé !</span> vous allez être redirigé vers la page
|
||||
de connexion.
|
||||
</div>) : ('')}
|
||||
{isBoolean(success) && !success ? (<div
|
||||
className="p-4 mb-4 text-sm text-red-800 rounded-lg bg-red-50 dark:bg-gray-800 dark:text-red-400"
|
||||
role="alert">
|
||||
<span className="font-medium">Oups !</span> Une erreur est survenue durant le changement du mot
|
||||
de passe. Rapprochez vous de nos équipes pour en savoir plus.
|
||||
</div>) : ('')}
|
||||
<main>
|
||||
<section className="grid grid-cols-1 gap-4 mb-4">
|
||||
<div>
|
||||
<label htmlFor="password"
|
||||
className="block mb-2 text-sm font-medium text-gray-900 dark:text-white">
|
||||
Mot de passe
|
||||
</label>
|
||||
<div className="relative">
|
||||
<input type="password"
|
||||
name="password"
|
||||
id="password"
|
||||
{...register("password", {required: "Le mot de passe est requis", minLength: 8})}
|
||||
className={errors.email ? 'bg-red-50 border border-red-500 text-red-900 placeholder-red-700 text-sm rounded-lg focus:ring-red-500 dark:bg-gray-700 focus:border-red-500 block w-full p-2.5 dark:text-red-500 dark:placeholder-red-500 dark:border-red-500' : 'bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full pr-10 p-2.5 dark:bg-gray-600 dark:border-gray-500 dark:placeholder-gray-400 dark:text-white'}/>
|
||||
{errors.password && errors.password.type !== "minLength" && (
|
||||
<p
|
||||
className="mt-2 text-sm text-red-600 dark:text-red-500">{errors.password.message}</p>)}
|
||||
{errors.password && errors.password.type === "minLength" && (
|
||||
<p className="mt-2 text-sm text-red-600 dark:text-red-500">Le mot de passe doit avoir
|
||||
une
|
||||
longueur minimum de 8 charactères</p>)}
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<label htmlFor="passwordConfirmation"
|
||||
className="block mb-2 text-sm font-medium text-gray-900 dark:text-white">
|
||||
Confirmez votre mot de passe
|
||||
</label>
|
||||
<div className="relative">
|
||||
<input type="password"
|
||||
name="passwordConfirmation"
|
||||
id="passwordConfirmation"
|
||||
{...register("passwordConfirmation", {
|
||||
required: "Veuillez confirmer le mot de passe", validate: {
|
||||
matchesPreviousPassword: (value) => {
|
||||
const {password} = getValues();
|
||||
return password === value || "Les mots de passe ne correspondent pas";
|
||||
}
|
||||
}
|
||||
})}
|
||||
className={errors.password ? 'bg-red-50 border border-red-500 text-red-900 placeholder-red-700 text-sm rounded-lg focus:ring-red-500 dark:bg-gray-700 focus:border-red-500 block w-full p-2.5 dark:text-red-500 dark:placeholder-red-500 dark:border-red-500' : 'bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full pr-10 p-2.5 dark:bg-gray-600 dark:border-gray-500 dark:placeholder-gray-400 dark:text-white'}/>
|
||||
{errors.passwordConfirmation && (
|
||||
<p
|
||||
className="mt-2 text-sm text-red-600 dark:text-red-500">{errors.passwordConfirmation.message}</p>)}
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<section className="flex items-center pt-5">
|
||||
<button type="submit"
|
||||
className="text-white bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:ring-blue-300 font-medium rounded-lg text-sm px-5 py-2.5 mb-2 dark:bg-blue-600 dark:hover:bg-blue-700 focus:outline-none dark:focus:ring-blue-800 w-full disabled:bg-gray-500 focus:disabled:bg-gray-500 hover:disabled:bg-gray-500"
|
||||
data-mdb-ripple="true"
|
||||
data-mdb-ripple-color="light" disabled={hasErrors()}>
|
||||
Changer votre mot de passe
|
||||
</button>
|
||||
</section>
|
||||
</main>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</Layout>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
export default ResetPassword;
|
||||
@ -0,0 +1,18 @@
|
||||
/*
|
||||
* Replace this with your own classes
|
||||
*
|
||||
* e.g.
|
||||
* .container {
|
||||
* }
|
||||
*/
|
||||
.page-sign-in {
|
||||
position: relative;
|
||||
height: 100vh;
|
||||
|
||||
.section {
|
||||
min-height: 100vh;
|
||||
justify-content: center;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,131 @@
|
||||
import delve from "dlv";
|
||||
import axios from "axios";
|
||||
import {useRouter} from "next/router";
|
||||
|
||||
import SeoConfig from "../../components/seo-config/seo-config";
|
||||
import Layout from "../../components/layout/layout";
|
||||
import {createJwtToken} from "../../libs/auth";
|
||||
import {environment} from "../../environments/environment";
|
||||
|
||||
import styles from './index.module.scss';
|
||||
|
||||
const getPageMetadata = async (path) => {
|
||||
try {
|
||||
return await axios.get(`${environment.strapiApiUrl}/pages?filters[slug]=${path === '/' ? 'home' : path.slice(1, path.length)}&populate=deep`);
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
return Promise.resolve({})
|
||||
}
|
||||
}
|
||||
|
||||
export const getServerSideProps = async (context) => {
|
||||
const path = context.resolvedUrl;
|
||||
const menuFooter = await axios.get(`${environment.strapiApiUrl}/menus/2?nested&populate=deep`);
|
||||
const page = await getPageMetadata(path);
|
||||
|
||||
return {
|
||||
props: {
|
||||
menuFooter: delve(menuFooter, 'data.data.attributes.items.data', []),
|
||||
page: delve(page, "data.data.0.attributes", {}),
|
||||
seo: delve(page, "data.data.0.attributes.seo", {})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export function SignIn({seo, menuFooter}) {
|
||||
const router = useRouter();
|
||||
|
||||
const onSubmit = async (e) => {
|
||||
e.preventDefault();
|
||||
const result = await createJwtToken(e.target.email.value, e.target.password.value);
|
||||
if (result.ok) {
|
||||
await router.replace('/');
|
||||
return;
|
||||
}
|
||||
|
||||
alert('Credential is not valid');
|
||||
};
|
||||
|
||||
return (
|
||||
<>
|
||||
<SeoConfig {...seo}/>
|
||||
<Layout showHeaders={false} showFooter={false} menuFooter={menuFooter} className="bg-gray-50">
|
||||
<div className={styles['page-sign-in']}>
|
||||
<main className={styles['section']}>
|
||||
<div className="container max-w-5xl px-6 py-4 md:py-12 h-full mx-auto relative -top-[25px] md:-top-[50px]">
|
||||
<div className="flex flex-col justify-center items-center flex-wrap h-full g-6 text-gray-800">
|
||||
<header className="max-w-[440px] text-center block">
|
||||
<a href="https://flowbite.com/" className="flex items-center justify-center mb-6">
|
||||
<img src="https://flowbite.com/docs/images/logo.svg" className="h-6 mr-3 sm:h-9"
|
||||
alt="Flowbite Logo"/>
|
||||
<span
|
||||
className="self-center text-xl font-semibold whitespace-nowrap dark:text-white">Flowbite</span>
|
||||
</a>
|
||||
|
||||
<h3
|
||||
className="mb-4 text-2xl font-extrabold leading-none text-center tracking-tight text-gray-900 md:text-3xl lg:text-3xl dark:text-white">
|
||||
Connexion à votre compte
|
||||
</h3>
|
||||
<p className="mb-6 text-md font-normal text-gray-500 lg:text-xl dark:text-gray-400">
|
||||
Vous n'êtes pas encore inscrit ? <br/><a href="/sign-up"
|
||||
className="font-medium text-blue-600 dark:text-blue-500 hover:underline"
|
||||
target="_self">Créez un compte maintenant</a>.
|
||||
</p>
|
||||
</header>
|
||||
<section
|
||||
className="w-full max-w-[440px] p-4 bg-white border border-gray-200 rounded-lg shadow-md sm:p-6 md:p-8 dark:bg-gray-800 dark:border-gray-700">
|
||||
<div className="w-full">
|
||||
<form onSubmit={onSubmit}>
|
||||
<div className="mb-6">
|
||||
<label htmlFor="email"
|
||||
className="block mb-2 text-sm font-medium text-gray-900 dark:text-white">
|
||||
E-mail
|
||||
</label>
|
||||
<input type="email"
|
||||
id="email"
|
||||
name="email"
|
||||
className="bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500"/>
|
||||
</div>
|
||||
<div className="mb-6">
|
||||
<label htmlFor="password"
|
||||
className="block mb-2 text-sm font-medium text-gray-900 dark:text-white">
|
||||
Mot de passe
|
||||
</label>
|
||||
<input type="password"
|
||||
id="password"
|
||||
name="password"
|
||||
className="bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500"/>
|
||||
</div>
|
||||
<div className="flex justify-between items-center mb-6">
|
||||
<div className="form-group form-check flex items-center">
|
||||
<input id="default-checkbox" type="checkbox" value=""
|
||||
className="w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600"/>
|
||||
<label htmlFor="default-checkbox"
|
||||
className="ml-2 text-sm font-medium text-gray-900 dark:text-gray-300">
|
||||
Rester connecté ?
|
||||
</label>
|
||||
</div>
|
||||
<a href="/lost-password"
|
||||
className="text-blue-600 hover:text-blue-700 focus:text-blue-700 active:text-blue-800 duration-200 transition ease-in-out text-sm">
|
||||
Mot de passe oublié ?
|
||||
</a>
|
||||
</div>
|
||||
<button type="submit"
|
||||
className="text-white bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:ring-blue-300 font-medium rounded-lg text-sm px-5 py-2.5 mr-2 mb-2 dark:bg-blue-600 dark:hover:bg-blue-700 focus:outline-none dark:focus:ring-blue-800 w-full"
|
||||
data-mdb-ripple="true"
|
||||
data-mdb-ripple-color="light">
|
||||
Connexion
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
</div>
|
||||
</Layout>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
export default SignIn;
|
||||
@ -0,0 +1,16 @@
|
||||
/*
|
||||
* Replace this with your own classes
|
||||
*
|
||||
* e.g.
|
||||
* .container {
|
||||
* }
|
||||
*/
|
||||
.page-sign-up {
|
||||
|
||||
.section {
|
||||
min-height: 63vh;
|
||||
justify-content: center;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,269 @@
|
||||
import styles from './index.module.scss';
|
||||
import axios from "axios";
|
||||
import delve from 'dlv';
|
||||
import {useRouter} from "next/router";
|
||||
import {SubmitHandler, useForm} from 'react-hook-form';
|
||||
import {BehaviorSubject, catchError, debounceTime, distinctUntilChanged, filter, map, of, switchMap} from "rxjs";
|
||||
import {useEffect, useState} from "react";
|
||||
|
||||
import SeoConfig from "../../components/seo-config/seo-config";
|
||||
import Layout from "../../components/layout/layout";
|
||||
import {Inputs, signUpRequest} from "../../libs/api";
|
||||
import {createJwtToken} from "../../libs/auth";
|
||||
import {config} from "../../config";
|
||||
import {environment} from "../../environments/environment";
|
||||
|
||||
const getPageMetadata = async (path) => {
|
||||
try {
|
||||
return await axios.get(`${environment.strapiApiUrl}/pages?filters[slug]=${path === '/' ? 'home' : path.slice(1, path.length)}&populate=deep`);
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
return Promise.resolve({})
|
||||
}
|
||||
}
|
||||
|
||||
export const getServerSideProps = async (context) => {
|
||||
const path = context.resolvedUrl;
|
||||
const menuHeader = await axios.get(`${environment.strapiApiUrl}/menus/1?nested&populate=deep`);
|
||||
const menuFooter = await axios.get(`${environment.strapiApiUrl}/menus/2?nested&populate=deep`);
|
||||
const page = await getPageMetadata(path);
|
||||
|
||||
return {
|
||||
props: {
|
||||
menuHeaders: delve(menuHeader, 'data.data.attributes.items.data', []),
|
||||
menuFooter: delve(menuFooter, 'data.data.attributes.items.data', []),
|
||||
page: delve(page, "data.data.0.attributes", {}),
|
||||
seo: delve(page, "data.data.0.attributes.seo", {})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export function SignUp({seo, menuHeaders, menuFooter}) {
|
||||
const router = useRouter();
|
||||
const {register, handleSubmit, watch, getValues, formState: {errors}, setError, clearErrors} = useForm({
|
||||
defaultValues: {
|
||||
email: "",
|
||||
username: "",
|
||||
password: "",
|
||||
passwordConfirmation: "",
|
||||
agreement: false,
|
||||
newsletter: false,
|
||||
}
|
||||
});
|
||||
const [spinner, setSpinner] = useState(false);
|
||||
const [subject, setSubject] = useState(null);
|
||||
|
||||
useEffect(() => {
|
||||
if (subject === null) {
|
||||
const sub = new BehaviorSubject('');
|
||||
setSubject(sub);
|
||||
} else {
|
||||
subject.pipe(
|
||||
map((s: string) => s.trim()),
|
||||
distinctUntilChanged(),
|
||||
filter((s: string) => s.length >= 2),
|
||||
debounceTime(200),
|
||||
switchMap(async (value) => {
|
||||
setSpinner(true);
|
||||
const result = await axios.get(`http://localhost:1337/api/username/${value}`)
|
||||
if (result.data) {
|
||||
setError('email', {type: 'custom', message: "Cet email est déjà utilisé. Veuillez en saisir un autre."});
|
||||
} else {
|
||||
clearErrors('email');
|
||||
}
|
||||
}),
|
||||
catchError((err) => of(false))
|
||||
).subscribe(() => setSpinner(false));
|
||||
}
|
||||
}, [subject]);
|
||||
|
||||
const onSubmit: SubmitHandler<Inputs> = async (data: Inputs) => {
|
||||
try {
|
||||
const response = await signUpRequest(data);
|
||||
if (response && response.user) {
|
||||
if (response.user.confirmed) {
|
||||
const result = await createJwtToken(data.email, data.password);
|
||||
if (result.ok) {
|
||||
await router.replace('/');
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
await router.push('/signup-confirmation')
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
throw new Error('no registered');
|
||||
}
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
}
|
||||
};
|
||||
|
||||
const onEmailChange = (e) => subject.next(e.target.value);
|
||||
|
||||
const hasErrors = () => Object.keys(errors).length > 0;
|
||||
|
||||
return (
|
||||
<>
|
||||
<SeoConfig {...seo}/>
|
||||
<Layout menuHeader={menuHeaders} menuFooter={menuFooter}>
|
||||
<div className={styles['page-sign-up']}>
|
||||
<section className={styles['section']}>
|
||||
<div className="container px-6 py-4 md:py-12 h-full mx-auto">
|
||||
<div className="flex justify-center items-center flex-wrap h-full g-6 text-gray-800">
|
||||
<div className="md:w-8/12 lg:w-6/12">
|
||||
<div
|
||||
className="w-full max-w-[560px] p-4 bg-white border border-gray-200 rounded-lg shadow-md sm:p-6 md:p-8 dark:bg-gray-800 dark:border-gray-700">
|
||||
<form className="space-y-6" onSubmit={handleSubmit(onSubmit)}>
|
||||
<header className="text-left block">
|
||||
<h3 className="text-3xl font-normal dark:text-white mb-6">Création de votre compte</h3>
|
||||
<p className="mb-6 text-base font-normal text-gray-500 dark:text-gray-400">
|
||||
Créez un compte gratuit 100% sécurisé. <br/>Vous avez déjà un compte ? <a href="/sign-in"
|
||||
className="font-medium text-blue-600 dark:text-blue-500 hover:underline"
|
||||
target="_self">
|
||||
Connectez-vous ici
|
||||
</a>.
|
||||
</p>
|
||||
</header>
|
||||
<main>
|
||||
<section className="grid grid-cols-1 md:grid-cols-2 gap-4">
|
||||
<div>
|
||||
<label htmlFor="email"
|
||||
className="block mb-2 text-sm font-medium text-gray-900 dark:text-white">
|
||||
E-mail
|
||||
</label>
|
||||
<div className="relative">
|
||||
{spinner && (
|
||||
<div className="absolute inset-y-0 right-0 flex items-center pr-1 pointer-events-none">
|
||||
<svg aria-hidden="true"
|
||||
className="w-5 h-5 mr-2 text-gray-200 animate-spin dark:text-gray-600 fill-blue-600"
|
||||
viewBox="0 0 100 101" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path
|
||||
d="M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z"
|
||||
fill="currentColor"/>
|
||||
<path
|
||||
d="M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z"
|
||||
fill="currentFill"/>
|
||||
</svg>
|
||||
<span className="sr-only">Loading...</span>
|
||||
</div>)}
|
||||
<input type="email"
|
||||
name="email"
|
||||
id="email"
|
||||
{...register("email", {required: "L'email est requis"})}
|
||||
onChange={onEmailChange}
|
||||
className={errors.email ? 'bg-red-50 border border-red-500 text-red-900 placeholder-red-700 text-sm rounded-lg focus:ring-red-500 dark:bg-gray-700 focus:border-red-500 block w-full p-2.5 dark:text-red-500 dark:placeholder-red-500 dark:border-red-500' : 'bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full pr-10 p-2.5 dark:bg-gray-600 dark:border-gray-500 dark:placeholder-gray-400 dark:text-white'}
|
||||
placeholder="name@company.com"/>
|
||||
{errors.email && (
|
||||
<p className="mt-2 text-sm text-red-600 dark:text-red-500">{errors.email.message}</p>)}
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<label htmlFor="username"
|
||||
className="block mb-2 text-sm font-medium text-gray-900 dark:text-white">
|
||||
Nom d'utilisateur
|
||||
</label>
|
||||
<input type="text"
|
||||
name="username"
|
||||
id="username"
|
||||
{...register("username", {required: "Le nom d'utilisateur est requis"})}
|
||||
className={errors.username ? "bg-red-50 border border-red-500 text-red-900 placeholder-red-700 text-sm rounded-lg focus:ring-red-500 dark:bg-gray-700 focus:border-red-500 block w-full p-2.5 dark:text-red-500 dark:placeholder-red-500 dark:border-red-500" : "bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-600 dark:border-gray-500 dark:placeholder-gray-400 dark:text-white"}
|
||||
placeholder="JohnDoe"/>
|
||||
{errors.username && (
|
||||
<p className="mt-2 text-sm text-red-600 dark:text-red-500">{errors.username.message}</p>)}
|
||||
</div>
|
||||
<div>
|
||||
<label htmlFor="password"
|
||||
className="block mb-2 text-sm font-medium text-gray-900 dark:text-white">
|
||||
Mot de passe
|
||||
</label>
|
||||
<input type="password"
|
||||
name="password"
|
||||
id="password"
|
||||
{...register("password", {required: "Le mot de passe est requis", minLength: 8})}
|
||||
className={errors.password ? "bg-red-50 border border-red-500 text-red-900 placeholder-red-700 text-sm rounded-lg focus:ring-red-500 dark:bg-gray-700 focus:border-red-500 block w-full p-2.5 dark:text-red-500 dark:placeholder-red-500 dark:border-red-500" : "bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-600 dark:border-gray-500 dark:placeholder-gray-400 dark:text-white"}
|
||||
placeholder=""/>
|
||||
{errors.password && errors.password.type !== "minLength" && (
|
||||
<p className="mt-2 text-sm text-red-600 dark:text-red-500">{errors.password.message}</p>)}
|
||||
{errors.password && errors.password.type === "minLength" && (
|
||||
<p className="mt-2 text-sm text-red-600 dark:text-red-500">Le mot de passe doit avoir une
|
||||
longueur minimum de 8 charactères</p>)}
|
||||
</div>
|
||||
<div>
|
||||
<label htmlFor="passwordConfirmation"
|
||||
className="block mb-2 text-sm font-medium text-gray-900 dark:text-white">
|
||||
Confirmez le mot de passe
|
||||
</label>
|
||||
<input type="password"
|
||||
name="passwordConfirmation"
|
||||
id="passwordConfirmation"
|
||||
{...register("passwordConfirmation", {
|
||||
required: "Veuillez confirmer le mot de passe", validate: {
|
||||
matchesPreviousPassword: (value) => {
|
||||
const {password} = getValues();
|
||||
return password === value || "Les mots de passe ne correspondent pas";
|
||||
}
|
||||
}
|
||||
})}
|
||||
className={errors.passwordConfirmation ? "bg-red-50 border border-red-500 text-red-900 placeholder-red-700 text-sm rounded-lg focus:ring-red-500 dark:bg-gray-700 focus:border-red-500 block w-full p-2.5 dark:text-red-500 dark:placeholder-red-500 dark:border-red-500" : "bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-600 dark:border-gray-500 dark:placeholder-gray-400 dark:text-white"}
|
||||
placeholder=""/>
|
||||
{errors.passwordConfirmation && (
|
||||
<p
|
||||
className="mt-2 text-sm text-red-600 dark:text-red-500">{errors.passwordConfirmation.message}</p>)}
|
||||
</div>
|
||||
</section>
|
||||
<section className="py-5">
|
||||
<div className="flex items-center">
|
||||
<input id="agreement"
|
||||
type="checkbox"
|
||||
value=""
|
||||
name="agreement"
|
||||
{...register("agreement", {required: "Vous devez accepter les conditions d'utilisation"})}
|
||||
className="w-4 h-4 border border-gray-300 rounded bg-gray-50 focus:ring-3 focus:ring-blue-300 dark:bg-gray-700 dark:border-gray-600 dark:focus:ring-blue-600 dark:ring-offset-gray-800 dark:focus:ring-offset-gray-800"/>
|
||||
<label htmlFor="agreement"
|
||||
className="ml-2 text-sm font-medium text-gray-900 dark:text-gray-300">
|
||||
En vous inscrivant, vous créez un compte MeCP et vous acceptez les conditions
|
||||
d'utilisation et la politique de confidentialité de MeCP.
|
||||
</label>
|
||||
</div>
|
||||
{errors.agreement && (
|
||||
<p className="mt-2 text-sm text-red-600 dark:text-red-500">{errors.agreement.message}</p>)}
|
||||
</section>
|
||||
<section className="flex items-center pb-5">
|
||||
<input id="newsletter"
|
||||
type="checkbox"
|
||||
value=""
|
||||
name="newsletter"
|
||||
{...register("newsletter")}
|
||||
className="w-4 h-4 border border-gray-300 rounded bg-gray-50 focus:ring-3 focus:ring-blue-300 dark:bg-gray-700 dark:border-gray-600 dark:focus:ring-blue-600 dark:ring-offset-gray-800 dark:focus:ring-offset-gray-800"/>
|
||||
<label htmlFor="newsletter"
|
||||
className="ml-2 text-sm font-medium text-gray-900 dark:text-gray-300">
|
||||
Envoyez-moi un e-mail sur les mises à jour de l'école, des cours et les produits.
|
||||
</label>
|
||||
</section>
|
||||
<section className="flex items-center pt-5">
|
||||
<button type="submit"
|
||||
className="text-white bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:ring-blue-300 font-medium rounded-lg text-sm px-5 py-2.5 mr-2 mb-2 dark:bg-blue-600 dark:hover:bg-blue-700 focus:outline-none dark:focus:ring-blue-800 w-full disabled:bg-gray-500 focus:disabled:bg-gray-500 hover:disabled:bg-gray-500"
|
||||
data-mdb-ripple="true"
|
||||
data-mdb-ripple-color="light" disabled={hasErrors()}>
|
||||
Inscription
|
||||
</button>
|
||||
</section>
|
||||
</main>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<div className="md:w-8/12 lg:w-6/12 mb-12 md:mb-0 hidden md:block">
|
||||
<img src="https://mdbcdn.b-cdn.net/img/Photos/new-templates/bootstrap-login-form/draw2.png"
|
||||
className="w-full" alt="Phone image"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</Layout>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
export default SignUp;
|
||||
@ -0,0 +1,7 @@
|
||||
/*
|
||||
* Replace this with your own classes
|
||||
*
|
||||
* e.g.
|
||||
* .container {
|
||||
* }
|
||||
*/
|
||||
@ -0,0 +1,44 @@
|
||||
import axios from "axios";
|
||||
import delve from 'dlv';
|
||||
|
||||
import SeoConfig from "../../components/seo-config/seo-config";
|
||||
import Layout from "../../components/layout/layout";
|
||||
import {config} from "../../config";
|
||||
import {environment} from "../../environments/environment";
|
||||
|
||||
const getPageMetadata = async (path) => {
|
||||
try {
|
||||
return await axios.get(`${environment.strapiApiUrl}/pages?filters[slug]=${path === '/' ? 'home' : path.slice(1, path.length)}&populate=deep`);
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
return Promise.resolve({})
|
||||
}
|
||||
}
|
||||
|
||||
export const getServerSideProps = async (context) => {
|
||||
const path = context.resolvedUrl;
|
||||
const menuHeader = await axios.get(`${environment.strapiApiUrl}/menus/1?nested&populate=deep`);
|
||||
const menuFooter = await axios.get(`${environment.strapiApiUrl}/menus/2?nested&populate=deep`);
|
||||
const page = await getPageMetadata(path);
|
||||
return {
|
||||
props: {
|
||||
menuHeader: delve(menuHeader, 'data.data.attributes.items.data', []),
|
||||
menuFooter: delve(menuFooter, 'data.data.attributes.items.data', []),
|
||||
page: delve(page, "data.data.0.attributes", {}),
|
||||
seo: delve(page, "data.data.0.attributes.seo", {})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export function SignupConfirmation({menuHeader, menuFooter, page, seo}) {
|
||||
return (
|
||||
<>
|
||||
<SeoConfig {...seo}/>
|
||||
<Layout menuHeader={menuHeader} menuFooter={menuFooter}>
|
||||
<p>Page d'accueil</p>
|
||||
</Layout>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
export default SignupConfirmation;
|
||||
@ -0,0 +1,14 @@
|
||||
@import 'tailwindcss/base.css';
|
||||
@import 'tailwindcss/components.css';
|
||||
@import 'tailwindcss/utilities.css';
|
||||
|
||||
html, body {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
body #__next {
|
||||
position: relative;
|
||||
height: 100%;
|
||||
}
|
||||
@ -0,0 +1,17 @@
|
||||
const {join} = require('path');
|
||||
|
||||
// Note: If you use library-specific PostCSS/Tailwind configuration then you should remove the `postcssConfig` build
|
||||
// option from your application's configuration (i.e. project.json).
|
||||
//
|
||||
// See: https://nx.dev/guides/using-tailwind-css-in-react#step-4:-applying-configuration-to-libraries
|
||||
|
||||
module.exports = {
|
||||
plugins: {
|
||||
'postcss-import': {},
|
||||
'tailwindcss/nesting': {},
|
||||
tailwindcss: {
|
||||
config: join(__dirname, 'tailwind.config.js'),
|
||||
},
|
||||
autoprefixer: {},
|
||||
},
|
||||
};
|
||||
@ -0,0 +1,95 @@
|
||||
{
|
||||
"name": "website",
|
||||
"$schema": "../../node_modules/nx/schemas/project-schema.json",
|
||||
"sourceRoot": "apps/website",
|
||||
"projectType": "application",
|
||||
"targets": {
|
||||
"build": {
|
||||
"executor": "@nrwl/next:build",
|
||||
"outputs": [
|
||||
"{options.outputPath}"
|
||||
],
|
||||
"defaultConfiguration": "development",
|
||||
"options": {
|
||||
"root": "apps/website",
|
||||
"outputPath": "dist/apps/website"
|
||||
},
|
||||
"configurations": {
|
||||
"development": {
|
||||
"fileReplacements": [
|
||||
{
|
||||
"replace": "apps/website/environments/environment.ts",
|
||||
"with": "apps/website/environments/environment.development.ts"
|
||||
}
|
||||
],
|
||||
"outputPath": "apps/website"
|
||||
},
|
||||
"staging": {
|
||||
"fileReplacements": [
|
||||
{
|
||||
"replace": "apps/website/environments/environment.ts",
|
||||
"with": "apps/website/environments/environment.staging.ts"
|
||||
}
|
||||
]
|
||||
},
|
||||
"production": {
|
||||
"fileReplacements": [
|
||||
{
|
||||
"replace": "apps/website/environments/environment.ts",
|
||||
"with": "apps/website/environments/environment.prod.ts"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"serve": {
|
||||
"executor": "@nrwl/next:server",
|
||||
"defaultConfiguration": "development",
|
||||
"options": {
|
||||
"buildTarget": "website:build",
|
||||
"dev": true
|
||||
},
|
||||
"configurations": {
|
||||
"development": {
|
||||
"buildTarget": "website:build:development",
|
||||
"dev": true
|
||||
},
|
||||
"staging": {
|
||||
"buildTarget": "website:build:staging",
|
||||
"dev": false
|
||||
},
|
||||
"production": {
|
||||
"buildTarget": "website:build:production",
|
||||
"dev": false
|
||||
}
|
||||
}
|
||||
},
|
||||
"export": {
|
||||
"executor": "@nrwl/next:export",
|
||||
"options": {
|
||||
"buildTarget": "website:build:production"
|
||||
}
|
||||
},
|
||||
"test": {
|
||||
"executor": "@nrwl/jest:jest",
|
||||
"outputs": [
|
||||
"{workspaceRoot}/coverage/{projectRoot}"
|
||||
],
|
||||
"options": {
|
||||
"jestConfig": "apps/website/jest.config.ts"
|
||||
}
|
||||
},
|
||||
"lint": {
|
||||
"executor": "@nrwl/linter:eslint",
|
||||
"outputs": [
|
||||
"{options.outputFile}"
|
||||
],
|
||||
"options": {
|
||||
"lintFilePatterns": [
|
||||
"apps/website/**/*.{ts,tsx,js,jsx}"
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"tags": []
|
||||
}
|
||||
|
After Width: | Height: | Size: 140 KiB |
@ -0,0 +1,18 @@
|
||||
const {createGlobPatternsForDependencies} = require('@nrwl/react/tailwind');
|
||||
const {join} = require('path');
|
||||
|
||||
/** @type {import('tailwindcss').Config} */
|
||||
module.exports = {
|
||||
content: [
|
||||
join(
|
||||
__dirname,
|
||||
'{src,pages,components}/**/*!(*.stories|*.spec).{ts,tsx,html}'
|
||||
),
|
||||
...createGlobPatternsForDependencies(__dirname),
|
||||
],
|
||||
theme: {
|
||||
extend: {},
|
||||
},
|
||||
plugins: [],
|
||||
darkMode: 'class'
|
||||
};
|
||||
@ -1,11 +1,10 @@
|
||||
import React from 'react';
|
||||
import { render } from '@testing-library/react';
|
||||
|
||||
import Index from '../pages/index';
|
||||
import Carousel from '../components/carousel/carousel';
|
||||
|
||||
describe('Index', () => {
|
||||
describe('Carousel', () => {
|
||||
it('should render successfully', () => {
|
||||
const { baseElement } = render(<Index />);
|
||||
const { baseElement } = render(<Carousel />);
|
||||
expect(baseElement).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@ -0,0 +1,10 @@
|
||||
import {render} from '@testing-library/react';
|
||||
|
||||
import Footer from '../components/footer/footer';
|
||||
|
||||
describe('Footer', () => {
|
||||
it('should render successfully', () => {
|
||||
const {baseElement} = render(<Footer/>);
|
||||
expect(baseElement).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@ -0,0 +1,25 @@
|
||||
import {render} from '@testing-library/react';
|
||||
|
||||
import Header from '../components/header/header';
|
||||
|
||||
jest.mock("next-auth/react", () => {
|
||||
const originalModule = jest.requireActual('next-auth/react');
|
||||
const mockSession = {
|
||||
expires: new Date(Date.now() + 2 * 86400).toISOString(),
|
||||
user: {username: "admin"}
|
||||
};
|
||||
return {
|
||||
__esModule: true,
|
||||
...originalModule,
|
||||
useSession: jest.fn(() => {
|
||||
return {data: mockSession, status: 'authenticated'} // return type is [] in v3 but changed to {} in v4
|
||||
}),
|
||||
};
|
||||
});
|
||||
|
||||
describe('Header', () => {
|
||||
it('should render successfully', () => {
|
||||
const {baseElement} = render(<Header/>);
|
||||
expect(baseElement).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@ -0,0 +1,26 @@
|
||||
import React from 'react';
|
||||
import {render} from '@testing-library/react';
|
||||
|
||||
import Index from '../pages/index';
|
||||
|
||||
jest.mock("next-auth/react", () => {
|
||||
const originalModule = jest.requireActual('next-auth/react');
|
||||
const mockSession = {
|
||||
expires: new Date(Date.now() + 2 * 86400).toISOString(),
|
||||
user: {username: "admin"}
|
||||
};
|
||||
return {
|
||||
__esModule: true,
|
||||
...originalModule,
|
||||
useSession: jest.fn(() => {
|
||||
return {data: mockSession, status: 'authenticated'} // return type is [] in v3 but changed to {} in v4
|
||||
}),
|
||||
};
|
||||
});
|
||||
|
||||
describe('Index', () => {
|
||||
it('should render successfully', () => {
|
||||
const {baseElement} = render(<Index/>);
|
||||
expect(baseElement).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@ -0,0 +1,25 @@
|
||||
import {render} from '@testing-library/react';
|
||||
|
||||
import Layout from '../components/layout/layout';
|
||||
|
||||
jest.mock("next-auth/react", () => {
|
||||
const originalModule = jest.requireActual('next-auth/react');
|
||||
const mockSession = {
|
||||
expires: new Date(Date.now() + 2 * 86400).toISOString(),
|
||||
user: {username: "admin"}
|
||||
};
|
||||
return {
|
||||
__esModule: true,
|
||||
...originalModule,
|
||||
useSession: jest.fn(() => {
|
||||
return {data: mockSession, status: 'authenticated'} // return type is [] in v3 but changed to {} in v4
|
||||
}),
|
||||
};
|
||||
});
|
||||
|
||||
describe('Layout', () => {
|
||||
it('should render successfully', () => {
|
||||
const {baseElement} = render(<Layout/>);
|
||||
expect(baseElement).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@ -0,0 +1,10 @@
|
||||
import {render} from '@testing-library/react';
|
||||
|
||||
import SeoConfig from '../components/seo-config/seo-config';
|
||||
|
||||
describe('SeoConfig', () => {
|
||||
it('should render successfully', () => {
|
||||
const {baseElement} = render(<SeoConfig/>);
|
||||
expect(baseElement).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@ -0,0 +1,176 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.withNx = void 0;
|
||||
const tslib_1 = require("tslib");
|
||||
function regexEqual(x, y) {
|
||||
return (x instanceof RegExp &&
|
||||
y instanceof RegExp &&
|
||||
x.source === y.source &&
|
||||
x.global === y.global &&
|
||||
x.ignoreCase === y.ignoreCase &&
|
||||
x.multiline === y.multiline);
|
||||
}
|
||||
/**
|
||||
* Do not remove or rename this function. Production builds inline `with-nx.js` file with a replacement
|
||||
* To this function that hard-codes the libsDir.
|
||||
*/
|
||||
function getWithNxContext() {
|
||||
return {
|
||||
workspaceRoot: '/Users/snaser/Projets/nx-guitar-school',
|
||||
libsDir: 'libs'
|
||||
}
|
||||
}
|
||||
function withNx(nextConfig = {}, context = getWithNxContext()) {
|
||||
var _a;
|
||||
// If `next-compose-plugins` is used, the context argument is invalid.
|
||||
if (!context.libsDir || !context.workspaceRoot) {
|
||||
context = getWithNxContext();
|
||||
}
|
||||
const userWebpack = nextConfig.webpack || ((x) => x);
|
||||
const { nx } = nextConfig, validNextConfig = tslib_1.__rest(nextConfig, ["nx"]);
|
||||
return Object.assign(Object.assign({ eslint: Object.assign({ ignoreDuringBuilds: true }, ((_a = validNextConfig.eslint) !== null && _a !== void 0 ? _a : {})) }, validNextConfig), { webpack: (config, options) => {
|
||||
/*
|
||||
* Update babel to support our monorepo setup.
|
||||
* The 'upward' mode allows the root babel.config.json and per-project .babelrc files to be picked up.
|
||||
*/
|
||||
options.defaultLoaders.babel.options.babelrc = true;
|
||||
options.defaultLoaders.babel.options.rootMode = 'upward';
|
||||
/*
|
||||
* Modify the Next.js webpack config to allow workspace libs to use css modules.
|
||||
* Note: This would be easier if Next.js exposes css-loader and sass-loader on `defaultLoaders`.
|
||||
*/
|
||||
// Include workspace libs in css/sass loaders
|
||||
const includes = [
|
||||
require('path').join(context.workspaceRoot, context.libsDir),
|
||||
];
|
||||
const nextCssLoaders = config.module.rules.find((rule) => typeof rule.oneOf === 'object');
|
||||
// webpack config is not as expected
|
||||
if (!nextCssLoaders)
|
||||
return config;
|
||||
/*
|
||||
* 1. Modify css loader to enable module support for workspace libs
|
||||
*/
|
||||
const nextCssLoader = nextCssLoaders.oneOf.find((rule) => rule.sideEffects === false && regexEqual(rule.test, /\.module\.css$/));
|
||||
// Might not be found if Next.js webpack config changes in the future
|
||||
if (nextCssLoader && nextCssLoader.issuer) {
|
||||
nextCssLoader.issuer.or = nextCssLoader.issuer.and
|
||||
? nextCssLoader.issuer.and.concat(includes)
|
||||
: includes;
|
||||
delete nextCssLoader.issuer.and;
|
||||
}
|
||||
/*
|
||||
* 2. Modify sass loader to enable module support for workspace libs
|
||||
*/
|
||||
const nextSassLoader = nextCssLoaders.oneOf.find((rule) => rule.sideEffects === false &&
|
||||
regexEqual(rule.test, /\.module\.(scss|sass)$/));
|
||||
// Might not be found if Next.js webpack config changes in the future
|
||||
if (nextSassLoader && nextSassLoader.issuer) {
|
||||
nextSassLoader.issuer.or = nextSassLoader.issuer.and
|
||||
? nextSassLoader.issuer.and.concat(includes)
|
||||
: includes;
|
||||
delete nextSassLoader.issuer.and;
|
||||
}
|
||||
/*
|
||||
* 3. Modify error loader to ignore css modules used by workspace libs
|
||||
*/
|
||||
const nextErrorCssModuleLoader = nextCssLoaders.oneOf.find((rule) => rule.use &&
|
||||
rule.use.loader === 'error-loader' &&
|
||||
rule.use.options &&
|
||||
(rule.use.options.reason ===
|
||||
'CSS Modules \u001b[1mcannot\u001b[22m be imported from within \u001b[1mnode_modules\u001b[22m.\n' +
|
||||
'Read more: https://err.sh/next.js/css-modules-npm' ||
|
||||
rule.use.options.reason ===
|
||||
'CSS Modules cannot be imported from within node_modules.\nRead more: https://err.sh/next.js/css-modules-npm'));
|
||||
// Might not be found if Next.js webpack config changes in the future
|
||||
if (nextErrorCssModuleLoader) {
|
||||
nextErrorCssModuleLoader.exclude = includes;
|
||||
}
|
||||
/**
|
||||
* 4. Modify css loader to allow global css from node_modules to be imported from workspace libs
|
||||
*/
|
||||
const nextGlobalCssLoader = nextCssLoaders.oneOf.find((rule) => {
|
||||
var _a, _b;
|
||||
return (_b = (_a = rule.include) === null || _a === void 0 ? void 0 : _a.and) === null || _b === void 0 ? void 0 : _b.find((include) => regexEqual(include, /node_modules/));
|
||||
});
|
||||
// Might not be found if Next.js webpack config changes in the future
|
||||
if (nextGlobalCssLoader && nextGlobalCssLoader.issuer) {
|
||||
nextGlobalCssLoader.issuer.or = nextGlobalCssLoader.issuer.and
|
||||
? nextGlobalCssLoader.issuer.and.concat(includes)
|
||||
: includes;
|
||||
delete nextGlobalCssLoader.issuer.and;
|
||||
}
|
||||
/**
|
||||
* 5. Add env variables prefixed with NX_
|
||||
*/
|
||||
addNxEnvVariables(config);
|
||||
/**
|
||||
* 6. Add SVGR support if option is on.
|
||||
*/
|
||||
// Default SVGR support to be on for projects.
|
||||
if ((nx === null || nx === void 0 ? void 0 : nx.svgr) !== false) {
|
||||
config.module.rules.push({
|
||||
test: /\.svg$/,
|
||||
oneOf: [
|
||||
// If coming from JS/TS file, then transform into React component using SVGR.
|
||||
{
|
||||
issuer: /\.[jt]sx?$/,
|
||||
use: [
|
||||
{
|
||||
loader: require.resolve('@svgr/webpack'),
|
||||
options: {
|
||||
svgo: false,
|
||||
titleProp: true,
|
||||
ref: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
loader: require.resolve('url-loader'),
|
||||
options: {
|
||||
limit: 10000,
|
||||
name: '[name].[hash:7].[ext]',
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
// Fallback to plain URL loader if someone just imports the SVG and references it on the <img src> tag
|
||||
{
|
||||
loader: require.resolve('url-loader'),
|
||||
options: {
|
||||
limit: 10000,
|
||||
name: '[name].[hash:7].[ext]',
|
||||
},
|
||||
},
|
||||
],
|
||||
});
|
||||
}
|
||||
return userWebpack(config, options);
|
||||
} });
|
||||
}
|
||||
exports.withNx = withNx;
|
||||
function getNxEnvironmentVariables() {
|
||||
return Object.keys(process.env)
|
||||
.filter((env) => /^NX_/i.test(env))
|
||||
.reduce((env, key) => {
|
||||
env[key] = process.env[key];
|
||||
return env;
|
||||
}, {});
|
||||
}
|
||||
function addNxEnvVariables(config) {
|
||||
var _a;
|
||||
const maybeDefinePlugin = (_a = config.plugins) === null || _a === void 0 ? void 0 : _a.find((plugin) => {
|
||||
var _a;
|
||||
return (_a = plugin.definitions) === null || _a === void 0 ? void 0 : _a['process.env.NODE_ENV'];
|
||||
});
|
||||
if (maybeDefinePlugin) {
|
||||
const env = getNxEnvironmentVariables();
|
||||
Object.entries(env)
|
||||
.map(([name, value]) => [`process.env.${name}`, `"${value}"`])
|
||||
.filter(([name]) => !maybeDefinePlugin.definitions[name])
|
||||
.forEach(([name, value]) => (maybeDefinePlugin.definitions[name] = value));
|
||||
}
|
||||
}
|
||||
// Support for older generated code: `const withNx = require('@nrwl/next/plugins/with-nx');`
|
||||
module.exports = withNx;
|
||||
// Support for newer generated code: `const { withNx } = require(...);`
|
||||
module.exports.withNx = withNx;
|
||||
//# sourceMappingURL=with-nx.js.map
|
||||
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,5 @@
|
||||
const fs = require('fs');
|
||||
const fse = require('fs-extra');
|
||||
const path = require('path');
|
||||
|
||||
fs.copyFileSync(path.join(__dirname, 'sources/server.js'), path.join(__dirname, '..', '..', 'dist/apps/website/server.js'));
|
||||
@ -0,0 +1,8 @@
|
||||
const path = require('path');
|
||||
|
||||
const nextPath = path.join(__dirname, 'node_modules', '.bin', 'next');
|
||||
|
||||
process.argv.length = 1;
|
||||
process.argv.push(nextPath, 'start');
|
||||
|
||||
require(nextPath);
|
||||
Loading…
Reference in new issue