Compare commits

...

60 Commits

Author SHA1 Message Date
Näser b5af543a0e chore: Create vendors app
3 years ago
Näser fd79d99444 Merge branch 'feature/filter-column' into develop
3 years ago
Näser 670ae72b1a feat: Create aside filters with categories and others sections
3 years ago
Näser adceb78cf7 feat: Create shop page with filter and product slug pages
3 years ago
Näser 851973d740 Merge branch 'feature/optimization' into develop
3 years ago
Näser 3ef85651d2 feat: Add all skeleton pages
3 years ago
Näser fe34429c5a fix: replace iframe by react-player
3 years ago
Näser 83d807cd27 fix: fix aria-label missing
3 years ago
Näser d4ab120bd7 fix: adjust CSS rules for links into footer section
3 years ago
Näser 666e9aa724 fix: Ajuste some CSS rules and next config for images
3 years ago
Näser 0b92be0942 chore: add remotePatterns
3 years ago
Näser b9f109b7fb Merge branch 'feature/homepage' into develop
3 years ago
Näser 38cc1118ab fix: fix meiliesearch API Key
3 years ago
Näser 17af949ec7 feat: add meilisearch key in staging environment
3 years ago
Näser 69cf478959 test: fix unit tests
3 years ago
Näser 90b2218b5a feat: add dark mode compatibility
3 years ago
Näser 8c28b6e25a feat: add blog section into home page
3 years ago
Näser 5315b6a5ac feat: ajust css rules & add cover background
3 years ago
Näser 65c32b7d35 feat: Add home section components
3 years ago
Näser d5ee140886 Merge branch 'feature/blog' into develop
3 years ago
Näser fdebcbea74 feat: Add search engine
3 years ago
Näser 7f8e5dd903 feat: Add blogs components
3 years ago
Näser 140b61e1d7 style: refactor initial props
3 years ago
Näser efb5eabcce fix: fix types error
3 years ago
Näser bf47ddaa05 Merge branch 'feature/scripts-sh' into develop
3 years ago
Näser 3bd16781d9 test: enable lcov report
3 years ago
Näser 00410dd865 test: add scannerwork folder into gitignore file
3 years ago
Näser e7828d1c60 test: change sonarqube url
3 years ago
Näser a7ee0ad53e test: correction from sonarqube rapport
3 years ago
Näser b1c5e7c4ac test: remove report xml path
3 years ago
Näser 38fd5a1abe test: move tests into folder and add test files in exclude list
3 years ago
Näser 7fb96c3ca5 test: add exclusions into sonar-project.properties
3 years ago
Näser e633ccc293 test: update sonarqube URL
3 years ago
Näser c6d0f7db9f test: update script analysis.sh
3 years ago
Näser a180b69fce test: update script analysis.sh
3 years ago
Näser 652bedd65d update mode
3 years ago
Näser 478f2cfa8f test: update script analysis.sh
3 years ago
Näser 79285e82fb update mode
3 years ago
Näser f1cdb895c1 test: add custom script sh
3 years ago
Näser 12bc46a7d2 Merge branch 'feature/unit-tests' into develop
3 years ago
Näser 32d41899a0 test: add sonar-project.properties
3 years ago
Näser 9ef38eec00 test: active coverage from jest
3 years ago
Näser 2e6a26a53e test: enable basic unit tests
3 years ago
Näser ae9db20c92 feat: Update package-lock.json
3 years ago
Näser 0e8121bc25 Merge branch 'feature/lost-password' into develop
3 years ago
Näser 61b1e36348 feat: add forgot and reset password pages
3 years ago
Näser 9769cbb246 Merge branch 'bugfix/deploiement-scripts' into develop
3 years ago
Näser e8de043e9d chore: add script npm for postbuild website staging
3 years ago
Näser fa3ddac572 Merge branch 'feature/configuration-deploiement' into develop
3 years ago
Näser c8ba3ff733 chore: add build tools for website
3 years ago
Näser 2009608698 chore: add build tools for strapi backend
3 years ago
Näser 2266345b56 chore: move client to website folder
3 years ago
Näser 233ce6fea4 feat: Add mysql client
3 years ago
Näser 4eca5855b4 Merge branch 'feature/add-authentication' into develop
3 years ago
Näser b29f4a411e feat: Add authentication
3 years ago
Näser e0dbb351a9 Merge branch 'feature/add-projects' into develop
3 years ago
Näser eb612e0bf2 Merge branch 'feature/configure-backend-project' into feature/add-projects
3 years ago
Näser f8fbd9aaa4 feat: Add global layout
3 years ago
Näser 33f322383c chore: add postgres configuration
3 years ago
Näser ee8f9a512a chore: add backend project
3 years ago

@ -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

3
.gitignore vendored

@ -27,12 +27,13 @@ node_modules
# misc # misc
/.sass-cache /.sass-cache
/connect.lock /connect.lock
/coverage **/coverage
/libpeerconnection.log /libpeerconnection.log
npm-debug.log npm-debug.log
yarn-error.log yarn-error.log
testem.log testem.log
/typings /typings
**/.scannerwork
# System Files # System Files
.DS_Store .DS_Store

@ -1,21 +1,15 @@
# NxGuitarSchool # NxGuitarSchool
<a href="https://nx.dev" target="_blank" rel="noreferrer"><img src="https://raw.githubusercontent.com/nrwl/nx/master/images/nx-logo.png" width="45"></a> ### Comptes
**This workspace has been generated by [Nx, a Smart, fast and extensible build system.](https://nx.dev)** #### FTP
## Development server Username : superadmin@naserloud.fr
mot de passe : =H*S9g**=S$s*(.S5g
host : node143-eu.n0c.com
Run `nx serve client` for a dev server. Navigate to http://localhost:4200/. The app will automatically reload if you change any of the source files. ### SSH
command : ssh dpxtrufj@node143-eu.n0c.com -port 5502
mdp : xVarAG3bsEJe8T
## Understand this workspace
Run `nx graph` to see a diagram of the dependencies of the projects.
## Remote caching
Run `npx nx connect-to-nx-cloud` to enable [remote caching](https://nx.app) and make CI faster.
## Further help
Visit the [Nx Documentation](https://nx.dev) to learn more.

@ -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,17 +0,0 @@
//@ts-check
// eslint-disable-next-line @typescript-eslint/no-var-requires
const { withNx } = require('@nrwl/next/plugins/with-nx');
/**
* @type {import('@nrwl/next/plugins/with-nx').WithNxOptions}
**/
const nextConfig = {
nx: {
// Set this to true if you would like to to use SVGR
// See: https://github.com/gregberge/svgr
svgr: false,
},
};
module.exports = withNx(nextConfig);

@ -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,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&apos;re up and running</span>
</h2>
<a href="#commands"> What&apos;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&apos;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));
}
}

@ -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

@ -5,13 +5,6 @@
{ {
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"], "files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
"rules": {} "rules": {}
},
{
"files": ["src/plugins/index.js"],
"rules": {
"@typescript-eslint/no-var-requires": "off",
"no-undef": "off"
}
} }
] ]
} }

