@@ -21,8 +21,12 @@ corporate_colors <- list(
2121 muted = " #7f8c8d"
2222)
2323
24- # Use shared CSS file
25- addResourcePath(" www" , " ../www" )
24+ # Use shared CSS file - handle both local and shinylive paths
25+ if (file.exists(" ../www" )) {
26+ addResourcePath(" www" , " ../www" )
27+ } else if (file.exists(" www" )) {
28+ addResourcePath(" www" , " www" )
29+ }
2630
2731# Custom theme
2832professional_theme <- bs_theme(
@@ -290,11 +294,11 @@ ui <- fluidPage(
290294 p(class = " metric-value" , textOutput(" page_estimate" , inline = TRUE ), " pages estimated" )
291295 ),
292296
293- downloadButton (
297+ actionButton (
294298 " generate_packet" ,
295- " Generate HTML Report " ,
299+ " Generate Board Packet " ,
296300 class = " btn btn-primary btn-lg w-100 mb-3" ,
297- icon = icon(" download " )
301+ icon = icon(" file-text " )
298302 ),
299303
300304 actionButton(
@@ -550,34 +554,46 @@ server <- function(input, output, session) {
550554 as.character(base_pages )
551555 })
552556
553- # Generate board packet download
554- output $ generate_packet <- downloadHandler(
555- filename = function () {
556- paste0(" Board_Packet_" , format(input $ meeting_date , " %Y%m%d" ), " .html" )
557- },
558- content = function (file ) {
559- # Generate HTML report
560- html_content <- generate_board_packet_html(
561- meeting_title = input $ meeting_title ,
562- meeting_date = input $ meeting_date ,
563- meeting_time = input $ meeting_time ,
564- meeting_location = input $ meeting_location ,
565- components = input $ components ,
566- agenda_data = agenda_items(),
567- financial_data = values $ financial_data ,
568- include_watermark = input $ include_watermark ,
569- include_toc = input $ include_toc
557+ # Generate board packet (Shinylive-compatible)
558+ observeEvent(input $ generate_packet , {
559+ # Generate HTML report
560+ html_content <- generate_board_packet_html(
561+ meeting_title = input $ meeting_title ,
562+ meeting_date = input $ meeting_date ,
563+ meeting_time = input $ meeting_time ,
564+ meeting_location = input $ meeting_location ,
565+ components = input $ components ,
566+ agenda_data = agenda_items(),
567+ financial_data = values $ financial_data ,
568+ include_watermark = input $ include_watermark ,
569+ include_toc = input $ include_toc
570+ )
571+
572+ # Show generated HTML in a modal (Shinylive-compatible)
573+ showModal(modalDialog(
574+ title = " Board Packet Generated" ,
575+ size = " xl" ,
576+ div(
577+ style = " max-height: 500px; overflow-y: auto; border: 1px solid #ddd; padding: 1rem;" ,
578+ HTML(html_content )
579+ ),
580+ footer = tagList(
581+ p(class = " text-muted" ,
582+ " Copy the content above or use your browser's print function to save as PDF." ),
583+ modalButton(" Close" )
570584 )
571-
572- writeLines( html_content , file )
573-
574- # Show completion notification
575- showNotification( " Board packet generated successfully! " , type = " message " , duration = 5 )
576-
577- # Update step 3 to completed
585+ ))
586+
587+ # Show completion notification
588+ showNotification( " Board packet generated successfully! " , type = " message " , duration = 5 )
589+
590+ # Update step 3 to completed
591+ tryCatch({
578592 shinyjs :: runjs(" $('#step3').addClass('completed').removeClass('active');" )
579- }
580- )
593+ }, error = function (e ) {
594+ # Silently handle if shinyjs fails
595+ })
596+ })
581597
582598 # Email preview modal
583599 observeEvent(input $ email_preview , {
0 commit comments