-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
42 changed files
with
3,809 additions
and
2,325 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
name: build-test | ||
|
||
on: | ||
pull_request: | ||
types: [opened, synchronize, reopened] | ||
|
||
jobs: | ||
build-lint-test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out repository code | ||
uses: actions/checkout@v3 | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: 20 | ||
cache: yarn | ||
cache-dependency-path: 'yarn.lock' | ||
- run: yarn | ||
- run: yarn build |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import Link from "next/link"; | ||
|
||
interface Props { | ||
children: React.ReactNode; | ||
} | ||
|
||
const FacultyLayout = ({ children }: Props) => { | ||
return <div>{children}</div>; | ||
}; | ||
|
||
export default FacultyLayout; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
"use client"; | ||
import { fetchApprovals, updateApproval } from "@/helpers/faculty/api"; | ||
import Cookies from "js-cookie"; | ||
import TableComponent from "@/components/TableComponent/TableComponent"; | ||
import generateColumns from "@/components/TableComponent/ColumnMapping"; | ||
import { useState, useEffect } from "react"; | ||
import loadingImg from "@/components/Faculty/loadingSpinner.svg"; | ||
import { number } from "yup"; | ||
|
||
const dto = [ | ||
{ | ||
status: "string", | ||
remarks: "string", | ||
salary: { | ||
salaryPeriod: "string", | ||
totalCTC: "number", | ||
job: { | ||
role: "string", | ||
company: { | ||
name: "string", | ||
}, | ||
season: { | ||
year: "string", | ||
type: "string", | ||
}, | ||
}, | ||
}, | ||
}, | ||
]; | ||
|
||
const dynamicColumns = generateColumns(dto); | ||
|
||
const FacultyPage = () => { | ||
const [data, setData] = useState(null); | ||
const [loading, setLoading] = useState(true); | ||
|
||
useEffect(() => { | ||
const fetchData = async () => { | ||
try { | ||
const jsonData = await fetchApprovals( | ||
Cookies.get("accessToken"), | ||
undefined | ||
); | ||
setData(jsonData); | ||
} catch (error) { | ||
console.error("Error fetching data:", error); | ||
} finally { | ||
setLoading(false); | ||
} | ||
}; | ||
|
||
fetchData(); | ||
}, []); | ||
return ( | ||
<div className="md:m-12 m-2"> | ||
<h1 className="text-center font-bold text-3xl my-5 py-5">Approvals</h1> | ||
<div> | ||
{loading && ( | ||
<img src={loadingImg.src} alt="" className="mx-auto my-auto" /> | ||
)} | ||
{data && ( | ||
<TableComponent | ||
data={data} | ||
columns={dynamicColumns} | ||
dto={dto} | ||
isFeedbackForm={true} | ||
/> | ||
)} | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
export default FacultyPage; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
"use client"; | ||
|
||
import React, { useEffect, useState } from "react"; | ||
import FacultyProfile from "@/components/Faculty/Profile"; | ||
import { fetchProfile } from "@/helpers/faculty/api"; | ||
import Cookies from "js-cookie"; | ||
import loadingImg from "@/components/Faculty/loadingSpinner.svg"; | ||
import { ProfileFC } from "@/helpers/faculty/api"; | ||
|
||
const Profile = ({ params }: { params: { facultyId: string } }) => { | ||
const [data, setData] = useState<ProfileFC>(); | ||
const [loading, setLoading] = useState(true); | ||
|
||
useEffect(() => { | ||
const profileData = async () => { | ||
const jsonData = await fetchProfile(Cookies.get("accessToken")); | ||
setData(jsonData); | ||
setLoading(false); | ||
}; | ||
profileData(); | ||
}, []); | ||
|
||
return ( | ||
<div className="h-screen grid justify-center items-center"> | ||
{loading && <img src={loadingImg.src} />} | ||
{data && <FacultyProfile profile={data} />} | ||
</div> | ||
); | ||
}; | ||
|
||
export default Profile; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,6 @@ | ||
"use client"; | ||
import React, { useEffect, useState } from "react"; | ||
import { Separator } from "@/components/ui/separator"; | ||
import Link from "next/link"; | ||
import { | ||
Table, | ||
TableHeader, | ||
|
@@ -12,20 +11,20 @@ import { | |
TableCell, | ||
} from "@/components/ui/table"; | ||
import { Button } from "@/components/ui/button"; | ||
import { fetchEachJob } from "@/helpers/api"; | ||
import HorizontalTimeline from "@/components/HorizontalTimeline"; | ||
import { Job, CustomEvent, EventData, CalenderEvent } from "@/helpers/student/types"; | ||
import { GetJobById } from "@/helpers/student/api"; | ||
import Cookies from "js-cookie"; | ||
|
||
function transformEvents(events: CustomEvent[]): EventData[] { | ||
|
||
// Get the current date | ||
|
||
const currentDate = new Date(); | ||
|
||
// Sort events by startDateTime | ||
|
||
const sortedEvents = events.sort((a, b) => new Date(a.startDateTime).getTime() - new Date(b.startDateTime).getTime()); | ||
|
||
// Transform the sorted events into the desired format | ||
|
||
const result: EventData[] = sortedEvents.map(event => { | ||
const eventDate = new Date(event.startDateTime); | ||
let status: string; | ||
|
@@ -37,18 +36,18 @@ function transformEvents(events: CustomEvent[]): EventData[] { | |
} | ||
|
||
return { | ||
date: eventDate.toLocaleDateString('en-GB'), // Convert date to DD/MM/YYYY format | ||
date: eventDate.toLocaleDateString('en-GB'), | ||
status, | ||
title: event.type, | ||
}; | ||
}); | ||
|
||
// Find the first event after the current date and mark it as 'selected' | ||
|
||
const firstFutureEventIndex = result.findIndex(event => new Date(event.date.split('/').reverse().join('-')) >= currentDate); | ||
if (firstFutureEventIndex !== -1) { | ||
result[firstFutureEventIndex].status = "selected"; | ||
} else if (result.length > 0) { | ||
// If all events have passed, mark the last event as 'selected' | ||
|
||
result[result.length - 1].status = "selected"; | ||
} | ||
|
||
|
@@ -57,10 +56,10 @@ function transformEvents(events: CustomEvent[]): EventData[] { | |
|
||
const transformEventsCalender = (jobData: Job): CalenderEvent[] => { | ||
return jobData.events.map(event => ({ | ||
day: new Date(event.startDateTime).setHours(0, 0, 0, 0), // startDate at midnight | ||
day: new Date(event.startDateTime).setHours(0, 0, 0, 0), | ||
description: event.metadata, | ||
id: event.id, | ||
label: "red", // assuming a fixed label as the original data doesn't provide this | ||
label: "red", | ||
timeFrom: event.startDateTime, | ||
timeTo: event.endDateTime, | ||
title: jobData.companyDetailsFilled.name, | ||
|
@@ -85,18 +84,13 @@ function formatNumber(num: number): string { | |
return num.toString(); | ||
} | ||
|
||
const faculty = [ | ||
{ name: 'Emily Johnson', designation: 'Professor', email: '[email protected]', phoneNumber: '123-456-7890' }, | ||
{ name: 'Alex Smith', designation: 'Assistant Professor', email: '[email protected]', phoneNumber: '987-654-3210' }, | ||
]; | ||
|
||
const JobPage = ({ params }: { params: { jobId: string } }) => { | ||
|
||
const [jobData, setJobData] = useState<Job | null>(null); | ||
|
||
useEffect(() => { | ||
const fetchJobData = async () => { | ||
const data = await GetJobById(params.jobId); | ||
const data = await GetJobById(params.jobId, Cookies.get("accessToken")); | ||
setJobData(data); | ||
storeCalenderEvents(data); | ||
}; | ||
|
@@ -122,7 +116,7 @@ const JobPage = ({ params }: { params: { jobId: string } }) => { | |
<div className="grid md:grid-cols-2 lg:grid-cols-5 text-sm mx-2"> | ||
<div> | ||
<div className="text-gray-500 font-semibold my-2">Website</div>{" "} | ||
<a className="text-blue-500" href={jobData.companyDetailsFilled.website} target="_blank" rel="noopener noreferrer">Link</a> | ||
<a className="text-blue-500" href={jobData?.companyDetailsFilled.website} target="_blank" rel="noopener noreferrer">Link</a> | ||
</div> | ||
<div> | ||
<div className="text-gray-500 font-semibold my-2">Domain</div>{" "} | ||
|
@@ -201,15 +195,14 @@ const JobPage = ({ params }: { params: { jobId: string } }) => { | |
<Separator /> | ||
</div> | ||
<HorizontalTimeline eventsData={transformEvents(jobData.events)} /> | ||
{/* <HorizontalTimeline eventsData={testData} /> */} | ||
<div className="my-7"> | ||
<Separator /> | ||
</div> | ||
<div> | ||
<div className="flex justify-between"> | ||
<div> | ||
<Button> | ||
<a href={`/student/jobs/salary/${params.jobId}`} target="_blank" rel="noopener noreferrer">Salary</a> | ||
<a href={`/student/job/salary/${params.jobId}`} target="_blank" rel="noopener noreferrer">Salary</a> | ||
</Button> | ||
</div> | ||
<div> | ||
|
Oops, something went wrong.