@ -1,19 +1,19 @@
{ {
"name": "client-e2e", "name": "vendors-e2e",
"$schema": "../../node_modules/nx/schemas/project-schema.json", "$schema": "../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "apps/client-e2e/src", "sourceRoot": "apps/vendors-e2e/src",
"projectType": "application", "projectType": "application",
"targets": { "targets": {
"e2e": { "e2e": {
"executor": "@nrwl/cypress:cypress", "executor": "@nrwl/cypress:cypress",
"options": { "options": {
"cypressConfig": "apps/client-e2e/cypress.config.ts", "cypressConfig": "apps/vendors-e2e/cypress.config.ts",
"devServerTarget": "client:serve:development", "devServerTarget": "vendors:serve:development",
"testingType": "e2e" "testingType": "e2e"
}, },
"configurations": { "configurations": {
"production": { "production": {
"devServerTarget": "client:serve:production" "devServerTarget": "vendors:serve:production"
} }
} }
}, },
@ -21,10 +21,10 @@
"executor": "@nrwl/linter:eslint", "executor": "@nrwl/linter:eslint",
"outputs": ["{options.outputFile}"], "outputs": ["{options.outputFile}"],
"options": { "options": {
"lintFilePatterns": ["apps/client-e2e/**/*.{js,ts}"] "lintFilePatterns": ["apps/vendors-e2e/**/*.{js,ts}"]
} }
} }
}, },
"tags": [], "tags": [],
"implicitDependencies": ["client"] "implicitDependencies": ["vendors"]
} }

@ -1,6 +1,6 @@
import { getGreeting } from '../support/app.po'; import { getGreeting } from '../support/app.po';
describe('client', () => { describe('vendors', () => {
beforeEach(() => cy.visit('/')); beforeEach(() => cy.visit('/'));
it('should display welcome message', () => { it('should display welcome message', () => {
@ -8,6 +8,6 @@ describe('client', () => {
cy.login('my-email@something.com', 'myPassword'); cy.login('my-email@something.com', 'myPassword');
// Function helper example, see `../support/app.po.ts` file // Function helper example, see `../support/app.po.ts` file
getGreeting().contains('Welcome client'); getGreeting().contains('Welcome vendors');
}); });
}); });

3
apps/vendors/.env vendored

@ -0,0 +1,3 @@
NX_STRAPI_URL_API=http://localhost:1337/api
NX_STRAPI_URL=http://localhost:1337
NEXTAUTH_URL=http://localhost:4300

@ -10,7 +10,7 @@
{ {
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"], "files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
"rules": { "rules": {
"@next/next/no-html-link-for-pages": ["error", "apps/client/pages"] "@next/next/no-html-link-for-pages": ["error", "apps/vendors/pages"]
} }
}, },
{ {

@ -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: 58px;
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: 131px;
min-height: calc(100vh - 181px);
}
}
}

@ -0,0 +1,43 @@
import styles from './layout.module.scss';
export function Layout({
showHeaders = true,
showFooter = true,
menuHeader = [],
menuFooter = [],
children = null,
className = '',
headerTransparent = false
}) {
const renderHeaders = () => {
if (showHeaders) {
return (<p>header </p>)
} else {
return ('');
}
}
const renderFooters = () => {
if (showFooter) {
return (<p>footer </p>)
} else {
return ('');
}
}
return (
<>
{renderHeaders()}
<div
className={'dark:bg-gray-900 bg-gray-50 ' + styles['app-container'] + ' ' + (showHeaders ? '' : styles['without-headers']) + ' ' + (showFooter ? '' : styles['without-footer']) + ' ' + className}>
<div className={styles['app-content'] + " w-full mx-auto"}>
{children}
</div>
{renderFooters()}
</div>
</>
);
}
export default Layout;

@ -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,8 @@
export const environment = {
appUrl: 'http://localhost:4200',
strapiUrl: 'http://localhost:1337',
strapiApiUrl: 'http://localhost:1337/api',
nextAuthSecret: "yBNW1wrb9CgOvEfbX6EQCvCDqiMkRBZP",
meiliUrl: "http://127.0.0.1:7700",
meiliApiKey: "f2e963e883cbacf6d4f63e792dc276491b8a866fb837f3fda37b8b78889a6851",
}

@ -0,0 +1,8 @@
export const environment = {
appUrl: 'http://localhost:4200',
strapiUrl: 'https://admin.mecp.nasercloud.fr',
strapiApiUrl: 'https://admin.mecp.nasercloud.fr/api',
nextAuthSecret: "yBNW1wrb9CgOvEfbX6EQCvCDqiMkRBZP",
meiliUrl: "https://ms-b6dafcb0b382-1943.fra.meilisearch.io",
meiliApiKey: "0e9a9d027b9e6b2d98c9670e5030a8d1aa72cab911fd768d4ad02636ae673690",
}

@ -0,0 +1,8 @@
export const environment = {
appUrl: 'http://localhost:4200',
strapiUrl: 'https://admin.mecp.nasercloud.fr',
strapiApiUrl: 'https://admin.mecp.nasercloud.fr/api',
nextAuthSecret: "yBNW1wrb9CgOvEfbX6EQCvCDqiMkRBZP",
meiliUrl: "https://ms-b6dafcb0b382-1943.fra.meilisearch.io",
meiliApiKey: "dda9e4a354839db9ae18c3722ae75422515c06525b3a841010928b5256f54e72",
}

@ -0,0 +1,8 @@
export const environment = {
appUrl: 'http://localhost:4200',
strapiUrl: 'http://localhost:1337',
strapiApiUrl: 'http://localhost:1337/api',
nextAuthSecret: "yBNW1wrb9CgOvEfbX6EQCvCDqiMkRBZP",
meiliUrl: "http://127.0.0.1:7700",
meiliApiKey: "dda9e4a354839db9ae18c3722ae75422515c06525b3a841010928b5256f54e72",
}

@ -1,11 +1,11 @@
/* eslint-disable */ /* eslint-disable */
export default { export default {
displayName: 'client', displayName: 'vendors',
preset: '../../jest.preset.js', preset: '../../jest.preset.js',
transform: { transform: {
'^(?!.*\\.(js|jsx|ts|tsx|css|json)$)': '@nrwl/react/plugins/jest', '^(?!.*\\.(js|jsx|ts|tsx|css|json)$)': '@nrwl/react/plugins/jest',
'^.+\\.[tj]sx?$': ['babel-jest', { presets: ['@nrwl/next/babel'] }], '^.+\\.[tj]sx?$': ['babel-jest', { presets: ['@nrwl/next/babel'] }],
}, },
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'], moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'],
coverageDirectory: '../../coverage/apps/client', coverageDirectory: '../../coverage/apps/vendors',
}; };

@ -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;
}
}

