@@ -47,6 +47,7 @@ interface UserManagementTableProps {
4747 updateUserSubscriptions : ( userId : number , subjectIds : number [ ] ) => void ;
4848 absenceCap : number ;
4949 allSubjects ?: SubjectAPI [ ] ;
50+ isLoading ?: boolean ;
5051 selectedYearRange : string ;
5152}
5253
@@ -56,6 +57,7 @@ export const UserManagementTable: React.FC<UserManagementTableProps> = ({
5657 updateUserSubscriptions,
5758 absenceCap,
5859 allSubjects : propSubjects ,
60+ isLoading = false ,
5961 selectedYearRange,
6062} ) => {
6163 const [ sortField , setSortField ] = useState < SortField > ( 'name' ) ;
@@ -247,6 +249,7 @@ export const UserManagementTable: React.FC<UserManagementTableProps> = ({
247249 transition = "width 0.3s ease"
248250 width = { searchTerm ? '270px' : '0px' }
249251 margin = { 0 }
252+ isDisabled = { isLoading }
250253 />
251254 </ InputGroup >
252255
@@ -255,6 +258,7 @@ export const UserManagementTable: React.FC<UserManagementTableProps> = ({
255258 setFilters = { setFilters }
256259 availableTags = { availableTags }
257260 tagColors = { tagColors }
261+ isDisabled = { isLoading }
258262 />
259263 </ HStack >
260264 </ HStack >
@@ -265,16 +269,16 @@ export const UserManagementTable: React.FC<UserManagementTableProps> = ({
265269 < Thead
266270 position = "sticky"
267271 top = { 0 }
268- zIndex = { 2000 } // Make sure it's above the popover for editing email subscriptions
272+ zIndex = { 1000 } // Make sure it's above the popover for editing email subscriptions
269273 bg = "white"
270274 boxShadow = "0 1px 1px rgba(227, 227, 227, 1)"
271275 >
272- < Tr borderColor = { 'red' } >
276+ < Tr >
273277 < SortableHeader field = "name" label = "Name" icon = { FiUser } />
274278 < SortableHeader field = "email" label = "Email" icon = { FiMail } />
275279 < SortableHeader
276280 field = "absences"
277- label = "Absent "
281+ label = "Abs. "
278282 icon = { FiClock }
279283 centered
280284 />
@@ -296,8 +300,9 @@ export const UserManagementTable: React.FC<UserManagementTableProps> = ({
296300 </ Thead >
297301
298302 < Tbody >
299- { sortedUsers . length > 0
300- ? sortedUsers . map ( ( user , index ) => (
303+ { isLoading
304+ ? null
305+ : sortedUsers . map ( ( user , index ) => (
301306 < Tr
302307 key = { index }
303308 sx = { {
@@ -310,8 +315,13 @@ export const UserManagementTable: React.FC<UserManagementTableProps> = ({
310315 size = "sm"
311316 name = { `${ user . firstName } ${ user . lastName } ` }
312317 src = { user . profilePicture || undefined }
318+ loading = "eager"
319+ ignoreFallback
313320 />
314- < Text textStyle = "cellBold" > { `${ user . firstName } ${ user . lastName } ` } </ Text >
321+
322+ < Text textStyle = "cellBold" whiteSpace = "nowrap" >
323+ { `${ user . firstName } ${ user . lastName } ` }
324+ </ Text >
315325 </ HStack >
316326 </ Td >
317327 < Td color = "gray.600" >
@@ -321,11 +331,11 @@ export const UserManagementTable: React.FC<UserManagementTableProps> = ({
321331 < Text
322332 textStyle = "cellBold"
323333 color = { getAbsenceColor (
324- user . absences ?. length || 0 ,
334+ getSelectedYearAbsences ( user . absences ) ,
325335 absenceCap
326336 ) }
327337 >
328- { user . absences ?. length || 0 }
338+ { getSelectedYearAbsences ( user . absences ) } { ' ' }
329339 </ Text >
330340 </ Td >
331341 < Td py = "6px" >
@@ -347,8 +357,7 @@ export const UserManagementTable: React.FC<UserManagementTableProps> = ({
347357 />
348358 </ Td >
349359 </ Tr >
350- ) )
351- : null }
360+ ) ) }
352361 </ Tbody >
353362 </ Table >
354363 </ Box >
0 commit comments