-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathui.R
261 lines (210 loc) · 7.4 KB
/
ui.R
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
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
# See global.R for setup
# UI -------------------------------------------------------------------------
message("ui")
ui <- fluidPage(
# Navbar structure
navbarPage(title = "Shiny Demo with Redfin",
theme = shinytheme("lumen"),
windowTitle = "Shiny Demo",
# DT Table with filters ------------------------------------------
tabPanel("DT Table", fluid = TRUE,
icon = icon("table", lib = "font-awesome"),
titlePanel("Redfin DT Table"),
sidebarLayout(
# Options ------------------------------------------
sidebarPanel(
# Notification -----------------------------------
tags$head(
tags$style(
HTML(".shiny-notification {
position:fixed;
top: calc(14%);
left: calc(18%);
}"))),
actionButton("show_dt_readme", "README"),
br(),
br(),
# Refresh ---------------------------------------
actionButton("dt_refresh", "Refresh"),
br(),
br(),
# Date Range -----------------------------------
dateRangeInput("dt_daterange",
"List Date",
start = as.Date("20170801", format = "%Y%m%d"),
end = as.Date("20170930", format = "%Y%m%d"),
min = as.Date("19990630", format = "%Y%m%d"),
max = Sys.Date() - 7,
format = "mm-dd-yyyy"),
# Priority Entries -------------------------------
checkboxInput("dt_priority",
"Priority",
value = FALSE
),
# City update from data ---------------------
checkboxInput("dt_city", "Location"),
conditionalPanel(
condition = "input.dt_city == true",
selectInput("city_id",
"Locations",
choices = city_choices$city, # from global.R
selected = default_city,
multiple = TRUE)
),
# Conditional selection ---------------------
checkboxInput("dt_proptype", "Property Type"),
conditionalPanel(
condition = "input.dt_proptype == true",
selectizeInput("dt_pick_prop",
"Types",
choices = NULL,
multiple = TRUE)
),
# Max price --------------------------------------
numericInput("dt_max_price",
"Max Price (in thousands, up to $5 million)",
value = 5 * 10^3,
min = 0,
max = 5 * 10^3,
step = 5 * 10^2),
# Keyword search --------------------------------
checkboxInput("dt_keywords", "Keywords in Address"),
conditionalPanel(
condition = "input.dt_keywords == true",
textInput("dt_pick_keywords", "Keywords")
),
# Save csv button -------------------------------
downloadButton("dt_proplist", "CSV"),
br(),
br(),
# Set width of sidebar panel --------------------
width = 3
), # sidebar panel
mainPanel(
h3("DT Table with Filters"),
div(
textOutput("dt_timestamp")
),
br(),
div(
DT::DTOutput("dt_filtered") %>%
withSpinner(color = "#99ffdd")
)
) # main panel
) # sidebar layout
), # DT Table tab panel
# Rhandsontable ------------------------------------------
tabPanel("Rhandson CRUD", fluid = TRUE,
icon = icon("clipboard", lib = "font-awesome"),
# Page navigation warning ---------------------------
tags$head(tags$script(HTML("
// Navigation notification
window.onbeforeunload = function() {
return true;
};
"))),
titlePanel("Redfin Rhandson CRUD"),
sidebarLayout(
# Options ------------------------------------------
sidebarPanel(
# Notification -----------------------------------
tags$head(
tags$style(
HTML(".shiny-notification {
position:fixed;
top: calc(14%);
left: calc(18%);
}"))),
actionButton("show_rhandson_readme", "README"),
br(),
br(),
# City ---------------------
selectizeInput(
"rh_city_id",
"City",
choices = city_choices$city, # from global.R
selected = default_city,
multiple = TRUE
),
# Property type ---------------------
selectizeInput(
"rh_prop_id",
"Property Type",
choices = prop_choices$property_type, # from global.R
selected = "Condo/Co-op",
multiple = TRUE
),
# Save button -----------------------------------
actionButton("save_button", "Save Data", icon("paper-plane")),
br(),
br(),
# Reset button ----------------------------------
actionButton("reset_input", "Reset"),
br(),
br(),
# Set width of sidebar panel --------------------
width = 3
), # sidebar panel
mainPanel(
h3("Rhandsontable CRUD"),
div(
textOutput("rh_timestamp")
),
br(),
div(
rHandsontableOutput("rhandson_redfin") %>%
withSpinner(color = "#99ffdd")
)
) # main panel
) # sidebar layout
), # Rhandsontable tab panel
# Priority price dist panel -----------------------------------------------
tabPanel("View Priority", fluid = TRUE,
icon = icon("chart-area", lib = "font-awesome"),
titlePanel("View Priority Homes"),
sidebarLayout(
# Options ------------------------------------------
sidebarPanel(
# Notification -----------------------------------
tags$head(
tags$style(
HTML(".shiny-notification {
position:fixed;
top: calc(14%);
left: calc(18%);
}"))),
actionButton("show_dist_readme", "README"),
br(),
br(),
# Refresh ---------------------------------------
actionButton("dist_refresh", "Refresh"),
br(),
br(),
# City update from data ---------------------
selectizeInput(
"dist_city_id",
"City",
choices = city_choices$city, # from global.R
selected = default_city,
multiple = FALSE
),
# Set width of sidebar panel -------------------
width = 2
), # sidebar panel
mainPanel(
div(
textOutput("dist_timestamp")
),
br(),
plotOutput("dist_plot") %>%
withSpinner(color = "#99ffdd"),
h3("Priority Home Data"),
div(
DT::DTOutput("dist_table") %>%
withSpinner(color = "#99ffdd")
)
) # main panel
) # sidebar layout
) # Priority price dist panel
) # navbar page
) # fluid page