@ -0,0 +1,132 @@
import delve from 'dlv';
import {ImageLoader, ImageLoaderProps} from "next/image";
import {isEmpty, isEqual} from "radash";
import {environment} from "../environments/environment";
export type ImageFormatType = "default" | "thumbnail" | "medium" | "small";
export interface PriceRange {
min: number;
max: number;
}
export type SortType = 'pas' | 'pde' | 'alp';
export interface QueryParam {
param: string;
value: PriceRange | string | number[];
}
export const buildQueriesListFromQueryParams = (query): QueryParam[] => {
const queryMap = ['sort', 'cat', 'page', 'facets', 'filters', 'search'];
return queryMap.map((param: string) => {
if (!isEmpty(query[param])) {
let value = !isEmpty(query[param]) ? query[param] : null;
if (param === 'filters') {
value = query[param].split(',').map((value: string) => parseInt(value, 10));
}
if (param === 'facets') {
const values = query[param].split(':');
value = {min: parseInt(values[0], 10), max: parseInt(values[1], 10)};
}
return ({param, value});
} else {
return null;
}
}).filter((val) => !isEmpty(val));
}
export const findQueryParamsValue = <T>(queryList: Array<{ param: string, value: T }>, params: string): T | null => {
const paramGET = queryList.find((val: { param: string, value: T }) => val.param === params);
return !isEmpty(paramGET) ? paramGET.value : null;
}
export const getShopSortList = (): Array<{ value: SortType, label: string }> => {
return [
{value: "pas", label: 'Prix croissant'},
{value: "pde", label: 'Prix décroissant'},
{value: "alp", label: 'Ordre alphabetique'},
];
}
export const buildShopParamsGET = (sort: SortType = 'pas',
page: number = null,
range: PriceRange = {
min: 0,
max: 0
},
cat: string = null,
filters: number[] = [],
search: string) => {
let url = `?sort=${sort}`;
if (!isEmpty(range) && !isEqual(range, {min: 0, max: 0})) {
url += `&facets=${range.min}:${range.max}`;
}
if (!isEmpty(filters)) {
url += `&filters=${filters.join(',')}`;
}
if (!isEmpty(cat)) {
url += `&cat=${cat}`;
}
if (!isEmpty(page)) {
url += `&page=${page}`;
}
if (!isEmpty(search)) {
url += `&search=${search}`;
}
return url;
}
export const contentfulImageLoader: ImageLoader = ({src, width}: ImageLoaderProps) => {
return `${src}?w=${width}`
}
export const getCategoryUrl = (item): string => {
const categorySlug = !delve(item, 'attributes', null) ? delve(item, 'category.data.attributes.slug', '') : delve(item, 'attributes.category.data.attributes.slug', '');
return '/blog/' + categorySlug;
}
export const getPostUrl = (item): string => {
const categorySlug = !delve(item, 'attributes', null) ? delve(item, 'category.data.attributes.slug', '') : delve(item, 'attributes.category.data.attributes.slug', '');
const postSlug = !delve(item, 'attributes', null) ? delve(item, 'slug', '') : delve(item, 'attributes.slug', '');
return '/blog/' + categorySlug + '/' + postSlug;
}
export const getStrapiImage = (item, format: ImageFormatType = 'default') => {
const image = !delve(item, 'attributes', null) ? delve(item, 'image.data.attributes', {}) : delve(item, 'attributes.image.data.attributes', {});
switch (format) {
case "default":
return environment.strapiUrl + delve(image, "url", "/images/default.png");
case "medium":
return environment.strapiUrl + delve(image, "formats.medium.url", "/images/default.png");
case "small":
return environment.strapiUrl + delve(image, "formats.small.url", "/images/default.png");
case "thumbnail":
return environment.strapiUrl + delve(image, "formats.thumbnail.url", "/images/default.png");
default:
return environment.strapiUrl + delve(image, "url", "/images/default.png");
}
}
export const getStrapiImageSize = (item, format: ImageFormatType = 'default'): [number, number] => {
const image = delve(item, 'attributes.image.data.attributes', {});
switch (format) {
case "default":
return [delve(image, "width", 100), delve(image, "height", 100)];
case "medium":
return [delve(image, "formats.medium.width", 100), delve(image, "formats.medium.height", 100)];
case "small":
return [delve(image, "formats.small.width", 100), delve(image, "formats.small.height", 100)];
case "thumbnail":
return [delve(image, "formats.thumbnail.width", 100), delve(image, "formats.thumbnail.height", 100)];
default:
return [delve(image, "width", 100), delve(image, "height", 100)];
}
}

@ -0,0 +1,36 @@
//@ts-check
// eslint-disable-next-line @typescript-eslint/no-var-requires
const { withNx } = require('@nrwl/next/plugins/with-nx');
/**
* @type {import('@nrwl/next/plugins/with-nx').WithNxOptions}
**/
const nextConfig = {
reactStrictMode: true,
poweredByHeader: false,
output: 'standalone',
compiler: {
styledComponents: true
},
nx: {
// Set this to true if you would like to to use SVGR
// See: https://github.com/gregberge/svgr
svgr: false
},
images: {
loader: "default",
remotePatterns: [
{
protocol: 'https',
hostname: 'mcep.nasercloud.fr',
}, {
protocol: 'https',
hostname: 'admin.mcep.nasercloud.fr',
}
],
domains: ["localhost", "127.0.0.1", "admin.mcep.nasercloud.fr", "mcep.nasercloud.fr"],
}
};
module.exports = withNx(nextConfig);

@ -0,0 +1,21 @@
import App, {AppProps} from 'next/app';
import {ThemeProvider} from "next-themes";
import {SessionProvider} from "next-auth/react";
import './styles.css';
function CustomApp({Component, pageProps}: AppProps) {
pageProps = {...pageProps};
return (
<>
<SessionProvider session={pageProps.session}>
<ThemeProvider enableSystem={true}
attribute="class">
<Component {...pageProps} />
</ThemeProvider>
</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,69 @@
import NextAuth, {AuthOptions, 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 const authOptions: AuthOptions = {
pages: {
signIn: '/sign-in'
},
// 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
}
export default NextAuth(authOptions);

@ -0,0 +1,19 @@
import styles from './index.module.scss';
import Layout from "../components/layout/layout";
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}>
<Layout>
<p>home page !</p>
</Layout>
</div>
);
}
export default Index;

@ -0,0 +1,18 @@
import {withAuth} from "next-auth/middleware";
export default withAuth({
callbacks: {
authorized: async ({req}) => {
const pathname = req.nextUrl.pathname;
if (pathname.startsWith('/_next') || pathname === '/favicon.ico' || pathname === '/__ENV.js') {
return true
}
return false
},
},
pages: {
signIn: '/sign-in'
}
})

@ -0,0 +1,7 @@
/*
* Replace this with your own classes
*
* e.g.
* .container {
* }
*/

@ -0,0 +1,14 @@
import styles from './index.module.scss';
/* eslint-disable-next-line */
export interface LoginProps {}
export function SignIn(props: LoginProps) {
return (
<div className={styles['container']}>
<h1>Welcome to Login!</h1>
</div>
);
}
export default SignIn;

@ -0,0 +1,3 @@
@tailwind components;
@tailwind base;
@tailwind utilities;

@ -0,0 +1,15 @@
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: {
tailwindcss: {
config: join(__dirname, 'tailwind.config.js'),
},
autoprefixer: {},
},
};

