Merge branch 'main' into hongpo/refactor-question-routers

pull/435/head
Jeff Sieu 3 years ago
commit d900840a74

@ -27,8 +27,11 @@ export default function ProductNavigation({ items, title, titleHref }: Props) {
return (
<nav aria-label="Global" className="flex h-full items-center space-x-8">
<Link
className="hover:text-primary-700 text-sm font-medium"
className="hover:text-primary-700 flex items-center gap-2 text-sm font-medium"
href={titleHref}>
{titleHref !== '/' && (
<img alt="TIH" className="h-8 w-auto" src="/logo.svg" />
)}
{title}
</Link>
<div className="hidden h-full items-center space-x-8 md:flex">

@ -517,7 +517,7 @@ export default function ResumeHomePage() {
</div>
</div>
<div className="relative lg:left-64 lg:w-[calc(100%-16rem)]">
<div className="lg:border-grey-200 sticky top-0 z-10 z-0 flex flex-wrap items-center justify-between pt-6 pb-2 lg:border-b">
<div className="lg:border-grey-200 sticky top-0 z-0 flex flex-wrap items-center justify-between pt-6 pb-2 lg:border-b">
<div className="border-grey-200 mb-4 flex w-full justify-between border-b pb-2 lg:mb-0 lg:w-auto lg:border-none lg:pb-0">
<div>
<Tabs

@ -284,18 +284,42 @@ export const offersProfileRouter = createRouter()
})),
},
experiences: {
create: input.background.experiences.map(async (x) => {
if (x.jobType === JobType.FULLTIME) {
if (x.companyId) {
return {
company: {
connect: {
id: x.companyId,
create: await Promise.all(
input.background.experiences.map(async (x) => {
if (x.jobType === JobType.FULLTIME) {
if (x.companyId) {
return {
company: {
connect: {
id: x.companyId,
},
},
},
durationInMonths: x.durationInMonths,
jobType: x.jobType,
level: x.level,
title: x.title,
totalCompensation:
x.totalCompensation != null
? {
create: {
baseCurrency: baseCurrencyString,
baseValue: await convert(
x.totalCompensation.value,
x.totalCompensation.currency,
baseCurrencyString,
),
currency: x.totalCompensation.currency,
value: x.totalCompensation.value,
},
}
: undefined,
};
}
return {
durationInMonths: x.durationInMonths,
jobType: x.jobType,
level: x.level,
location: x.location,
title: x.title,
totalCompensation:
x.totalCompensation != null
@ -314,37 +338,35 @@ export const offersProfileRouter = createRouter()
: undefined,
};
}
return {
durationInMonths: x.durationInMonths,
jobType: x.jobType,
level: x.level,
location: x.location,
title: x.title,
totalCompensation:
x.totalCompensation != null
? {
create: {
baseCurrency: baseCurrencyString,
baseValue: await convert(
x.totalCompensation.value,
x.totalCompensation.currency,
baseCurrencyString,
),
currency: x.totalCompensation.currency,
value: x.totalCompensation.value,
},
}
: undefined,
};
}
if (x.jobType === JobType.INTERN) {
if (x.companyId) {
return {
company: {
connect: {
id: x.companyId,
if (x.jobType === JobType.INTERN) {
if (x.companyId) {
return {
company: {
connect: {
id: x.companyId,
},
},
},
durationInMonths: x.durationInMonths,
jobType: x.jobType,
monthlySalary:
x.monthlySalary != null
? {
create: {
baseCurrency: baseCurrencyString,
baseValue: await convert(
x.monthlySalary.value,
x.monthlySalary.currency,
baseCurrencyString,
),
currency: x.monthlySalary.currency,
value: x.monthlySalary.value,
},
}
: undefined,
title: x.title,
};
}
return {
durationInMonths: x.durationInMonths,
jobType: x.jobType,
monthlySalary:
@ -365,33 +387,13 @@ export const offersProfileRouter = createRouter()
title: x.title,
};
}
return {
durationInMonths: x.durationInMonths,
jobType: x.jobType,
monthlySalary:
x.monthlySalary != null
? {
create: {
baseCurrency: baseCurrencyString,
baseValue: await convert(
x.monthlySalary.value,
x.monthlySalary.currency,
baseCurrencyString,
),
currency: x.monthlySalary.currency,
value: x.monthlySalary.value,
},
}
: undefined,
title: x.title,
};
}
throw new trpc.TRPCError({
code: 'BAD_REQUEST',
message: 'Missing fields in background experiences.',
});
}),
throw new trpc.TRPCError({
code: 'BAD_REQUEST',
message: 'Missing fields in background experiences.',
});
}),
)
},
specificYoes: {
create: input.background.specificYoes.map((x) => {
@ -546,7 +548,6 @@ export const offersProfileRouter = createRouter()
profileName: uniqueName,
},
});
return createOfferProfileResponseMapper(profile, token);
},
})

@ -1,5 +1,4 @@
import { z } from 'zod';
import type { ResumesCommentVote } from '@prisma/client';
import { Vote } from '@prisma/client';
import { createRouter } from '../context';
@ -20,13 +19,13 @@ export const resumesCommentsVotesRouter = createRouter().query('list', {
},
});
let userVote: ResumesCommentVote | null = null;
let numVotes = 0;
votes.forEach((vote) => {
numVotes += vote.value === Vote.UPVOTE ? 1 : -1;
userVote = vote.userId === userId ? vote : null;
});
const userVotes = votes.filter((vote) => vote.userId === userId);
const userVote = userVotes.length > 0 ? userVotes[0] : null;
const numVotes = votes
.map((vote) => (vote.value === Vote.UPVOTE ? 1 : -1))
.reduce((result, current) => {
return result + current;
}, 0);
const resumeCommentVote: ResumeCommentVote = {
numVotes,

@ -39,7 +39,7 @@ export type Filter = {
export type FilterState = Partial<CustomFilter> &
Record<FilterId, Array<FilterValue>>;
export type SortOrder = 'latest' | 'popular' | 'topComments';
export type SortOrder = 'latest' | 'mostComments' | 'popular';
export type Shortcut = {
customFilters?: CustomFilter;
@ -63,7 +63,7 @@ export const BROWSE_TABS_VALUES = {
export const SORT_OPTIONS: Array<FilterOption<SortOrder>> = [
{ label: 'Latest', value: 'latest' },
{ label: 'Popular', value: 'popular' },
{ label: 'Top Comments', value: 'topComments' },
{ label: 'Most Comments', value: 'mostComments' },
];
export const ROLES: Array<FilterOption<RoleFilter>> = [

Loading…
Cancel
Save