@@ -288,6 +288,8 @@ pub struct ComparisonsPageProps {
288
288
/// The comparison data for Perseus itself.
289
289
pub perseus_comparison : Comparison ,
290
290
}
291
+
292
+ #[ perseus:: template( ComparisonsPage ) ]
291
293
#[ component( ComparisonsPage <G >) ]
292
294
pub fn comparisons_page ( props : ComparisonsPageProps ) -> SycamoreTemplate < G > {
293
295
let comparisons = props. comparisons . clone ( ) ;
@@ -362,22 +364,25 @@ pub fn comparisons_page(props: ComparisonsPageProps) -> SycamoreTemplate<G> {
362
364
}
363
365
}
364
366
367
+ #[ perseus:: head]
368
+ pub fn head ( ) -> SycamoreTemplate < SsrNode > {
369
+ template ! {
370
+ title { ( format!( "{} | {}" , t!( "comparisons-title" ) , t!( "perseus" ) ) ) }
371
+ }
372
+ }
373
+
365
374
pub fn get_template < G : GenericNode > ( ) -> Template < G > {
366
375
Template :: new ( "comparisons" )
367
- . template ( |props| {
368
- template ! {
369
- ComparisonsPage ( serde_json:: from_str( & props. unwrap( ) ) . unwrap( ) )
370
- }
371
- } )
372
- . head ( |_| {
373
- template ! {
374
- title { ( format!( "{} | {}" , t!( "comparisons-title" ) , t!( "perseus" ) ) ) }
375
- }
376
- } )
376
+ . template ( comparisons_page)
377
+ . head ( head)
377
378
. build_state_fn ( get_build_state)
378
379
}
379
380
380
- pub async fn get_build_state ( _path : String , _locale : String ) -> RenderFnResultWithCause < String > {
381
+ #[ perseus:: autoserde( build_state) ]
382
+ pub async fn get_build_state (
383
+ _path : String ,
384
+ _locale : String ,
385
+ ) -> RenderFnResultWithCause < ComparisonsPageProps > {
381
386
// Get all the comparisons from JSON
382
387
// This includes the special properties for Perseus itself
383
388
let mut perseus_comparison: Option < Comparison > = None ;
@@ -416,6 +421,5 @@ pub async fn get_build_state(_path: String, _locale: String) -> RenderFnResultWi
416
421
} )
417
422
}
418
423
} ;
419
- let props_str = serde_json:: to_string ( & props) ?;
420
- Ok ( props_str)
424
+ Ok ( props)
421
425
}
0 commit comments