@ -1,7 +1,7 @@
{ {
"name": "client", "name": "vendors",
"$schema": "../../node_modules/nx/schemas/project-schema.json", "$schema": "../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "apps/client", "sourceRoot": "apps/vendors",
"projectType": "application", "projectType": "application",
"targets": { "targets": {
"build": { "build": {
@ -9,12 +9,12 @@
"outputs": ["{options.outputPath}"], "outputs": ["{options.outputPath}"],
"defaultConfiguration": "production", "defaultConfiguration": "production",
"options": { "options": {
"root": "apps/client", "root": "apps/vendors",
"outputPath": "dist/apps/client" "outputPath": "dist/apps/vendors"
}, },
"configurations": { "configurations": {
"development": { "development": {
"outputPath": "apps/client" "outputPath": "apps/vendors"
}, },
"production": {} "production": {}
} }
@ -23,16 +23,17 @@
"executor": "@nrwl/next:server", "executor": "@nrwl/next:server",
"defaultConfiguration": "development", "defaultConfiguration": "development",
"options": { "options": {
"buildTarget": "client:build", "buildTarget": "vendors:build",
"dev": true "dev": true,
"port": 4300
}, },
"configurations": { "configurations": {
"development": { "development": {
"buildTarget": "client:build:development", "buildTarget": "vendors:build:development",
"dev": true "dev": true
}, },
"production": { "production": {
"buildTarget": "client:build:production", "buildTarget": "vendors:build:production",
"dev": false "dev": false
} }
} }
@ -40,14 +41,14 @@
"export": { "export": {
"executor": "@nrwl/next:export", "executor": "@nrwl/next:export",
"options": { "options": {
"buildTarget": "client:build:production" "buildTarget": "vendors:build:production"
} }
}, },
"test": { "test": {
"executor": "@nrwl/jest:jest", "executor": "@nrwl/jest:jest",
"outputs": ["{workspaceRoot}/coverage/{projectRoot}"], "outputs": ["{workspaceRoot}/coverage/{projectRoot}"],
"options": { "options": {
"jestConfig": "apps/client/jest.config.ts", "jestConfig": "apps/vendors/jest.config.ts",
"passWithNoTests": true "passWithNoTests": true
} }
}, },
@ -55,7 +56,7 @@
"executor": "@nrwl/linter:eslint", "executor": "@nrwl/linter:eslint",
"outputs": ["{options.outputFile}"], "outputs": ["{options.outputFile}"],
"options": { "options": {
"lintFilePatterns": ["apps/client/**/*.{ts,tsx,js,jsx}"] "lintFilePatterns": ["apps/vendors/**/*.{ts,tsx,js,jsx}"]
} }
} }
}, },

@ -0,0 +1,17 @@
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: [],
};

@ -0,0 +1,10 @@
{
"extends": ["plugin:cypress/recommended", "../../.eslintrc.json"],
"ignorePatterns": ["!**/*"],
"overrides": [
{
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
"rules": {}
}
]
}

@ -0,0 +1,6 @@
import { defineConfig } from 'cypress';
import { nxE2EPreset } from '@nrwl/cypress/plugins/cypress-preset';
export default defineConfig({
e2e: nxE2EPreset(__dirname),
});

@ -0,0 +1,30 @@
{
"name": "website-e2e",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "apps/website-e2e/src",
"projectType": "application",
"targets": {
"e2e": {
"executor": "@nrwl/cypress:cypress",
"options": {
"cypressConfig": "apps/website-e2e/cypress.config.ts",
"devServerTarget": "website:serve:development",
"testingType": "e2e"
},
"configurations": {
"production": {
"devServerTarget": "website:serve:production"
}
}
},
"lint": {
"executor": "@nrwl/linter:eslint",
"outputs": ["{options.outputFile}"],
"options": {
"lintFilePatterns": ["apps/website-e2e/**/*.{js,ts}"]
}
}
},
"tags": [],
"implicitDependencies": ["website"]
}

@ -0,0 +1,13 @@
import { getGreeting } from '../support/app.po';
describe('website', () => {
beforeEach(() => cy.visit('/'));
it('should display welcome message', () => {
// Custom command example, see `../support/commands.ts` file
cy.login('my-email@something.com', 'myPassword');
// Function helper example, see `../support/app.po.ts` file
getGreeting().contains('Welcome website');
});
});

@ -0,0 +1,4 @@
{
"name": "Using fixtures to represent data",
"email": "hello@cypress.io"
}

@ -0,0 +1 @@
export const getGreeting = () => cy.get('h1');

@ -0,0 +1,33 @@
// ***********************************************
// This example commands.js shows you how to
// create various custom commands and overwrite
// existing commands.
//
// For more comprehensive examples of custom
// commands please read more here:
// https://on.cypress.io/custom-commands
// ***********************************************
// eslint-disable-next-line @typescript-eslint/no-namespace
declare namespace Cypress {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
interface Chainable<Subject> {
login(email: string, password: string): void;
}
}
//
// -- This is a parent command --
Cypress.Commands.add('login', (email, password) => {
console.log('Custom command example: Login', email, password);
});
//
// -- This is a child command --
// Cypress.Commands.add("drag", { prevSubject: 'element'}, (subject, options) => { ... })
//
//
// -- This is a dual command --
// Cypress.Commands.add("dismiss", { prevSubject: 'optional'}, (subject, options) => { ... })
//
//
// -- This will overwrite an existing command --
// Cypress.Commands.overwrite("visit", (originalFn, url, options) => { ... })

@ -0,0 +1,17 @@
// ***********************************************************
// This example support/index.js is processed and
// loaded automatically before your test files.
//
// This is a great place to put global configuration and
// behavior that modifies Cypress.
//
// You can change the location of this file or turn off
// automatically serving support files with the
// 'supportFile' configuration option.
//
// You can read more here:
// https://on.cypress.io/configuration
// ***********************************************************
// Import commands.js using ES2015 syntax:
import './commands';

@ -0,0 +1,10 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"sourceMap": false,
"outDir": "../../dist/out-tsc",
"allowJs": true,
"types": ["cypress", "node"]
},
"include": ["src/**/*.ts", "src/**/*.js", "cypress.config.ts"]
}

@ -0,0 +1,2 @@
NX_STRAPI_URL_API=http://localhost:1337/api
NX_STRAPI_URL=http://localhost:1337

@ -0,0 +1,33 @@
{
"extends": [
"plugin:@nrwl/nx/react-typescript",
"next",
"next/core-web-vitals",
"../../.eslintrc.json"
],
"ignorePatterns": ["!**/*", ".next/**/*"],
"overrides": [
{
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
"rules": {
"@next/next/no-html-link-for-pages": ["error", "apps/website/pages"]
}
},
{
"files": ["*.ts", "*.tsx"],
"rules": {}
},
{
"files": ["*.js", "*.jsx"],
"rules": {}
}
],
"rules": {
"@next/next/no-html-link-for-pages": "off",
"@typescript-eslint/ban-ts-comment": "off",
"react/no-unescaped-entities": "off"
},
"env": {
"jest": true
}
}

@ -0,0 +1,7 @@
/*
* Replace this with your own classes
*
* e.g.
* .container {
* }
*/

@ -0,0 +1,20 @@
import {render} from '@testing-library/react';
import BlogPagination from './blog-pagination';
jest.mock("next/router", () => ({
useRouter() {
return {
route: "/",
pathname: "",
query: "",
asPath: "",
};
},
}));
describe('BlogPagination', () => {
it('should render successfully', () => {
const {baseElement} = render(<BlogPagination paginator={{pagination: {}}} />);
expect(baseElement).toBeTruthy();
});
});

