Skip to content
Snippets Groups Projects
Commit b6c0274d authored by Fatima Ezzahra Majidi's avatar Fatima Ezzahra Majidi
Browse files

Merge branch 'master' into 'main'

Ajout des listes (stages, entreprises, étudiants, candidatures, superviseurs)...

See merge request !1
parents 129d803d 628b1b07
No related branches found
No related tags found
1 merge request!1Ajout des listes (stages, entreprises, étudiants, candidatures, superviseurs)...
Showing with 28249 additions and 61 deletions
# 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*
# Gestion des stages Frontend
# Getting Started with Create React App
This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
## Available Scripts
## Getting started
In the project directory, you can run:
To make it easy for you to get started with GitLab, here's a list of recommended next steps.
### `npm start`
Already a pro? Just edit this README.md and make it your own. Want to make it easy? [Use the template at the bottom](#editing-this-readme)!
Runs the app in the development mode.\
Open [http://localhost:3000](http://localhost:3000) to view it in your browser.
## Add your files
The page will reload when you make changes.\
You may also see any lint errors in the console.
- [ ] [Create](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#create-a-file) or [upload](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#upload-a-file) files
- [ ] [Add files using the command line](https://docs.gitlab.com/ee/gitlab-basics/add-file.html#add-a-file-using-the-command-line) or push an existing Git repository with the following command:
### `npm test`
```
cd existing_repo
git remote add origin https://gitlab.univ-lille.fr/fatima-ezzahra.majidi.etu/gestion-des-stages-frontend.git
git branch -M main
git push -uf origin main
```
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.
## Integrate with your tools
### `npm run build`
- [ ] [Set up project integrations](https://gitlab.univ-lille.fr/fatima-ezzahra.majidi.etu/gestion-des-stages-frontend/-/settings/integrations)
Builds the app for production to the `build` folder.\
It correctly bundles React in production mode and optimizes the build for the best performance.
## Collaborate with your team
The build is minified and the filenames include the hashes.\
Your app is ready to be deployed!
- [ ] [Invite team members and collaborators](https://docs.gitlab.com/ee/user/project/members/)
- [ ] [Create a new merge request](https://docs.gitlab.com/ee/user/project/merge_requests/creating_merge_requests.html)
- [ ] [Automatically close issues from merge requests](https://docs.gitlab.com/ee/user/project/issues/managing_issues.html#closing-issues-automatically)
- [ ] [Enable merge request approvals](https://docs.gitlab.com/ee/user/project/merge_requests/approvals/)
- [ ] [Set auto-merge](https://docs.gitlab.com/ee/user/project/merge_requests/merge_when_pipeline_succeeds.html)
See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.
## Test and Deploy
### `npm run eject`
Use the built-in continuous integration in GitLab.
**Note: this is a one-way operation. Once you `eject`, you can't go back!**
- [ ] [Get started with GitLab CI/CD](https://docs.gitlab.com/ee/ci/quick_start/index.html)
- [ ] [Analyze your code for known vulnerabilities with Static Application Security Testing (SAST)](https://docs.gitlab.com/ee/user/application_security/sast/)
- [ ] [Deploy to Kubernetes, Amazon EC2, or Amazon ECS using Auto Deploy](https://docs.gitlab.com/ee/topics/autodevops/requirements.html)
- [ ] [Use pull-based deployments for improved Kubernetes management](https://docs.gitlab.com/ee/user/clusters/agent/)
- [ ] [Set up protected environments](https://docs.gitlab.com/ee/ci/environments/protected_environments.html)
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.
# Editing this README
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.
When you're ready to make this README your own, just edit this file and use the handy template below (or feel free to structure it however you want - this is just a starting point!). Thanks to [makeareadme.com](https://www.makeareadme.com/) for this template.
## Learn More
## Suggestions for a good README
You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).
Every project is different, so consider which of these sections apply to yours. The sections used in the template are suggestions for most open source projects. Also keep in mind that while a README can be too long and detailed, too long is better than too short. If you think your README is too long, consider utilizing another form of documentation rather than cutting out information.
To learn React, check out the [React documentation](https://reactjs.org/).
## Name
Choose a self-explaining name for your project.
### Code Splitting
## Description
Let people know what your project can do specifically. Provide context and add a link to any reference visitors might be unfamiliar with. A list of Features or a Background subsection can also be added here. If there are alternatives to your project, this is a good place to list differentiating factors.
This section has moved here: [https://facebook.github.io/create-react-app/docs/code-splitting](https://facebook.github.io/create-react-app/docs/code-splitting)
## Badges
On some READMEs, you may see small images that convey metadata, such as whether or not all the tests are passing for the project. You can use Shields to add some to your README. Many services also have instructions for adding a badge.
### Analyzing the Bundle Size
## Visuals
Depending on what you are making, it can be a good idea to include screenshots or even a video (you'll frequently see GIFs rather than actual videos). Tools like ttygif can help, but check out Asciinema for a more sophisticated method.
This section has moved here: [https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size](https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size)
## Installation
Within a particular ecosystem, there may be a common way of installing things, such as using Yarn, NuGet, or Homebrew. However, consider the possibility that whoever is reading your README is a novice and would like more guidance. Listing specific steps helps remove ambiguity and gets people to using your project as quickly as possible. If it only runs in a specific context like a particular programming language version or operating system or has dependencies that have to be installed manually, also add a Requirements subsection.
### Making a Progressive Web App
## Usage
Use examples liberally, and show the expected output if you can. It's helpful to have inline the smallest example of usage that you can demonstrate, while providing links to more sophisticated examples if they are too long to reasonably include in the README.
This section has moved here: [https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app](https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app)
## Support
Tell people where they can go to for help. It can be any combination of an issue tracker, a chat room, an email address, etc.
### Advanced Configuration
## Roadmap
If you have ideas for releases in the future, it is a good idea to list them in the README.
This section has moved here: [https://facebook.github.io/create-react-app/docs/advanced-configuration](https://facebook.github.io/create-react-app/docs/advanced-configuration)
## Contributing
State if you are open to contributions and what your requirements are for accepting them.
### Deployment
For people who want to make changes to your project, it's helpful to have some documentation on how to get started. Perhaps there is a script that they should run or some environment variables that they need to set. Make these steps explicit. These instructions could also be useful to your future self.
This section has moved here: [https://facebook.github.io/create-react-app/docs/deployment](https://facebook.github.io/create-react-app/docs/deployment)
You can also document commands to lint the code or run tests. These steps help to ensure high code quality and reduce the likelihood that the changes inadvertently break something. Having instructions for running tests is especially helpful if it requires external setup, such as starting a Selenium server for testing in a browser.
### `npm run build` fails to minify
## Authors and acknowledgment
Show your appreciation to those who have contributed to the project.
## License
For open source projects, say how it is licensed.
## Project status
If you have run out of energy or time for your project, put a note at the top of the README saying that development has slowed down or stopped completely. Someone may choose to fork your project or volunteer to step in as a maintainer or owner, allowing your project to keep going. You can also make an explicit request for maintainers.
This section has moved here: [https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify](https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify)
This diff is collapsed.
{
"name": "gestion-stages-front",
"version": "0.1.0",
"private": true,
"dependencies": {
"@testing-library/dom": "^10.4.0",
"@testing-library/jest-dom": "^6.6.3",
"@testing-library/react": "^16.2.0",
"@testing-library/user-event": "^13.5.0",
"axios": "^1.8.1",
"bootstrap": "^5.3.3",
"react": "^19.0.0",
"react-dom": "^19.0.0",
"react-router-dom": "^7.2.0",
"react-scripts": "5.0.1",
"web-vitals": "^2.1.4"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": [
"react-app",
"react-app/jest"
]
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}
}
public/favicon.ico

3.78 KiB

<!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 created using create-react-app"
/>
<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>React App</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>
public/logo192.png

5.22 KiB

public/logo512.png

9.44 KiB

{
"short_name": "React App",
"name": "Create React App Sample",
"icons": [
{
"src": "favicon.ico",
"sizes": "64x64 32x32 24x24 16x16",
"type": "image/x-icon"
},
{
"src": "logo192.png",
"type": "image/png",
"sizes": "192x192"
},
{
"src": "logo512.png",
"type": "image/png",
"sizes": "512x512"
}
],
"start_url": ".",
"display": "standalone",
"theme_color": "#000000",
"background_color": "#ffffff"
}
# https://www.robotstxt.org/robotstxt.html
User-agent: *
Disallow:
.App {
text-align: center;
}
.App-logo {
height: 40vmin;
pointer-events: none;
}
@media (prefers-reduced-motion: no-preference) {
.App-logo {
animation: App-logo-spin infinite 20s linear;
}
}
.App-header {
background-color: #282c34;
min-height: 100vh;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
font-size: calc(10px + 2vmin);
color: white;
}
.App-link {
color: #61dafb;
}
@keyframes App-logo-spin {
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
}
import React from "react";
import { BrowserRouter as Router, Routes, Route } from "react-router-dom";
import Navbar from "./components/Navbar";
import StageList from "./components/StageList";
import EnterpriseList from "./components/EnterpriseList";
import StudentList from "./components/StudentList";
import CandidacyList from "./components/CandidacyList";
import UnivSupervisorList from "./components/UnivSupervisorList";
function App() {
return (
<Router>
<Navbar />
<Routes>
<Route path="/stages" element={<StageList />} />
<Route path="/entreprises" element={<EnterpriseList />} />
<Route path="/etudiants" element={<StudentList />} />
<Route path="/candidatures" element={<CandidacyList />} />
<Route path="/superviseurs" element={<UnivSupervisorList />} />
</Routes>
</Router>
);
}
export default App;
import { render, screen } from '@testing-library/react';
import App from './App';
test('renders learn react link', () => {
render(<App />);
const linkElement = screen.getByText(/learn react/i);
expect(linkElement).toBeInTheDocument();
});
import React, { useEffect, useState } from "react";
const CandidacyList = () => {
const [candidacies, setCandidacies] = useState([]);
const [error, setError] = useState(null);
useEffect(() => {
fetch("http://localhost:8080/api/candidacies")
.then((response) => {
if (!response.ok) {
throw new Error("Erreur lors de la récupération des candidatures !");
}
return response.json();
})
.then((data) => setCandidacies(data))
.catch((err) => setError(err.message));
}, []);
return (
<div>
<h2>Liste des Candidatures</h2>
{error && <p style={{ color: "red" }}>{error}</p>}
<ul>
{candidacies.length > 0 ? (
candidacies.map((candidacy) => (
<li key={candidacy.id}>
Étudiant: {candidacy.student.firstname} {candidacy.student.lastname} -
Stage: {candidacy.stage.name} -
Superviseur: {candidacy.univSupervisor.name}
</li>
))
) : (
<p>Aucune candidature trouvée.</p>
)}
</ul>
</div>
);
};
export default CandidacyList;
import React, { useEffect, useState } from "react";
const EnterpriseList = () => {
const [enterprises, setEnterprises] = useState([]);
const [error, setError] = useState(null);
useEffect(() => {
fetch("http://localhost:8080/api/enterprises")
.then((response) => {
if (!response.ok) {
throw new Error("Erreur lors de la récupération des entreprises !");
}
return response.json();
})
.then((data) => setEnterprises(data))
.catch((err) => setError(err.message));
}, []);
return (
<div>
<h2>Liste des Entreprises</h2>
{error && <p style={{ color: "red" }}>{error}</p>}
<ul>
{enterprises.length > 0 ? (
enterprises.map((enterprise) => (
<li key={enterprise.id}>
<strong>{enterprise.name}</strong> - {enterprise.address}
</li>
))
) : (
<p>Aucune entreprise trouvée.</p>
)}
</ul>
</div>
);
};
export default EnterpriseList;
import React from "react";
import { Link } from "react-router-dom";
function Navbar() {
return (
<nav className="navbar navbar-expand-lg navbar-dark bg-dark">
<div className="container">
<Link className="navbar-brand" to="/">Gestion Stages</Link>
<button
className="navbar-toggler"
type="button"
data-bs-toggle="collapse"
data-bs-target="#navbarNav"
aria-controls="navbarNav"
aria-expanded="false"
aria-label="Toggle navigation"
>
<span className="navbar-toggler-icon"></span>
</button>
<div className="collapse navbar-collapse" id="navbarNav">
<ul className="navbar-nav">
<li className="nav-item">
<Link className="nav-link" to="/login">Login</Link>
</li>
<li className="nav-item">
<Link className="nav-link" to="/stages">Stages</Link>
</li>
<li className="nav-item">
<Link className="nav-link" to="/etudiants">Étudiants</Link>
</li>
<li className="nav-item">
<Link className="nav-link" to="/entreprises">Entreprises</Link>
</li>
<li className="nav-item">
<Link className="nav-link" to="/candidatures">Candidatures</Link>
</li>
<li className="nav-item">
<Link className="nav-link" to="/superviseurs">Superviseurs</Link>
</li>
</ul>
</div>
</div>
</nav>
);
}
export default Navbar;
import React, { useEffect, useState } from "react";
const StageList = () => {
const [stages, setStages] = useState([]); // État pour stocker les stages
const [error, setError] = useState(null); // État pour gérer les erreurs
useEffect(() => {
fetch("http://localhost:8080/api/stages") // Appel API
.then((response) => {
if (!response.ok) {
throw new Error("Erreur lors de la récupération des stages !");
}
return response.json();
})
.then((data) => setStages(data)) // Mettre à jour l'état avec les données reçues
.catch((err) => setError(err.message)); // Gestion des erreurs
}, []); // Le tableau vide signifie que ça s'exécute une seule fois au chargement
return (
<div>
<h2>Liste des Stages</h2>
{error && <p style={{ color: "red" }}>{error}</p>} {/* Affichage des erreurs */}
<ul>
{stages.length > 0 ? (
stages.map((stage) => (
<li key={stage.id}>
<strong>{stage.name}</strong> - {stage.description}
</li>
))
) : (
<p>Aucun stage trouvé.</p>
)}
</ul>
</div>
);
};
export default StageList;
import React, { useEffect, useState } from "react";
const StudentList = () => {
const [students, setStudents] = useState([]);
const [error, setError] = useState(null);
useEffect(() => {
fetch("http://localhost:8080/api/students")
.then((response) => {
if (!response.ok) {
throw new Error("Erreur lors de la récupération des étudiants !");
}
return response.json();
})
.then((data) => setStudents(data))
.catch((err) => setError(err.message));
}, []);
return (
<div>
<h2>Liste des Étudiants</h2>
{error && <p style={{ color: "red" }}>{error}</p>}
<ul>
{students.length > 0 ? (
students.map((student) => (
<li key={student.id}>
<strong>{student.firstname} {student.lastname}</strong>
</li>
))
) : (
<p>Aucun étudiant trouvé.</p>
)}
</ul>
</div>
);
};
export default StudentList;
import React, { useEffect, useState } from "react";
const UnivSupervisorList = () => {
const [supervisors, setSupervisors] = useState([]);
const [error, setError] = useState(null);
useEffect(() => {
fetch("http://localhost:8080/api/univsupervisors")
.then((response) => {
if (!response.ok) {
throw new Error("Erreur lors de la récupération des superviseurs !");
}
return response.json();
})
.then((data) => setSupervisors(data))
.catch((err) => setError(err.message));
}, []);
return (
<div>
<h2>Liste des Superviseurs</h2>
{error && <p style={{ color: "red" }}>{error}</p>}
<ul>
{supervisors.length > 0 ? (
supervisors.map((supervisor) => (
<li key={supervisor.id}>
<strong>{supervisor.name}</strong>
</li>
))
) : (
<p>Aucun superviseur trouvé.</p>
)}
</ul>
</div>
);
};
export default UnivSupervisorList;
body {
margin: 0;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
code {
font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
monospace;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment