Skip to content

Commit

Permalink
feat: add Salary and Tools sections to RecruiterInfo page
Browse files Browse the repository at this point in the history
  • Loading branch information
martapanc committed Sep 18, 2023
1 parent 570230b commit f9e1400
Show file tree
Hide file tree
Showing 6 changed files with 150 additions and 4 deletions.
68 changes: 68 additions & 0 deletions src/app/(public)/recruiters-info/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
import ReactMarkdown from 'react-markdown';

import '@/components/molecules/RecruiterInfo/recruiterInfo.css';

import Heading from '@/components/atoms/headings/Heading';
import { SalaryHappinessTool } from '@/components/molecules/RecruiterInfo/SalaryHappinessTool';

import { queryRecruitersPage } from '@/queries/recruiters-page';

export const metadata = {
title: 'Recruiters Info | MartaCodes.it',
description: 'Information for Recruiters',
};

const queryData = async () => {
const recruitersPage = await queryRecruitersPage();

return {
recruitersPage,
};
};

const RecruitersPage = async () => {
const { recruitersPage } = await queryData();

const salaryData = {
min: 70000,
median: 85000,
max: 120000,
};

const config = {
displayTitle: true,
currency: 'EUR',
forexMultiplier: 1,
};

return (
<main className='min-h-main'>
<section>
<div className='layout relative flex flex-col py-12'>
<Heading title='recruiters.title' />

<div
className='salary-expectations mb-2'
aria-label='Salary Expectations'
>
<h2 className='mb-2'>{recruitersPage.salary.title}</h2>
<ReactMarkdown>{recruitersPage.salary.content}</ReactMarkdown>

<SalaryHappinessTool salaryData={salaryData} config={config} />
</div>

<hr />

<div className='tools-techs mb-8'>
<h2 className='my-4'>{recruitersPage.toolsTechs.title}</h2>
<ReactMarkdown>{recruitersPage.toolsTechs.content}</ReactMarkdown>
</div>

<hr />
</div>
</section>
</main>
);
};

export default RecruitersPage;
10 changes: 6 additions & 4 deletions src/components/molecules/RecruiterInfo/SalaryHappinessTool.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use client';

import { Box, Slider } from '@mui/material';
import * as React from 'react';
import { useEffect, useState } from 'react';
Expand Down Expand Up @@ -26,10 +28,10 @@ const SalaryHappinessTool = ({ salaryData, config }: SalaryHappinessProps) => {
const minVisible = roundNum(medianInCurrency * 0.5);
const minSad = roundNum(medianInCurrency * 0.6);
const stillSad = roundNum(medianInCurrency * 0.7);
const minAcceptable = roundNum(medianInCurrency * 0.8);
const minAcceptable = roundNum(medianInCurrency * 0.9);
const veryHappy = roundNum(medianInCurrency * 1.2);
const overTheMoon = roundNum(medianInCurrency * 1.3);
const maxVisible = roundNum(medianInCurrency * 1.5);
const maxVisible = roundNum(medianInCurrency * 1.4);

const [selectedSalary, setSelectedSalary] = useState(minAcceptable);
const [happinessScore, setHappinessScore] = useState({
Expand Down Expand Up @@ -72,8 +74,8 @@ const SalaryHappinessTool = ({ salaryData, config }: SalaryHappinessProps) => {
}, [selectedSalary]);

return (
<Box width={300} className='m-2 '>
{config.displayTitle && <h3>Salary Happiness Tool</h3>}
<Box width={340} className='p-4'>
{config.displayTitle && <h3>Salary &rArr; Happiness Tool</h3>}

<Slider
className='mt-2'
Expand Down
21 changes: 21 additions & 0 deletions src/components/molecules/RecruiterInfo/recruiterInfo.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
.salary-expectations p {
margin-bottom: 12px;
}

.tools-techs h4 {
margin-bottom: 8px;
}

.tools-techs p {
margin-top: 20px;
}

ul {
margin-bottom: 16px;
list-style: inside;
}

li {
margin-left: 22px;
margin-bottom: 5px;
}
3 changes: 3 additions & 0 deletions src/data/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -95,5 +95,8 @@
},
"uses": {
"title": "Uses"
},
"recruiters": {
"title": "Info for Recruiters"
}
}
41 changes: 41 additions & 0 deletions src/queries/recruiters-page.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import { gql } from '@apollo/client';

import { flattenToObject } from '@/lib/graphqlUtils';

import apolloClient from '../../apollo/apollo-client';

import { RecruitersPage } from '@/types/RecruitersPage';

export async function queryRecruitersPage() {
const { data } = await apolloClient.query({ query: recruitersPageQuery });

return flattenToObject<RecruitersPage>(data.recruitersPage);
}

export const recruitersPageQuery = gql`
{
recruitersPage {
data {
id
attributes {
salary {
title
content
}
toolsTechs {
title
content
}
jobPreferences {
title
content
}
tldr {
title
content
}
}
}
}
}
`;
11 changes: 11 additions & 0 deletions src/types/RecruitersPage.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
export interface RecruitersPage {
salary: TitledParagraph;
toolsTechs: TitledParagraph;
jobPreferences: TitledParagraph;
tldr: TitledParagraph;
}

interface TitledParagraph {
title: string;
content: string;
}

0 comments on commit f9e1400

Please sign in to comment.