@ -0,0 +1,80 @@
import styles from './blog-pagination.module.scss';
import {useRouter} from "next/router";
/* eslint-disable-next-line */
export interface BlogPaginationProps {
paginator: any;
}
export function BlogPagination({paginator = {pagination: {}}}: BlogPaginationProps) {
const router = useRouter();
const {total, pageCount, page} = paginator.pagination;
const isOnlyOne = pageCount > 0 && pageCount === 1;
const isEmpty = total === 0;
const isFirst = page === 1;
const isLast = page === pageCount;
const goPrevious = async () => {
await router.push(`${window.location.origin}${window.location.pathname}?page=${page - 1}`);
}
const goNext = async () => {
await router.push(`${window.location.origin}${window.location.pathname}?page=${page + 1}`);
}
return (
<div className={styles['container']}>
<div className="flex flex-col items-center">
{isOnlyOne && !isEmpty && (
<span className="text-sm text-gray-700 dark:text-gray-400">{total} article(s)</span>)}
{!isOnlyOne && !isEmpty && (<span className="text-sm text-gray-700 dark:text-gray-400">
Articles <span className="font-semibold text-gray-900 dark:text-white">{page}</span> à <span
className="font-semibold text-gray-900 dark:text-white">{pageCount}</span> sur un total de <span
className="font-semibold text-gray-900 dark:text-white">{total}</span>
</span>)}
<div className="inline-flex mt-2 xs:mt-0">
<button
disabled={isOnlyOne || isFirst || isEmpty}
onClick={goPrevious}
className="
inline-flex items-center px-4 py-2 mr-2 text-sm font-medium rounded
text-white bg-gray-800
hover:bg-gray-900
disabled:bg-gray-500 disabled:hover:bg-gray-500
dark:bg-gray-800 dark:border-gray-700 dark:text-gray-400 dark:hover:bg-gray-700 dark:hover:text-white">
<svg aria-hidden="true"
className="w-5 h-5 mr-2"
fill="currentColor"
viewBox="0 0 20 20"
xmlns="http://www.w3.org/2000/svg">
<path fillRule="evenodd"
d="M7.707 14.707a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414l4-4a1 1 0 011.414 1.414L5.414 9H17a1 1 0 110 2H5.414l2.293 2.293a1 1 0 010 1.414z"
clipRule="evenodd"></path>
</svg>
Prev
</button>
<button
disabled={isOnlyOne || isLast || isEmpty}
onClick={goNext}
className="inline-flex items-center px-4 py-2 ml-2 text-sm font-medium rounded
text-white bg-gray-800
hover:bg-gray-900
disabled:bg-gray-500 disabled:hover:bg-gray-500
dark:bg-gray-800 dark:border-gray-700 dark:text-gray-400 dark:hover:bg-gray-700 dark:hover:text-white">
Next
<svg aria-hidden="true"
className="w-5 h-5 ml-2"
fill="currentColor"
viewBox="0 0 20 20"
xmlns="http://www.w3.org/2000/svg">
<path fillRule="evenodd"
d="M12.293 5.293a1 1 0 011.414 0l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414-1.414L14.586 11H3a1 1 0 110-2h11.586l-2.293-2.293a1 1 0 010-1.414z"
clipRule="evenodd"></path>
</svg>
</button>
</div>
</div>
</div>
);
}
export default BlogPagination;

@ -0,0 +1,7 @@
/*
* Replace this with your own classes
*
* e.g.
* .container {
* }
*/

@ -0,0 +1,31 @@
import {render} from '@testing-library/react';
import configureStore from "redux-mock-store";
import BlogSearch from './blog-search';
import {Provider} from "react-redux";
jest.mock("next/router", () => ({
useRouter() {
return {
route: "/",
pathname: "",
query: "",
asPath: "",
};
},
}));
describe('BlogSearch', () => {
const initialState = {results: []};
const mockStore = configureStore();
let store;
it('should render successfully', () => {
store = mockStore(initialState);
const {baseElement} = render(
<Provider store={store}>
<BlogSearch />
</Provider>);
expect(baseElement).toBeTruthy();
});
});

@ -0,0 +1,117 @@
import {useEffect, useState} from "react";
import {BehaviorSubject, catchError, debounceTime, delay, distinctUntilChanged, filter, map, of, switchMap} from "rxjs";
import {useRouter} from "next/router";
import {MeiliSearch} from "meilisearch";
import {useDispatch} from "react-redux";
import {environment} from "../../environments/environment";
import styles from './blog-search.module.scss';
import {setBlogSearchState} from "../../store/blogSearchSlice";
/* eslint-disable-next-line */
export interface BlogSearchProps {
}
export function BlogSearch(props: BlogSearchProps) {
const router = useRouter();
const [client, setClient] = useState(null);
const [loading, setLoading] = useState(false);
const [subject, setSubject] = useState(null);
const dispatch = useDispatch();
useEffect(() => {
if (subject === null) {
const sub = new BehaviorSubject('');
const client = new MeiliSearch({
host: environment.meiliUrl,
apiKey: environment.meiliApiKey
})
setSubject(sub);
setClient(client);
} else {
subject.pipe(
map((s: string) => s.trim()),
distinctUntilChanged(),
filter((s: string) => s.length >= 2),
debounceTime(200),
map((value) => {
setLoading(true);
return value;
}),
delay(2000),
switchMap(async (value: string) => {
const index = await client.getIndex('article');
const articles = await index.search(value);
setLoading(false);
await router.push('/shop/results');
dispatch(setBlogSearchState(articles.hits));
}),
catchError((err) => of(false))
).subscribe(() => setLoading(false));
}
}, [subject]);
const onSearchChange = (e) => subject.next(e.target.value);
return (
<div className={styles['container'] + " rounded-lg mx-2 md:mx-0 mt-5 md:mt-0 p-5 mb-5 shadow-sm" +
" bg-white" +
" dark:bg-gray-800"}>
<form>
<label htmlFor="default-search"
className="mb-2 text-sm font-medium text-gray-900 sr-only dark:text-white">Search</label>
<div className="relative">
<div className="absolute inset-y-0 left-0 flex items-center pl-3 pointer-events-none">
<svg aria-hidden="true"
className="w-5 h-5 text-gray-500 dark:text-gray-400"
fill="none"
stroke="currentColor"
viewBox="0 0 24 24"
xmlns="http://www.w3.org/2000/svg">
<path strokeLinecap="round"
strokeLinejoin="round"
strokeWidth="2"
d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"></path>
</svg>
</div>
<input type="search"
id="default-search"
onChange={onSearchChange}
className="block w-full p-4 pl-10 text-sm text-gray-900 border border-gray-300 rounded-lg bg-gray-50 focus:ring-blue-500 focus:border-blue-500 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"
placeholder="Rechercher un article ..." />
{!loading && (<button type="submit"
className="text-white absolute right-2.5 bottom-2.5 font-medium rounded-lg text-sm px-4 py-2
bg-blue-700
hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800">
Search
</button>)}
{loading && (<button disabled
type="button"
className="absolute right-2.5 bottom-2 py-2 px-4 text-sm font-medium bg-white rounded-lg border
hover:bg-gray-100 hover:text-blue-700 focus:z-10 focus:ring-4 focus:outline-none focus:ring-blue-700 focus:text-blue-700
text-gray-900 border-gray-200
dark:bg-gray-800 dark:text-gray-400 dark:border-gray-600 dark:hover:text-white dark:hover:bg-gray-700
inline-flex items-center">
<svg aria-hidden="true"
role="status"
className="inline w-4 h-4 mr-2 text-gray-200 animate-spin dark:text-gray-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="#1C64F2" />
</svg>
Chargement...
</button>
)}
</div>
</form>
</div>
);
}
export default BlogSearch;

@ -0,0 +1,7 @@
/*
* Replace this with your own classes
*
* e.g.
* .container {
* }
*/

@ -0,0 +1,10 @@
import {render} from '@testing-library/react';
import CardBlogDetails from './card-blog-details';
describe('CardBlogDetails', () => {
it('should render successfully', () => {
const {baseElement} = render(<CardBlogDetails item={{}} />);
expect(baseElement).toBeTruthy();
});
});

