-
Notifications
You must be signed in to change notification settings - Fork 0
/
app_ui.R
48 lines (36 loc) · 1.44 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
library(shiny)
# Add www subdirectory for images and stuff
addResourcePath(prefix = 'www', directoryPath = paste0(getwd(), '/www'))
# We'll do a dynamic redirect after authenticating
# https://stackoverflow.com/questions/57755830/how-to-redirect-to-a-dynamic-url-in-shiny
jscode <- "Shiny.addCustomMessageHandler('mymessage', function(message) { window.location = message;});"
# ------------------------------- Pre-login UI ------------------------------ #
AnonymousUI <- fluidPage(
theme = 'bootstrap.yeti.css',
title = 'Shiny Synapse Auth Example App',
# Logo
div(img(src = paste0('www/logo.png'), width = '300px'),
style='text-align: center;'),
br(),
# Login button
tags$head(tags$script(jscode)),
div(actionButton("action", "Log in with Synapse"),
style='text-align: center;'),
br(),
div("Don't have a Synapse account yet? Follow the ",
a(href = 'https://midas-wyss.github.io/synapse_instructions_predictive_bioanalytics.html',
'instructions for registering here'),
'.', style='text-align: center;')
)
# ------------------------------ Post-login UI ------------------------------ #
AuthenticatedUI <- fluidPage(
theme = 'bootstrap.yeti.css',
title = 'Shiny Synapse Auth Example App',
# Logo
div(img(src = paste0('www/logo.png'), width = '300px'),
style='text-align: center;'),
br(),
# Success message
h5('You successfully logged in!'),
verbatimTextOutput('user_info')
)