-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathui.R
276 lines (246 loc) · 8.29 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
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
library(shinydashboard)
####Modal
my_modal <- function(id, title, ...) {
mo <- tags$div(class = "modal fade", id = id,
tags$div(class = "modal-dialog modal-md",
tags$div(class = "modal-content",
tags$div(class = "modal-header",
tags$button(type="button",class="close",
`data-dismiss`="modal",HTML("×")),
tags$h4(title)),
tags$div(class = "modal-body", ...),
tags$div(class = "modal-footer",
tags$button(type="button", class="btn btn-default",
`data-dismiss`="modal","Close")))))
}
#### Title ####
header <- dashboardHeader(
titleWidth = 300,
title = tagList(shiny::icon("book", lib = "glyphicon"),
"Book List Recommendation"))
#### Sidebar ####
sidebar <- dashboardSidebar(
width = 300,
# Logo
sidebarUserPanel("Miaozhi Yu", image = "booklogo.png"),
# Tabs
sidebarMenu(
menuItem("History", tabName = "tab_history",
icon = icon("map")),
menuItem("Recommendation", tabName = "tab_recommendation",
icon = icon("book")),
menuItem("Data", tabName = "tab_data",
icon = icon("database")),
# menuItem("Review", tabName = "tab_review",
# icon = icon("star")),
br(),
br(),
br(),
br(),
br(),
br(),
br(),
br(),
br(),
br(),
br(),
br(),
br(),
br(),
br(),
br(),
br(),
br(),
br(),
br(),
menuItem('About', tabName = 'tab_about',
icon = icon('info-circle'))
)
)
#### Tabs - About ####
tab_about <- tabItem(
tabName = 'tab_about',
fluidRow(
tabBox(
width = 12,
title = tagList(shiny::icon("info-circle"), 'Info'),
id = 'tabbox1',
tabPanel(
"About Goodreads",
fluidRow(
column(
width = 5, align = 'center',
tags$img(src = 'download.png', width = "356px", height = "300px")),
column(
width = 7,
tags$h3('Goodreads is an Amazon company and "social cataloging" website founded in December 2006 and launched in
January 2007 by Otis Chandler, II, a software engineer and entrepreneur, and Elizabeth Chandler'),
tags$h3('The website allows individuals to freely search Goodreads extensive user-populated database of
books, annotations, and reviews. Users can sign up and register books to generate library catalogs and reading lists.'),
tags$h3('On July 23, 2013, it was announced on their website that the user base had grown to 20 million members,
having doubled in close to 11 months.'),
tags$a(href = 'https://www.goodreads.com/',
'Learn more about Good Reads',
class="btn btn-primary"))
)), # End of Tab Panel 1
tabPanel(
"About Me",
fluidRow(
box(
width = 12, title = ,
column(
width = 2,
tags$img(
src = 'Miaozhi_Yu.jpg',
width = "100px", height = "100px")),
column(
width = 10,
#tags$p(aboutme),
br(),
br(),
tags$p(tags$a(icon('github-alt'), target = '_blank',
'My Github',
href = 'https://github.com/MiaozhiYu',
class="btn btn-primary")),
tags$p(
tags$a(icon('linkedin'), target = '_blank',
'My LinkedIn',
href = 'https://www.linkedin.com/in/miaozhi-yu-87429739',
class="btn btn-primary"))
)))) # End of Tab Panel 2
))) # End of Tab Box
### Tabs - Map ####
tab_history <- tabItem(
tabName = "tab_history",
# Row 1, Region Selection
fluidRow(
column(6, align = 'justify',
box(title = 'About This Tab', width = 15,
status = 'info', solidHeader = F,
'This dashboard shows the how literature hot spots change over time.'
)
),
column(6,
sliderInput("Publish_Year", "Year:",
min = 1600, max = 2000, value =1600 ,step=100,animate = T)
)
),
# Row 2, Map motion
fluidRow(
box(
title = 'World Map', status = 'primary', solidHeader = T,
height = 800, width = 12,
htmlOutput("map_motion")
) # End of Map Box
)
) # End of history Tab
tab_recommendation <- tabItem(
tabName = "tab_recommendation",
# Row 1, Region Selection
fluidRow(
column(4,
selectInput(
inputId = "type",
label = h3("Type of Literature"),
choices = levels(data_rating$type),
selected = levels(data_rating$type), multiple = T
)
),
column(4,
selectInput(
inputId = "period",
label = h3("Time Period"),
choices = levels(data_rating$period),
selected = levels(data_rating$period), multiple = T
)
),
column(4,
selectInput(
inputId = "country",
label = h3("Country"),
choices = levels(as.factor(data_rating$country)),
selected = levels(as.factor(data_rating$country)),multiple = T
)
)
), # end of selection bar
#row2, recommendation start
fluidRow(
column(12,
h3('Recommendations:')
)
),
#row3, recommendation
fluidRow(
column(3,offset = 1,
#conditionalPanel("input.n >= 50",
htmlOutput("rec_pic1",style="border:1px solid #ccc;",
`data-toggle`="modal",
`data-target`="#mymodal1"),
my_modal('mymodal1','Word Cloud',plotOutput("plot_1"))
),
column(3,
htmlOutput('rec_pic2',style="border:1px solid #ccc;",
`data-toggle`="modal",
`data-target`="#mymodal2"),
my_modal('mymodal2','Word Cloud',plotOutput("plot_2"))
),
column(3,
htmlOutput('rec_pic3',style="border:1px solid #ccc;",
`data-toggle`="modal",
`data-target`="#mymodal3"),
my_modal('mymodal3','Word Cloud',plotOutput("plot_3"))
)
)
# fluidRow(
# column(3,
# bsModal(
# "modalWordCloud1",
# "Word Cloud",
# "tabWC1",
# size = "large",
# plotOutput("wordcloud1")
# )
# )
# )
)# End of Recommendation Tab
#begin of review tab
# tab_review = tabItem(tabName = "tab_review",
# fluidRow(
# column(4,
# selectInput(
# inputId = "selection",
# label = h3("Choose a book: "),
# choices = levels(data_rating$title))
# ),
# column(4,
# actionButton("update", "Get review")
# ),
# fluidRow(
# plotOutput("plot")
# )
#
# )
# )#end of review tab
#begin of data tab
tab_data = tabItem(tabName = "tab_data",
fluidRow(box(dataTableOutput('tbl'), width = 12))
)
body <- dashboardBody(
### Tabs
tabItems(
tab_history, # history tab
tab_recommendation,
#tab_review,
tab_data,
tab_about # About tab
) # End of Tabs
) # End of Body
#### Main Frame ####
dashboardPage(
# Properties
skin = "purple",
# Main Frame
header,
sidebar,
body
)