Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build test #70

Merged
merged 3 commits into from
Jun 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions .github/workflows/build-test.yml
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
8 changes: 3 additions & 5 deletions src/app/(routes)/student/jobs/[jobId]/page.tsx
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,
Expand All @@ -12,10 +11,10 @@ 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[] {

Expand Down Expand Up @@ -96,7 +95,7 @@ const JobPage = ({ params }: { params: { jobId: string } }) => {

useEffect(() => {
const fetchJobData = async () => {
const data = await GetJobById(params.jobId);
const data = await GetJobById(params.jobId, Cookies.get("accessToken"));
setJobData(data);
storeCalenderEvents(data);
};
Expand All @@ -122,7 +121,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>{" "}
Expand Down Expand Up @@ -201,7 +200,6 @@ const JobPage = ({ params }: { params: { jobId: string } }) => {
<Separator />
</div>
<HorizontalTimeline eventsData={transformEvents(jobData.events)} />
{/* <HorizontalTimeline eventsData={testData} /> */}
<div className="my-7">
<Separator />
</div>
Expand Down
14 changes: 2 additions & 12 deletions src/app/(routes)/student/jobs/salary/[jobId]/page.tsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,8 @@
"use client";
import React, { useEffect, useState } from "react";
import {
Table,
TableHeader,
TableBody,
TableFooter,
TableHead,
TableRow,
TableCell,
} from "@/components/ui/table";
import { SampleJobData } from "@/dummyData/job";
import { Separator } from "@/components/ui/separator";
import SalaryCard from "@/components/jobs/SalaryCard";
import { GetJobById } from "@/helpers/student/api";
import Cookies from "js-cookie";

interface Props {}
interface Salary {
Expand All @@ -37,7 +27,7 @@ const SalaryPage = ({ params }: { params: { jobId: string } }) => {

useEffect(() => {
const fetchSalaryData = async () => {
const data = await GetJobById(params.jobId);
const data = await GetJobById(params.jobId, Cookies.get("accessToken"));
setSalaryData(data.salaries);
};

Expand Down
4 changes: 2 additions & 2 deletions src/components/jobs/JobCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import {
import { OnCampusOffers, Salary, Resume } from "@/helpers/student/types";
import { ApplyJob, GetSalaryById } from "@/helpers/student/api";
import Cookies from "js-cookie";
import toast, { Toaster } from "react-hot-toast";
import toast from "react-hot-toast";
interface Props {
jobItem: OnCampusOffers;
salaryId: string;
Expand All @@ -29,7 +29,7 @@ const JobCard = ({ jobItem, salaryId, resumes }: Props) => {

useEffect(() => {
const fetchSalary = async () => {
const data = await GetSalaryById(salaryId);
const data = await GetSalaryById(salaryId, Cookies.get("accessToken"));
setSalary(data);
console.log(data);
};
Expand Down
14 changes: 0 additions & 14 deletions src/components/jobs/OffCampusCard.tsx
Original file line number Diff line number Diff line change
@@ -1,22 +1,8 @@
import React from "react";
import Link from "next/link";
import { Separator } from "../ui/separator";
import { fetchJobSalary } from "@/helpers/api";
import { cookies } from "next/headers";
import { useState, useEffect } from 'react';
import {JobDetails} from "@/dummyData/jobdetails"
import { Button } from "@/components/ui/button";
import {
Select,
SelectContent,
SelectGroup,
SelectItem,
SelectLabel,
SelectTrigger,
SelectValue,
} from "@/components/ui/select"
import { OffCampusOffer } from "@/helpers/student/types";
import { GetSalaryById } from "@/helpers/student/api";
interface Props {
jobItem: OffCampusOffer;
}
Expand Down
5 changes: 2 additions & 3 deletions src/components/jobs/SalaryCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,14 @@ import {
Table,
TableHeader,
TableBody,
TableFooter,
TableHead,
TableRow,
TableCell,
} from "@/components/ui/table";
import { SampleJobData } from "@/dummyData/job";
import { Separator } from "@/components/ui/separator";
import { Salary } from "@/helpers/student/types";
import { GetSalaryById } from "@/helpers/student/api";
import Cookies from "js-cookie";

interface Props{
salaryId: string;
Expand All @@ -23,7 +22,7 @@ export default function SalaryCard({salaryId}: Props) {

useEffect(() => {
const fetchSalaryData = async () => {
const data = await GetSalaryById(salaryId);
const data = await GetSalaryById(salaryId, Cookies.get("accessToken"));
setSalaryData(data);
};

Expand Down
18 changes: 14 additions & 4 deletions src/helpers/student/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,14 @@ const url = (NextUrl: string) => {
return `${baseUrl}/api/v1${NextUrl}`;
};

export const GetJobById = async (jobId: string) => {
export const GetJobById = async (jobId: string, accessToken:string) => {
try {
const res = await fetch(url(`/jobs/${jobId}`));
const res = await fetch(url(`/jobs/${jobId}`),{
method: 'GET',
headers: {
'Authorization': `Bearer ${accessToken}`
},
});
if (!res.ok) {
throw new Error("Failed to fetch Job data");
}
Expand All @@ -17,9 +22,14 @@ export const GetJobById = async (jobId: string) => {
console.error("Error fetching Job data:", error);
}
};
export const GetSalaryById = async (salaryId: string) => {
export const GetSalaryById = async (salaryId: string,accessToken: string) => {
try {
const res = await fetch(url(`/salaries/${salaryId}`));
const res = await fetch(url(`/salaries/${salaryId}`), {
method: 'GET',
headers: {
'Authorization': `Bearer ${accessToken}`
}
});
if (!res.ok) {
throw new Error("Failed to fetch salary data");
}
Expand Down
Loading