@ -0,0 +1,121 @@
import delve from 'dlv';
import NextImage from "next/image";
import {
FacebookIcon,
FacebookMessengerIcon,
FacebookMessengerShareButton,
FacebookShareButton,
LinkedinIcon,
LinkedinShareButton,
TwitterIcon,
TwitterShareButton,
WhatsappIcon,
WhatsappShareButton
} from "react-share";
import styles from './card-blog-details.module.scss';
import {contentfulImageLoader, getCategoryUrl, getPostUrl, getStrapiImage} from "../../libs/utils";
/* eslint-disable-next-line */
export interface CardBlogDetailsProps {
item: any;
}
export function CardBlogDetails({item = {}}: CardBlogDetailsProps) {
const {width = 0, height = 0} = delve(item, 'image.data.attributes', {});
const {title} = item;
const shareUrl = getPostUrl(item);
return (
<div className={styles['container'] + " rounded-l p-4 md:p-8 overflow-hidden shadow-sm" +
" bg-white" +
" dark:bg-gray-800"}>
<header className="md:flex flex-col">
<h2 className="text-3xl mb-5 text-bold">
{delve(item, 'title', 'N/A')}
</h2>
<section className="flex items-center justify-between">
<div className="flex">
<span className="flex items-center">
<img
src="https://images.unsplash.com/photo-1492562080023-ab3db95bfbce?ixlib=rb-1.2.1&amp;ixid=eyJhcHBfaWQiOjEyMDd9&amp;auto=format&amp;fit=crop&amp;w=731&amp;q=80"
alt="avatar"
width="auto"
height="auto"
className="mr-4 w-10 h-10 object-cover rounded-full hidden sm:block" />
<h3 className="text-gray-700 text-normal font-bold hover:underline text-slate-400">Par Alex John</h3>
</span>
</div>
<div className="flex flex-col">
<a href={getCategoryUrl(item)}
title={"Accédez à la catégorie " + delve(item, 'category.data.attributes.name', 'N/A')}
aria-label={"Accédez à la catégorie " + delve(item, 'category.data.attributes.name', 'N/A')}
className="px-2 py-1 text-sm bg-gray-600 text-gray-100 font-bold rounded hover:bg-gray-500">
{delve(item, 'category.data.attributes.name', 'N/A')}
</a>
</div>
</section>
</header>
<hr className="border-gray-100 my-5 sm:mx-auto dark:border-gray-700 container mx-auto" />
<main>
<section>
<div className="whitespace-pre-wrap text-lg font-bold text-slate-500
text-gray-600
dark:text-gray-300"
dangerouslySetInnerHTML={{__html: delve(item, 'description', 'N/A')}} />
{<NextImage
loader={contentfulImageLoader}
width={width}
height={height}
className="rounded-lg my-5"
src={getStrapiImage(item, "default")}
alt={delve(item, 'title', 'N/A')} />}
</section>
<section className="whitespace-pre-wrap text-lg text-slate-400"
dangerouslySetInnerHTML={{__html: delve(item, 'content', 'N/A')}} />
<hr className="border-gray-100 my-5 sm:mx-auto dark:border-gray-700 container mx-auto" />
<section className="flex justify-between">
<div>
<h4 className="font-bold text-lg text-gray-400 mb-2">Partager cet article</h4>
<div className="grid grid-cols-5 gap-2">
<FacebookShareButton url={shareUrl}>
<FacebookIcon size={32}
round />
</FacebookShareButton>
<FacebookMessengerShareButton
url={shareUrl}
appId="521270401588372"
className="Demo__some-network__share-button">
<FacebookMessengerIcon size={32}
round />
</FacebookMessengerShareButton>
<TwitterShareButton
url={shareUrl}
title={title}
className="Demo__some-network__share-button"
>
<TwitterIcon size={32}
round />
</TwitterShareButton>
<WhatsappShareButton
url={shareUrl}
title={title}
separator=":: "
className="Demo__some-network__share-button"
>
<WhatsappIcon size={32}
round />
</WhatsappShareButton>
<LinkedinShareButton url={shareUrl}
className="Demo__some-network__share-button">
<LinkedinIcon size={32}
round />
</LinkedinShareButton>
</div>
</div>
</section>
</main>
</div>
);
}
export default CardBlogDetails;

@ -0,0 +1,10 @@
/*
* Replace this with your own classes
*
* e.g.
* .container {
* }
*/
.card-blog-container {
margin-bottom: 10px;
}

@ -0,0 +1,10 @@
import { render } from '@testing-library/react';
import CardBlog from './card-blog';
describe('CardBlog', () => {
it('should render successfully', () => {
const { baseElement } = render(<CardBlog />);
expect(baseElement).toBeTruthy();
});
});

@ -0,0 +1,79 @@
import delve from 'dlv';
import {format} from 'date-fns';
import styles from './card-blog.module.scss';
import {getCategoryUrl, getPostUrl, getStrapiImage} from "../../libs/utils";
/* eslint-disable-next-line */
export interface CardBlogProps {
item: object;
}
export function CardBlog({item}: CardBlogProps) {
return (
<div className={styles['card-blog-container'] + " rounded-lg overflow-hidden shadow-sm" +
" bg-white" +
" dark:bg-gray-800"}>
<div className="md:flex">
<div className="md:shrink-0">
<img className="h-48 w-full object-cover md:h-full md:w-48 rounded-t-lg"
src={getStrapiImage(item, 'medium')}
alt="Modern building architecture" />
</div>
<div className="p-4 md:p-8 w-full">
<div className="flex justify-between items-center">
<span
className="font-light text-sm
text-gray-600
dark:text-gray-300">{format(new Date(delve(item, 'attributes.publishedAt', 'Jun 1, 2020')), 'dd/MM/yyyy')}</span>
<a href={getCategoryUrl(item)}
title={"Accédez à la catégorie " + delve(item, 'attributes.category.data.attributes.name', 'N/A')}
aria-label={"Accédez à la catégorie " + delve(item, 'attributes.category.data.attributes.name', 'N/A')}
className="px-2 py-1 text-sm font-bold rounded
bg-gray-600 text-gray-100
hover:bg-gray-500">
{delve(item, 'attributes.category.data.attributes.name', 'N/A')}
</a>
</div>
<div className="mt-2">
<a
title={"Lire l'article " + delve(item, 'attributes.title', 'N/A')}
aria-label={"Lire l'article " + delve(item, 'attributes.title', 'N/A')}
href={getPostUrl(item)}
className="text-xl font-bold hover:underline
text-gray-700
dark:text-gray-200">
{delve(item, 'attributes.title', 'N/A')}
</a>
<p className="mt-2 font-light text-sm
text-gray-600
dark:text-gray-300">{delve(item, 'attributes.description', 'N/A')}</p>
</div>
<div className="flex justify-between items-center mt-4">
<a href={getPostUrl(item)}
title={"Lire l'article " + delve(item, 'attributes.title', 'N/A')}
aria-label={"Lire l'article " + delve(item, 'attributes.title', 'N/A')}
className="text-blue-500 text-sm hover:underline">Lire l'article</a>
<div>
<span className="flex items-center">
<img
src="https://images.unsplash.com/photo-1492562080023-ab3db95bfbce?ixlib=rb-1.2.1&amp;ixid=eyJhcHBfaWQiOjEyMDd9&amp;auto=format&amp;fit=crop&amp;w=731&amp;q=80"
alt="avatar"
width="auto"
height="auto"
className="mx-4 w-10 h-10 object-cover rounded-full hidden sm:block" />
<h3 className="text-normal font-bold hover:underline
text-gray-700
dark:text-gray-300">Alex John</h3>
</span>
</div>
</div>
</div>
</div>
</div>
);
}
export default CardBlog;

@ -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,10 @@
import { render } from '@testing-library/react';
import Categories from './categories';
describe('Categories', () => {
it('should render successfully', () => {
const { baseElement } = render(<Categories />);
expect(baseElement).toBeTruthy();
});
});

