Changeset 6729ba5 for client_app
- Timestamp:
- 01/15/21 16:39:45 (4 years ago)
- Branches:
- master
- Children:
- 81c9e25
- Parents:
- ed3f5c4
- Location:
- client_app/src
- Files:
-
- 4 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
client_app/src/components/item_components/internship_component.js
red3f5c4 r6729ba5 1 1 import React from 'react'; 2 2 import {Header, List, Segment, Button} from 'semantic-ui-react'; 3 import {Link} from "react-router-dom"; 3 4 4 5 const Internships = (props) => { … … 6 7 <Segment> 7 8 <Header as="h3">{props.item.title}</Header> 8 {props.item.type!=="USER" ? <Button primary>Edit</Button> : <span> </span>} 9 {props.item.type!=="USER" ? <Button primary as={Link} to={{ 10 pathname: "/edit/internship", 11 state: { 12 index: props.index, 13 item: props.item 14 } 15 }}>Edit</Button> : <span> </span>} 9 16 <Segment>{props.item.description}</Segment> 10 17 <Segment> -
client_app/src/components/item_components/job_component.js
red3f5c4 r6729ba5 7 7 <Segment> 8 8 <Header as="h3">{props.item.title}</Header> 9 {props.item. type!=="USER" ? <Button primary as={Link} to={{9 {props.item.accountType!=="USER" ? <Button primary as={Link} to={{ 10 10 pathname: "/edit/job", 11 11 state: { 12 jobId: props.item.id, 13 accId: props.item.accId, 14 type: props.item.type 12 index: props.index, 13 item: props.item 15 14 } 16 15 }}>Edit</Button> : <span> </span>} -
client_app/src/components/item_components/project_component.js
red3f5c4 r6729ba5 1 1 import React from 'react'; 2 2 import {Header, List, Segment, Button} from 'semantic-ui-react'; 3 import {Link} from "react-router-dom"; 3 4 4 5 const Projects = (props) => { … … 7 8 <Segment> 8 9 <Header as="h3">{props.item.title}</Header> 9 {props.item.type!=="USER" ? <Button primary>Edit</Button> : <span> </span>} 10 {props.item.type!=="USER" ? <Button primary as={Link} to={{ 11 pathname: "/edit/project", 12 state: { 13 index: props.index, 14 item: props.item 15 } 16 }}>Edit</Button> : <span> </span>} 10 17 <Segment>{props.item.description}</Segment> 11 18 <Segment> -
client_app/src/components/main/App.js
red3f5c4 r6729ba5 24 24 import InternshipRegister from "../work_register/internship_register"; 25 25 import ProjectRegister from "../work_register/project_register"; 26 import EditJob from "../work_edit/test"; 26 import EditJob from "../work_edit/edit_job"; 27 import EditInternship from "../work_edit/edit_internship"; 28 import EditProject from "../work_edit/edit_project"; 27 29 28 30 class App extends Component{ … … 63 65 <Route path={"/register/project"} render={() => <ProjectRegister accountId={this.state.currentUser.id} type={this.state.currentUser.type} updateProjects={this.updateProjects} />}/> 64 66 <Route path={"/edit/job"} render={(props) => <EditJob {...props} editJob={this.editJob}/>} /> 65 {/*<Route path={"/edit/internship"} render={(props) => <EditInternship {...props} editJob={this.editInternship}/>} />*/}66 {/*<Route path={"/edit/project"} render={(props) => <EditProject {...props} editJob={this.editProject}/>} />*/}67 <Route path={"/edit/internship"} render={(props) => <EditInternship {...props} editInternship={this.editInternship}/>} /> 68 <Route path={"/edit/project"} render={(props) => <EditProject {...props} editProject={this.editProject}/>} /> 67 69 <Route path={"/logout"} render={() => <Redirect to={"/login"}/>}/> 68 70 <Route path={"/"} render={() => <Redirect to={"/login"}/>}/> … … 121 123 122 124 editJob = (job, index) => { 125 let jobs = this.state.currentUser.jobs; 126 jobs[index] = job; 127 123 128 this.setState(prevState => ({ 124 129 currentUser:{ 125 130 ...prevState.currentUser, 126 jobs: Object.assign([],this.state.jobs,{[index]: job})131 jobs: jobs 127 132 } 128 133 })) … … 130 135 131 136 editInternship = (internship, index) => { 137 let interns = this.state.currentUser.internships; 138 interns[index] = internship; 139 132 140 this.setState(prevState => ({ 133 141 currentUser:{ 134 142 ...prevState.currentUser, 135 internships: Object.assign([],this.state.jobs,{[index]: internship})143 internships: interns 136 144 } 137 145 })) … … 139 147 140 148 editProject = (project, index) => { 149 let proj = this.state.currentUser.projects; 150 proj[index] = project; 151 141 152 this.setState(prevState => ({ 142 153 currentUser:{ 143 154 ...prevState.currentUser, 144 projects: Object.assign([],this.state.jobs,{[index]: project})155 projects: proj 145 156 } 146 157 }))
Note:
See TracChangeset
for help on using the changeset viewer.