Changeset 2e507a8 for client_app


Ignore:
Timestamp:
01/12/21 21:10:56 (3 years ago)
Author:
Vzdra <vladko.zdravkovski@…>
Branches:
master
Children:
47067ae
Parents:
a70db1a
Message:

front end additions

Location:
client_app/src
Files:
10 added
1 deleted
5 edited

Legend:

Unmodified
Added
Removed
  • client_app/src/components/data/components/user_jobs.js

    ra70db1a r2e507a8  
    11import React from 'react';
    22import { Redirect } from 'react-router-dom';
    3 import { Container, Card } from 'semantic-ui-react'
     3import { Container, Card } from 'semantic-ui-react';
     4import Jobs from '../components/item_components/job_component';
    45
    56
     
    78    var itemsArray = [];
    89
    9     if(props.userProfile.email!=null){
    10         props.userProfile.jobs.forEach(item => {
    11             let obj = {}
    12             obj.header = item.title;
    13             obj.description = item.description + "\n" + "Contact: " + item.accountEmail;
    14             if(item.accountType=="TEAM"){
    15                 obj.meta = "Team: " + item.accountName + " / Salary: " + item.salary
    16             }else{
    17                 obj.meta = "Company: " + item.accountName + " / Salary: " + item.salary
    18             }
    19 
    20             itemsArray.push(obj);
    21         });
    22 
    23         return(
    24             <Container textAlign="left">
    25                 <h1>Jobs for you!</h1>
    26                 <Card.Group items={itemsArray} />
    27             </Container>
    28         );
     10    if(props.userProfile.type==="USER"){
     11        if(props.userProfile.email!=null){
     12            return(
     13                <Container textAlign="left">
     14                    <h1>Jobs for you!</h1>
     15                    {props.userProfile.jobs.map(item =>{
     16                        return <Jobs
     17                            title={item.title}
     18                            description={item.description}
     19                            accountName={item.accountName}
     20                            accountEmail={item.accountEmail}
     21                            skills={item.skillsRequired}
     22                            type={props.userProfile.type}
     23                        />
     24                    })}
     25                </Container>
     26            );
     27        }
    2928    }
    3029
  • client_app/src/components/data/profile.js

    ra70db1a r2e507a8  
    11import React from 'react';
    2 import UserDetails from "./components/user_profile";
     2import UserDetails from "./components/profiles/user_profile";
    33import { Redirect } from "react-router-dom";
     4import CompanyProfile from "./components/profiles/company_profile";
     5import TeamProfile from "./components/profiles/team_profile";
    46
    57const Profile = (props) => {
     
    1719    }
    1820
     21    if(props.userProfile.type==="COMPANY"){
     22        return (
     23            <CompanyProfile data={{
     24                email: props.userProfile.email,
     25                name: props.userProfile.name,
     26                address: props.userProfile.address
     27            }}/>
     28        );
     29    }
     30
     31    if(props.userProfile.type==="TEAM"){
     32        return (
     33            <TeamProfile data={{
     34                email: props.userProfile.email,
     35                name: props.userProfile.name,
     36                members: props.userProfile.members
     37            }}/>
     38        );
     39    }
     40
    1941    return(
    2042        <Redirect to={"/login"}/>
  • client_app/src/components/login/login.js

    ra70db1a r2e507a8  
    3131                <h1 style={{color: "red"}}>{props.error}</h1>
    3232                <Form onSubmit={onFormSubmit}>
    33                     <Form.Input id="email" name="email" type='text' required fluid label='E-mail' placeholder='Enter e-mail.' onChange={handleCheck} />
     33                    <Form.Input id="email" name="email" type='email' required fluid label='E-mail' placeholder='Enter e-mail.' onChange={handleCheck} />
    3434                    <Form.Input id="password" name="password" type='password' required fluid label='Password' placeholder='Enter password.' onChange={handleCheck} />
    3535                    <Form.Field
  • client_app/src/components/main/App.js

    ra70db1a r2e507a8  
    88import UserLogin from "../../repository/login_repo";
    99import UserJobs from "../data/components/user_jobs";
     10import UserInternships from "../data/components/user_internships";
     11import UserProjects from "../data/components/user_projects";
     12import CompanyJobs from "../data/components/company_jobs";
    1013
    1114class App extends Component{
     
    2326          return(
    2427              <Router>
    25                   <HeaderComp acc={this.state.currentUser.email} accType={this.state.currentUser.type} name={this.state.currentUser.name}/>
     28                  <HeaderComp acc={this.state.currentUser.email} accType={this.state.currentUser.type} name={this.state.currentUser.name} removeState={this.removeState}/>
    2629                  <main>
    27                       <Route path={"/login"} render={() => <Login error={this.state.error} onCompleteForm={this.attemptLogin} loggedIn={this.state.logged}/>}/>
    28                       <Route path={"/profile"} render={() => <Profile userProfile={this.state.currentUser}/>}/>
    29                       <Route path={"/jobs"} render={() => <UserJobs userProfile={this.state.currentUser}/>}/>
     30                      <Route path={"/login"} render={() => <Login error={this.state.error} onCompleteForm={this.attemptLogin} loggedIn={this.state.logged}/>} />
     31                      <Route path={"/profile"} render={() => <Profile userProfile={this.state.currentUser}/>} />
     32                      <Route path={"/user/jobs"} render={() => <UserJobs userProfile={this.state.currentUser}/>} />
     33                      <Route path={"/user/internships"} render={() => <UserInternships userProfile={this.state.currentUser}/>} />
     34                      <Route path={"/user/projects"} render={() => <UserProjects userProfile={this.state.currentUser}/>} />
     35                      <Route path={"/team/jobs"} />
     36                      <Route path={"/team/projects"} />
     37                      <Route path={"/company/jobs"} render={() => <CompanyJobs userProfile={this.state.currentUser} />}/>
     38                      <Route path={"/company/internships"}/>
     39                      <Route path={"/profile/edit"} />
     40                      <Route path={"/job/edit"} />
     41                      <Route path={"/internship/edit"}/>
     42                      <Route path={"/project/edit"} />
     43                      <Route path={"/logout"} render={() => <Redirect to={"/login"}/>}/>
    3044                      <Route path={"/"} render={() => <Redirect to={"/login"}/>}/>
    3145                  </main>
     
    3347          );
    3448  }
     49
     50  removeState = () => {
     51      this.setState({
     52          logged: false,
     53          error: null,
     54          currentUser: {}
     55      })
     56  }
     57
    3558
    3659  attemptLogin = (email, password, type) => {
  • client_app/src/components/template/header.js

    ra70db1a r2e507a8  
    11import React from 'react';
    22import {Link} from "react-router-dom";
    3 import {Menu, MenuItem} from "semantic-ui-react";
     3import {Menu, MenuItem } from "semantic-ui-react";
    44
    55
     
    77    if(props.accType == null){
    88        return(
    9             <Menu inverted position="right">
    10                 <MenuItem as={Link} to='/login'>
     9            <Menu inverted>
     10                <MenuItem  as={Link} to='/register/user'>
     11                    Register User
     12                </MenuItem>
     13                <MenuItem as={Link} to='/register/company'>
     14                    Register Company
     15                </MenuItem>
     16                <MenuItem as={Link} to='/register/team'>
     17                    Register Team
     18                </MenuItem>
     19                <MenuItem position="right" as={Link} to='/login'>
    1120                    Login
    1221                </MenuItem>
     
    1625        if(props.accType==="COMPANY"){
    1726            return(
    18                 <Menu inverted position="right">
     27                <Menu inverted>
    1928                    <Menu.Item as={Link} to='/profile'>
    2029                        Profile
    2130                    </Menu.Item>
    22                     <Menu.Item as={Link} to='/jobs'>
     31                    <Menu.Item as={Link} to='/company/jobs'>
    2332                        Jobs
    2433                    </Menu.Item>
    25                     <Menu.Item as={Link} to='/internships'>
     34                    <Menu.Item as={Link} to='/company/internships'>
    2635                        Internships
    2736                    </Menu.Item>
     37                    <MenuItem onClick={props.removeState} position="right" as={Link} to='/logout'>
     38                        Logout
     39                    </MenuItem>
    2840                </Menu>
    2941            );
    3042        }else if(props.accType==="TEAM"){
    3143            return(
    32                 <Menu inverted position="right">
    33                     <Menu.Item as={Link} to='/profile'>
     44                <Menu inverted>
     45                    <Menu.Item position="right" as={Link} to='/profile'>
    3446                        Profile
    3547                    </Menu.Item>
    36                     <Menu.Item as={Link} to='/jobs'>
     48                    <Menu.Item as={Link} to='/team/jobs'>
    3749                        Jobs
    3850                    </Menu.Item>
    39                     <Menu.Item as={Link} to='/projects'>
     51                    <Menu.Item as={Link} to='/team/projects'>
    4052                        Projects
    4153                    </Menu.Item>
     54                    <MenuItem onClick={props.removeState} position="right" as={Link} to='/logout'>
     55                        Logout
     56                    </MenuItem>
    4257                </Menu>
    4358            );
    4459        }else if(props.accType==="USER"){
    4560            return(
    46                 <Menu inverted position="right">
     61                <Menu inverted>
    4762                    <Menu.Item as={Link} to='/profile'>
    4863                        Profile
    4964                    </Menu.Item>
    50                     <Menu.Item as={Link} to='/jobs'>
     65                    <Menu.Item as={Link} to='/user/jobs'>
    5166                        Jobs
    5267                    </Menu.Item>
    53                     <Menu.Item as={Link} to='/internships'>
     68                    <Menu.Item as={Link} to='/user/internships'>
    5469                        Internships
    5570                    </Menu.Item>
    56                     <Menu.Item as={Link} to='/projects'>
     71                    <Menu.Item as={Link} to='/user/projects'>
    5772                        Projects
    5873                    </Menu.Item>
    59                     <Menu.Item as={Link} to='/search'>
     74                    <Menu.Item as={Link} to='/user/search'>
    6075                        Search
    6176                    </Menu.Item>
     77                    <MenuItem onClick={props.removeState} position="right" as={Link} to='/logout'>
     78                        Logout
     79                    </MenuItem>
    6280                </Menu>
    6381            );
Note: See TracChangeset for help on using the changeset viewer.