-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathapp_ui.R
229 lines (215 loc) · 5.68 KB
/
app_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
#' The application User-Interface
#'
#' @param request Internal parameter for `{shiny}`.
#' DO NOT REMOVE.
#' @import shiny shinydashboard
#' @noRd
app_ui <- function(request) {
tagList(
golem_add_external_resources(),
dashboardPage(
title = "Biodose Tools",
skin = "purple",
header = dashboard_header(),
sidebar = dashboard_sidebar(),
body = dashboard_body()
)
)
}
#' The dashboard header
#'
#' @import shiny shinydashboard
#' @noRd
dashboard_header <- function() {
dashboardHeader(
title = span(
img(src = "www/icon_small.svg", height = 35),
"Biodose Tools"
),
tags$li(
a(
icon("github"),
height = 40,
href = "https://github.com/biodosetools-team/biodosetools",
title = "",
target = "_blank"
),
class = "dropdown"
)
)
}
#' The dashboard sidebar
#'
#' @import shiny shinydashboard
#' @noRd
dashboard_sidebar <- function() {
dashboardSidebar(
# About section
sidebarMenu(
menuItem(
text = "About this app",
tabName = "home",
icon = icon("home"),
selected = TRUE
)
),
# Aberration assays section
p(class = "menu-title", "Aberration assays"),
sidebarMenu(
# Dicentrics
menuItem(
text = "Dicentrics",
tabName = "menu-item-dicent",
icon = icon("dna"),
startExpanded = FALSE,
# Modules
menuItem(
text = "Fitting",
tabName = "tab-fitting-dicent",
icon = icon("cog"),
selected = FALSE
),
menuItem(
text = "Dose estimation",
tabName = "tab-estimation-dicent",
icon = icon("calculator")
)
),
# Translocations
menuItem(
text = "Translocations",
tabName = "menu-item-trans",
icon = icon("palette"),
# Modules
menuSubItem(
text = "Fitting",
tabName = "tab-fitting-trans",
icon = icon("cog")
),
menuSubItem(
text = "Dose estimation",
tabName = "tab-estimation-trans",
icon = icon("calculator")
)
),
# Micronuclei
if (golem::app_dev()) {
menuItem(
text = "Micronuclei",
tabName = "menu-item-micro",
icon = icon("dot-circle"),
# Modules
menuItem(
text = "Fitting",
tabName = "tab-fitting-micro",
icon = icon("cog"),
badgeLabel = "wip",
badgeColor = "green"
),
menuItem(
text = "Dose estimation",
tabName = "tab-estimation-micro",
icon = icon("calculator"),
badgeLabel = "wip",
badgeColor = "green"
)
)
}
),
# Other tools section
# p(class = "menu-title", "Other tools"),
p(
class = "sticky-footer",
a(
paste("Version", utils::packageVersion(pkg = "biodosetools")),
href = "https://github.com/biodosetools-team/biodosetools/blob/master/NEWS.md"
)
)
)
}
#' The dashboard home page
#'
#' @import shiny shinydashboard
#' @noRd
dashboard_home <- function() {
tabItem(
tabName = "home",
div(
style = "padding-bottom: 20px;",
h2("About this project", style = "margin-left: 10%;"),
includeMarkdown(
system.file("app/www/about_body.md", package = "biodosetools")
),
# Buttons
div(
style = "margin-left: 10%;",
# GitHub icon
actionButton(
inputId = "github_link",
label = "Source code",
icon = icon("github"),
class = "home-button",
onclick = "window.open('https://github.com/biodosetools-team/biodosetools/', '_blank')"
),
widget_sep(),
# Wiki/Documentation icon
actionButton(
inputId = "wiki_link",
label = "Documentation",
icon = icon("book"),
class = "home-button",
onclick = "window.open('https://biodosetools-team.github.io/documentation/', '_blank')"
),
widget_sep(),
# Report bugs
actionButton(
inputId = "wiki_link",
label = "Report issue",
icon = icon("bug"),
class = "home-button",
onclick = "window.open('https://github.com/biodosetools-team/biodosetools/issues/new/', '_blank')"
)
)
)
)
}
#' The dashboard body
#'
#' @import shiny shinydashboard
#' @noRd
dashboard_body <- function() {
dashboardBody(
tabItems(
dashboard_home(),
# Modules
mod_fitting_dicent_ui(id = "fitting_dicent_ui", label = "tab-fitting-dicent"),
mod_estimation_dicent_ui(id = "estimation_dicent_ui", label = "tab-estimation-dicent"),
mod_fitting_trans_ui(id = "fitting_trans_ui", label = "tab-fitting-trans"),
mod_estimation_trans_ui(id = "estimation_trans_ui", label = "tab-estimation-trans"),
mod_fitting_micro_ui(id = "fitting_micro_ui", label = "tab-fitting-micro"),
mod_estimation_micro_ui(id = "estimation_micro_ui", label = "tab-estimation-micro")
)
)
}
#' Add external Resources to the Application
#'
#' This function is internally used to add external
#' resources inside the Shiny application.
#'
#' @import shiny
#' @importFrom golem add_resource_path activate_js favicon bundle_resources
#' @noRd
golem_add_external_resources <- function() {
add_resource_path(
"www", app_sys("app/www")
)
tags$head(
favicon(ico = "favicon", ext = "png"),
bundle_resources(
path = app_sys("app/www"),
app_title = "Biodose Tools"
)
# Add here other external resources
# for example, you can add shinyalert::useShinyalert()
)
}