]> nmode's Git Repositories - Rnaught/blob - R/ui.R
Remove 'shinyBS' dependency
[Rnaught] / R / ui.R
1 ui <- function() {
2 shiny::fluidPage(
3 # Title.
4 shiny::titlePanel(shiny::HTML(paste0("Rnaught: An Estimation Suite for R", shiny::tags$sub("0")))),
5
6 # Sidebar layout.
7 shiny::sidebarLayout(
8 # Sidebar. Hidden if the 'About' tab is selected.
9 shiny::conditionalPanel(condition="input.tabset != 'About'",
10 shiny::sidebarPanel(id="sidebar",
11 # Data tab sidebar.
12 shiny::conditionalPanel(condition="input.tabset == 'Data'",
13 shiny::h3("Enter data"),
14 # Data input method selection.
15 shiny::radioButtons(inputId="dataInputMethod", label="", choices=list("Manually"=1, "Upload a .csv file"=2, "Paste a .csv file"=3)),
16 # Option 1: Manual entry.
17 shiny::conditionalPanel(condition="input.dataInputMethod == '1'",
18 shiny::textInput(inputId="dataName", label="Dataset name"),
19 shiny::span(shiny::textOutput(outputId="dataNameWarn"), style="color: red;"),
20 shiny::fluidRow(
21 shiny::column(8, shiny::textInput(inputId="dataCounts", label=shiny::HTML(paste0(
22 "Case counts", shiny::tags$sup("[?]", title="Enter as a comma-separated list of positive integers, with at least two entries. Ex: 1,1,2,3,5,8"))))
23 ),
24 shiny::column(4, shiny::selectInput(inputId="dataUnits", label="Reporting frequency", choices=list("Daily", "Weekly")))
25 ),
26 shiny::span(shiny::textOutput(outputId="dataCountsWarn"), style="color: red;")
27 ),
28 # Option 2: Upload .csv file.
29 shiny::conditionalPanel(condition="input.dataInputMethod == '2'",
30 shiny::fileInput(inputId="dataUpload", label="", accept=c("text/csv", "text/comma-separated-values,text/plain", ".csv")),
31 ),
32 # Option 3: Paste .csv file.
33 shiny::conditionalPanel(condition="input.dataInputMethod == '3'",
34 shiny::textAreaInput(inputId="dataPaste", label="", rows=8, resize="none"),
35 ),
36 # Warning text for .csv upload / paste.
37 shiny::conditionalPanel(condition="['2', '3'].includes(input.dataInputMethod)",
38 shiny::span(shiny::textOutput(outputId="dataCSVWarn"), style="color: red;"),
39 ),
40 # Button to add data.
41 shiny::actionButton(inputId="addData", label="Add"),
42 ),
43 # Estimators tab sidebar (collapsable entries).
44 shiny::conditionalPanel(condition="input.tabset == 'Estimators'",
45 shiny::h3("Estimators"),
46 # WHITE & PANAGO (WP).
47 shiny::tags$details(
48 shiny::tags$summary(shiny::h4("White & Panago (WP)")),
49 shiny::p("This is a description of the method."),
50 shiny::br(),
51 shiny::radioButtons(inputId="serialWPKnown", label="Is the mean serial interval known?", inline=TRUE, choices=list("Yes"=1, "No"=2)),
52 # Known serial interval.
53 shiny::conditionalPanel(condition="input.serialWPKnown == '1'",
54 shiny::fluidRow(
55 shiny::column(8, shiny::textInput(inputId="serialWPInput", label="Mean Serial Interval")),
56 shiny::column(4, shiny::selectInput(inputId="serialWPUnits", label="Time units", choices=list("Days", "Weeks")))
57 ),
58 shiny::span(shiny::textOutput(outputId="serialWPWarn"), style="color: red;")
59 ),
60 # Unknown serial interval.
61 shiny::conditionalPanel(condition="input.serialWPKnown == '2'",
62 shiny::h5("Grid Search Parameters"),
63 shiny::fluidRow(
64 shiny::column(4, shiny::textInput(inputId="gridLengthInput", label="Grid length", value="100")),
65 shiny::column(4, shiny::textInput(inputId="gridShapeInput", label="Max. shape", value="10")),
66 shiny::column(4, shiny::textInput(inputId="gridScaleInput", label="Max. scale", value="10"))
67 ),
68 shiny::fluidRow(
69 shiny::column(4, shiny::span(shiny::textOutput(outputId="gridLengthWarn"), style="color: red;")),
70 shiny::column(4, shiny::span(shiny::textOutput(outputId="gridShapeWarn"), style="color: red;")),
71 shiny::column(4, shiny::span(shiny::textOutput(outputId="gridScaleWarn"), style="color: red;"))
72 )
73 ),
74 shiny::actionButton(inputId="addWP", label="Add")
75 ),
76 # SEQUENTIAL BAYES (seqB).
77 shiny::tags$details(
78 shiny::tags$summary(shiny::h4("Sequential Bayes (seqB)")),
79 shiny::p("This is a description of the method."),
80 shiny::br(),
81 shiny::fluidRow(
82 shiny::column(8, shiny::textInput(inputId="serialseqBInput", label="Mean Serial Interval")),
83 shiny::column(4, shiny::selectInput(inputId="serialseqBUnits", label="Time units", choices=list("Days", "Weeks")))
84 ),
85 shiny::span(shiny::textOutput(outputId="serialseqBWarn"), style="color: red;"),
86 shiny::textInput(inputId="kappaInput", label=shiny::HTML(paste0("Maximum value of the uniform prior",
87 shiny::tags$sup("[?]", title="This describes the prior belief of R0, and should be set to a higher value if R0 is believed to be larger. (Default: 20)"))),
88 value="20"
89 ),
90 shiny::span(shiny::textOutput(outputId="kappaWarn"), style="color: red;"),
91 shiny::actionButton(inputId="addseqB", label="Add")
92 ),
93 # INCIDENCE DECAY (ID).
94 shiny::tags$details(
95 shiny::tags$summary(shiny::h4("Incidence Decay (ID)")),
96 shiny::p("This is a description of the method."),
97 shiny::br(),
98 shiny::fluidRow(
99 shiny::column(8, shiny::textInput(inputId="serialIDInput", label="Mean Serial Interval")),
100 shiny::column(4, shiny::selectInput(inputId="serialIDUnits", label="Time units", choices=list("Days", "Weeks")))
101 ),
102 shiny::span(shiny::textOutput(outputId="serialIDWarn"), style="color: red;"),
103 shiny::actionButton(inputId="addID", label="Add")
104 ),
105 # INCIDENCE DECAY & EXPONENTIAL ADJUSTEMENT (IDEA).
106 shiny::tags$details(
107 shiny::tags$summary(shiny::h4("Incidence Decay and Exponential Adjustement (IDEA)")),
108 shiny::p("This is a description of the method."),
109 shiny::br(),
110 shiny::fluidRow(
111 shiny::column(8, shiny::textInput(inputId="serialIDEAInput", label="Mean Serial Interval")),
112 shiny::column(4, shiny::selectInput(inputId="serialIDEAUnits", label="Time units", choices=list("Days", "Weeks")))
113 ),
114 shiny::span(shiny::textOutput(outputId="serialIDEAWarn"), style="color: red;"),
115 shiny::actionButton(inputId="addIDEA", label="Add")
116 ),
117 shiny::tags$style(type="text/css", "summary { display: list-item; cursor: pointer; }"),
118 shiny::tags$style(type="text/css", "summary h4 { display: inline; }")
119 )
120 )
121 ),
122 # Main panel.
123 shiny::mainPanel(id="main",
124 shiny::tabsetPanel(id="tabset", type="tabs",
125 shiny::tabPanel("About", shiny::br(), "Hello"),
126 shiny::tabPanel("Data", shiny::br(), shiny::dataTableOutput(outputId="dataTable"), shiny::tags$style(type="text/css", "#dataTable tfoot { display:none; }")),
127 shiny::tabPanel("Estimators", shiny::br(),
128 shiny::dataTableOutput(outputId="estTable"),
129 shiny::tags$style(type="text/css", "#estTable tfoot { display:none; }"),
130 shiny::downloadButton(outputId="downloadEst", label="Download table as .csv")
131 )
132 )
133 )
134 )
135 )
136 }