-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathUI.R
More file actions
220 lines (207 loc) · 9.77 KB
/
Copy pathUI.R
File metadata and controls
220 lines (207 loc) · 9.77 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
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
# Define colors
PRIMARY_COLOR <- "#4F46E5"
SECONDARY_COLOR <- "#10B981"
ACCENT_COLOR <- "#F59E0B"
TEXT_COLOR <- "#E5E7EB"
BG_COLOR <- "#111827"
CARD_BG <- "#1F2937"
DARK_ACCENT <- "#374151"
ui <- navbarPage(
title = tags$span(
tags$img(src = "Vivid_volcano_logo.png", height = "50px", style = "margin-right: 10px;"),
"Vivid-Volcano Analytics"
),
id = "navBar",
theme = "custom_theme.css", # Will be provided in styles.css
windowTitle = "Vivid-Volcano Analytics Dashboard",
# Include external CSS
header = tags$head(
tags$link(rel = "stylesheet", type = "text/css", href = "styles.css"),
tags$link(rel = "stylesheet", href = "https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css"),
tags$meta(name = "viewport", content = "width=device-width, initial-scale=1.0")
),
# Main Dashboard Tab
tabPanel("Dashboard",
div(class = "dash-container",
fluidRow(class = "controls",
# Time Range
column(4,
h4("Time Range:", class = "filter-header"),
div(class = "filter-group",
radioGroupButtons(
inputId = "timeRange",
label = NULL,
choices = c("All Time" = "all", "7 Days" = "7", "30 Days" = "30", "Custom" = "custom"),
justified = TRUE,
size = "sm",
status = "primary",
checkIcon = list(yes = icon("check"))
)
)
),
# Custom Date Range
column(4,
h4("Select custom Time Range:", class = "filter-header"),
div(class = "filter-group",
dateRangeInput(
"customDateRange",
label = NULL,
start = Sys.Date() - 30,
end = Sys.Date(),
width = "100%"
)
)
),
# Last Updated
column(4,
div(class = "last-updated",
h4(icon("database"), "Last database query:", class = "filter-header"),
p(icon("clock"), " ", textOutput("lastQueryTime", inline = TRUE))
)
)
),
# Stats cards
fluidRow(class = "tiles",
column(width = 3,
div(class = "stat-card",
div(class = "stat-icon sessions",
icon("users")
),
div(class = "stat-details",
h3(class = "stat-value", uiOutput("totalSessionsValue")),
p(class = "stat-label", "Total Sessions"),
div(class = "stat-trend", uiOutput("sessionsComparisonText"))
)
)
),
column(width = 3,
div(class = "stat-card",
div(class = "stat-icon visits",
icon("user-plus")
),
div(class = "stat-details",
h3(class = "stat-value", uiOutput("firstTimeVisitsValue")),
p(class = "stat-label", "New Users"),
div(class = "stat-trend", uiOutput("visitsComparisonText"))
)
)
),
column(width = 3,
div(class = "stat-card",
div(class = "stat-icon uploads",
icon("cloud-upload-alt")
),
div(class = "stat-details",
h3(class = "stat-value", uiOutput("totalUploadsValue")),
p(class = "stat-label", "Data Uploads"),
div(class = "stat-trend", uiOutput("uploadsComparisonText"))
)
)
),
column(width = 3,
div(class = "stat-card",
div(class = "stat-icon analyses",
icon("chart-bar")
),
div(class = "stat-details",
h3(class = "stat-value", uiOutput("totalAnalysesValue")),
p(class = "stat-label", "Total Analyses"),
div(class = "stat-trend", uiOutput("analysesComparisonText"))
)
)
)
),
# First row of charts - 3 plots
fluidRow(
column(width = 4,
box(
width = NULL, # Takes full width of the column
title = "Sessions Over Time",
status = "primary",
solidHeader = TRUE,
highchartOutput("sessionsTimeSeries", height = "250px")
)
),
column(width = 4,
box(
width = NULL,
title = "Uploads Over Time",
status = "primary",
solidHeader = TRUE,
highchartOutput("uploadsTimeSeries", height = "250px")
)
),
column(width = 4,
box(
width = NULL,
title = "Activities Over Time",
status = "primary",
solidHeader = TRUE,
highchartOutput("analysesTimeSeries", height = "250px")
)
)
),
# Second row of charts - 3 plots
fluidRow(
column(width = 4,
shinydashboard::box(
width = NULL,
title = "Session Duration",
status = "primary",
solidHeader = TRUE,
highchartOutput("sessionDurationHist", height = "250px")
)
),
column(width = 4,
shinydashboard::box(
width = NULL,
title = "Browser Distribution",
status = "primary",
solidHeader = TRUE,
highchartOutput("browserTree", height = "250px")
)
),
column(width = 4,
shinydashboard::box(
width = NULL,
title = "Trend Analysis",
status = "primary",
solidHeader = TRUE,
highchartOutput("Trend_plot", height = "250px")
)
)
)# Close the fluidRow for second row of charts
) # Close the div with class="dash-container"
), # Close the Dashboard tabPanel
# About Tab
tabPanel("About",
div(class = "about-container",
div(class = "about-card",
div(class = "card-header",
h2("Vivid Volcano Analytics Dashboard")
),
div(class = "card-body",
h4("About This Dashboard"),
p("This dashboard provides analytics for the Vivid Volcano application, showing usage metrics and user behavior."),
p("It fetches the data from the PostgreSQL database (hosted on Supabase) and collected through a telemetry module of Vivid Volcano application."),
h4("Features"),
tags$ul(
tags$li("Real-time analytics of application usage"),
tags$li("Session tracking and visualization"),
tags$li("Analysis of user workflows and tool usage"),
tags$li("Time-based filtering options"),
tags$li("Trend analysis")
),
h4("Technical Details"),
p("Built with R Shiny, leveraging packages such as shinydashboard, highcharter, and DBI for PostgreSQL connections."),
div(class = "action-buttons",
tags$a(href = APP_URL, target = "_blank", icon("desktop"), "Open Vivid Volcano App", class = "action-btn app-btn"),
tags$a(href = GITHUB_URL, target = "_blank", icon("github"), "GitHub Repository for Vivid Volcano", class = "action-btn github-btn"),
tags$a(href = LINKEDIN_URL, target = "_blank", icon("linkedin"), "Developer LinkedIn", class = "action-btn linkedin-btn"),
tags$a(href = DASHBOARD_CODE_URL, target = "_blank", icon("code"), "Dashboard Source", class = "action-btn code-btn")
)
)
)
)
)
)