+ {activeCompanyData && (
+
+ {activeCompanyData.company.logo.storePath && (
+
+ )}
+
+ {activeCompanyData.company.name}
+
+
+ Students Recruited:
+ {activeCompanyData.recruits}
+
+
+ CTC:
+ {activeCompanyData.ctc}
+
+
+ )}
+ {Object.keys(placedData).map((degree) => (
+
- {student.course}
+ {degree}
- {student.branch.map((branches) => (
-
+ {Object.keys(placedData[degree]).map((branch) => (
+
- {branches.branchName}
+ {branch}
- {branches.students.map((studentName) => (
-
+ {placedData[degree][branch].map((studentName) => (
+
{studentName}
))}
@@ -64,23 +91,41 @@ const LiveData = ({ activeCompany, setCompany, data }) => {
))}
))}
+ {!activeCompanyData && !live.length && (
+
+ The data for the selected session is not available at the
+ moment.
+
+ )}
- {data.map((company, key) => (
+ {live.map((item, key) => (
setCompany(key)}
+ onClick={() => setActiveCompanyData(item)}
>
-
+ {item.company.logo.storePath && (
+
+ )}
+ {!item.company.logo.storePath && (
+
+ {item.company.name}
+
+ )}
))}
@@ -88,9 +133,9 @@ const LiveData = ({ activeCompany, setCompany, data }) => {
) : (
<>
- Showing {LIVE.data.length} Companies
+ Showing {live.length} Companies
- {data.map((company) => (
+ {live.map((company) => (
))}
>
diff --git a/client/src/components/live/nameFilter.js b/client/src/components/live/nameFilter.js
index 26b00eb4..81ba9480 100644
--- a/client/src/components/live/nameFilter.js
+++ b/client/src/components/live/nameFilter.js
@@ -22,6 +22,8 @@ const NameFilter = ({ filterText, handleChange }) => {
className={classes.filterField}
value={filterText}
onChange={handleChange}
+ // TODO: remove after implementation
+ disabled
/>
@@ -52,6 +54,8 @@ const useStyles = makeStyles(() => ({
filterField: {
width: '300px',
fontSize: '18px',
+ // TODO: remove after implementation
+ backgroundColor: 'lightgray',
lineHeight: '24px',
fontFamily: 'Source Sans Pro',
fontWeight: theme.typography.fontWeightLight,
diff --git a/client/src/graphql/queries/live/getLiveByYearAndSemester.js b/client/src/graphql/queries/live/getLiveByYearAndSemester.js
new file mode 100644
index 00000000..963df103
--- /dev/null
+++ b/client/src/graphql/queries/live/getLiveByYearAndSemester.js
@@ -0,0 +1,29 @@
+import { gql } from '@apollo/client';
+
+export default gql`
+ query getLiveByYearAndSemester($year: Int!, $semester: SemesterEnum!) {
+ getLiveByYearAndSemester(year: $year, semester: $semester) {
+ id
+ liveType
+ company {
+ id
+ name
+ logo {
+ store
+ storePath
+ }
+ location
+ }
+ recruits
+ year
+ semester
+ studentsRecruited {
+ name
+ branch
+ degree
+ }
+ ctc
+ benefits
+ }
+ }
+`;
diff --git a/client/src/pages/live.jsx b/client/src/pages/live.jsx
index 1d72d951..fa777e62 100644
--- a/client/src/pages/live.jsx
+++ b/client/src/pages/live.jsx
@@ -74,13 +74,17 @@ const LivePage = () => {
);
};
-export async function getServerSideProps() {
- return {
- redirect: {
- destination: '/comingSoon',
- permanent: false,
- },
- };
-}
+// export async function getServerSideProps() {
+/**
+ * For lan restriction, if ever required
+ * if (req.headers['x-forwarded-for']) {
+ * ip = req.headers['x-forwarded-for'].split(',')[0];
+ * } else if (req.headers['x-real-ip']) {
+ * ip = req.connection.remoteAddress;
+ * } else {
+ * ip = req.connection.remoteAddress;
+ * }
+ */
+// }
export default LivePage;
diff --git a/client/src/screens/Live.js b/client/src/screens/Live.js
index af94b99b..55b12852 100644
--- a/client/src/screens/Live.js
+++ b/client/src/screens/Live.js
@@ -1,4 +1,4 @@
-import React, { useState } from 'react';
+import React, { useEffect, useState } from 'react';
// libraries
import { Typography, Container, useMediaQuery } from '@mui/material';
@@ -18,16 +18,21 @@ import theme from '../config/themes/light';
// placeholder
import { LIVE } from '../assets/placeholder/live';
+import getLiveByYearAndSemester from '../graphql/queries/live/getLiveByYearAndSemester';
+import { GraphClient } from '../config/ApolloClient';
+import ActivityIndicator from '../components/shared/ActivityIndicator';
function Live() {
const classes = useStyles();
const Desktop = useMediaQuery(theme.breakpoints.up('sm'));
- const [activeCompany, setCompany] = useState(0);
+ const [liveData, setLiveData] = useState([]);
const [department, setDepartment] = useState(LIVE.departments[0]);
- const [degree, setDegree] = useState('B.Tech');
+ const [degree, setDegree] = useState('All Degrees');
const [filterText, setFilter] = useState('');
const [activeSession, setSession] = useState(LIVE.sessions[0]);
- const [placement, setPlacement] = useState(false);
+ const [showPlacement, setShowPlacement] = useState(true);
+
+ const [isLoading, setLoading] = useState(true);
const selectSessions = (season) => {
setSession(season);
@@ -38,12 +43,29 @@ function Live() {
};
const selectDegree = (event) => {
- setDegree(event.target.value);
+ // setDegree(event.target.value);
};
- const selectDepartment = (branch) => {
- setDepartment(branch);
- };
+ // const selectDepartment = (branch) => {
+ // setDepartment(branch);
+ // };
+
+ useEffect(() => {
+ setLoading(true);
+ const [semester, year] = activeSession.split(' ');
+ GraphClient.query({
+ query: getLiveByYearAndSemester,
+ variables: { year: parseInt(year), semester: semester.toUpperCase() },
+ })
+ .then((res) => {
+ setLiveData(res.data.getLiveByYearAndSemester);
+ setLoading(false);
+ })
+ .catch((err) => {
+ console.log(err);
+ setLoading(false);
+ });
+ }, [activeSession]);
return (
@@ -59,7 +81,10 @@ function Live() {
selectSessions={selectSessions}
LIVE={LIVE}
/>
-
+
-
+ /> */}