1- import React from ' react' ;
1+ import React from " react" ;
22import {
33 Box ,
44 Card ,
@@ -7,12 +7,12 @@ import {
77 Grid ,
88 CircularProgress ,
99 Container ,
10- } from '@mui/material' ;
11- import ArrowForwardIosIcon from '@mui/icons-material/ArrowForwardIos' ;
12- import { useNavigate } from 'react-router-dom' ;
10+ } from "@mui/material" ;
11+ import { useNavigate } from "react-router-dom" ;
1312import useFetchRecentPackages , {
1413 RecentPackage ,
15- } from '../hooks/useFetchRecentPackages' ;
14+ } from "../hooks/useFetchRecentPackages" ;
15+ import "./PackageDashboard.css" ;
1616
1717const PackageDashboard : React . FC = ( ) => {
1818 const navigate = useNavigate ( ) ;
@@ -21,69 +21,68 @@ const PackageDashboard: React.FC = () => {
2121 if ( loading ) {
2222 return (
2323 < Box
24- display = 'flex'
25- justifyContent = 'center'
26- alignItems = 'center'
27- minHeight = '100vh' >
24+ display = "flex"
25+ justifyContent = "center"
26+ alignItems = "center"
27+ minHeight = "50vh"
28+ >
2829 < CircularProgress />
2930 </ Box >
3031 ) ;
3132 }
3233
3334 const renderPackages = ( packages : RecentPackage [ ] , type : string ) => (
3435 < >
35- < Typography
36- variant = 'h5'
37- gutterBottom
38- style = { { borderBottom : '2px solid #1976d2' , paddingBottom : '8px' } } >
36+ < Typography variant = "h5" gutterBottom className = "section-title" >
3937 { type }
4038 </ Typography >
4139 { packages . map ( ( pkg , i ) => (
4240 < Card
4341 key = { i }
44- style = { {
45- marginBottom : '16px' ,
46- borderRadius : '8px' ,
47- boxShadow : '0 4px 8px rgba(0, 0, 0, 0.1)' ,
48- cursor : 'pointer' ,
49- transition : 'transform 0.2s, background-color 0.2s' ,
50- } }
51- onClick = { ( ) => navigate ( '/package/' + pkg . name ) }
42+ className = "package-card"
43+ onClick = { ( ) => navigate ( "/package/" + pkg . name ) }
5244 onMouseEnter = { ( e ) =>
53- ( e . currentTarget . style . backgroundColor = '#f0f8ff' )
45+ ( e . currentTarget . className = "package-card package-card-hover" )
5446 }
55- onMouseLeave = { ( e ) =>
56- ( e . currentTarget . style . backgroundColor = 'white' )
57- } >
58- < CardContent style = { { display : 'flex' , alignItems : 'center' } } >
47+ onMouseLeave = { ( e ) => ( e . currentTarget . className = "package-card" ) }
48+ >
49+ < CardContent className = "card-content" >
5950 < Box flex = { 1 } >
60- < Typography variant = 'h6' gutterBottom >
51+ < Typography variant = "h6" gutterBottom className = "package-name" >
6152 { pkg . name } (v{ pkg . version } )
6253 </ Typography >
63- < Typography variant = 'body2' color = 'textSecondary' gutterBottom >
64- { type === 'Just Updated'
54+ < Typography
55+ variant = "body2"
56+ color = "textSecondary"
57+ gutterBottom
58+ className = "package-timestamp"
59+ >
60+ { type === "Just Updated"
6561 ? `Updated: ${ new Date ( pkg . updatedAt ! ) . toLocaleString ( ) } `
6662 : `Added: ${ new Date ( pkg . createdAt ! ) . toLocaleString ( ) } ` }
6763 </ Typography >
68- < Typography variant = 'body1' paragraph >
69- { pkg . description || 'No description available.' }
64+ < Typography
65+ variant = "body1"
66+ paragraph
67+ className = "package-description"
68+ >
69+ { pkg . description || "No description available." }
7070 </ Typography >
7171 </ Box >
72- < ArrowForwardIosIcon color = 'action' />
7372 </ CardContent >
7473 </ Card >
7574 ) ) }
7675 </ >
7776 ) ;
7877
7978 return (
80- < Container maxWidth = 'md' style = { { marginTop : '24px' } } >
79+ < Container maxWidth = "md" className = "dashboard-container" >
8180 < Grid container spacing = { 4 } >
8281 < Grid item xs = { 12 } md = { 6 } >
83- { renderPackages ( data . recentlyUpdated , ' Just Updated' ) }
82+ { renderPackages ( data . recentlyUpdated , " Just Updated" ) }
8483 </ Grid >
8584 < Grid item xs = { 12 } md = { 6 } >
86- { renderPackages ( data . recentlyCreated , ' New Packages' ) }
85+ { renderPackages ( data . recentlyCreated , " New Packages" ) }
8786 </ Grid >
8887 </ Grid >
8988 </ Container >
0 commit comments