forked from cleytonfar/CicloMobilidade
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.R
More file actions
141 lines (129 loc) · 4.15 KB
/
app.R
File metadata and controls
141 lines (129 loc) · 4.15 KB
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
# Attaching packages:
library(shiny)
library(shinydashboard)
library(shinydashboardPlus)
library(fresh)
library(tidyverse)
library(data.table)
library(stringr)
library(purrr)
library(DT)
library(leaflet)
library(sf)
library(rgdal)
library(raster)
library(lubridate)
library(geojsonsf)
library(waiter)
# load modules:
source("R/analiseMalha_module.R")
source("R/analiseTrafego_module.R")
source("R/upload_module.R")
## header:
myHeader = dashboardHeader(
title = "Pedala Recife",
tags$li(a(href = 'https://www2.recife.pe.gov.br/',
img(src = 'dual_logo3.png',
title = "Pedala Recife", height = "50px"),
style = "padding-top:10px; padding-bottom:10px;"),
class = "dropdown")
)
## sidebar:
mySidebar = dashboardSidebar(
width = 4,
collapsed = F,
sidebarMenu(
id = "sidebarid",
menuItem(
"Ciclo de Mobilidade",
tabName = "analiseTrafego",
startExpanded = T,
icon = icon("traffic-light", lib = "font-awesome", verify_fa=F)
),
conditionalPanel(
'input.sidebarid == "analiseTrafego"',
selectInput(
inputId = "variavel",
"Selecionar variável:",
choices = c("Número de viagens" = "trip_count_cat",
"Número de viagens (trabalho)" = "commute_trip_count_cat",
"Número de viagens (lazer)" = "leisure_trip_count_cat",
"Número de viagens (manhã)" = "morning_trip_count_cat",
"Número de viagens (noite)" = "evening_trip_count_cat",
"Número de pessoas" = "people_count_cat",
"Número de pessoas (homens)" = "male_people_count_cat",
"Número de pessoas (mulher)" = "female_people_count_cat",
"Número de pessoas (idade 13-19)" = "age_13_19_people_count_cat",
"Número de pessoas (idade 20-34)" = "age_20_34_people_count_cat",
"Número de pessoas (idade 35-54)" = "age_35_54_people_count_cat",
"Número de pessoas (idade 55-64)" = "age_55_64_people_count_cat",
"Número de pessoas (idade 65+)" = "age_65_plus_people_count_cat"
)
)
),
menuItem(
"Ciclo de Turismo e Lazer",
tabName = "analiseMalha",
icon = icon("biking", lib = "font-awesome", verify_fa=F)
),
menuItem(
"Upload",
tabName = "uploadFiles",
icon = icon("upload", lib = "font-awesome", verify_fa = F)
)
)
)
## Body:
myBody = dashboardBody(
shinyWidgets::useSweetAlert(),
waiter::use_waiter(),
waiter::autoWaiter(
color = transparent(.5),
html = spin_3() # use a spinner
),
tags$link(rel = "stylesheet", type = "text/css", href = "custom.css"),
tabItems(
tabItem(
tabName = "analiseTrafego",
analiseTrafegoInput("id1")
),
tabItem(
tabName = "analiseMalha",
analiseMalhaInput("id2")
),
tabItem(
tabName = "uploadFiles",
uploadInput("uploadFiles")
)
)
)
# App:
# customized theme:
mytheme = create_theme(
adminlte_color(
red = "#a50f15",
orange = "#cb181d",
maroon = "#ef3b2c",
green = "#3fff2d",
blue = "#2635ff",
yellow = "#feff6e",
fuchsia = "#ff5bf8",
navy = "#374c92",
purple = "#615cbf",
light_blue = "#5691cc"
)
)
# UI:
ui = dashboardPage(
freshTheme = mytheme,
header = myHeader,
sidebar = mySidebar,
body = myBody
)
# Server:
server = function(input, output, session) {
analiseTrafegoServer("id1", nome_variavel = reactive(input$variavel))
analiseMalhaServer("id2")
uploadServer("uploadFiles")
}
shinyApp(ui, server)