alexdum commited on
Commit
af79978
·
1 Parent(s): 34eb10a

refactor: Replaced individual value boxes with a unified card for station information display in the data tab header.

Browse files
Files changed (1) hide show
  1. server.R +42 -32
server.R CHANGED
@@ -870,7 +870,7 @@ server <- function(input, output, session) {
870
  }
871
  )
872
 
873
- # Data Tab Header
874
  output$station_info_header <- renderUI({
875
  id <- current_station_id()
876
  if (is.null(id)) {
@@ -896,37 +896,47 @@ server <- function(input, output, session) {
896
  dates_text <- paste(date_range[1], "to", date_range[2])
897
  }
898
 
899
- layout_columns(
900
- fill = FALSE,
901
- value_box(
902
- title = "Station",
903
- value = span(s_name, style = "font-size: 1.2rem; font-weight: 500;"),
904
- p(paste("ID:", id)),
905
- theme = "primary"
906
- ),
907
- value_box(
908
- title = "State / Location",
909
- value = span(s_state, style = "font-size: 1.2rem; font-weight: 500;"),
910
- p(paste0("Lat: ", meta$latitude[1], " | Lon: ", meta$longitude[1])),
911
- theme = "secondary"
912
- ),
913
- value_box(
914
- title = "Elevation",
915
- value = span(paste0(s_elev, " m"), style = "font-size: 1.2rem; font-weight: 500;"),
916
- p("Above mean sea level"),
917
- theme = "info"
918
- ),
919
- value_box(
920
- title = "Data Period",
921
- value = span(dates_text, style = "font-size: 1.2rem; font-weight: 500;"),
922
- p(paste("Resolution:", input$data_resolution)),
923
- theme = "success"
924
- ),
925
- value_box(
926
- title = "Actions",
927
- value = span("Download", style = "font-size: 1.2rem; font-weight: 500;"),
928
- downloadButton("download_hourly", "Export CSV", class = "btn-sm btn-light", style = "width: 100%;"),
929
- theme = "warning"
 
 
 
 
 
 
 
 
 
 
930
  )
931
  )
932
  })
 
870
  }
871
  )
872
 
873
+ # Data Tab Header - Info Callout Card
874
  output$station_info_header <- renderUI({
875
  id <- current_station_id()
876
  if (is.null(id)) {
 
896
  dates_text <- paste(date_range[1], "to", date_range[2])
897
  }
898
 
899
+ # Unified Info Card
900
+ card(
901
+ style = "margin-bottom: 20px; border-left: 5px solid #007bff;",
902
+ card_body(
903
+ padding = 15,
904
+ layout_columns(
905
+ fill = FALSE,
906
+ # Col 1: Station
907
+ div(
908
+ strong("Station"), br(),
909
+ span(s_name, style = "font-size: 1.1rem;"), br(),
910
+ tags$small(class = "text-muted", paste("ID:", id))
911
+ ),
912
+ # Col 2: Location
913
+ div(
914
+ strong("Location"), br(),
915
+ span(s_state), br(),
916
+ tags$small(class = "text-muted", paste0(meta$latitude[1], "°N, ", meta$longitude[1], "°E"))
917
+ ),
918
+ # Col 3: Elevation & Resolution
919
+ div(
920
+ strong("Technical"), br(),
921
+ span(paste0(s_elev, " m")), br(),
922
+ span(class = "badge bg-info text-dark", input$data_resolution)
923
+ ),
924
+ # Col 4: Period
925
+ div(
926
+ strong("Data Selection"), br(),
927
+ span(dates_text)
928
+ ),
929
+ # Col 5: Actions
930
+ div(
931
+ class = "d-flex align-items-center justify-content-end",
932
+ downloadButton(
933
+ "download_hourly",
934
+ label = "Export CSV",
935
+ class = "btn-sm btn-primary",
936
+ icon = icon("download")
937
+ )
938
+ )
939
+ )
940
  )
941
  )
942
  })