Skip to content

Commit

Permalink
Featured job icons on front page (#484)
Browse files Browse the repository at this point in the history
Co-authored-by: Richard  Bao <[email protected]>
  • Loading branch information
RichardBao1 and Richard Bao authored Sep 5, 2024
1 parent 5179b9f commit 5b85041
Show file tree
Hide file tree
Showing 7 changed files with 88 additions and 33 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ jobs:
test:
name: Test
runs-on: ubuntu-latest
container:
image: docker:20.10
options: --privileged
steps:
- name: Checkout repository
uses: actions/checkout@v4
Expand Down
36 changes: 26 additions & 10 deletions backend/src/dev.ts
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ export default async function seedDB() {

const job6 = new Job();
job6.role = 'Backend Developer';
job6.description = 'Java is not poggers';
job6.description = 'Example job description';
job6.applicationLink = 'https://sampleapplicationlink.net';
job6.company = company;
job6.approved = false;
Expand All @@ -203,8 +203,8 @@ export default async function seedDB() {

// following two jobs are used for testing retrieving number of verified job posts
const job7 = new Job();
job7.role = 'verified job 1';
job7.description = 'Java is not poggers';
job7.role = 'Security Engineer Intern at Foo';
job7.description = 'In the midst of the bustling city, a gentle breeze whispered through the trees, carrying with it the faint scent of blooming flowers. The sun, high above, cast soft shadows on the pavement, where people hurried by, each lost in their own thoughts. A dog barked in the distance, breaking the monotony of the day, while birds chirped melodiously from the branches. Amid the urban chaos, there was a sense of calm, a momentary pause in the relentless rush. Time seemed to slow, if only for a brief moment, as the world continued to spin quietly around them.';
job7.applicationLink = 'https://sampleapplicationlink.net';
job7.company = company;
job7.approved = true;
Expand All @@ -219,8 +219,8 @@ export default async function seedDB() {
job7.createdAt = new Date('1999-5-10');

const job8 = new Job();
job8.role = 'verified job 1';
job8.description = 'Java is not poggers';
job8.role = 'Software Engineer Intern at Foo with some very very very very very very very long name so that I can test how it looks on front page';
job8.description = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.';
job8.applicationLink = 'https://sampleapplicationlink.net';
job8.company = company;
job8.approved = true;
Expand All @@ -234,7 +234,23 @@ export default async function seedDB() {
job8.isPaid = true;
job8.createdAt = new Date('1999-10-10');

companyAccount.company.jobs = [job1, job2, job3, job4, job5, job6, job7, job8];
const job9 = new Job();
job9.role = 'Software Engineer Graduate Role at Foo';
job9.description = 'Example job description';
job9.applicationLink = 'https://sampleapplicationlink.net';
job9.company = company;
job9.approved = true;
job9.expiry = new Date('2030-01-10');
job9.mode = JobMode.Remote;
job9.studentDemographic = [StudentDemographic.All];
job9.jobType = JobType.Intern;
job9.workingRights = [WorkingRights.AusCtz, WorkingRights.AusPermRes, WorkingRights.AusStudVisa];
job9.wamRequirements = WamRequirements.HD;
job9.additionalInfo = '';
job9.isPaid = true;
job9.createdAt = new Date('1984-10-10');

companyAccount.company.jobs = [job1, job2, job3, job4, job5, job6, job7, job8, job9];

await AppDataSource.manager.save(companyAccount);

Expand Down Expand Up @@ -263,7 +279,7 @@ export default async function seedDB() {
// normal approved job
const companyAccount3Job1 = new Job();
companyAccount3Job1.role = 'approved job';
companyAccount3Job1.description = 'Java is not poggers';
companyAccount3Job1.description = 'Example job description';
companyAccount3Job1.applicationLink = 'https://sampleapplicationlink.net';
companyAccount3Job1.company = company3;
companyAccount3Job1.approved = true;
Expand All @@ -284,7 +300,7 @@ export default async function seedDB() {
// approved but expired job
const companyAccount3Job2 = new Job();
companyAccount3Job2.role = 'expired job';
companyAccount3Job2.description = 'Java is not poggers';
companyAccount3Job2.description = 'Example job description';
companyAccount3Job2.applicationLink = 'https://sampleapplicationlink.net';
companyAccount3Job2.company = company3;
companyAccount3Job2.approved = true;
Expand All @@ -305,7 +321,7 @@ export default async function seedDB() {
// approved but hidden job
const companyAccount3Job3 = new Job();
companyAccount3Job3.role = 'hidden job';
companyAccount3Job3.description = 'Java is not poggers';
companyAccount3Job3.description = 'Example job description';
companyAccount3Job3.applicationLink = 'https://sampleapplicationlink.net';
companyAccount3Job3.company = company3;
companyAccount3Job3.approved = true;
Expand All @@ -327,7 +343,7 @@ export default async function seedDB() {
// approved by deleted job
const companyAccount3Job4 = new Job();
companyAccount3Job4.role = 'deleted job';
companyAccount3Job4.description = 'Java is not poggers';
companyAccount3Job4.description = 'Example job description';
companyAccount3Job4.applicationLink = 'https://sampleapplicationlink.net';
companyAccount3Job4.company = company3;
companyAccount3Job4.approved = true;
Expand Down
11 changes: 10 additions & 1 deletion backend/src/student.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import StudentProfile from './entity/student_profile';
import Helpers, { IResponseWithStatus } from './helpers';
import { Logger, LogModule } from './logging';

import { WorkingRights } from './types/job-field';
import { JobMode, JobType, WorkingRights } from './types/job-field';

import { StudentBase } from './types/shared';

Expand Down Expand Up @@ -140,8 +140,11 @@ export default class StudentFunctions {
.createQueryBuilder()
.select([
'company.logo',
'company.location',
'Job.id',
'Job.role',
'Job.jobType',
'Job.mode',
'Job.description',
'Job.workingRights',
'Job.applicationLink',
Expand Down Expand Up @@ -171,6 +174,9 @@ export default class StudentFunctions {
workingRights: WorkingRights[];
applicationLink: string;
company: string;
companyLocation: string;
jobType: JobType;
mode: JobMode;
} = {
id: job.id,
logo: job.company.logo ? job.company.logo.toString() : null,
Expand All @@ -179,6 +185,9 @@ export default class StudentFunctions {
workingRights: job.workingRights,
applicationLink: job.applicationLink,
company: job.company.name,
companyLocation: job.company.location,
jobType: job.jobType,
mode: job.mode,
};
return newJob;
});
Expand Down
10 changes: 4 additions & 6 deletions frontend/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ const HomePage = () => {
pagination={{
clickable: true
}}
autoHeight
breakpoints={{
640: {
slidesPerView: 2
Expand All @@ -148,20 +149,17 @@ const HomePage = () => {
slidesPerView: 4
}
}}
loop
autoplay
modules={[Pagination, Navigation]}
style={{
padding: '0 25px'
}}
>
{featuredJobs.map((job) => (
<SwiperSlide key={job.id}>
<FeaturedJobCard
title={job.role}
description={job.description}
workingRights={job.workingRights}
imgSrc={job.logo}
jobType={job.jobType}
mode={job.mode}
location={job.companyLocation}
/>
</SwiperSlide>
))}
Expand Down
52 changes: 36 additions & 16 deletions frontend/components/FeaturedJobCard/FeaturedJobCard.tsx
Original file line number Diff line number Diff line change
@@ -1,23 +1,37 @@
import React from 'react';
import { faBuilding } from '@fortawesome/free-solid-svg-icons';
import {
faAddressCard,
faBuilding,
faClock,
faLocationDot
} from '@fortawesome/free-solid-svg-icons';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import Image from 'next/image';
import Link from 'next/link';
import { WorkingRights } from 'constants/jobFields';
import { JobMode, JobType } from 'constants/jobFields';
import styles from './styles.module.css';

type FeaturedJobCardProps = {
title: string;
description: string;
workingRights: string[];
imgSrc: string;
jobType: string;
location: string;
mode: string;
};

const FeaturedJobCard = ({ title, description, workingRights, imgSrc }: FeaturedJobCardProps) => {
const FeaturedJobCard = ({
title,
description,
imgSrc,
jobType,
location,
mode
}: FeaturedJobCardProps) => {
return (
<Link href="/student/login">
<div className="flex mx-4 mt-8 mb-12 flex-col justify-between shadow-card rounded-lg bg-white relative hover-anim">
<div>
<div className="flex mx-4 mt-8 mb-12 flex-col justify-between shadow-card rounded-lg bg-white relative hover-anim max-h-[600px]">
<div className="flex-grow overflow-hidden">
<div className="flex justify-center min-w-0 h-52 mx-5">
{imgSrc ? (
<Image
Expand All @@ -35,18 +49,24 @@ const FeaturedJobCard = ({ title, description, workingRights, imgSrc }: Featured
)}
</div>
<h3 className="text-xl font-bold mx-4 mb-4">{title}</h3>
<div className="h-[100px] flex flex-row flex-wrap m-0 justify-center items-center mx-2 my-2 xs:flex-col">
{workingRights.map((tag) => (
<div
key={tag}
className="flex justify-center items-center rounded-md my-1 mx-1 px-2 h-6 bg-jb-tags text-base"
>
{WorkingRights[tag as keyof typeof WorkingRights]}
</div>
))}

<div className="px-1">
<div className="flex items-center mx-4 my-1">
<FontAwesomeIcon className="w-4" icon={faClock} />
<p className="ml-2">{JobType[jobType as keyof typeof JobType]}</p>
</div>
<div className="flex items-center mx-4 my-1">
<FontAwesomeIcon className="w-4" icon={faLocationDot} />
<p className="ml-2">{location}</p>
</div>
<div className="flex items-center mx-4 my-1 mb-4">
<FontAwesomeIcon className="w-4" icon={faAddressCard} />
<p className="ml-2">{JobMode[mode as keyof typeof JobMode]}</p>
</div>
</div>

<p
className="text-base m-0 py-4 px-5 text-left text-jb-placeholder h-[200px] overflow-hidden text-ellipsis"
className="text-base m-0 py-3 px-5 text-left text-jb-placeholder h-[600px]"
dangerouslySetInnerHTML={{
__html: description
}}
Expand Down
3 changes: 3 additions & 0 deletions frontend/types/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ export type FeaturedJob = {
workingRights: WorkingRights[];
applicationLink: string;
company: string;
jobType: JobType;
mode: JobMode;
companyLocation: string;
};

export type FeaturedJobsPayload = {
Expand Down
6 changes: 6 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 5b85041

Please sign in to comment.