-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ac77e3b
commit 9581468
Showing
7 changed files
with
211 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import { GifSafeImage, Typography } from '@/components/common'; | ||
import { config } from '@/lib'; | ||
import { PublicResume } from '@/lib/types/apiResponses'; | ||
import { getProfilePicture } from '@/lib/utils'; | ||
import Link from 'next/link'; | ||
import { BsDownload } from 'react-icons/bs'; | ||
import styles from './style.module.scss'; | ||
|
||
interface ResumeProps { | ||
resume: PublicResume; | ||
} | ||
|
||
const Resume = ({ resume }: ResumeProps) => { | ||
const fileName = decodeURIComponent(resume.url.split('/').at(-1) ?? 'resume.pdf'); | ||
|
||
return ( | ||
<div className={styles.wrapper}> | ||
{resume.user ? ( | ||
<Link href={`${config.userProfileRoute}${resume.user.handle}`} className={styles.user}> | ||
<GifSafeImage | ||
src={getProfilePicture(resume.user)} | ||
width={48} | ||
height={48} | ||
alt={`Profile picture for ${resume.user.firstName} ${resume.user.lastName}`} | ||
className={styles.image} | ||
/> | ||
<Typography variant="label/large" className={styles.name}> | ||
{resume.user.firstName} {resume.user.lastName} | ||
</Typography> | ||
<p className={styles.info}> | ||
{resume.user.graduationYear} {resume.user.major} | ||
</p> | ||
</Link> | ||
) : null} | ||
<Link href={resume.url} className={styles.resume}> | ||
<BsDownload className={styles.image} /> | ||
<p className={styles.name}>{fileName}</p> | ||
<p className={styles.info}> | ||
Uploaded {new Date(resume.lastUpdated).toLocaleDateString('en-US', { dateStyle: 'full' })} | ||
</p> | ||
</Link> | ||
</div> | ||
); | ||
}; | ||
|
||
export default Resume; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
@use 'src/styles/vars.scss' as vars; | ||
|
||
.wrapper { | ||
background-color: var(--theme-elevated-background); | ||
border: 1px solid var(--theme-elevated-stroke); | ||
border-radius: 0.5rem; | ||
display: flex; | ||
gap: 1rem; | ||
padding: 1rem; | ||
word-break: break-word; | ||
|
||
@media (max-width: vars.$breakpoint-md) { | ||
flex-direction: column; | ||
gap: 2rem; | ||
} | ||
|
||
.user, | ||
.resume { | ||
align-items: center; | ||
display: grid; | ||
gap: 0.5rem 1rem; | ||
grid-template-areas: | ||
'image name' | ||
'image info'; | ||
grid-template-columns: auto 1fr; | ||
|
||
.image { | ||
grid-area: image; | ||
} | ||
|
||
.name { | ||
grid-area: name; | ||
} | ||
|
||
&:hover .name { | ||
text-decoration: underline; | ||
} | ||
|
||
.info { | ||
grid-area: info; | ||
} | ||
} | ||
|
||
.user { | ||
flex: 1 0 0; | ||
|
||
.image { | ||
border-radius: 5rem; | ||
object-fit: contain; | ||
} | ||
} | ||
|
||
.resume { | ||
flex: 1.5 0 0; | ||
|
||
.image { | ||
height: 1.5rem; | ||
width: 1.5rem; | ||
|
||
@media (max-width: vars.$breakpoint-md) { | ||
width: 3rem; | ||
} | ||
} | ||
|
||
.name { | ||
color: var(--theme-blue-text-button); | ||
} | ||
|
||
.info { | ||
color: var(--theme-text-on-background-2); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
export type Styles = { | ||
image: string; | ||
info: string; | ||
name: string; | ||
resume: string; | ||
user: string; | ||
wrapper: string; | ||
}; | ||
|
||
export type ClassNames = keyof Styles; | ||
|
||
declare const styles: Styles; | ||
|
||
export default styles; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import Resume from '@/components/admin/Resume'; | ||
import { Typography } from '@/components/common'; | ||
import { config } from '@/lib'; | ||
import { ResumeAPI } from '@/lib/api'; | ||
import withAccessType, { GetServerSidePropsWithAuth } from '@/lib/hoc/withAccessType'; | ||
import { PermissionService } from '@/lib/services'; | ||
import type { PublicResume } from '@/lib/types/apiResponses'; | ||
import styles from '@/styles/pages/resumes.module.scss'; | ||
|
||
interface AdminResumePageProps { | ||
resumes: PublicResume[]; | ||
} | ||
|
||
const AdminResumePage = ({ resumes }: AdminResumePageProps) => { | ||
return ( | ||
<div className={styles.page}> | ||
<Typography variant="title/large" component="h1"> | ||
Resumes | ||
</Typography> | ||
{resumes.map(resume => ( | ||
<Resume key={resume.uuid} resume={resume} /> | ||
))} | ||
</div> | ||
); | ||
}; | ||
|
||
export default AdminResumePage; | ||
|
||
const getServerSidePropsFunc: GetServerSidePropsWithAuth<AdminResumePageProps> = async ({ | ||
authToken, | ||
}) => { | ||
const resumes = await ResumeAPI.getResumes(authToken); | ||
return { props: { title: 'View Resumes', resumes } }; | ||
}; | ||
|
||
export const getServerSideProps = withAccessType( | ||
getServerSidePropsFunc, | ||
PermissionService.canViewResumes, | ||
{ redirectTo: config.homeRoute } | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
.page { | ||
display: flex; | ||
flex-direction: column; | ||
gap: 1rem; | ||
margin: 0 auto; | ||
max-width: 60rem; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
export type Styles = { | ||
page: string; | ||
}; | ||
|
||
export type ClassNames = keyof Styles; | ||
|
||
declare const styles: Styles; | ||
|
||
export default styles; |