visualise_ui <- function(id) {
  ns <- NS(id)
  tabPanel(
    title = "Visualise",
    value = ns("tab"),
    tags$br(),
    sidebarLayout(
      sidebarPanel(
        h3("Upload your data"),
        p("Note: this data must contain regularly spaced time series such as
          daily or weekly case counts
          (this will either be brought over from the previous step, Aggregate,
          or you can upload a temporally aggregated dataset below)"),
        uiOutput(ns("vis_load")),

        radioButtons(ns("plottype"),
                     "Type of plot",
                     c("Timeseries" = "timeseries",
                       "Seasonality" = "seasonality",
                       "Heatmap" = "heatmap"),
                     inline = TRUE,
                     selected = character(0)),

        selectInput(ns("cases_col"),
                    label = "Column containing case data",
                    choices = c(""),
                    selected = ""),
        selectInput(ns("time_col"),
                    label = "Column containing time step",
                    choices = c(""),
                    selected = ""),
        selectInput(ns("area_col"),
                    label = "Column containing spatial scale (optional)",
                    choices = c(""),
                    selected = ""),

        conditionalPanel(
          condition = paste0("input['", ns("plottype"), "'] == 'timeseries'"),
          uiOutput(ns("ts_slider")),
          actionButton(ns("tsbutton"), label = "Plot Timeseries")
        ),

        conditionalPanel(
          condition = paste0("input['", ns("plottype"), "'] == 'seasonality'"),
          actionButton(ns("seasonbutton"), label = "Plot Seasonality")
        ),

        conditionalPanel(
          condition = paste0("input['", ns("plottype"), "'] == 'heatmap'"),
          actionButton(ns("heatbutton"), label = "Plot Heatmap")
        )
      ),

      mainPanel(
        conditionalPanel(
          condition = paste0("input['", ns("plottype"), "'] == 'timeseries'"),
          plotOutput(ns("ts_plot")),
          verbatimTextOutput(ns("warning_msg_ts")),
          downloadButton(ns("download_timeseries"), "Download timeseries plot")
        ),
        conditionalPanel(
          condition = paste0("input['", ns("plottype"), "'] == 'seasonality'"),
          plotOutput(ns("season_plot")),
          verbatimTextOutput(ns("warning_msg_season")),
          downloadButton(ns("download_season"), "Download seasonality plot")
        ),
        conditionalPanel(
          condition = paste0("input['", ns("plottype"), "'] == 'heatmap'"),
          plotOutput(ns("heat_plot")),
          verbatimTextOutput(ns("warning_msg_heat")),
          downloadButton(ns("download_heat"), "Download heatmap plot")
        )
      )
    )
  )
}

### END
