@@ -38,6 +38,7 @@ export default function BlogHistory({ posts = [] }: BlogHistoryProps) {
3838 // Prepare data for the chart
3939 const data = sortedPosts . map ( ( post ) => ( {
4040 date : new Date ( post . date_modified ) ,
41+ timestamp : new Date ( post . date_modified ) . getTime ( ) ,
4142 title : post . title ,
4243 summary : post . summary ,
4344 contentSize : post . content_html . length / 1024 ,
@@ -97,15 +98,16 @@ export default function BlogHistory({ posts = [] }: BlogHistoryProps) {
9798 onMouseLeave = { ( ) => setActiveIndex ( null ) }
9899 >
99100 < XAxis
100- dataKey = "date "
101- tickFormatter = { ( date ) =>
102- date . toLocaleDateString ( undefined , {
101+ dataKey = "timestamp "
102+ tickFormatter = { ( timestamp ) =>
103+ new Date ( timestamp ) . toLocaleDateString ( undefined , {
103104 month : "short" ,
104105 year : "numeric" ,
105106 } )
106107 }
107- type = "category "
108+ type = "number "
108109 domain = { [ "dataMin" , "dataMax" ] }
110+ scale = "time"
109111 />
110112 < Tooltip
111113 content = { ( { active, payload, label } ) => {
@@ -128,20 +130,20 @@ export default function BlogHistory({ posts = [] }: BlogHistoryProps) {
128130 < div
129131 className = "flex items-center justify-center mr-4"
130132 style = { {
131- width : "100px" ,
132- height : "100px" ,
133- flexShrink : 0 ,
134- backgroundColor : "#f0f0f0"
135- } }
133+ width : "100px" ,
134+ height : "100px" ,
135+ flexShrink : 0 ,
136+ backgroundColor : "#f0f0f0" ,
137+ } }
136138 >
137139 < img
138140 className = "rounded-xl w-full h-full"
139141 src = { data . content_html . match ( / < i m g .* ?s r c = " ( .* ?) " / ) [ 1 ] }
140142 alt = { data . title }
141143 style = { {
142144 objectFit : "cover" ,
143- width : "100px" ,
144- height : "100px"
145+ width : "100px" ,
146+ height : "100px" ,
145147 } }
146148 />
147149 </ div >
0 commit comments