Skip to content

Commit

Permalink
fix linting
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasdavis committed Nov 19, 2024
1 parent c046095 commit 4cb4eab
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 46 deletions.
4 changes: 1 addition & 3 deletions apps/registry/app/explore/ClientResumes.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,9 +162,7 @@ export default function ClientResumes({
{resume.name || 'Anonymous'}
</a>
</h3>
<p className="text-gray-600">
{resume.label || 'No title'}
</p>
<p className="text-gray-600">{resume.label || 'No title'}</p>
<p className="text-sm text-gray-500">
{resume.location?.city
? `${resume.location.city}, ${resume.location.countryCode}`
Expand Down
91 changes: 54 additions & 37 deletions apps/registry/app/jobs/ClientJobBoard.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,52 +21,60 @@ const normalizeString = (str) => {

const categorizeJobType = (type) => {
const normalized = normalizeString(type);

if (normalized.includes('contract')) return 'Contract';
if (normalized.includes('fulltime') || normalized.includes('full')) return 'Full-time';
if (normalized.includes('parttime') || normalized.includes('part')) return 'Part-time';
if (normalized.includes('fulltime') || normalized.includes('full'))
return 'Full-time';
if (normalized.includes('parttime') || normalized.includes('part'))
return 'Part-time';
if (normalized.includes('intern')) return 'Internship';
if (normalized.includes('temp')) return 'Temporary';
if (normalized.includes('hybrid')) return 'Hybrid';
if (normalized.includes('remote')) return 'Remote';

return 'Other';
};

const categorizeExperience = (exp) => {
const normalized = normalizeString(exp);

if (normalized.includes('entry') || normalized.includes('junior')) return 'Entry Level';
if (normalized.includes('mid') || normalized.includes('intermediate')) return 'Mid Level';
if (normalized.includes('senior') || normalized.includes('sr')) return 'Senior Level';
if (normalized.includes('lead') || normalized.includes('principal')) return 'Lead';
if (normalized.includes('manager') || normalized.includes('head')) return 'Manager';
if (normalized.includes('exec') || normalized.includes('director')) return 'Executive';


if (normalized.includes('entry') || normalized.includes('junior'))
return 'Entry Level';
if (normalized.includes('mid') || normalized.includes('intermediate'))
return 'Mid Level';
if (normalized.includes('senior') || normalized.includes('sr'))
return 'Senior Level';
if (normalized.includes('lead') || normalized.includes('principal'))
return 'Lead';
if (normalized.includes('manager') || normalized.includes('head'))
return 'Manager';
if (normalized.includes('exec') || normalized.includes('director'))
return 'Executive';

return 'Not Specified';
};

const categorizeSalary = (salary) => {
if (!salary) return 'Not Specified';

const normalized = normalizeString(salary);

if (normalized.includes('competitive')) return 'Competitive';

// Extract the first number found in the string
const numbers = salary.match(/\d+/g);
if (!numbers) return 'Not Specified';

const firstNumber = parseInt(numbers[0], 10);

if (normalized.includes('k')) {
if (firstNumber < 50) return 'Under $50k';
if (firstNumber < 100) return '$50k - $100k';
if (firstNumber < 150) return '$100k - $150k';
if (firstNumber < 200) return '$150k - $200k';
return '$200k+';
}

if (firstNumber < 50000) return 'Under $50k';
if (firstNumber < 100000) return '$50k - $100k';
if (firstNumber < 150000) return '$100k - $150k';
Expand All @@ -76,16 +84,17 @@ const categorizeSalary = (salary) => {

const categorizeLocation = (location) => {
if (!location) return 'Not Specified';

// If it's already in the City, Region, Country format, return as is
if (location.includes(',')) return location;

const normalized = normalizeString(location);

if (normalized.includes('remote')) return 'Remote';
if (normalized.includes('hybrid')) return 'Hybrid';
if (normalized.includes('onsite') || normalized.includes('office')) return 'On-site';

if (normalized.includes('onsite') || normalized.includes('office'))
return 'On-site';

return location;
};

Expand All @@ -112,9 +121,10 @@ const ClientJobBoard = ({ initialJobs }) => {
};

jobs.forEach((job) => {
const gptContent = job.gpt_content && job.gpt_content !== 'FAILED'
? JSON.parse(job.gpt_content)
: {};
const gptContent =
job.gpt_content && job.gpt_content !== 'FAILED'
? JSON.parse(job.gpt_content)
: {};

if (gptContent.type) {
options.jobType.add(categorizeJobType(gptContent.type));
Expand Down Expand Up @@ -157,18 +167,19 @@ const ClientJobBoard = ({ initialJobs }) => {
if (searchTerm) {
const searchLower = searchTerm.toLowerCase();
result = result.filter((job) => {
const gptContent = job.gpt_content && job.gpt_content !== 'FAILED'
? JSON.parse(job.gpt_content)
: {};

const gptContent =
job.gpt_content && job.gpt_content !== 'FAILED'
? JSON.parse(job.gpt_content)
: {};

return (
gptContent.title?.toLowerCase().includes(searchLower) ||
gptContent.company?.toLowerCase().includes(searchLower) ||
gptContent.description?.toLowerCase().includes(searchLower) ||
gptContent.requirements?.some(req =>
gptContent.requirements?.some((req) =>
req.toLowerCase().includes(searchLower)
) ||
gptContent.responsibilities?.some(resp =>
gptContent.responsibilities?.some((resp) =>
resp.toLowerCase().includes(searchLower)
)
);
Expand All @@ -178,9 +189,10 @@ const ClientJobBoard = ({ initialJobs }) => {
Object.entries(filters).forEach(([key, value]) => {
if (value) {
result = result.filter((job) => {
const gptContent = job.gpt_content && job.gpt_content !== 'FAILED'
? JSON.parse(job.gpt_content)
: {};
const gptContent =
job.gpt_content && job.gpt_content !== 'FAILED'
? JSON.parse(job.gpt_content)
: {};

switch (key) {
case 'jobType':
Expand Down Expand Up @@ -239,7 +251,8 @@ const ClientJobBoard = ({ initialJobs }) => {
<div className="flex-1">
<div className="flex justify-between items-center mb-4">
<p className="text-sm text-gray-600">
{filteredJobs.length} {filteredJobs.length === 1 ? 'job' : 'jobs'} found
{filteredJobs.length} {filteredJobs.length === 1 ? 'job' : 'jobs'}{' '}
found
</p>
{activeFilterCount > 0 && (
<button
Expand Down Expand Up @@ -389,7 +402,11 @@ const JobItem = ({ job }) => {
? JSON.parse(job.gpt_content)
: {};

const locationString = [gptContent.location?.city, gptContent.location?.region, gptContent.location?.countryCode]
const locationString = [
gptContent.location?.city,
gptContent.location?.region,
gptContent.location?.countryCode,
]
.filter(Boolean)
.join(', ');

Expand Down
9 changes: 3 additions & 6 deletions apps/registry/app/jobs/components/MatchingCandidates.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,7 @@ export default function MatchingCandidates({ jobId }) {
}

if (error) {
return (
<div className="mt-8 text-center text-gray-500">
{error}
</div>
);
return <div className="mt-8 text-center text-gray-500">{error}</div>;
}

if (!candidates?.length) {
Expand Down Expand Up @@ -106,7 +102,8 @@ export default function MatchingCandidates({ jobId }) {
<div className="flex items-center text-gray-500 text-sm mt-1">
<MapPin className="w-4 h-4 mr-1" />
<span>
{candidate.location.city}, {candidate.location.countryCode}
{candidate.location.city},{' '}
{candidate.location.countryCode}
</span>
</div>
)}
Expand Down

0 comments on commit 4cb4eab

Please sign in to comment.