Skip to content
Open
Show file tree
Hide file tree
Changes from 10 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 71 additions & 0 deletions APIClients/InterviewGroupAPIClient.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
import { fetchGraphql } from "@utils/makegqlrequest";
import { queries, mutations } from "graphql/queries";

const InterviewGroupStatusEnum = {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rename as this is not an enum (please don't use an enum either it's a typescript anti pattern)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changed to InterviewGroupStatus

READY_TO_INTERVIEW: "Ready to Interview",
INVITES_SENT: "Invites Sent",
AVAILABILITY_PENDING: "Availability Pending",
} as const;

type InterviewGroup = {
schedulingLink: string | null;
};

type Applicant = {
firstName: string;
lastName: string;
};

type Interviewer = {
id: string;
firstName: string;
lastName: string;
email: string;
profilePictureFileId: string | null;
};

const InterviewGroupAPIClient = {
updateSchedulingLink: async (
id: string,
schedulingLink: string,
): Promise<string | null> => {
return fetchGraphql(mutations.updateInterviewGroup, {
id,
status: InterviewGroupStatusEnum.READY_TO_INTERVIEW,
schedulingLink,
})
.then((result) => result.data.updateInterviewGroup.schedulingLink)
.catch((e: Error) => {
throw new Error(
`Failed to update scheduling link. Cause: ${e.message}`,
);
});
},
getInterviewGroup: async (id: string): Promise<InterviewGroup> => {
return fetchGraphql(queries.getInterviewGroup, { id })
.then((result) => result.data.getInterviewGroup)
.catch((e: Error) => {
throw new Error(`Failed to fetch interview group. Cause: ${e.message}`);
});
},
getInterviewersByGroupId: async (groupId: string): Promise<Interviewer[]> => {
return fetchGraphql(queries.getInterviewersByGroupId, { groupId })
.then((result) => result.data.getInterviewersByGroupId)
.catch((e: Error) => {
throw new Error(`Failed to fetch interviewers. Cause: ${e.message}`);
});
},
getInterviewedApplicantsByGroupId: async (
groupId: string,
): Promise<Applicant[]> => {
return fetchGraphql(queries.getInterviewedApplicantsByGroupId, { groupId })
.then((result) => result.data.getInterviewedApplicantsByGroupId)
.catch((e: Error) => {
throw new Error(
`Failed to fetch interviewed applicants. Cause: ${e.message}`,
);
});
},
};

export default InterviewGroupAPIClient;
4 changes: 2 additions & 2 deletions components/common/SplitPageLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ export const SplitPanelLayout = ({
const hasWidthOverride = leftWidth || rightWidth;
const gridStyle = hasWidthOverride
? {
gridTemplateColumns: `${leftWidth ? `${leftWidth}px` : "1fr"} ${
rightWidth ? `${rightWidth}px` : "1fr"
gridTemplateColumns: `${leftWidth ? `${leftWidth}fr` : "1fr"} ${
rightWidth ? `${rightWidth}fr` : "1fr"
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

replaced px with fr such that component scales horizontally to parent

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mxc-maggiechen what we thinking about this one, seems interesting

}`,
}
: undefined;
Expand Down
19 changes: 19 additions & 0 deletions components/icons/edit.icon.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { ReactElement } from "react";
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please name files in accordance with current codebase patterns (EditIcon.tsx)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think the icon files all follow the .icon.tsx naming pattern at least under components/icons/


export const EditIcon = (): ReactElement => (
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you don't need to type the return type we can just have export const EditIcon = () => {}

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

<svg
width="24"
height="24"
viewBox="0 0 24 24"
fill="none"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M11 4H4C3.46957 4 2.96086 4.21071 2.58579 4.58579C2.21071 4.96086 2 5.46957 2 6V20C2 20.5304 2.21071 21.0391 2.58579 21.4142C2.96086 21.7893 3.46957 22 4 22H18C18.5304 22 19.0391 21.7893 19.4142 21.4142C19.7893 21.0391 20 20.5304 20 20V13M18.5 2.5C18.8978 2.10217 19.4374 1.87868 20 1.87868C20.5626 1.87868 21.1022 2.10217 21.5 2.5C21.8978 2.89782 22.1213 3.43739 22.1213 4C22.1213 4.56261 21.8978 5.10217 21.5 5.5L12 15L8 16L9 12L18.5 2.5Z"
stroke="#848AA5"
strokeWidth="2"
strokeLinecap="round"
strokeLinejoin="round"
/>
</svg>
);
33 changes: 33 additions & 0 deletions graphql/queries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,13 @@ export const mutations = {
refresh(refreshToken: $refreshToken)
}
`,
updateInterviewGroup: `
mutation UpdateInterviewGroup($id: ID!, $status: String!, $schedulingLink: String!) {
updateInterviewGroup(id: $id, status: $status, schedulingLink: $schedulingLink) {
schedulingLink
}
}
`,
changeRating: `
mutation changeRating($id: Int!, $ratingToBeChanged: String!, $newValue: Int!) {
changeRating(id: $id, ratingToBeChanged: $ratingToBeChanged, newValue: $newValue) {
Expand All @@ -47,4 +54,30 @@ export const queries = {
isAuthorizedByRole(accessToken: $accessToken, roles: $roles)
}
`,
getInterviewGroup: `
query GetInterviewGroup($id: ID!) {
getInterviewGroup(id: $id) {
schedulingLink
}
}
`,
getInterviewersByGroupId: `
query GetInterviewersByGroupId($groupId: ID!) {
getInterviewersByGroupId(groupId: $groupId) {
id
firstName
lastName
email
profilePictureFileId
}
}
`,
getInterviewedApplicantsByGroupId: `
query GetInterviewedApplicantsByGroupId($groupId: ID!) {
getInterviewedApplicantsByGroupId(groupId: $groupId) {
firstName
lastName
}
}
`,
};
Loading