Nantes Université

Skip to content
Extraits de code Groupes Projets
Valider ac6aaf43 rédigé par Malo Grall's avatar Malo Grall
Parcourir les fichiers

Merge branch 'front-dev' into main

parents f013829d 230483bd
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
Pipeline #56325 réussi
Affichage de
avec 55945 ajouts et 7261 suppressions
module.exports = {
env: {
browser: true,
node: true
},
extends: [
'plugin:react/recommended',
'plugin:@typescript-eslint/recommended',
'plugin:react-hooks/recommended',
'plugin:jest/recommended',
'plugin:storybook/recommended',
'standard'
],
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaFeatures: {
jsx: true // Allows for the parsing of JSX
}
},
plugins: ['react', 'react-hooks', 'jest'],
rules: {
'react/prop-types': 0,
'no-use-before-define': 'off',
'react/jsx-uses-react': 1,
'react/jsx-no-useless-fragment': 1,
'no-console': 'warn',
indent: ['warn', 2, { SwitchCase: 1 }]
},
settings: {
react: {
version: 'detect'
}
}
}
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
# dependencies
/node_modules
/.pnp
.pnp.js
# testing
/coverage
# production
/build
# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local
npm-debug.log*
yarn-debug.log*
yarn-error.log*
const path = require('path')
module.exports = {
"stories": [
"../src/**/*.stories.mdx",
"../src/**/*.stories.@(js|jsx|ts|tsx)"
],
"addons": [
"@storybook/addon-links",
"@storybook/addon-essentials",
"@storybook/preset-create-react-app"
],
"framework": "@storybook/react",
"core": {
"builder": "webpack5"
},
webpackFinal: async(config) => {
// We want to use ts-loader for tsx files
config.module.rules.push({
test: /\.tsx?$/,
use: [
{
loader: 'babel-loader',
options: {
presets: ['@babel/preset-env'],
},
},
{
loader: 'ts-loader',
options: {
compilerOptions: {
noEmit: false,
},
},
},
],
include: [path.resolve(__dirname, "../utils"),]
});
return config;
}
}
\ No newline at end of file
import 'bootstrap/dist/css/bootstrap.min.css'
export const parameters = {
actions: { argTypesRegex: "^on[A-Z].*" },
controls: {
matchers: {
color: /(background|color)$/i,
date: /Date$/,
},
},
}
\ No newline at end of file
{
"files": ["../utils/types.ts"]
}
\ No newline at end of file
This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app).
# Getting Started with Create React App
## Getting Started
This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
First, run the development server:
## Available Scripts
```bash
npm run dev
# or
yarn dev
```
In the project directory, you can run:
Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
### `npm start`
You can start editing the page by modifying `pages/index.tsx`. The page auto-updates as you edit the file.
Runs the app in the development mode.\
Open [http://localhost:3000](http://localhost:3000) to view it in the browser.
[API routes](https://nextjs.org/docs/api-routes/introduction) can be accessed on [http://localhost:3000/api/hello](http://localhost:3000/api/hello). This endpoint can be edited in `pages/api/hello.ts`.
The page will reload if you make edits.\
You will also see any lint errors in the console.
The `pages/api` directory is mapped to `/api/*`. Files in this directory are treated as [API routes](https://nextjs.org/docs/api-routes/introduction) instead of React pages.
### `npm test`
## Learn More
Launches the test runner in the interactive watch mode.\
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.
### `npm run build`
Builds the app for production to the `build` folder.\
It correctly bundles React in production mode and optimizes the build for the best performance.
The build is minified and the filenames include the hashes.\
Your app is ready to be deployed!
To learn more about Next.js, take a look at the following resources:
See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.
- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
### `npm run eject`
You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome!
**Note: this is a one-way operation. Once you `eject`, you can’t go back!**
## Deploy on Vercel
If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.
Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own.
You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it.
## Learn More
The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.
You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).
Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details.
To learn React, check out the [React documentation](https://reactjs.org/).
module.exports = {
presets: [[
'@babel/preset-env',
{
targets: {
esmodules: true
}
}
], '@babel/preset-react']
}
import React, { EventHandler, FormEvent, FormEventHandler, useState } from "react"
import { connection } from "../utils/server"
interface Props {
username: string
setUsername: (name: string) => void
}
const Connection: React.FC<Props> = ({ setUsername, username }) => {
const handleSubmit = (e: FormEvent) => {
e.preventDefault()
connection(username)
}
return (
<form onSubmit={handleSubmit}>
<input
type="text"
placeholder="Pseudo"
value={username}
onChange={(event) => setUsername(event.target.value)}
/>
<input type="submit" value="Connecter" />
</form>
)
}
export default Connection
\ No newline at end of file
// eslint-disable-next-line @typescript-eslint/no-var-requires
const path = require('path')
module.exports = {
process (src, filename) {
return 'module.exports = ' + JSON.stringify(path.basename(filename)) + ';'
}
}
/// <reference types="next" />
/// <reference types="next/types/global" />
/// <reference types="next/image-types/global" />
// NOTE: This file should not be edited
// see https://nextjs.org/docs/basic-features/typescript for more information.
/** @type {import('next').NextConfig} */
module.exports = {
reactStrictMode: true,
}
Ce diff est replié.
{
"name": "client",
"version": "0.1.0",
"private": true,
"dependencies": {
"bootstrap": "^5.1.3",
"react": "^17.0.2",
"react-bootstrap": "^2.0.4",
"react-dom": "^17.0.2",
"react-scripts": "5.0.0",
"ts-loader": "^9.2.6",
"web-vitals": "^2.1.2"
},
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start",
"lint": "next lint"
"start": "react-scripts start",
"build": "react-scripts build",
"test": "jest",
"eject": "react-scripts eject",
"lint": "eslint . 'src/stories/**/*.{ts,js,tsx,jsx}'",
"lint:fix": "eslint . --fix 'src/stories/**/*.{ts,js,tsx,jsx}'",
"storybook": "start-storybook -p 6006 -s public",
"build-storybook": "build-storybook -s public"
},
"dependencies": {
"next": "12.0.4",
"react": "17.0.2",
"react-dom": "17.0.2"
"eslintConfig": {
"extends": [
"react-app",
"react-app/jest"
],
"overrides": [
{
"files": [
"**/*.stories.*"
],
"rules": {
"import/no-anonymous-default-export": "off"
}
}
]
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
},
"devDependencies": {
"@types/node": "16.11.10",
"@types/react": "17.0.36",
"eslint": "7.32.0",
"eslint-config-next": "12.0.4",
"typescript": "4.5.2"
"@babel/preset-env": "^7.16.5",
"@babel/preset-react": "^7.16.5",
"@storybook/addon-actions": "^6.4.9",
"@storybook/addon-essentials": "^6.4.9",
"@storybook/addon-links": "^6.4.9",
"@storybook/builder-webpack5": "^6.4.9",
"@storybook/manager-webpack5": "^6.4.9",
"@storybook/node-logger": "^6.4.9",
"@storybook/preset-create-react-app": "^4.0.0",
"@storybook/react": "^6.4.9",
"@testing-library/jest-dom": "^5.16.1",
"@testing-library/react": "^12.1.2",
"@testing-library/user-event": "^13.5.0",
"@types/jest": "^27.0.3",
"@types/node": "^16.11.15",
"@types/react": "^17.0.37",
"@types/react-dom": "^17.0.11",
"eslint": "^7.32.0",
"eslint-config-standard": "^16.0.3",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-promise": "^5.2.0",
"eslint-plugin-storybook": "^0.5.5",
"install": "^0.13.0",
"webpack": "^5.65.0"
},
"jest": {
"testEnvironment": "jsdom",
"setupFilesAfterEnv": [
"<rootDir>/setupTests.ts"
],
"moduleFileExtensions": [
"js",
"json",
"jsx",
"ts",
"tsx"
],
"transform": {
"^.+\\.(js|jsx|ts|tsx)$": "babel-jest",
"\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "<rootDir>/fileTransformer.ts"
},
"moduleNameMapper": {
"\\.(css|less)$": "identity-obj-proxy"
}
}
}
import '../styles/globals.css'
import type { AppProps } from 'next/app'
function MyApp({ Component, pageProps }: AppProps) {
return <Component {...pageProps} />
}
export default MyApp
// Next.js API route support: https://nextjs.org/docs/api-routes/introduction
import type { NextApiRequest, NextApiResponse } from 'next'
type Data = {
name: string
}
export default function handler(
req: NextApiRequest,
res: NextApiResponse<Data>
) {
res.status(200).json({ name: 'John Doe' })
}
import type { NextPage } from 'next'
import Head from 'next/head'
import Image from 'next/image'
import { useState } from 'react'
import Connection from '../components/Connection'
import styles from '../styles/Home.module.css'
const Home: NextPage = () => {
const [username, setUsername] = useState('')
return (
<div className={styles.container}>
<Head>
<title>Create Next App</title>
<meta name="description" content="Generated by create next app" />
<link rel="icon" href="/favicon.ico" />
</Head>
<div dangerouslySetInnerHTML={{ __html: username }}></div>
<Connection username={username} setUsername={setUsername} />
<main className={styles.main}>
<h1 className={styles.title}>
Welcome to <a href="https://nextjs.org">Next.js!</a>
</h1>
<p className={styles.description}>
Get started by editing{' '}
<code className={styles.code}>pages/index.tsx</code>
</p>
<div className={styles.grid}>
<a href="https://nextjs.org/docs" className={styles.card}>
<h2>Documentation &rarr;</h2>
<p>Find in-depth information about Next.js features and API.</p>
</a>
<a href="https://nextjs.org/learn" className={styles.card}>
<h2>Learn &rarr;</h2>
<p>Learn about Next.js in an interactive course with quizzes!</p>
</a>
<a
href="https://github.com/vercel/next.js/tree/master/examples"
className={styles.card}
>
<h2>Examples &rarr;</h2>
<p>Discover and deploy boilerplate example Next.js projects.</p>
</a>
<a
href="https://vercel.com/new?utm_source=create-next-app&utm_medium=default-template&utm_campaign=create-next-app"
className={styles.card}
>
<h2>Deploy &rarr;</h2>
<p>
Instantly deploy your Next.js site to a public URL with Vercel.
</p>
</a>
</div>
</main>
<footer className={styles.footer}>
<a
href="https://vercel.com?utm_source=create-next-app&utm_medium=default-template&utm_campaign=create-next-app"
target="_blank"
rel="noopener noreferrer"
>
Powered by{' '}
<span className={styles.logo}>
<Image src="/vercel.svg" alt="Vercel Logo" width={72} height={16} />
</span>
</a>
</footer>
</div>
)
}
export default Home
client/public/favicon.ico

25,3 ko | W: | H:

client/public/favicon.ico

3,78 ko | W: | H:

client/public/favicon.ico
client/public/favicon.ico
client/public/favicon.ico
client/public/favicon.ico
  • 2-up
  • Swipe
  • Onion skin
client/public/img/7wonder-logo.png

95,2 ko

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<meta
name="description"
content="Web site of the game 7 Wonders"
/>
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
<!--
manifest.json provides metadata used when your web app is installed on a
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
-->
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
<!--
Notice the use of %PUBLIC_URL% in the tags above.
It will be replaced with the URL of the `public` folder during the build.
Only files inside the `public` folder can be referenced from the HTML.
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
<title>7 Wonders</title>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
<!--
This HTML file is a template.
If you open it directly in the browser, you will see an empty page.
You can add webfonts, meta tags, or analytics to this file.
The build step will place the bundled scripts into the <body> tag.
To begin the development, run `npm start` or `yarn start`.
To create a production bundle, use `npm run build` or `yarn build`.
-->
</body>
</html>
client/public/logo192.png

5,22 ko

0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter