Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
645f711
Created recruitment application form
LavanSumanan Nov 6, 2021
53ff3c1
Started moving CMS components over
williamhpark Nov 7, 2021
3d794de
Converted TextInput from js to tsx and added it to recruitment form
LavanSumanan Nov 7, 2021
37af4a6
Updated radio button
LavanSumanan Nov 11, 2021
deb4bb9
Created FileUpload component
LavanSumanan Nov 20, 2021
3952dcd
Transferred code from the Recruitment form page to component
williamhpark Nov 25, 2021
a5dd8f2
Fixed styling for components in the recruitment form
LavanSumanan Nov 27, 2021
508c2db
Implemented majority of recruitment form hook functionality
williamhpark Nov 29, 2021
7887b09
Resolved merge conflicts with previous commit
williamhpark Nov 29, 2021
4470f59
Created recruitment application form
LavanSumanan Nov 6, 2021
89975e0
Started moving CMS components over
williamhpark Nov 7, 2021
cd99fcb
Converted TextInput from js to tsx and added it to recruitment form
LavanSumanan Nov 7, 2021
61de347
Updated radio button
LavanSumanan Nov 11, 2021
ef43350
Created FileUpload component
LavanSumanan Nov 20, 2021
0df6239
Transferred code from the Recruitment form page to component
williamhpark Nov 25, 2021
1da8103
Implemented majority of recruitment form hook functionality
williamhpark Nov 29, 2021
9a45b32
Fixed styling for components in the recruitment form
LavanSumanan Nov 27, 2021
9641ff7
Fix rebase issues
LavanSumanan Jun 24, 2022
750fff0
Merge branch 'CU-rt3ce6_Implement-Frontend-For-Form_Lavan-Aidan-Suman…
LavanSumanan Jun 24, 2022
9ae2fb4
Created recruitment application form
LavanSumanan Nov 6, 2021
04cd651
Started moving CMS components over
williamhpark Nov 7, 2021
4033c86
Converted TextInput from js to tsx and added it to recruitment form
LavanSumanan Nov 7, 2021
c9a5bb5
Updated radio button
LavanSumanan Nov 11, 2021
ab714c2
Created FileUpload component
LavanSumanan Nov 20, 2021
7c13976
Transferred code from the Recruitment form page to component
williamhpark Nov 25, 2021
9890e66
Implemented majority of recruitment form hook functionality
williamhpark Nov 29, 2021
50443f5
Fixed styling for components in the recruitment form
LavanSumanan Nov 27, 2021
b2ccfdf
Fix rebase issues
LavanSumanan Jun 24, 2022
ef71550
Created recruitment application form
LavanSumanan Nov 6, 2021
a2b45d2
Started moving CMS components over
williamhpark Nov 7, 2021
e308361
Converted TextInput from js to tsx and added it to recruitment form
LavanSumanan Nov 7, 2021
47bf317
Updated radio button
LavanSumanan Nov 11, 2021
2185640
Created FileUpload component
LavanSumanan Nov 20, 2021
26ffda1
Transferred code from the Recruitment form page to component
williamhpark Nov 25, 2021
4ac46d7
Implemented majority of recruitment form hook functionality
williamhpark Nov 29, 2021
352691a
Fixed styling for components in the recruitment form
LavanSumanan Nov 27, 2021
3165a63
rebased off master
sashco-m Nov 5, 2022
61bdeca
merge
sashco-m Nov 27, 2022
27fc185
missed
sashco-m Nov 27, 2022
b9ec218
remove old componenets
sashco-m Nov 27, 2022
87ec602
passing job info to application page working
sashco-m Nov 28, 2022
b008ff7
fix file upload on FE
sashco-m Dec 6, 2022
cc37bf3
make dropdownlist show selected value
sashco-m Dec 6, 2022
edf17fd
fix broken dropdown lists
sashco-m Dec 6, 2022
8b8726b
added server object, make api call TODO
sashco-m Dec 6, 2022
f94d9b3
uploaded file added to state
sashco-m Dec 7, 2022
4cb0135
resume upload working, TODO fix verification failing on application c…
sashco-m Dec 7, 2022
de85eed
application working
sashco-m Dec 9, 2022
d15ba7a
fix recruitment form styling
sashco-m Jan 27, 2023
7214b96
remove commented code
sashco-m Jan 27, 2023
48afd9f
Add loading spinner on submit
sashco-m Jan 27, 2023
9779892
remove console logs
sashco-m Feb 2, 2023
4be2edc
remove comment
sashco-m Feb 2, 2023
d8c0724
merge conflict with master
sashco-m Feb 2, 2023
f9002dd
remove unused import
sashco-m Feb 2, 2023
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
16 changes: 16 additions & 0 deletions src/@types/recruitment-form.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
declare module 'recruitment-form' {
export interface RecruitmentForm {
postingId: number;
firstName: string;
lastName: string;
emailAddress: string;
term: string;
termType: string;
program: string;
inPerson: boolean;
whyJoin: string;
technicalQ: string;
additionalInfo: string;
resumeLink: string;
}
}
21 changes: 21 additions & 0 deletions src/api/application.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { Server } from "./server"
import { AxiosResponse } from 'axios';

const upload = (server:Server) =>
(formData:FormData):Promise<AxiosResponse<string>> =>
server.post('/api/upload/resume',
formData, {
headers: {
'Content-Type':'multipart/form-data'
}
}
)

const apply = (server: Server) =>
(body: Object):Promise<AxiosResponse<string>> =>
server.post('/api/applications', body)

export default (server:Server) => ({
upload: upload(server),
apply: apply(server)
})
6 changes: 4 additions & 2 deletions src/api/index.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import newsletter from './newsletter';
import postings from './postings';
import server from './server';
import server, { serverDashboard } from './server';
import sponsors from './sponsors';
import teams from './teams';
import application from './application'

export default {
postings: postings(server),
teams: teams(server),
sponsors: sponsors(server),
newsletter: newsletter(server)
newsletter: newsletter(server),
application: application(serverDashboard)
};
1 change: 0 additions & 1 deletion src/api/postings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { Server } from 'server';

const getPostings = (server: Server) => (joinTeamName: boolean = false): Promise<AxiosResponse<PostingShort[]>> | Promise<AxiosResponse<PostingShortWithTeamName[]>> => server.get(`/api/postings${joinTeamName ? '?joinTeamName=true' : ''}`);
const getPostingById = (server: Server) => (id: number, joinTeamName: boolean = false): Promise<AxiosResponse<PostingLong>> => server.get(`/api/postings/${id}${joinTeamName ? '?joinTeamName=true' : ''}`).then((res: AxiosResponse<PostingLong>) => {
console.log(res);
return res;
});

Expand Down
10 changes: 10 additions & 0 deletions src/api/recruitment-form.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { Server } from 'server';
import { AxiosResponse } from 'axios';
import { RecruitmentForm } from 'recruitment-form';

const getRecruitmentForm = (server: Server) => (): Promise<AxiosResponse<RecruitmentForm>> => server.get(`/api/recruitment`);


export default (server: Server) => ({
getRecruitmentForm: getRecruitmentForm(server),
});
10 changes: 9 additions & 1 deletion src/api/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ const devHostName = window.location.hostname; // Retrieves the current device's

const baseUrl = process.env.NODE_ENV === 'development' ? `http://${devHostName}:9000` : process.env.REACT_APP_BASE_URL

const baseUrlDashboard = process.env.NODE_ENV === 'production' ? '' : 'http://localhost:9001'

export const server = axios.create({
baseURL: baseUrl,
timeout: 10000,
Expand All @@ -15,5 +17,11 @@ export const server = axios.create({
},
});

export default server;
export const serverDashboard = axios.create({
baseURL: baseUrlDashboard,
timeout:10000,
withCredentials:false,
})

export default server
export type Server = typeof server;
137 changes: 137 additions & 0 deletions src/components/DropDownList/DropDownList.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
import React, { useMemo, useState, useCallback, FC } from 'react';
import styled, { css } from 'styled-components';

import ListOpenSvg from './assets/list-open.svg';
import ListClosedSvg from './assets/list-closed.svg';
import UnstyledListItem from './ListItem';

interface DropDownListProps {
className?: string;
items: string[];
title: string;
handleClickItem: (value: string) => void;
value: string;
valid: boolean | null;
required: boolean;
}

const ListItem = styled(UnstyledListItem)``;

const ListOpenIcon = styled.img.attrs({
src: ListOpenSvg,
})``;

const ListClosedIcon = styled.img.attrs({
src: ListClosedSvg,
})``;

const Container = styled(({ valid, required, ...props }) => <div {...props} />)`
overflow: visible;
z-index: 10;
${'' /** Hides the top of the list under the List name container */}
background-color: #fff;
width: 100%;
border: 1px solid #c4c4c4;
border-radius: 5px;
border: 1px solid
${({ valid, required }): string =>
valid === false && required === true ? 'red' : '#c4c4c4'};
`;

const ListNameContainer = styled.div`
border-radius: 10px;
background-color: #fff;

display: flex;
align-items: center;
justify-content: space-between;
padding: 16px;

cursor: pointer;
`;

const TitleText = styled.div`
font: 14px IBM Plex Sans;
color: #00000080;
`;

// Good practice to not pass props like "open" to a root element
const List = styled(({ open, ...props }) => <ul {...props} />)`
border-radius: 5px;

margin-top: -20px;
padding-top: 8px;
position: relative;
width: calc(100% - 10px);
margin-left: 6px;
padding-inline-start: 0;

${
'' /* Cannot Use Transitions with "height: auto", so this calculates the height of the list based on the number of children */
}
${'' /* ${({ open, children }) => (open ? css` */}
${({ open }) =>
open
? css`
${
'' /* height: calc(37px * ${Children.toArray(children).length} ); */
}
${
'' /* This does not transition, but the above does not work well with text wrapping */
}
${'' /* TODO: This needs to get relooked at when I have more time */}
height: max-content;
`
: css`
height: 0px;
`}
overflow-y: hidden;

transition: height 0.15s;
`;

const DropDownList: FC<DropDownListProps> = ({
className /* Allows for external styles to be applied to the component using
the styled components library
className prop needs to be passed to the parent JSX element */,
items /* an Array of items to be displayed in the selector dropdown */,
title /* Name of the drop down list */,
handleClickItem,
value,
valid,
}) => {
const [open, setOpen] = useState(false);
const [selected, setSelected] = useState('')

const handleOpenToggle = useCallback(() => {
setOpen(!open);
}, [open, setOpen]);

const handleClickItem2 = useCallback(
(value: string) => {
setSelected(value)
handleClickItem(value);
setOpen(!open);
},
[handleClickItem, open, setOpen],
);

const ListStateIcon = useMemo(() => (open ? ListOpenIcon : ListClosedIcon), [
open,
]);
const listItems = items.map((item) => (
<ListItem text={item} key={item} onClick={handleClickItem2} />
));

return (
<Container>
<ListNameContainer onClick={handleOpenToggle} className={className}>
<TitleText>{selected!== '' ? selected : title}</TitleText>
<ListStateIcon />
</ListNameContainer>
<List open={open}>{listItems}</List>
</Container>
);
};

export default DropDownList;
34 changes: 34 additions & 0 deletions src/components/DropDownList/ListItem.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import React, { FC } from 'react';
import styled from 'styled-components';

interface ListItemProps {
className?: string;
text: string;
onClick: (value: string) => void;
}

const Container = styled.li`
list-style: none;
border-top: 0.75px solid rgba(214, 220, 227, 0.5);
padding-left: 16px;
padding-right: 16px;
display: flex;
justify-content: space-between;
padding-top: 8px;
padding-bottom: 8px;

cursor: pointer;
`;

const Text = styled.div`
font: 14px IBM Plex Sans;
color: #000;
`;

const ListItem: FC<ListItemProps> = ({ className, text, onClick }) => (
<Container className={className} onClick={() => onClick(text)}>
<Text>{text}</Text>
</Container>
);

export default ListItem;
3 changes: 3 additions & 0 deletions src/components/DropDownList/assets/list-closed.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions src/components/DropDownList/assets/list-open.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions src/components/DropDownList/assets/remove.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions src/components/DropDownList/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import DropDownList from './DropDownList'

export default DropDownList
95 changes: 95 additions & 0 deletions src/components/FileUpload/FileUpload.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
import React, { useState } from 'react';
import styled from 'styled-components';

const FileUpload = ({
name,
multiple,
handleFileUpload,
}: {
name: string;
multiple: boolean;
handleFileUpload: (value:File) => void;
}) => {
const FileInput = styled.input`
opacity: 0;
position: absolute;
z-index: -1;
`;

const Label = styled.label`
display: grid;
padding: 20px 10px;
cursor: pointer;
font-family: IBM Plex Sans;
font-style: normal;
font-size: 24px;
line-height: 140%;
text-align: center;
color: rgba(0, 0, 0, 0.5);
width: 100%;
border: 1.2px dashed #c4c4c4;
box-sizing: border-box;
border-radius: 6px;
background: #ffffff;
`;
let [fileName, setFileName] = useState("")

return (
<div>
<Label htmlFor="file">
<span>
<svg
width="24"
height="33"
viewBox="0 0 24 33"
fill="none"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M9.08325 32.75H14.9166V15.25H23.6666L11.9999 0.666687L0.333252 15.25H9.08325V32.75Z"
fill="black"
fillOpacity="0.4"
/>
</svg>
</span>
<span>
<svg
width="60"
height="27"
viewBox="0 0 60 27"
fill="none"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M53.3333 20.5H6.66659V0.083313H0.833252V20.5C0.833252 23.7171 3.4495 26.3333 6.66659 26.3333H53.3333C56.5503 26.3333 59.1666 23.7171 59.1666 20.5V0.083313H53.3333V20.5Z"
fill="black"
fillOpacity="0.4"
/>
</svg>
</span>
<p style={{ margin: 0 }}>
<strong>Choose a file</strong> or drag it here.
</p>
</Label>
<FileInput
id="file"
type="file"
name={name}
accept={'application/pdf'}
onChange={(e) => {
if(e.target.files != null){
// update file in state
handleFileUpload(e.target.files[0])
setFileName(e.target.files[0].name)
}
}
}

multiple={multiple}
/>
{fileName && <p>{fileName}</p>}
</div>
);
};

export default FileUpload;
3 changes: 3 additions & 0 deletions src/components/FileUpload/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import FileUpload from "./FileUpload";

export default FileUpload;
Loading