Nothing found.
diff --git a/apps/portal/src/server/router/questions-answer-comment-router.ts b/apps/portal/src/server/router/questions-answer-comment-router.ts
index 75977b41..63a9ede4 100644
--- a/apps/portal/src/server/router/questions-answer-comment-router.ts
+++ b/apps/portal/src/server/router/questions-answer-comment-router.ts
@@ -166,13 +166,29 @@ export const questionsAnswerCommentRouter = createProtectedRouter()
const { answerCommentId, vote } = input;
- return await ctx.prisma.questionsAnswerCommentVote.create({
- data: {
- answerCommentId,
- userId,
- vote,
- },
- });
+ const incrementValue = vote === Vote.UPVOTE ? 1 : -1;
+
+ const [answerCommentVote] = await ctx.prisma.$transaction([
+ ctx.prisma.questionsAnswerCommentVote.create({
+ data: {
+ answerCommentId,
+ userId,
+ vote,
+ },
+ }),
+ ctx.prisma.questionsAnswerComment.update({
+ data: {
+ upvotes: {
+ increment: incrementValue,
+ },
+ },
+ where: {
+ id: answerCommentId,
+ },
+ }),
+ ]);
+
+ return answerCommentVote;
},
})
.mutation('updateVote', {
@@ -198,14 +214,30 @@ export const questionsAnswerCommentRouter = createProtectedRouter()
});
}
- return await ctx.prisma.questionsAnswerCommentVote.update({
- data: {
- vote,
- },
- where: {
- id,
- },
- });
+ const incrementValue = vote === Vote.UPVOTE ? 2 : -2;
+
+ const [answerCommentVote] = await ctx.prisma.$transaction([
+ ctx.prisma.questionsAnswerCommentVote.update({
+ data: {
+ vote,
+ },
+ where: {
+ id,
+ },
+ }),
+ ctx.prisma.questionsAnswerComment.update({
+ data: {
+ upvotes: {
+ increment: incrementValue,
+ },
+ },
+ where: {
+ id: voteToUpdate.answerCommentId,
+ },
+ }),
+ ]);
+
+ return answerCommentVote;
},
})
.mutation('deleteVote', {
@@ -229,10 +261,26 @@ export const questionsAnswerCommentRouter = createProtectedRouter()
});
}
- return await ctx.prisma.questionsAnswerCommentVote.delete({
- where: {
- id: input.id,
- },
- });
+ const incrementValue = voteToDelete.vote === Vote.UPVOTE ? -1 : 1;
+
+ const [answerCommentVote] = await ctx.prisma.$transaction([
+ ctx.prisma.questionsAnswerCommentVote.delete({
+ where: {
+ id: input.id,
+ },
+ }),
+ ctx.prisma.questionsAnswerComment.update({
+ data: {
+ upvotes: {
+ increment: incrementValue,
+ },
+ },
+ where: {
+ id: voteToDelete.answerCommentId,
+ },
+ }),
+ ]);
+ return answerCommentVote;
+
},
});
diff --git a/apps/portal/src/server/router/questions-answer-router.ts b/apps/portal/src/server/router/questions-answer-router.ts
index 5d386854..e2318ba7 100644
--- a/apps/portal/src/server/router/questions-answer-router.ts
+++ b/apps/portal/src/server/router/questions-answer-router.ts
@@ -229,13 +229,28 @@ export const questionsAnswerRouter = createProtectedRouter()
const { answerId, vote } = input;
- return await ctx.prisma.questionsAnswerVote.create({
- data: {
- answerId,
- userId,
- vote,
- },
- });
+ const incrementValue = vote === Vote.UPVOTE ? 1 : -1;
+
+ const [answerVote] = await ctx.prisma.$transaction([
+ ctx.prisma.questionsAnswerVote.create({
+ data: {
+ answerId,
+ userId,
+ vote,
+ },
+ }),
+ ctx.prisma.questionsAnswer.update({
+ data: {
+ upvotes: {
+ increment: incrementValue,
+ },
+ },
+ where: {
+ id: answerId,
+ },
+ }),
+ ]);
+ return answerVote;
},
})
.mutation('updateVote', {
@@ -260,14 +275,30 @@ export const questionsAnswerRouter = createProtectedRouter()
});
}
- return await ctx.prisma.questionsAnswerVote.update({
- data: {
- vote,
- },
- where: {
- id,
- },
- });
+ const incrementValue = vote === Vote.UPVOTE ? 2 : -2;
+
+ const [questionsAnswerVote] = await ctx.prisma.$transaction([
+ ctx.prisma.questionsAnswerVote.update({
+ data: {
+ vote,
+ },
+ where: {
+ id,
+ },
+ }),
+ ctx.prisma.questionsAnswer.update({
+ data: {
+ upvotes: {
+ increment: incrementValue,
+ },
+ },
+ where: {
+ id: voteToUpdate.answerId,
+ },
+ }),
+ ]);
+
+ return questionsAnswerVote;
},
})
.mutation('deleteVote', {
@@ -290,10 +321,26 @@ export const questionsAnswerRouter = createProtectedRouter()
});
}
- return await ctx.prisma.questionsAnswerVote.delete({
- where: {
- id: input.id,
- },
- });
+ const incrementValue = voteToDelete.vote === Vote.UPVOTE ? -1 : 1;
+
+ const [questionsAnswerVote] = await ctx.prisma.$transaction([
+ ctx.prisma.questionsAnswerVote.delete({
+ where: {
+ id: input.id,
+ },
+ }),
+ ctx.prisma.questionsAnswer.update({
+ data: {
+ upvotes: {
+ increment: incrementValue,
+ },
+ },
+ where: {
+ id: voteToDelete.answerId,
+ },
+ }),
+ ]);
+ return questionsAnswerVote;
+
},
});
diff --git a/apps/portal/src/server/router/questions-question-comment-router.ts b/apps/portal/src/server/router/questions-question-comment-router.ts
index e2f786f9..28cf3b9d 100644
--- a/apps/portal/src/server/router/questions-question-comment-router.ts
+++ b/apps/portal/src/server/router/questions-question-comment-router.ts
@@ -166,13 +166,28 @@ export const questionsQuestionCommentRouter = createProtectedRouter()
const userId = ctx.session?.user?.id;
const { questionCommentId, vote } = input;
- return await ctx.prisma.questionsQuestionCommentVote.create({
- data: {
- questionCommentId,
- userId,
- vote,
- },
- });
+ const incrementValue: number = vote === Vote.UPVOTE ? 1 : -1;
+
+ const [ questionCommentVote ] = await ctx.prisma.$transaction([
+ ctx.prisma.questionsQuestionCommentVote.create({
+ data: {
+ questionCommentId,
+ userId,
+ vote,
+ },
+ }),
+ ctx.prisma.questionsQuestionComment.update({
+ data: {
+ upvotes: {
+ increment: incrementValue,
+ },
+ },
+ where: {
+ id: questionCommentId,
+ },
+ }),
+ ]);
+ return questionCommentVote;
},
})
.mutation('updateVote', {
@@ -198,14 +213,30 @@ export const questionsQuestionCommentRouter = createProtectedRouter()
});
}
- return await ctx.prisma.questionsQuestionCommentVote.update({
- data: {
- vote,
- },
- where: {
- id,
- },
- });
+ const incrementValue = vote === Vote.UPVOTE ? 2 : -2;
+
+ const [questionCommentVote] = await ctx.prisma.$transaction([
+ ctx.prisma.questionsQuestionCommentVote.update({
+ data: {
+ vote,
+ },
+ where: {
+ id,
+ },
+ }),
+ ctx.prisma.questionsQuestionComment.update({
+ data: {
+ upvotes: {
+ increment: incrementValue,
+ },
+ },
+ where: {
+ id: voteToUpdate.questionCommentId,
+ },
+ }),
+ ]);
+
+ return questionCommentVote;
},
})
.mutation('deleteVote', {
@@ -229,10 +260,25 @@ export const questionsQuestionCommentRouter = createProtectedRouter()
});
}
- return await ctx.prisma.questionsQuestionCommentVote.delete({
- where: {
- id: input.id,
- },
- });
+ const incrementValue = voteToDelete.vote === Vote.UPVOTE ? -1 : 1;
+
+ const [questionCommentVote] = await ctx.prisma.$transaction([
+ ctx.prisma.questionsQuestionCommentVote.delete({
+ where: {
+ id: input.id,
+ },
+ }),
+ ctx.prisma.questionsQuestionComment.update({
+ data: {
+ upvotes: {
+ increment: incrementValue,
+ },
+ },
+ where: {
+ id: voteToDelete.questionCommentId,
+ },
+ }),
+ ]);
+ return questionCommentVote;
},
});
diff --git a/apps/portal/src/server/router/questions-question-encounter-router.ts b/apps/portal/src/server/router/questions-question-encounter-router.ts
index 1f328dc6..0f597ad3 100644
--- a/apps/portal/src/server/router/questions-question-encounter-router.ts
+++ b/apps/portal/src/server/router/questions-question-encounter-router.ts
@@ -25,9 +25,13 @@ export const questionsQuestionEncounterRouter = createProtectedRouter()
const locationCounts: Record
= {};
const roleCounts: Record = {};
+ let latestSeenAt = questionEncountersData[0].seenAt;
+
for (let i = 0; i < questionEncountersData.length; i++) {
const encounter = questionEncountersData[i];
+ latestSeenAt = latestSeenAt < encounter.seenAt ? encounter.seenAt : latestSeenAt;
+
if (!(encounter.company!.name in companyCounts)) {
companyCounts[encounter.company!.name] = 1;
}
@@ -46,6 +50,7 @@ export const questionsQuestionEncounterRouter = createProtectedRouter()
const questionEncounter: AggregatedQuestionEncounter = {
companyCounts,
+ latestSeenAt,
locationCounts,
roleCounts,
};
diff --git a/apps/portal/src/server/router/questions-question-router.ts b/apps/portal/src/server/router/questions-question-router.ts
index 3768b852..3c4f8f8b 100644
--- a/apps/portal/src/server/router/questions-question-router.ts
+++ b/apps/portal/src/server/router/questions-question-router.ts
@@ -11,9 +11,16 @@ export const questionsQuestionRouter = createProtectedRouter()
.query('getQuestionsByFilter', {
input: z.object({
companyNames: z.string().array(),
+ cursor: z
+ .object({
+ idCursor: z.string().optional(),
+ lastSeenCursor: z.date().optional(),
+ upvoteCursor: z.number().optional(),
+ })
+ .nullish(),
endDate: z.date().default(new Date()),
+ limit: z.number().min(1).default(50),
locations: z.string().array(),
- pageSize: z.number().default(50),
questionTypes: z.nativeEnum(QuestionsQuestionType).array(),
roles: z.string().array(),
sortOrder: z.nativeEnum(SortOrder),
@@ -21,16 +28,36 @@ export const questionsQuestionRouter = createProtectedRouter()
startDate: z.date().optional(),
}),
async resolve({ ctx, input }) {
+ const { cursor } = input;
+
const sortCondition =
input.sortType === SortType.TOP
- ? {
- upvotes: input.sortOrder,
- }
- : {
- lastSeenAt: input.sortOrder,
- };
+ ? [
+ {
+ upvotes: input.sortOrder,
+ },
+ {
+ id: input.sortOrder,
+ },
+ ]
+ : [
+ {
+ lastSeenAt: input.sortOrder,
+ },
+ {
+ id: input.sortOrder,
+ },
+ ];
+
+ const toSkip = cursor ? 1 : 0;
const questionsData = await ctx.prisma.questionsQuestion.findMany({
+ cursor:
+ cursor !== undefined
+ ? {
+ id: cursor ? cursor!.idCursor : undefined,
+ }
+ : undefined,
include: {
_count: {
select: {
@@ -53,9 +80,9 @@ export const questionsQuestionRouter = createProtectedRouter()
},
votes: true,
},
- orderBy: {
- ...sortCondition,
- },
+ orderBy: sortCondition,
+ skip: toSkip,
+ take: input.limit + 1,
where: {
...(input.questionTypes.length > 0
? {
@@ -98,7 +125,7 @@ export const questionsQuestionRouter = createProtectedRouter()
},
});
- return questionsData.map((data) => {
+ const processedQuestionsData = questionsData.map((data) => {
const votes: number = data.votes.reduce(
(previousValue: number, currentValue) => {
let result: number = previousValue;
@@ -116,23 +143,78 @@ export const questionsQuestionRouter = createProtectedRouter()
0,
);
+ const companyCounts: Record = {};
+ const locationCounts: Record = {};
+ const roleCounts: Record = {};
+
+ let latestSeenAt = data.encounters[0].seenAt;
+
+ for (let i = 0; i < data.encounters.length; i++) {
+ const encounter = data.encounters[i];
+
+ latestSeenAt =
+ latestSeenAt < encounter.seenAt ? encounter.seenAt : latestSeenAt;
+
+ if (!(encounter.company!.name in companyCounts)) {
+ companyCounts[encounter.company!.name] = 1;
+ }
+ companyCounts[encounter.company!.name] += 1;
+
+ if (!(encounter.location in locationCounts)) {
+ locationCounts[encounter.location] = 1;
+ }
+ locationCounts[encounter.location] += 1;
+
+ if (!(encounter.role in roleCounts)) {
+ roleCounts[encounter.role] = 1;
+ }
+ roleCounts[encounter.role] += 1;
+ }
+
const question: Question = {
- company: data.encounters[0].company!.name ?? 'Unknown company',
+ aggregatedQuestionEncounters: {
+ companyCounts,
+ latestSeenAt,
+ locationCounts,
+ roleCounts,
+ },
content: data.content,
id: data.id,
- location: data.encounters[0].location ?? 'Unknown location',
numAnswers: data._count.answers,
numComments: data._count.comments,
numVotes: votes,
receivedCount: data.encounters.length,
- role: data.encounters[0].role ?? 'Unknown role',
- seenAt: data.encounters[0].seenAt,
+ seenAt: latestSeenAt,
type: data.questionType,
updatedAt: data.updatedAt,
user: data.user?.name ?? '',
};
return question;
});
+
+ let nextCursor: typeof cursor | undefined = undefined;
+
+ if (questionsData.length > input.limit) {
+ const nextItem = questionsData.pop()!;
+ processedQuestionsData.pop();
+
+ const nextIdCursor: string | undefined = nextItem.id;
+ const nextLastSeenCursor =
+ input.sortType === SortType.NEW ? nextItem.lastSeenAt : undefined;
+ const nextUpvoteCursor =
+ input.sortType === SortType.TOP ? nextItem.upvotes : undefined;
+
+ nextCursor = {
+ idCursor: nextIdCursor,
+ lastSeenCursor: nextLastSeenCursor,
+ upvoteCursor: nextUpvoteCursor,
+ };
+ }
+
+ return {
+ data: processedQuestionsData,
+ nextCursor,
+ };
},
})
.query('getQuestionById', {
@@ -190,16 +272,45 @@ export const questionsQuestionRouter = createProtectedRouter()
0,
);
+ const companyCounts: Record = {};
+ const locationCounts: Record = {};
+ const roleCounts: Record = {};
+
+ let latestSeenAt = questionData.encounters[0].seenAt;
+
+ for (const encounter of questionData.encounters) {
+ latestSeenAt =
+ latestSeenAt < encounter.seenAt ? encounter.seenAt : latestSeenAt;
+
+ if (!(encounter.company!.name in companyCounts)) {
+ companyCounts[encounter.company!.name] = 1;
+ }
+ companyCounts[encounter.company!.name] += 1;
+
+ if (!(encounter.location in locationCounts)) {
+ locationCounts[encounter.location] = 1;
+ }
+ locationCounts[encounter.location] += 1;
+
+ if (!(encounter.role in roleCounts)) {
+ roleCounts[encounter.role] = 1;
+ }
+ roleCounts[encounter.role] += 1;
+ }
+
const question: Question = {
- company: questionData.encounters[0].company!.name ?? 'Unknown company',
+ aggregatedQuestionEncounters: {
+ companyCounts,
+ latestSeenAt,
+ locationCounts,
+ roleCounts,
+ },
content: questionData.content,
id: questionData.id,
- location: questionData.encounters[0].location ?? 'Unknown location',
numAnswers: questionData._count.answers,
numComments: questionData._count.comments,
numVotes: votes,
receivedCount: questionData.encounters.length,
- role: questionData.encounters[0].role ?? 'Unknown role',
seenAt: questionData.encounters[0].seenAt,
type: questionData.questionType,
updatedAt: questionData.updatedAt,
diff --git a/apps/portal/src/types/questions.d.ts b/apps/portal/src/types/questions.d.ts
index 4157eb37..aea8d31e 100644
--- a/apps/portal/src/types/questions.d.ts
+++ b/apps/portal/src/types/questions.d.ts
@@ -1,16 +1,13 @@
import type { QuestionsQuestionType } from '@prisma/client';
export type Question = {
- // TODO: company, location, role maps
- company: string;
+ aggregatedQuestionEncounters: AggregatedQuestionEncounter;
content: string;
id: string;
- location: string;
numAnswers: number;
numComments: number;
numVotes: number;
receivedCount: number;
- role: string;
seenAt: Date;
type: QuestionsQuestionType;
updatedAt: Date;
@@ -19,6 +16,7 @@ export type Question = {
export type AggregatedQuestionEncounter = {
companyCounts: Record;
+ latestSeenAt: Date;
locationCounts: Record;
roleCounts: Record;
};
From b52f15a937a0cc4b90fddd76c42638a22a3b7cb6 Mon Sep 17 00:00:00 2001
From: Keane Chan
Date: Mon, 24 Oct 2022 23:00:37 +0800
Subject: [PATCH 5/8] [portal][ui] add error message to checkbox input
---
.../ui/src/CheckboxInput/CheckboxInput.tsx | 106 ++++++++++--------
1 file changed, 58 insertions(+), 48 deletions(-)
diff --git a/packages/ui/src/CheckboxInput/CheckboxInput.tsx b/packages/ui/src/CheckboxInput/CheckboxInput.tsx
index edeb9d3a..fec43b7e 100644
--- a/packages/ui/src/CheckboxInput/CheckboxInput.tsx
+++ b/packages/ui/src/CheckboxInput/CheckboxInput.tsx
@@ -7,6 +7,7 @@ type Props = Readonly<{
defaultValue?: boolean;
description?: string;
disabled?: boolean;
+ errorMessage?: string;
label: string;
name?: string;
onChange?: (
@@ -21,6 +22,7 @@ function CheckboxInput(
defaultValue,
description,
disabled = false,
+ errorMessage,
label,
name,
value,
@@ -30,59 +32,67 @@ function CheckboxInput(
) {
const id = useId();
const descriptionId = useId();
+ const errorId = useId();
return (
-
-
- {
- onChange?.(event.target.checked, event);
- }
- : undefined
- }
- />
-
-
-
- {label}
-
- {description && (
-
+
+
+
- {description}
-
- )}
+ defaultChecked={defaultValue}
+ disabled={disabled}
+ id={id}
+ name={name}
+ type="checkbox"
+ onChange={(event) => {
+ if (!onChange) {
+ return;
+ }
+
+ onChange(event.target.checked, event);
+ }}
+ />
+
+
+
+ {label}
+
+ {description && (
+
+ {description}
+
+ )}
+
+ {errorMessage && (
+
+ {errorMessage}
+
+ )}
);
}
From 64670923e15a080356edba62caa4f71879fa9ee0 Mon Sep 17 00:00:00 2001
From: Keane Chan
Date: Mon, 24 Oct 2022 23:00:50 +0800
Subject: [PATCH 6/8] [resumes][feat] add error message to submit form
---
apps/portal/src/pages/resumes/submit.tsx | 66 ++++++++++++++----------
1 file changed, 39 insertions(+), 27 deletions(-)
diff --git a/apps/portal/src/pages/resumes/submit.tsx b/apps/portal/src/pages/resumes/submit.tsx
index c851cafa..7901056b 100644
--- a/apps/portal/src/pages/resumes/submit.tsx
+++ b/apps/portal/src/pages/resumes/submit.tsx
@@ -86,10 +86,16 @@ export default function SubmitResumeForm({
setValue,
reset,
watch,
+ clearErrors,
formState: { errors, isDirty, dirtyFields },
} = useForm({
defaultValues: {
+ additionalInfo: '',
+ experience: '',
isChecked: false,
+ location: '',
+ role: '',
+ title: '',
...initFormDetails,
},
});
@@ -296,7 +302,7 @@ export default function SubmitResumeForm({
options={ROLES}
placeholder=" "
required={true}
- onChange={(val) => setValue('role', val)}
+ onChange={(val) => onValueChange('role', val)}
/>
setValue('experience', val)}
+ onChange={(val) => onValueChange('experience', val)}
/>
setValue('location', val)}
+ onChange={(val) => onValueChange('location', val)}
/>
{/* Upload resume form */}
{isNewForm && (
@@ -335,6 +341,16 @@ export default function SubmitResumeForm({
: 'border-slate-300',
'flex cursor-pointer justify-center rounded-md border-2 border-dashed bg-slate-100 py-4',
)}>
+
{resumeFile == null ? (
@@ -345,29 +361,15 @@ export default function SubmitResumeForm({
{resumeFile.name}
)}
-
-
- Drop file here
- or
-
- {resumeFile == null
- ? 'Select file'
- : 'Replace file'}
-
-
-
-
+
+ Drop file here
+ or
+
+ {resumeFile == null ? 'Select file' : 'Replace file'}
+
+
PDF up to {FILE_SIZE_LIMIT_MB}MB
@@ -394,8 +396,18 @@ export default function SubmitResumeForm({
setValue('isChecked', val)}
+ onChange={(val) => {
+ if (val) {
+ clearErrors('isChecked');
+ }
+ setValue('isChecked', val);
+ }}
/>
>
)}
From 0d53dab7a835f40cd974c91abb6c17bd593372df Mon Sep 17 00:00:00 2001
From: Zhang Ziqing <69516975+ziqing26@users.noreply.github.com>
Date: Mon, 24 Oct 2022 23:18:23 +0800
Subject: [PATCH 7/8] [offers][fix] fix landing page description (#424)
* [offers][fix] fix landing page width
* [offers][fix] fix landing page typo
* [offers][chore] fix British English in landing page
* [offers][chore] fix description in landing page
---
.../src/components/offers/OffersNavigation.ts | 2 +-
.../offers/landing/LeftTextCard.tsx | 9 ++--
.../offers/landing/RightTextCard.tsx | 9 ++--
.../offers/profile/ProfileComments.tsx | 31 +------------
apps/portal/src/components/offers/types.ts | 2 +
.../src/pages/offers/{home.tsx => browse.tsx} | 0
apps/portal/src/pages/offers/index.tsx | 44 +++++++++----------
.../pages/offers/profile/[offerProfileId].tsx | 5 ++-
8 files changed, 39 insertions(+), 63 deletions(-)
rename apps/portal/src/pages/offers/{home.tsx => browse.tsx} (100%)
diff --git a/apps/portal/src/components/offers/OffersNavigation.ts b/apps/portal/src/components/offers/OffersNavigation.ts
index 9b340cec..0c43c644 100644
--- a/apps/portal/src/components/offers/OffersNavigation.ts
+++ b/apps/portal/src/components/offers/OffersNavigation.ts
@@ -1,7 +1,7 @@
import type { ProductNavigationItems } from '~/components/global/ProductNavigation';
const navigation: ProductNavigationItems = [
- { href: '/offers/home', name: 'Home' },
+ { href: '/offers/browse', name: 'Browse' },
{ href: '/offers/submit', name: 'Analyse your offers' },
];
diff --git a/apps/portal/src/components/offers/landing/LeftTextCard.tsx b/apps/portal/src/components/offers/landing/LeftTextCard.tsx
index 27886018..329a58f5 100644
--- a/apps/portal/src/components/offers/landing/LeftTextCard.tsx
+++ b/apps/portal/src/components/offers/landing/LeftTextCard.tsx
@@ -1,5 +1,7 @@
import type { ReactNode } from 'react';
+import { HOME_URL } from '~/components/offers/types';
+
type LeftTextCardProps = Readonly<{
description: string;
icon: ReactNode;
@@ -8,7 +10,6 @@ type LeftTextCardProps = Readonly<{
title: string;
}>;
-const baseUrl = '/offers/home';
export default function LeftTextCard({
description,
icon,
@@ -21,7 +22,7 @@ export default function LeftTextCard({
-
+
{icon}
@@ -32,8 +33,8 @@ export default function LeftTextCard({
{description}
diff --git a/apps/portal/src/components/offers/landing/RightTextCard.tsx b/apps/portal/src/components/offers/landing/RightTextCard.tsx
index 551c246a..9028ad16 100644
--- a/apps/portal/src/components/offers/landing/RightTextCard.tsx
+++ b/apps/portal/src/components/offers/landing/RightTextCard.tsx
@@ -1,5 +1,7 @@
import type { ReactNode } from 'react';
+import { HOME_URL } from '~/components/offers/types';
+
type RightTextCarddProps = Readonly<{
description: string;
icon: ReactNode;
@@ -8,7 +10,6 @@ type RightTextCarddProps = Readonly<{
title: string;
}>;
-const baseUrl = '/offers/home';
export default function RightTextCard({
description,
icon,
@@ -21,7 +22,7 @@ export default function RightTextCard({
-
+
{icon}
@@ -32,8 +33,8 @@ export default function RightTextCard({
{description}
diff --git a/apps/portal/src/components/offers/profile/ProfileComments.tsx b/apps/portal/src/components/offers/profile/ProfileComments.tsx
index ebed5bfd..b26f78ae 100644
--- a/apps/portal/src/components/offers/profile/ProfileComments.tsx
+++ b/apps/portal/src/components/offers/profile/ProfileComments.tsx
@@ -175,36 +175,7 @@ export default function ProfileComments({
) : (
Please log in before commenting on this profile.
)}
-
-
+
{replies?.map((reply: Reply) => (
+
{/* Hero section */}
- Choosing offers made easier
-
- using profiles behind offers.
+ Choosing offers
+
+ made easier
-
- Analyse your offers using profiles from fellow software engineers.
+
+ Analyze your offers using profiles from fellow software engineers.
+ href={HOME_URL}>
Get started
Live demo
@@ -118,7 +118,7 @@ export default function LandingPage() {
/>
{/* Gradient Feature Section */}
-
+
Your privacy is our priority.
-
- All offer profiles are anonymised and we do not store information
+
+ All offer profiles are anonymized and we do not store information
about your personal identity.
@@ -185,7 +185,7 @@ export default function LandingPage() {
{feature.name}
-
+
{feature.description}
@@ -200,14 +200,14 @@ export default function LandingPage() {
Ready to get started?
-
+
Create your own offer profile today.
diff --git a/apps/portal/src/pages/offers/profile/[offerProfileId].tsx b/apps/portal/src/pages/offers/profile/[offerProfileId].tsx
index e90d8f77..8933112c 100644
--- a/apps/portal/src/pages/offers/profile/[offerProfileId].tsx
+++ b/apps/portal/src/pages/offers/profile/[offerProfileId].tsx
@@ -10,6 +10,7 @@ import type {
BackgroundDisplayData,
OfferDisplayData,
} from '~/components/offers/types';
+import { HOME_URL } from '~/components/offers/types';
import type { JobTitleType } from '~/components/shared/JobTitles';
import { getLabelForJobTitleType } from '~/components/shared/JobTitles';
@@ -46,7 +47,7 @@ export default function OfferProfile() {
enabled: typeof offerProfileId === 'string',
onSuccess: (data: Profile) => {
if (!data) {
- router.push('/offers/home');
+ router.push(HOME_URL);
}
// If the profile is not editable with a wrong token, redirect to the profile page
if (!data?.isEditable && token !== '') {
@@ -148,7 +149,7 @@ export default function OfferProfile() {
},
onSuccess: () => {
trpcContext.invalidateQueries(['offers.profile.listOne']);
- router.push('/offers/home');
+ router.push(HOME_URL);
showToast({
title: `Offers profile successfully deleted!`,
variant: 'success',
From c118ed59d490e9cc6dc66650d695b5059c80a10a Mon Sep 17 00:00:00 2001
From: hpkoh <53825802+hpkoh@users.noreply.github.com>
Date: Mon, 24 Oct 2022 23:20:51 +0800
Subject: [PATCH 8/8] [questions][fix] fix pagination off by one (#425)
---
.../src/server/router/questions-question-encounter-router.ts | 1 -
apps/portal/src/server/router/questions-question-router.ts | 5 +----
2 files changed, 1 insertion(+), 5 deletions(-)
diff --git a/apps/portal/src/server/router/questions-question-encounter-router.ts b/apps/portal/src/server/router/questions-question-encounter-router.ts
index 0f597ad3..8fa4a0e4 100644
--- a/apps/portal/src/server/router/questions-question-encounter-router.ts
+++ b/apps/portal/src/server/router/questions-question-encounter-router.ts
@@ -77,7 +77,6 @@ export const questionsQuestionEncounterRouter = createProtectedRouter()
},
})
.mutation('update', {
- //
input: z.object({
companyId: z.string().optional(),
id: z.string(),
diff --git a/apps/portal/src/server/router/questions-question-router.ts b/apps/portal/src/server/router/questions-question-router.ts
index 3c4f8f8b..3ea33bce 100644
--- a/apps/portal/src/server/router/questions-question-router.ts
+++ b/apps/portal/src/server/router/questions-question-router.ts
@@ -14,7 +14,7 @@ export const questionsQuestionRouter = createProtectedRouter()
cursor: z
.object({
idCursor: z.string().optional(),
- lastSeenCursor: z.date().optional(),
+ lastSeenCursor: z.date().nullish().optional(),
upvoteCursor: z.number().optional(),
})
.nullish(),
@@ -49,8 +49,6 @@ export const questionsQuestionRouter = createProtectedRouter()
},
];
- const toSkip = cursor ? 1 : 0;
-
const questionsData = await ctx.prisma.questionsQuestion.findMany({
cursor:
cursor !== undefined
@@ -81,7 +79,6 @@ export const questionsQuestionRouter = createProtectedRouter()
votes: true,
},
orderBy: sortCondition,
- skip: toSkip,
take: input.limit + 1,
where: {
...(input.questionTypes.length > 0