Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
node_modules
postgres
Docker_Postgre
cards-test.js



4 changes: 2 additions & 2 deletions Guid.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
How to start Tracker_Back

sudo docker run --rm --name work_db -e POSTGRES_PASSWORD=1 -e POSTGRES_USER=sergey1 -e POSTGRES_DB=work_db -d -p 5433:5432 -v $HOME/Documents/last_commits/Project_Management/Docker_Postgre:/var/lib/postgresql/data postgres
sudo docker run --rm --name pmt-db -e POSTGRES_PASSWORD=1 -e POSTGRES_USER=sergey1 -e POSTGRES_DB=pmt-db -d -p 5433:5432 -v $HOME/Documents/App-Project_Management-DEV/Docker_Postgre:/var/lib/postgresql/data postgres
sudo ss -lptn 'sport = :5432'
sudo kill 931
docker-compose up
Expand All @@ -11,4 +11,4 @@ How to start Tracker_Back





4 changes: 4 additions & 0 deletions PMT-Client/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.env
node_modules/
build/

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
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>
<title>Project Managment Tool</title>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
Expand Down
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
21 changes: 21 additions & 0 deletions PMT-Client/src/Component/Footer/Footer.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@

import React from 'react';
import '../../Styles/styleFooter.css'
const Footer = () => {
return (
<div className = 'footer'>
<div className = 'content'>
<ul>
<li>About Us</li>
<li>About Us</li>
<li>About Us</li>
<li>About Us</li>
<li>About Us</li>
</ul>
</div>

</div>
);
};

export default Footer;
83 changes: 83 additions & 0 deletions PMT-Client/src/Component/Header/NavBar.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
import React, { useState } from "react"
import 'bootstrap/dist/css/bootstrap.min.css';
import {Nav, Navbar, Container, NavDropdown, Dropdown, Row, Col, Stack} from 'react-bootstrap/'
import "../../Styles/styleHeader.css"

import { useHistory } from "react-router";
import { useDispatch, useSelector } from "react-redux";
import { user_logout } from "../../store/actions/auth";


export default function NavBar(){
const history = useHistory();
const dispatch = useDispatch()
const data = useSelector((state) => state.Auth.data_user)
let name_user = null
data.map((item) => {
name_user = item.name_user
})

let isauth = useSelector((state) => state.Auth.authenticate)

const handle_logout =() =>{
dispatch(user_logout())
localStorage.setItem('token', null)
window.location.replace("/")
}

return(
<div className="header-div">
<Navbar collapseOnSelect expand="lg" bg="light" variant="light">
<Container>
<Navbar.Brand onClick={() => history.push("/startp")}>
startUP! Factory
</Navbar.Brand>
<Navbar.Toggle aria-controls="responsive-navbar-nav" />

<Navbar.Collapse id="responsive-navbar-nav">

{isauth ? (
<>
<Nav className = "me-auto">
<Nav.Link onClick={() => history.push("/project")}>Projects</Nav.Link>
<Nav.Link onClick={() => handle_logout()}>Logout</Nav.Link>
</Nav>

<Nav>
<Nav.Link onClick={() => history.push("/project")}>{name_user}</Nav.Link>
<NavDropdown
id="nav-dropdown-dark-example"
title="Dropdown"
menuVariant="white"
>
<NavDropdown.Item href="#action/3.1">Action</NavDropdown.Item>
<NavDropdown.Item href="#action/3.2">Another action</NavDropdown.Item>
<NavDropdown.Item href="#action/3.3">Something</NavDropdown.Item>
<NavDropdown.Divider />
<NavDropdown.Item onClick={() => handle_logout()}>Logout</NavDropdown.Item>

</NavDropdown>
</Nav>
</>
) : (
<>
<Nav className ="me-auto">
<Nav.Link onClick={() => history.push("/about_us")}>About Us</Nav.Link>
<Nav.Link onClick={() => history.push("/create_profiles_page")}>Contacts</Nav.Link>
</Nav>
<Nav>
<Nav.Link onClick={() => history.push("/login")}>Sign in</Nav.Link>
<Nav.Link onClick={() => history.push("/auth")}>Sign up</Nav.Link>
</Nav>
</>
)}
</Navbar.Collapse>
</Container>
</Navbar>
</div>

)
}



11 changes: 11 additions & 0 deletions PMT-Client/src/Component/Main/AboutUs.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import React from 'react';

const AboutUs = () => {
return (
<div className = "about-us-container">
Welcome!
</div>
);
};

export default AboutUs;
67 changes: 67 additions & 0 deletions PMT-Client/src/Component/Main/Auth.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
import React, { useEffect, useState } from 'react'
import {Form, Row, Col, Button} from 'react-bootstrap'
import { connect, useDispatch, useSelector } from 'react-redux';
import { useHistory } from 'react-router';

import '../../Styles/styleAuth.css'
import f11 from '../../Styles/img/f11.svg'
import { auth, req_auth } from '../../store/operations/auth';
import { ROUTES } from '../../constans/constans';

