Skip to content

Commit

Permalink
format according to prettier config
Browse files Browse the repository at this point in the history
  • Loading branch information
JoshCLim committed Jun 16, 2024
1 parent 4ae417f commit f38688c
Show file tree
Hide file tree
Showing 26 changed files with 105 additions and 105 deletions.
2 changes: 1 addition & 1 deletion frontend/src/api/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export class FetchError extends Error {

constructor(
public resp: Response,
public data?: unknown,
public data?: unknown
) {
super(resp.statusText);

Expand Down
10 changes: 5 additions & 5 deletions frontend/src/api/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ export const doSignup = async ({
// };

const authenticatedRequest = <T = void>(
payload: Parameters<typeof API.request<T>>[0],
payload: Parameters<typeof API.request<T>>[0]
) => {
const token = getStore("AUTH_TOKEN");
if (!token) {
Expand Down Expand Up @@ -189,7 +189,7 @@ export const getApplicationRatings = (applicationId: number) =>
export const submitAnswer = (
applicationId: number,
questionId: number,
description: string,
description: string
) =>
authenticatedRequest({
method: "POST",
Expand All @@ -205,7 +205,7 @@ export const submitAnswer = (
export const createCampaign = (
campaign: NewCampaignInput,
roles: RoleInput[],
questions: QuestionInput[],
questions: QuestionInput[]
) =>
authenticatedRequest<Campaign>({
method: "POST",
Expand All @@ -230,7 +230,7 @@ export const deleteCampaign = (id: number) =>

export const setApplicationStatus = (
applicationId: number,
status: ApplicationStatus,
status: ApplicationStatus
) =>
authenticatedRequest({
method: "PUT",
Expand All @@ -242,7 +242,7 @@ export const setApplicationStatus = (
export const inviteUserToOrg = (
email: string,
organisationId: number,
adminLevel: AdminLevel = "ReadOnly",
adminLevel: AdminLevel = "ReadOnly"
) =>
authenticatedRequest({
method: "POST",
Expand Down
8 changes: 4 additions & 4 deletions frontend/src/components/AdminSideBar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,25 +84,25 @@ const AdminSidebar = ({
pushToast(
"Organisation Creation Successful",
"Organisation successfully created",
"success",
"success"
);
} else if (!inputText) {
pushToast(
"Organisation Creation Error",
"Organisation name is required!",
"error",
"error"
);
} else if (!uploadedImage.image) {
pushToast(
"Organisation Creation Error",
"Organisation logo image is required!",
"error",
"error"
);
} else {
pushToast(
"Organisation Creation Error",
"Organisation unknown error occurred!",
"error",
"error"
);
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export const Section = styled("div")<{ isHidden?: boolean }>(
marginTop: "0px",
marginBottom: "50px",
display: isHidden ? "none" : "",
}),
})
);

export const SectionHeader = styled("h1")`
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/components/ApplicationForm/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ const ApplicationForm = ({
// (currently gets printed under each rolename and all are overwritten)
const handleAnswerInput = (
e: ChangeEvent<HTMLInputElement | HTMLTextAreaElement>,
qID: number,
qID: number
) => {
setAnswers({ ...answers, ...{ [qID]: e.target.value } });
};
Expand Down Expand Up @@ -160,7 +160,7 @@ const ApplicationForm = ({
onChange={(e) => handleAnswerInput(e, q.id)}
/>
</>
),
)
)}
</Section>
))}
Expand Down
8 changes: 4 additions & 4 deletions frontend/src/components/CampaignCard/Content.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -102,13 +102,13 @@ const Content = ({
pushToast(
"Update Campaign Cover Image",
`Internal Error: ${data}`,
"error",
"error"
);
} catch {
pushToast(
"Update Campaign Cover Image",
"Internal Error: Response Invalid",
"error",
"error"
);
}

Expand All @@ -119,7 +119,7 @@ const Content = ({
pushToast(
"Update Campaign Cover Image",
"Something went wrong on the backend!",
"error",
"error"
);

return;
Expand All @@ -134,7 +134,7 @@ const Content = ({
pushToast(
"Update Campaign Cover Image",
"Uploaded image succesfully",
"success",
"success"
);
};

Expand Down
4 changes: 2 additions & 2 deletions frontend/src/components/CampaignCard/Popup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@ type Props = {
};
const Popup = ({ appliedFor, positions, open, closeModal }: Props) => {
const positionsMap = Object.fromEntries(
positions.map(({ id, ...position }) => [id, position]),
positions.map(({ id, ...position }) => [id, position])
);
const positionStatuses = Object.fromEntries(
appliedFor.map(([id, status]) => [
id,
{ position: positionsMap[id].name, status },
]),
])
);

return (
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/contexts/MessagePopupContext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ export type Message = {

// eslint-disable-next-line @typescript-eslint/no-empty-function
export const MessagePopupContext = createContext(
(_message: Omit<Message, "id">) => {},
(_message: Omit<Message, "id">) => {}
);
10 changes: 5 additions & 5 deletions frontend/src/hooks/useFetch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ type Controllers = { [url: string]: AbortController };
const getController = (
url: string,
controllers: Controllers,
abortBehaviour: AbortBehaviour,
abortBehaviour: AbortBehaviour
) => {
let controllerName;
switch (abortBehaviour) {
Expand Down Expand Up @@ -72,7 +72,7 @@ const useFetch = <T = void>(url: string, options?: Options<T>) => {
const controller = getController(
url,
controllers.current,
abortBehaviour,
abortBehaviour
);

let data;
Expand Down Expand Up @@ -152,7 +152,7 @@ const useFetch = <T = void>(url: string, options?: Options<T>) => {
aborted: false,
} as FetchReturn<T>;
},
[],
[]
);

useEffect(() => {
Expand All @@ -168,10 +168,10 @@ const useFetch = <T = void>(url: string, options?: Options<T>) => {
(method: string) =>
(
url: string,
options?: Omit<Options<T>, "jsonResp" | "abortBehaviour" | "deps">,
options?: Omit<Options<T>, "jsonResp" | "abortBehaviour" | "deps">
) =>
doFetch(url, { ...outerOptions, ...options, method } as Options<T>),
[url, options?.body],
[url, options?.body]
);

return {
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ globalStyles();
ReactDOM.createRoot(document.getElementById("root")).render(
<StrictMode>
<App />
</StrictMode>,
</StrictMode>
);
14 changes: 7 additions & 7 deletions frontend/src/pages/admin/AdminContent/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -105,14 +105,14 @@ const AdminContent = ({
// FIXME: when array is empty we die???
setOrgList(orgList.filter((_, index) => index !== orgSelected));
setOrgSelected(
orgSelected === orgList.length - 1 ? orgList.length - 2 : orgSelected,
orgSelected === orgList.length - 1 ? orgList.length - 2 : orgSelected
);
setShowDeleteDialog(false);
};

const handleWindowChange = (
_: MouseEvent<HTMLElement>,
newWindow: string,
newWindow: string
) => {
if (newWindow) {
setWindowSelected(newWindow);
Expand All @@ -124,7 +124,7 @@ const AdminContent = ({
pushToast(
"Update Organisation Logo",
"No organisation logo given",
"error",
"error"
);
return;
}
Expand All @@ -140,13 +140,13 @@ const AdminContent = ({
pushToast(
"Update Organisation Logo",
`Internal Error: ${data}`,
"error",
"error"
);
} catch {
pushToast(
"Update Organisation Logo",
"Internal Error: Response Invalid",
"error",
"error"
);
}

Expand All @@ -157,7 +157,7 @@ const AdminContent = ({
pushToast(
"Update Organisation Logo",
"Something went wrong on the backend!",
"error",
"error"
);

return;
Expand All @@ -170,7 +170,7 @@ const AdminContent = ({
pushToast(
"Update Organisation Logo",
"Image uploaded successfully",
"success",
"success"
);
};

Expand Down
14 changes: 7 additions & 7 deletions frontend/src/pages/admin/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@ const Admin = () => {
orgList,
setOrgList,
}),
[orgSelected, setOrgSelected, orgList, setOrgList],
[orgSelected, setOrgSelected, orgList, setOrgList]
);
const isFormOpenContextValue = useMemo(
() => ({ isFormOpen, setIsFormOpen }),
[isFormOpen, setIsFormOpen],
[isFormOpen, setIsFormOpen]
);

useEffect(() => {
Expand All @@ -60,7 +60,7 @@ const Admin = () => {
orgName: item.name,
campaigns: item.campaigns,
members: item.members,
})),
}))
);
if (organisations.length > 0) {
setOrgSelected(0);
Expand All @@ -74,15 +74,15 @@ const Admin = () => {
title: item.name,
startDate: item.starts_at,
endDate: item.ends_at,
})),
}))
);

setMembers(
org.members.map((item) => ({
id: item.id,
name: item.display_name,
role: item.role,
})),
}))
);
}

Expand All @@ -101,14 +101,14 @@ const Admin = () => {
title: item.name,
startDate: item.starts_at,
endDate: item.ends_at,
})) ?? [],
})) ?? []
);
setMembers(
orgList[orgSelected]?.members.map((item) => ({
id: item.id,
name: item.display_name,
role: item.role,
})) ?? [],
})) ?? []
);
}, [orgSelected, orgList]);

Expand Down
Loading

0 comments on commit f38688c

Please sign in to comment.