@ -0,0 +1,45 @@
import delve from 'dlv';
import {environment} from "../../environments/environment";
import styles from './categories.module.scss';
import Link from "next/link";
/* eslint-disable-next-line */
export interface CategoriesProps {
items: object[];
}
// <!-- pb-0 sm:pt-4 -->
export function Categories({items = []}: CategoriesProps) {
return (
<div
className={styles['container'] + " rounded-lg mx-2 md:mx-0 mt-5 md:mt-0 p-5 mb-5 shadow-sm" +
" bg-white" +
" dark:bg-gray-800"}>
<div className="flex items-center justify-between mb-4">
<h5 className="text-xl font-bold leading-none text-gray-900 dark:text-white">Catégories</h5>
</div>
<div className="flow-root">
<ul role="list" className="divide-y divide-gray-200 dark:divide-gray-700">
{items.map((item: any, index: number) => (<li key={'categories-' + item.slug + index} className="py-3 sm:py-4">
<div className="flex items-center space-x-4">
<div className="flex-shrink-0">
<img className="w-8 h-8 rounded-full"
src={environment.strapiUrl + delve(item, 'attributes.image.data.attributes.formats.thumbnail.url', '')}
alt="Neil image"/>
</div>
<div className="flex-1 min-w-0">
<h4><Link href={"/blog/" + item.attributes.slug}>{delve(item, 'attributes.name', 'N/A')}</Link></h4>
</div>
</div>
</li>))
}
</ul>
</div>
</div>
);
}
export default Categories;

@ -0,0 +1,7 @@
/*
* Replace this with your own classes
*
* e.g.
* .container {
* }
*/

@ -0,0 +1,10 @@
import { render } from '@testing-library/react';
import DropdownCategories from './dropdown-categories';
describe('DropdownCategories', () => {
it('should render successfully', () => {
const { baseElement } = render(<DropdownCategories />);
expect(baseElement).toBeTruthy();
});
});

@ -0,0 +1,42 @@
import styles from './dropdown-categories.module.scss';
import {PropsWithChildren, useState} from "react";
import {FontAwesomeIcon} from "@fortawesome/react-fontawesome";
import {faChevronDown, faChevronUp} from "@fortawesome/free-solid-svg-icons";
/* eslint-disable-next-line */
export interface DropdownCategoriesProps extends PropsWithChildren {
title?: string;
collapse?: boolean;
count?: number;
}
export function DropdownCategories({children, title = '', count = null, collapse = false}: DropdownCategoriesProps) {
const [visible, setVisible] = useState(!collapse);
return (
<div className={styles['container']}>
<header className="flex justify-between grow px-6 py-2 align-middle items-center cursor-pointer"
onClick={() => setVisible(!visible)}>
<h2 className="overflow-y-auto text-md text-gray-400 flex items-center">
{title}
{count && (
<span className="inline-flex items-center justify-center w-6 h-6 ml-2 text-xs font-semibold text-blue-800 bg-blue-200 rounded-full">
{count}
</span>)}
</h2>
{visible && (<FontAwesomeIcon icon={faChevronDown}
size={'sm'}
className="text-gray-400" />)}
{!visible && (<FontAwesomeIcon icon={faChevronUp}
size={'sm'}
className="text-gray-400" />)}
</header>
<main className={visible ? 'block' : 'hidden'}>
{children}
</main>
</div>
);
}
export default DropdownCategories;

@ -0,0 +1,7 @@
/*
* Replace this with your own classes
*
* e.g.
* .container {
* }
*/

@ -0,0 +1,10 @@
import { render } from '@testing-library/react';
import DropdownSection from './dropdown-section';
describe('DropdownComponent', () => {
it('should render successfully', () => {
const { baseElement } = render(<DropdownSection />);
expect(baseElement).toBeTruthy();
});
});

@ -0,0 +1,30 @@
import {PropsWithChildren, useState} from "react";
import {FontAwesomeIcon} from "@fortawesome/react-fontawesome";
import {faChevronDown, faChevronUp} from "@fortawesome/free-solid-svg-icons";
import styles from './dropdown-section.module.scss';
/* eslint-disable-next-line */
export interface DropdownComponentProps extends PropsWithChildren {
title?: string;
collapse?: boolean;
}
export function DropdownSection({children, title = '', collapse = false}: DropdownComponentProps) {
const [visible, setVisible] = useState(!collapse);
return (
<div className={styles['container']}>
<header className="flex justify-between grow px-6 py-4 align-middle items-center cursor-pointer"
onClick={() => setVisible(!visible)}>
<h1 className="overflow-y-auto text-lg text-gray-600">{title}</h1>
{visible && (<FontAwesomeIcon icon={faChevronDown} className="text-gray-600"/>)}
{!visible && (<FontAwesomeIcon icon={faChevronUp} className="text-gray-600"/>)}
</header>
<main className={visible ? 'block' : 'hidden'}>
{children}
</main>
</div>
);
}
export default DropdownSection;

@ -0,0 +1,7 @@
/*
* Replace this with your own classes
*
* e.g.
* .container {
* }
*/

@ -0,0 +1,5 @@
import dynamic from "next/dynamic";
const DynamicComponent = ({children}) => <>{children}</>
export default dynamic(() => Promise.resolve(DynamicComponent), {ssr: false})

@ -0,0 +1,7 @@
/*
* Replace this with your own classes
*
* e.g.
* .container {
* }
*/

@ -0,0 +1,51 @@
import delve from "dlv";
export function Footer({items = []}) {
const generateItem = (item, index) => {
const value = delve(item, 'attributes', {});
return (
<li key={value.title + index}
className="my-1 h-10 flex align-middle items-center md:h-auto">
<a href={value.url}
target={value.target}
title={"Accédez à la page " + value.title}
aria-label={"Accédez à la page " + value.title}
className="mr-4 hover:underline md:mr-6 ">
{value.title}
</a>
</li>
);
}
return (
<footer className="p-4 bg-white md:px-6 md:py-8 dark:bg-gray-900">
<div className="sm:flex sm:items-center sm:justify-between">
<a href="/"
aria-label="Page d'accueil MeCP"
title="Page d'accueil MeCP"
className="flex items-center mb-4 sm:mb-0">
<img src="https://flowbite.com/docs/images/logo.svg"
className="h-8 mr-3"
height="auto"
width="auto"
alt="Flowbite Logo" />
<span className="self-center text-2xl font-semibold whitespace-nowrap dark:text-white">MeCP</span>
</a>
<ul className="flex flex-wrap items-center justify-end 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">©2023
<a href="/"
aria-label="Page d'accueil MeCP"
title="Page d'accueil MeCP"
className="hover:underline"> MeCP</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,270 @@
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 {useRouter} from "next/router";
import {faBagShopping, faRightToBracket, faUserPlus} from "@fortawesome/free-solid-svg-icons";
import {getBackendImg, hasAvatar} from "../../libs/api";
import {siteConfig} from "../../config";
import {buildShopParamsGET} from "../../libs/utils";
export function Header({items = []}) {
const {data: session} = useSession();
const router = useRouter();
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 isActive = (item) => router.route.includes(item.attributes.url);
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) => {
const url = item.url.includes('/shop') ? `${item.url}${buildShopParamsGET()}` : item.url;
return (
<a href={url}
target={item.target}
title={"Accédez à la page " + item.title}
aria-label={"Accédez à la page " + item.title}
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}
title={"Accédez à la page " + value.title}
aria-label={"Accédez à la page " + value.title}
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"
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"
title="Page de connexion"
aria-label="Page de connexion"
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"
title="Page d'inscription"
aria-label="Page d'inscription"
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"
role="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-label="Options de l'utilisateur"
aria-expanded="false"
data-dropdown-placement="bottom">
<span className="sr-only">Options de l'utilisateur</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="#"
aria-label="Profile"
title="Profile"
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">
Profile
</a>
</li>
<li>
<a href="#"
aria-label="Paramètres"
title="Paramètres"
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">
Paramètres
</a>
</li>
<li>
<a href="#"
aria-label="Mes cours"
title="Mes cours"
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">
Mes cours
</a>
</li>
<li>
<a href="#"
title="Dconnexion"
aria-label="Dconnexion"
// @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">
Déconnexion
</a>
</li>
</ul>
</div>
</>
);
}
return (
<nav
className="bg-white fixed border-gray-200 dark:bg-gray-800 w-full z-10 border-b-gray-50 dark:border-b-gray-700">
<div className="flex mx-auto">
<main className="w-full">
<section
className="bg-white dark:bg-gray-800 w-full md:w-auto p-2 md:p-4"
id="navbar-default">
<div className="container max-w-screen-xl flex flex-wrap items-center justify-between mx-auto">
<a href="/"
aria-label="Page d'accueil MeCP"
title="Page d'accueil MeCP"
className="flex items-center">
<img src="https://flowbite.com/docs/images/logo.svg"
className="h-6 mr-3 sm:h-9"
height="auto"
width="auto"
alt="Flowbite Logo" />
<span className="self-center text-xl font-semibold whitespace-nowrap dark:text-white">MeCP</span>
</a>
<div className="flex items-center">
<button
id="shop-panel-button"
name="shop-panel-button"
aria-label="Accéder au panier d'achat"
role="button"
type="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"
type="button"
role="navigation"
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-label="Déplier le menu"
aria-controls="navbar-dropdown"
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>
</div>
</section>
<hr className="border-gray-100 dark:border-gray-700 container max-w-screen-xl mx-auto" />
<section className="hidden w-full md:block md:w-auto"
id="navbar-dropdown">
<div className="container max-w-screen-xl mx-auto">
<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, isActive(item)))}
</ul>
</div>
</section>
<hr className="border-gray-100 sm:mx-auto dark:border-gray-700" />
</main>
</div>
</nav>
);
}
export default Header;

