@ -25,18 +25,20 @@ export const renderViewTemplate = (options: ViewTemplateOptions) => {
switch ( options . type ) {
switch ( options . type ) {
case 'profile' :
case 'profile' :
const pubkey = options . id ;
const pubkey = options . id ;
const detail = elem ( 'p' , { data : { 'profileDetails' : pubkey } } ) ;
const detail = elem ( 'p' ) ;
dom [ ` detail- ${ pubkey } ` ] = detail ;
const following = elem ( 'span' ) ;
const header = elem ( 'header' , { className : 'hero' } , [
const profileHeader = elem ( 'header' , { className : 'hero' } , [
elem ( 'small' , { } , nip19 . npubEncode ( pubkey ) ) ,
elem ( 'small' , { className : 'hero-npub' } , nip19 . npubEncode ( pubkey ) ) ,
elem ( 'h1' , { } , pubkey ) ,
elem ( 'div' , { className : 'hero-title' } , [
elem ( 'h1' , { } , pubkey ) ,
] ) ,
detail ,
detail ,
elem ( 'footer' , { } , [
elem ( 'footer' , { } , following ) ,
elem ( 'span' , { data : { following : pubkey } } )
] )
] ) ;
] ) ;
dom [ pubkey ] = header ;
dom . header = profileHeader ;
content . append ( header ) ;
dom . detail = detail ;
dom . following = following ;
content . append ( profileHeader ) ;
document . title = pubkey ;
document . title = pubkey ;
break ;
break ;
case 'note' :
case 'note' :
@ -45,14 +47,14 @@ export const renderViewTemplate = (options: ViewTemplateOptions) => {
break ;
break ;
case 'event' :
case 'event' :
const id = options . id ;
const id = options . id ;
const eventHeader = elem ( 'header' , { className : 'hero' } , [
content . append (
elem ( 'h 1', { } , id ) ,
elem ( 'h eader', { className : 'hero' } , [
] ) ;
elem ( 'h1' , { } , id ) ,
dom [ id ] = eventHeader ;
] )
content . append ( eventHeader ) ;
) ;
document . title = id ;
document . title = id ;
break ;
break ;
}
}
const view = elem ( 'section' , { className : 'view' } , [ content ] ) ;
const view = elem ( 'section' , { className : 'view' } , [ content ] ) ;
return { content , dom , view } ;
return { content , dom , view } ;
} ;
} ;