Skip to content

Commit

Permalink
Merge pull request #146 from FAC-Sixteen/Feature/student-dashboard
Browse files Browse the repository at this point in the history
Add dynamic data to student completed Jobs card
  • Loading branch information
misterrodger authored Aug 18, 2019
2 parents ae0ce6d + 4b8bf3c commit 906e70d
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 100 deletions.
34 changes: 0 additions & 34 deletions dist/index.html

This file was deleted.

46 changes: 0 additions & 46 deletions dist/main.170d054774e90732d358.js

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,11 @@ import React, { useState, useEffect } from "react";
import "../../../style/css/StudentCompletedJobCard.css";
import axios from "axios";

const StudentCompletedJobCard = ({StudentCompletedJobCard, props}) => {
const [passedProps, updateProps] = useState(props);

const [data, setData] = useState([]);
useEffect(() => {
const fetchData = async () => {
const result = await axios("/api/brief/all-briefs");
setData(result.data);
};
fetchData();

}, []);
const StudentCompletedJobCard = ({StudentCompletedJobCard, props, compBriefs}) => {

return (
<ul className={StudentCompletedJobCard ? "showing" : "hidden"}>
{data.map((value, index) => {
{compBriefs.map((value, index) => {
return (
<li key={index}>
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ import StudentCompletedJobCard from "../CompletedJobCard/StudentCompletedJobCard
import StudentCurrentJobCard from "../CurrentJobCard/CurrentJobCard";
import NewJobCard from "../NewJobCard/NewJobCard";

const StudentJobsToggle = ({props}) => {
const StudentJobsToggle = ({ props, compJobs }) => {

const [grey1, setGrey1] = useState(true);
const [grey2, setGrey2] = useState(false);
const [grey3, setGrey3] = useState(false);
Expand Down Expand Up @@ -49,7 +50,7 @@ const StudentJobsToggle = ({props}) => {
Completed
</div>
</div>
<StudentCompletedJobCard StudentCompletedJobCard={grey3} props={props} />
<StudentCompletedJobCard StudentCompletedJobCard={grey3} props={props} compBriefs={compJobs} />
<StudentCurrentJobCard StudentCurrentJobCard={grey2} props={props} />
<NewJobCard StudentNewJobCard={grey1} props={props} />
</div>
Expand Down
12 changes: 7 additions & 5 deletions src/routes/StudentDashboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,25 @@ import Footer from "../components/Footer/Footer";
import "./css/allPages.css";

const StudentDashboard = () => {
const [profile, setProfile] = useState([]);
const [profile, setProfile] = useState({});
const [compBriefs, setCompBriefs] = useState([])

useEffect(() => {
const fetchData = async () => {
const result = await axios(`/api/student/get-student/` + document.cookie.slice(3));
setProfile(result.data);

setProfile(result.data.profile);
setCompBriefs(result.data.briefs);
};

fetchData();
}, []);

return (
<div>
<NavBar />
<div className="fullViewportHeight">
<ShortStudentProfileCard props={profile}/>
<StudentJobsToggle props={profile}/>
<ShortStudentProfileCard props={profile} />
<StudentJobsToggle props={profile} compJobs={compBriefs} />
</div>
</div>
);
Expand Down

0 comments on commit 906e70d

Please sign in to comment.