@ -0,0 +1,7 @@
/*
* Replace this with your own classes
*
* e.g.
* .container {
* }
*/

@ -0,0 +1,10 @@
import { render } from '@testing-library/react';
import HomeSectionBlogUne from './home-section-blog-une';
describe('HomeSectionBlogUne', () => {
it('should render successfully', () => {
const { baseElement } = render(<HomeSectionBlogUne />);
expect(baseElement).toBeTruthy();
});
});

@ -0,0 +1,83 @@
import {format} from "date-fns";
import NextImage from "next/image";
import delve from 'dlv';
import {contentfulImageLoader, getCategoryUrl, getPostUrl, getStrapiImage, getStrapiImageSize} from "../../libs/utils";
/* eslint-disable-next-line */
export interface HomeSectionBlogUneProps {
item: object;
}
export function HomeSectionBlogUne({item}: HomeSectionBlogUneProps) {
const [width, height] = getStrapiImageSize(item);
return (
<>
<div className="rounded-lg overflow-hidden shadow-sm
bg-white
dark:bg-gray-800">
<div className="flex justify-between items-center absolute left-5 top-5">
<span
className="font-bold shadow text-white text-sm">{format(new Date(delve(item, 'attributes.publishedAt', 'Jun 1, 2020')), 'dd/MM/yyyy')}</span>
</div>
<div className="flex justify-between items-center absolute right-5 top-5">
<a href={getCategoryUrl(item)}
title={"Accédez à la catégorie " + delve(item, 'attributes.category.data.attributes.name', 'N/A')}
aria-label={"Accédez à la catégorie " + delve(item, 'attributes.category.data.attributes.name', 'N/A')}
className="px-2 py-1 text-sm bg-gray-600 text-gray-100 font-bold rounded hover:bg-gray-500">
{delve(item, 'attributes.category.data.attributes.name', 'N/A')}
</a>
</div>
{<NextImage
loader={contentfulImageLoader}
width={width}
height={height}
className="rounded-t-lg"
src={getStrapiImage(item)}
alt={delve(item, '0.title', 'N/A')} />}
<main className="p-5">
<div className="mt-2">
<a
href={getPostUrl(item)}
title={"Accédez à l'article " + delve(item, 'attributes.title', 'N/A')}
aria-label={"Accédez à l'article " + delve(item, 'attributes.title', 'N/A')}
className="text-xl font-bold hover:underline
text-gray-700
dark:text-gray-200">
{delve(item, 'attributes.title', 'N/A')}
</a>
<p className="mt-2 font-light text-sm
text-gray-600
dark:text-gray-300">{delve(item, 'attributes.description', 'N/A')}</p>
</div>
<div className="flex justify-between items-center mt-4">
<a href={getPostUrl(item)}
title={"Accédez à l'article " + delve(item, 'attributes.title', 'N/A')}
aria-label={"Accédez à l'article " + delve(item, 'attributes.title', 'N/A')}
className="text-blue-500 text-sm hover:underline">Lire l'article</a>
<div>
<span
className="flex items-center">
<img
src="https://images.unsplash.com/photo-1492562080023-ab3db95bfbce?ixlib=rb-1.2.1&amp;ixid=eyJhcHBfaWQiOjEyMDd9&amp;auto=format&amp;fit=crop&amp;w=731&amp;q=80"
alt="avatar"
width="auto"
height="auto"
className="mx-4 w-10 h-10 object-cover rounded-full hidden sm:block" />
<h3 className="text-normal font-bold hover:underline
text-gray-700
dark:text-gray-300">Alex John</h3>
</span>
</div>
</div>
</main>
</div>
</>
);
}
export default HomeSectionBlogUne;

@ -0,0 +1,7 @@
/*
* Replace this with your own classes
*
* e.g.
* .container {
* }
*/

@ -0,0 +1,10 @@
import { render } from '@testing-library/react';
import HomeSectionBlog from './home-section-blog';
describe('HomeSectionBlog', () => {
it('should render successfully', () => {
const { baseElement } = render(<HomeSectionBlog />);
expect(baseElement).toBeTruthy();
});
});

@ -0,0 +1,28 @@
/* eslint-disable-next-line */
import {getStrapiImageSize} from "../../libs/utils";
import CardBlog from "../card-blog/card-blog";
import HomeSectionBlogUne from "../home-section-blog-une/home-section-blog-une";
export interface HomeSectionBlogProps {
posts: object[];
}
export function HomeSectionBlog({posts = []}: HomeSectionBlogProps) {
const firstArticle = posts.length > 0 ? posts.slice(0, 1) : [];
const otherArticles = posts.length > 0 ? posts.slice(1, posts.length) : [];
return (
<>
<section className="container max-w-6xl relative mx-auto relative flex flex-col md:flex-row mb-10 h-auto">
<div className="w-12/12 md:w-6/12 px-4 mb-4 md:mb-0 md:px-0 md:pr-2">
<HomeSectionBlogUne item={firstArticle[0]} />
</div>
<div className="w-12/12 md:w-6/12 px-4 md:px-0 md:pl-2">
{otherArticles.map((item: object, index: number) => (<CardBlog key={"home-card-blog-" + index}
item={item} />))}
</div>
</section>
</>
);
}
export default HomeSectionBlog;

@ -0,0 +1,7 @@
/*
* Replace this with your own classes
*
* e.g.
* .container {
* }
*/

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save