Skip to content

Commit

Permalink
README
Browse files Browse the repository at this point in the history
  • Loading branch information
MelanieSarrouy committed Dec 7, 2021
1 parent 930759a commit 85e49db
Show file tree
Hide file tree
Showing 27 changed files with 299 additions and 167 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# api keys
.env

# dependencies
/node_modules
/.pnp
Expand Down
126 changes: 63 additions & 63 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,70 +1,70 @@
# Getting Started with Create React App
[![Netlify Status](https://api.netlify.com/api/v1/badges/d3ba51cd-668d-4c68-b900-b31c84e16825/deploy-status)](https://app.netlify.com/sites/oc-hrnet/deploys)

This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
<br/>
<p align="center"><img src="https://github.com/MelanieSarrouy/MelanieSarrouy_P14_16112021/blob/main/src/assets/logo-vert.png?raw=true" alt="HRNet logo" /></p>

## Available Scripts
[HRNet](https://oc-hrnet.netlify.app/)

In the project directory, you can run:
# HRNET: Employee records management application

### P14 - OpenClassrooms

This application allows you to add new employees through a form and to have access to the all employees list. A table allows you to perform a search, to sort the data displayed and to choose the number of data to display per page.

Goals:

### `yarn start`
- Moving a jQuery library to React
- reduce the technical debt
- use a state management system
- modernise the style
- create, publish and use a React component on [npm](https://www.npmjs.com/) as a package :

[nmp-package](https://www.npmjs.com/package/simple-react-modal-ui)

Runs the app in the development mode.\
Open [http://localhost:3000](http://localhost:3000) to view it in the browser.
[npm-package GitHub repository](https://github.com/MelanieSarrouy/MelanieSarrouy_P14_npm-package_simple-customisable-modal)

## 1. Technologies

This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).

- [react](https://reactjs.org/) v17.0.2
- [react-dom](https://fr.reactjs.org/docs/react-dom.html)v17.0.2
- [react-router-dom](https://reactrouter.com/web/guides/quick-start) v6.0.2
- [redux](https://redux.js.org/introduction/getting-started) v4.1.2
- [react-redux](https://react-redux.js.org/introduction/getting-started) v7.2.6
- [redux/toolkit](https://redux-toolkit.js.org/introduction/getting-started) v1.6.2
- [redux-thunk](https://redux.js.org/usage/writing-logic-thunks) v2.4.0
- [firebase](https://firebase.google.com/) v9.5.0
- [prop-types](https://www.npmjs.com/package/prop-types) v15.7.2
- [styled-components](https://styled-components.com/) v5.3.3
- [simple-react-modal-ui](https://www.npmjs.com/package/simple-react-modal-ui)v0.1.5
- Recommended IDE : [Visual Studio code](https://code.visualstudio.com/)

## 2. Prerequisites

- [Git](https://git-scm.com/) to clone repositories
- [Node.js](https://nodejs.org/en/) to run `yarn` commands
- [Yarn](https://yarnpkg.com/) to run application

## 3. Install and run application


### Install back-end

This project uses [Firebase](https://firebase.google.com/) for database management

**1**. First you need to create a new project on **firebase** and start a new collection named ***'employees'*** (you can use collection example with the **json** file found in **'/src/datas/employees.json'**)

**2**. Next, look at and copy the **firebaseConfig** constant (you can find it in your Firebase project settings)

**3**. In this project you should find a **.env_sample** file with **environment variable names**, so you need to create your own **.env** file at project root with the environment variable names and your firebaseConfig values (don't forget to add **'.env'** file to **'.gitignore'**)

### Install and launch front-end

- [ ] Clone repository : https://github.com/MelanieSarrouy/MelanieSarrouy_P14_16112021
- [ ] `cd MelanieSarrouy_P14_16112021`
- [ ] `yarn` to install dependencies
- [ ] `yarn start` Runs the app in the development mode.\
Open [http://localhost:3000](http://localhost:3000) to view it in the browser.\
The page will reload if you make edits.\
You will also see any lint errors in the console.

### `yarn test`

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.

### `yarn 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!

See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.

### `yarn eject`

**Note: this is a one-way operation. Once you `eject`, you can’t go back!**

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

You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).

To learn React, check out the [React documentation](https://reactjs.org/).

### Code Splitting

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)

### Analyzing the Bundle Size

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)

### Making a Progressive Web App

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)

### Advanced Configuration

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)

### Deployment

This section has moved here: [https://facebook.github.io/create-react-app/docs/deployment](https://facebook.github.io/create-react-app/docs/deployment)

### `yarn build` fails to minify

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)
You will also see any lint errors in the console.
Binary file modified public/favicon.ico
Binary file not shown.
12 changes: 11 additions & 1 deletion src/React/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,25 @@ import { useStore } from 'react-redux'
import { useEffect } from 'react'
import { getEmployees } from '../firebase/firebaseServices'
import NotFoundPage from './pages/NotFoundPage'
import styled from 'styled-components'


export const Divimg = styled.div`
position: fixed;
right: -10rem;
bottom: -10rem;
z-index: 0;
& img {
width: 20rem;
}
`
export const App = () => {
const store = useStore()

useEffect(() => {
getEmployees(store)
}, [store])


return (
<>
<BrowserRouter>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ const Pagination = (props) => {
) {
return (
<ButtonNumber
backgroundColor={colors.primary}
backgroundColor={colors.secondary}
color="white"
key={index + 1}
onClick={(e) => {
Expand Down
20 changes: 4 additions & 16 deletions src/React/pages/Homepage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import React, { useState } from 'react'
import { useStore } from 'react-redux'
import PropTypes from 'prop-types'
// styles imports
import {
Form,
Expand Down Expand Up @@ -46,14 +45,14 @@ const Homepage = () => {
const [zipCode, setZipCode] = useState('')
const [department, setDepartment] = useState('engineering')

const departmentsSorted = departments.sort(sortDepartments)

const USAStates = states

const [modalIsOpen, setModalIsOpen] = useState(false)

const store = useStore()

const departmentsSorted = departments.sort(sortDepartments)

const USAStates = states

const closeModal = () => {
setModalIsOpen(false)
}
Expand Down Expand Up @@ -221,17 +220,6 @@ const Homepage = () => {
)
}

// PROPTYPES // ___________________________________________________________

Modal.propTypes = {
hideModal: PropTypes.func.isRequired,
styleModalBackground: PropTypes.string.isRequired,
styleModal: PropTypes.string.isRequired,
styleModalContent: PropTypes.number.isRequired,
animation: PropTypes.bool.isRequired,
closeButton: PropTypes.bool.isRequired,
}

// EXPORT // ______________________________________________________________

export default Homepage
5 changes: 3 additions & 2 deletions src/Redux/reducers/getEmployeesReducer.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
// IMPORTS // ______________________________________________________________

import { createReducer } from "@reduxjs/toolkit"
import { employeesListError, employeesListLoading, employeesListSuccess, } from "../actions/actionGetEmployees"

// REDUCER // ______________________________________________________________

const initialStateGetEmployees = {
isLoading: false,
employees: [],
isEmpty: true,
error: null,


}

export const getEmployeesReducer = createReducer(initialStateGetEmployees, (builder) => {
Expand Down
3 changes: 3 additions & 0 deletions src/Redux/store/store.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
// IMPORTS // ______________________________________________________________

import { configureStore } from "@reduxjs/toolkit";
import { getEmployeesReducer } from "../reducers/getEmployeesReducer";

// STORE // ______________________________________________________________

export const store = configureStore({
reducer: {
Expand Down
Binary file added src/assets/logo-blanc.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/logo-vert.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
72 changes: 0 additions & 72 deletions src/datas/employees.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,6 @@ const employeesList = [
street: "2002 Altered Carbon St",
zipCode: "00011",
},
{
city: "HerosCity",
dateOfBirth: "2021-11-01",
department: "Human Resources",
firstName: "Sisi",
id: "96rKSTwNAhLgElbvXSAd",
lastName: "Lafamille",
startDate: "2021-11-25",
state: "KS",
street: "007 James Bond St",
zipCode: "00017",
},
{
city: "Motihari",
dateOfBirth: "1903-06-25",
Expand All @@ -35,18 +23,6 @@ const employeesList = [
street: "1949 Nineteen Eighty-Four St",
zipCode: "00007",
},
{
city: "Paris",
dateOfBirth: "1979-09-03",
department: "Legal",
firstName: "Stephane",
id: "BXMQz15ZnWn1K0sUmSXm",
lastName: "Doudou",
startDate: "2021-11-06",
state: "CO",
street: "451 Ici St",
zipCode: "00014",
},
{
city: "Colombo",
dateOfBirth: "1917-12-16",
Expand All @@ -71,54 +47,6 @@ const employeesList = [
street: "1985 Ender's Game Av",
zipCode: "00009",
},
{
city: "La Couvertoirade",
dateOfBirth: "1982-08-28",
department: "Human Resources",
firstName: "Melanie",
id: "GZdAgnenAO5Vcdgk8YE5",
lastName: "Sarrouy",
startDate: "2021-11-22",
state: "HI",
street: "La Blaquèrerie",
zipCode: "00013",
},
{
city: "OufCity",
dateOfBirth: "1918-02-12",
department: "Human Resources",
firstName: "Al",
id: "I1pYYFGsG5gZqkBFBNEl",
lastName: "Bundy",
startDate: "2030-11-26",
state: "TX",
street: "145 Crazy St",
zipCode: "00016",
},
{
city: "New York",
dateOfBirth: "1956-06-06",
department: "Engineering",
firstName: "Calvin",
id: "P9PoSjgYvwYv4ePP1632",
lastName: "Hobbs",
startDate: "2021-11-21",
state: "NY",
street: "17 Test Street",
zipCode: "00015",
},
{
city: "Zinzintown",
dateOfBirth: "2000-03-08",
department: "Marketing",
firstName: "George",
id: "XC9neZnYoGcXH2UHanPx",
lastName: "Delajungle",
startDate: "2020-05-07",
state: "CT",
street: "3645 Main St",
zipCode: "00016",
},
{
city: "Providence",
dateOfBirth: "1890-08-20",
Expand Down
Loading

0 comments on commit 85e49db

Please sign in to comment.