jameson-bodenburg commited on
Commit
d8029b3
·
verified ·
1 Parent(s): b32800b

Update app.R

Browse files
Files changed (1) hide show
  1. app.R +76 -3
app.R CHANGED
@@ -454,10 +454,61 @@ predict_stuffplus <- function(data) {
454
  }
455
 
456
 
457
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
458
 
459
  # UI
460
- ui <- fluidPage(
461
  tags$head(
462
  tags$style(HTML("
463
  body, table, .gt_table {
@@ -928,10 +979,32 @@ ui <- fluidPage(
928
  )
929
  )
930
  )
931
-
 
 
 
932
  # Server
933
  server <- function(input, output, session) {
934
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
935
 
936
 
937
  # Reactive values
 
454
  }
455
 
456
 
457
+ login_ui <- fluidPage(
458
+ tags$style(HTML("
459
+ body {
460
+ background-color: #f0f4f8;
461
+ font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
462
+ color: #006F71;
463
+ }
464
+ .login-container {
465
+ max-width: 360px;
466
+ margin: 120px auto;
467
+ background: #A27752;
468
+ padding: 30px 25px;
469
+ border-radius: 8px;
470
+ box-shadow: 0 4px 15px #A1A1A4;
471
+ text-align: center;
472
+ color: white;
473
+ }
474
+ .login-message {
475
+ margin-bottom: 20px;
476
+ font-size: 14px;
477
+ color: #ffffff;
478
+ font-weight: 600;
479
+ }
480
+ .btn-primary {
481
+ background-color: #006F71 !important;
482
+ border-color: #006F71 !important;
483
+ color: white !important;
484
+ font-weight: bold;
485
+ width: 100%;
486
+ margin-top: 10px;
487
+ box-shadow: 0 2px 5px #006F71;
488
+ transition: background-color 0.3s ease;
489
+ }
490
+ .btn-primary:hover {
491
+ background-color: #006F71 !important;
492
+ border-color: #A27752 !important;
493
+ }
494
+ .form-control {
495
+ border-radius: 4px;
496
+ border: 1.5px solid #006F71 !important;
497
+ color: #006F71;
498
+ font-weight: 600;
499
+ }
500
+ ")),
501
+
502
+ div(class = "login-container",
503
+ tags$img(src = "https://upload.wikimedia.org/wikipedia/en/thumb/e/ef/Coastal_Carolina_Chanticleers_logo.svg/1200px-Coastal_Carolina_Chanticleers_logo.svg.png", height = "150px"),
504
+ passwordInput("password", "Password:"),
505
+ actionButton("login", "Login"),
506
+ textOutput("wrong_pass")
507
+ )
508
+ )
509
 
510
  # UI
511
+ app_ui <- fluidPage(
512
  tags$head(
513
  tags$style(HTML("
514
  body, table, .gt_table {
 
979
  )
980
  )
981
  )
982
+
983
+ ui <- fluidPage(
984
+ uiOutput("page")
985
+ )
986
  # Server
987
  server <- function(input, output, session) {
988
 
989
+
990
+ logged_in <- reactiveVal(FALSE)
991
+
992
+ output$page <- renderUI({
993
+ if (logged_in()) {
994
+ app_ui
995
+ } else {
996
+ login_ui
997
+ }
998
+ })
999
+
1000
+ observeEvent(input$login, {
1001
+ if (input$password == PASSWORD) {
1002
+ logged_in(TRUE)
1003
+ output$wrong_pass <- renderText("")
1004
+ } else {
1005
+ output$wrong_pass <- renderText("Incorrect password, please try again.")
1006
+ }
1007
+ })
1008
 
1009
 
1010
  # Reactive values