Spaces:
Sleeping
Sleeping
File size: 6,657 Bytes
ea4c284 846ccf2 ea4c284 98bdeda ea4c284 846ccf2 98bdeda 846ccf2 98bdeda ea4c284 98bdeda ea4c284 98bdeda ea4c284 2b6afec d9c2fdc 2b6afec ea4c284 846ccf2 ea4c284 2b6afec ea4c284 99d9397 aa5d864 99d9397 ea4c284 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 | ui <- page_navbar(
id = "main_nav",
theme = bs_theme(version = 5, bootswatch = "cosmo"),
title = "WMO Normals Explorer",
navbar_options = navbar_options(collapsible = TRUE),
header = tagList(
tags$head(
# If you have shinyjs installed, you can uncomment this:
# shinyjs::useShinyjs(),
tags$link(rel = "stylesheet", type = "text/css", href = "custom.css?v=1.1"),
tags$script(src = "fullscreen.js"),
tags$script(src = "app.js?v=1.1")
),
# Frozen overlay div (startup loading spinner)
div(
class = "frozen-overlay",
div(
class = "frozen-overlay-content",
div(class = "spinner-border text-primary", role = "status"),
p(class = "frozen-overlay-message", "Loading stations...")
)
)
),
fillable_mobile = TRUE,
sidebar = sidebar(
title = "Filters",
open = list(desktop = "open", mobile = "closed"),
# Normals Period Filter
div(
style = "display: flex; align-items: center; gap: 8px;",
tags$label("Select Normals Period", `for` = "normals_period"),
tooltip(
bsicons::bs_icon("info-circle", size = "1em"),
"Choose the 30-year WMO Climatological Normal baseline period (e.g. 1991–2020, 1981–2010, 1961–1990)."
)
),
selectInput("normals_period", label = NULL,
choices = NORMALS_PERIOD_CHOICES,
selected = "1991-2020"),
# Parameter Filter
div(
style = "display: flex; align-items: center; gap: 8px;",
tags$label("Select Parameter", `for` = "parameter"),
tooltip(
bsicons::bs_icon("info-circle", size = "1em"),
"Choose the climate variable to display on the map (e.g. temperature, precipitation, pressure)."
)
),
selectInput("parameter", label = NULL,
choices = c(
"Mean Temperature" = "TAVG",
"Max Temperature" = "TMAX",
"Min Temperature" = "TMIN",
"Precipitation" = "PRCP",
"Precipitation Days (>= 1mm)" = "DP01",
"Mean Sea Level Pressure" = "MSLP",
"Mean Vapor Pressure" = "MNVP",
"Sunshine Duration" = "TSUN"
),
selected = "TAVG"),
# Time Period Filter (Month / Annual)
div(
style = "display: flex; align-items: center; gap: 8px;",
tags$label("Select Month / Annual", `for` = "time_period"),
tooltip(
bsicons::bs_icon("info-circle", size = "1em"),
"Select a month or Annual to view the corresponding climatological normal value."
)
),
selectInput("time_period", label = NULL,
choices = c("Annual", month.abb),
selected = "Annual"),
# Country Filter
div(
style = "display: flex; align-items: center; gap: 8px;",
tags$label("Select Country", `for` = "country"),
tooltip(
bsicons::bs_icon("info-circle", size = "1em"),
"Filter stations by country. Select 'All Countries' to show all stations worldwide."
)
),
selectInput("country", label = NULL,
choices = c("All Countries" = "All", countries_list),
selected = "All"),
# Station Filter dynamically updated
div(
style = "display: flex; align-items: center; gap: 8px;",
tags$label("Select Station", `for` = "station"),
tooltip(
bsicons::bs_icon("info-circle", size = "1em"),
"Pick a specific station to zoom in and view its full dashboard with climate normals."
)
),
selectInput("station", label = NULL,
choices = c("All Stations" = "All"),
selected = "All"),
conditionalPanel(
condition = "input.station && input.station !== 'All'",
div(
class = "mt-1 mb-2",
actionButton(
"clear_station_sidebar",
label = span(bsicons::bs_icon("x-circle-fill", class = "me-1"), "Deselect Station"),
class = "sidebar-station-clear-btn",
onclick = "Shiny.setInputValue('clear_station_sidebar', Date.now(), {priority: 'event'});"
)
)
),
hr(),
uiOutput("dataset_info_box"),
hr(),
tags$small("Tip: Click map points to view detailed weather plots.")
),
nav_panel(
title = "Map View",
div(
style = "position: relative; height: 100%; width: 100%;",
maplibreOutput("station_map", width = "100%", height = "100%"),
# Floating Station Chip
absolutePanel(
id = "station_chip_panel",
top = 15, left = 60,
style = "z-index: 1000; pointer-events: none;",
uiOutput("station_chip_ui")
),
# Layer Control Panel (Collapsible)
absolutePanel(
top = 130, left = 10, right = "auto",
class = "map-layer-control",
style = "z-index: 1000;",
div(class = "control-icon", icon("layer-group")),
div(
class = "control-content",
radioButtons(
inputId = "basemap",
label = "Basemap",
choices = c(
"OpenFreeMap Positron" = "ofm_positron",
"OpenFreeMap Bright" = "ofm_bright",
"Satellite (Sentinel-2)" = "sentinel"
),
selected = "ofm_positron"
),
hr(style = "margin: 8px 0;"),
checkboxInput(
inputId = "show_labels",
label = "Show Labels",
value = TRUE
)
)
),
# Home Button Overlay
absolutePanel(
id = "zoom_home_panel",
top = 80, left = 10, right = "auto",
actionButton("home_zoom", bsicons::bs_icon("house-fill"), class = "btn-home", title = "Zoom to home")
),
# Map Legend
uiOutput("map_legend")
)
),
nav_panel(
title = "Dashboard",
div(
class = "container-fluid",
style = "padding: 20px;",
uiOutput("dashboard_header"),
hr(),
DT::DTOutput("dashboard_data"),
div(
style = "margin-top: 20px; margin-bottom: 20px;",
uiOutput("plots_grid")
)
)
),
nav_spacer(),
nav_item(
tooltip(
tags$a(
id = "fullscreen_toggle",
href = "#",
onclick = "toggleFullScreen(); return false;",
style = "display: flex; align-items: center; color: rgba(0,0,0,0.55); padding: 0.5rem 1rem; text-decoration: none;",
bsicons::bs_icon("arrows-fullscreen", size = "1.2rem")
),
"Toggle Fullscreen",
placement = "bottom"
)
)
)
|