export default function Auth(){
const dispatch = useDispatch()
const history = useHistory();

const [stateEmail, setEmail] = useState("")
const [statePassword, setPassword] = useState("")
const [stateName, setName] = useState("")

const authenticate = useSelector((state) => state.Auth.authenticate)
const obj = {email: stateEmail, password: statePassword, name: stateName}

useEffect(() => {
if(authenticate == true){
// alert('Authorization was successful!!!');
history.push('/create_profiles_page') //Переход на создание профиля
}
}, [authenticate])

const handleSub = _event => {
if(obj.email, obj.password, obj.name === ''){
alert('fild form');
}else{
dispatch(auth(obj, ROUTES.AUTH.SIGNUP)) //-----REQ
}
}

return (
<div className = "container123321">
<div className = 'sub-container'>

<Form.Group className="mb-3" controlId="formGridAddress1" onChange= {e => setName(e.target.value)}>
<Form.Label>Name</Form.Label>
<Form.Control type="name" placeholder="Name" />
</Form.Group>

<Form.Group className="mb-3" as={Col} controlId="formGridEmail" onChange = {e => setEmail(e.target.value)}>
<Form.Label>Email</Form.Label>
<Form.Control type="email" placeholder="Enter email"/>
</Form.Group>

<Form.Group className="mb-3" as={Col} controlId="formGridPassword" onChange = {e => setPassword(e.target.value)}>
<Form.Label>Password</Form.Label>
<Form.Control type="password" placeholder="Password"/>
</Form.Group>

<Form.Group className="mb-3" id="formGridCheckbox">
<Form.Check type="checkbox" label="I agree with the terms of use" />
</Form.Group>

<Button variant="primary" onClick ={handleSub}>Sign up</Button>

</div>
<div className = 'ee'><img src = {f11}/></div>
</div>
)
}

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@

import React, { useEffect } from 'react'
import { Form, Button } from 'react-bootstrap'
import { connect, useDispatch, useSelector } from 'react-redux';
Expand All @@ -16,7 +16,7 @@ const mapStateToProps = (state) => {
};
function Create(){
const dispatch = useDispatch()
const history = useHistory();
const history = useHistory()
const state = useSelector((state) => state)

const email = useSelector((state) => state.setAuth.email)
Expand All @@ -38,7 +38,7 @@ const mapStateToProps = (state) => {
else{
dispatch(reqcreateProject(obj))
}
}
bdb}
return (
<div>
<div style ={{textAlign: 'center'}}>Create new project</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,46 +6,30 @@ import { LOGIN, SETEMAIL, SETPASSWORD } from '../../Utils/redux/redux-types'
import { reqlogin } from '../../Utils/redux/actions';
import f8 from '../../Styles/img/f8.svg'
import '../../Styles/styleLogin.css'
import { login } from '../../store/operations/auth';
import { ROUTES } from '../../constans/constans';

const mapDispatchToProps = {
reqlogin,
};
const mapStateToProps = (state) => {
return {
store: state.reducer.success
}
};

function LogForm(){
export default function LogForm(){
const dispatch = useDispatch()
const history = useHistory();

const [stateEmail, setEmail] = useState("")
const [statePassword, setPassword] = useState("")

const state = useSelector((state) => state)
const email = useSelector((state) => state.setAuth.email)
const password = useSelector((state) => state.setAuth.password)

const obj = {email: email, password: password}

const handleDispatch = _event => {
dispatch({type: SETEMAIL, payload: stateEmail})
dispatch({type: SETPASSWORD, payload: statePassword})
}
const authenticate = useSelector((state) => state.Auth.authenticate)
const obj = {email: stateEmail, password: statePassword}

useEffect(() => {
if(state.reducer.success){
dispatch({type: LOGIN, payload: true })
history.push('/startp')
if(authenticate == true){
history.push('/startp') //...переход по определенному профилю для пользователя
}
}, [state.reducer.success])
}, [authenticate])

const handlesub = _event => {
if(obj.email, obj.password === ''){
alert('fild form');
}else{
dispatch(reqlogin(obj))
dispatch(login(obj, ROUTES.AUTH.LOGIN)) //----REQ
}
}

Expand All @@ -62,17 +46,16 @@ const mapStateToProps = (state) => {
<Form.Label>Email address</Form.Label>
<Form.Control type="email" placeholder="Enter email"/>
<Form.Text className="text-muted">We'll never share your email with anyone else.</Form.Text>
</Form.Group>

</Form.Group>

<Form.Group className="mb-3" controlId="formBasicPassword" onChange = {e => setPassword(e.target.value)}>
<Form.Label>Password</Form.Label>
<Form.Control type="password" placeholder="Password"/>
</Form.Group>

<Form.Group className="mb-3" controlId="formBasicCheckbox">
{/* <Form.Group className="mb-3" controlId="formBasicCheckbox">
<Form.Check type="checkbox" label="I agree" onChange ={handleDispatch}/>
</Form.Group>
</Form.Group> */}

<Button variant="primary" onClick={handlesub}>Sign in</Button>
</div>
Expand All @@ -82,5 +65,5 @@ const mapStateToProps = (state) => {
)
}

export default connect(mapStateToProps, mapDispatchToProps)(LogForm);


Loading