1- import { Box , Typography , Button } from '@mui/material'
1+ import { Box , Typography , Button , useTheme , useMediaQuery } from '@mui/material'
22import ResumeCard from './ResumeCard'
33import { Link , useNavigate } from 'react-router-dom'
44import { useSelector , useDispatch } from 'react-redux'
@@ -9,6 +9,7 @@ import useDraftResume from '../hooks/useDraftResume'
99import { logout } from '../tools/auth'
1010import AuthErrorDisplay from './common/AuthErrorDisplay'
1111import { clearAuth } from '../redux/slices/auth'
12+
1213const buttonStyles = {
1314 background : '#3A35A2' ,
1415 padding : '10px 31px' ,
@@ -27,6 +28,9 @@ const buttonStyles = {
2728const ResumeScreen : React . FC = ( ) => {
2829 const dispatch = useDispatch < AppDispatch > ( )
2930 const navigate = useNavigate ( )
31+ const theme = useTheme ( )
32+ const isMobile = useMediaQuery ( theme . breakpoints . down ( 'md' ) )
33+
3034 const { signed, unsigned, status, error } = useSelector (
3135 ( state : RootState ) => state . myresumes
3236 )
@@ -56,9 +60,11 @@ const ResumeScreen: React.FC = () => {
5660 setFriendlyError ( null )
5761 } else if ( status === 'failed' ) {
5862 // Handle specific error messages from fetchUserResumes
59- if ( error ?. includes ( 'No authentication token found' ) ||
60- error ?. includes ( 'Authentication expired' ) ||
61- error ?. includes ( 'Session expired' ) ) {
63+ if (
64+ error ?. includes ( 'No authentication token found' ) ||
65+ error ?. includes ( 'Authentication expired' ) ||
66+ error ?. includes ( 'Session expired' )
67+ ) {
6268 setFriendlyError ( error )
6369 if ( isAuthenticated ) {
6470 handleLogout ( )
@@ -78,9 +84,7 @@ const ResumeScreen: React.FC = () => {
7884 setFriendlyError ( 'Please log in to view your resumes.' )
7985 } else {
8086 // For any other errors, show the error message if available
81- setFriendlyError (
82- error || 'An error occurred while loading your resumes.'
83- )
87+ setFriendlyError ( error || 'An error occurred while loading your resumes.' )
8488 }
8589 } else if ( status === 'succeeded' ) {
8690 setFriendlyError ( null )
@@ -104,36 +108,64 @@ const ResumeScreen: React.FC = () => {
104108 < Box
105109 sx = { {
106110 mx : 'auto' ,
107- p : 3 ,
111+ p : { xs : 0 , md : 3 } ,
108112 display : 'flex' ,
109113 flexDirection : 'column' ,
110- marginInline : 3 ,
114+ marginInline : { xs : 1 , md : 3 } ,
111115 gap : 2
112116 } }
113117 >
114118 < Box
115119 sx = { {
116120 display : 'flex' ,
121+ flexDirection : { xs : 'column' , md : 'row' } ,
117122 justifyContent : 'space-between' ,
118- alignItems : 'center' ,
119- mb : 4 ,
120- mt : 2
123+ alignItems : { xs : 'flex-start' , md : 'center' } ,
124+ mb : { xs : 2 , md : 4 } ,
125+ mt : 2 ,
126+ gap : { xs : 2 , md : 0 }
121127 } }
122128 >
123- < Typography variant = 'h4' sx = { { color : '#2E2E48' , fontWeight : 700 } } >
129+ < Typography
130+ variant = 'h4'
131+ sx = { {
132+ color : '#2E2E48' ,
133+ fontWeight : 700 ,
134+ fontSize : { xs : '24px' , sm : '28px' , md : '32px' }
135+ } }
136+ >
124137 My Resumes
125138 </ Typography >
126- < Box sx = { { display : 'flex' , gap : 2 } } >
139+ < Box
140+ sx = { {
141+ display : 'flex' ,
142+ gap : { xs : 1 , md : 2 } ,
143+ flexDirection : { xs : 'column' , sm : 'row' } ,
144+ width : { xs : '100%' , sm : 'auto' }
145+ } }
146+ >
127147 { isAuthenticated && (
128148 < >
129- < Link style = { buttonStyles } to = '/resume/new' >
149+ < Link
150+ style = { {
151+ ...buttonStyles ,
152+ padding : isMobile ? '8px 20px' : '10px 31px' ,
153+ fontSize : isMobile ? '14px' : '16px' ,
154+ textAlign : 'center' ,
155+ display : 'block'
156+ } }
157+ to = '/resume/new'
158+ >
130159 Create new resume
131160 </ Link >
132161 < Button
133162 onClick = { handleLogout }
134163 sx = { {
135164 ...buttonStyles ,
136165 textTransform : 'capitalize' ,
166+ padding : isMobile ? '8px 20px' : '10px 31px' ,
167+ fontSize : isMobile ? '14px' : '16px' ,
168+ width : { xs : '100%' , sm : 'auto' } ,
137169 '&:hover' : {
138170 background : '#322e8e' ,
139171 border : '3px solid #322e8e'
@@ -159,7 +191,15 @@ const ResumeScreen: React.FC = () => {
159191 ( status === 'succeeded' || status === 'idle' ) &&
160192 signed . length > 0 && (
161193 < >
162- < Typography variant = 'h6' sx = { { color : '#2E2E48' , fontWeight : 600 , mt : 2 } } >
194+ < Typography
195+ variant = 'h6'
196+ sx = { {
197+ color : '#2E2E48' ,
198+ fontWeight : 600 ,
199+ mt : 2 ,
200+ fontSize : { xs : '18px' , md : '20px' }
201+ } }
202+ >
163203 Signed Resumes
164204 </ Typography >
165205 { signed . map ( resume => (
@@ -180,7 +220,15 @@ const ResumeScreen: React.FC = () => {
180220 ( status === 'succeeded' || status === 'idle' ) &&
181221 draftResumes . length > 0 && (
182222 < >
183- < Typography variant = 'h6' sx = { { color : '#2E2E48' , fontWeight : 600 , mt : 2 } } >
223+ < Typography
224+ variant = 'h6'
225+ sx = { {
226+ color : '#2E2E48' ,
227+ fontWeight : 600 ,
228+ mt : 2 ,
229+ fontSize : { xs : '18px' , md : '20px' }
230+ } }
231+ >
184232 Draft Resumes
185233 </ Typography >
186234 { draftResumes . map ( resume => (
0 commit comments