jofaichow commited on
Commit
08fc9b9
1 Parent(s): f7f6c39

improved valueBoxes

Browse files
Files changed (1) hide show
  1. app/app.R +28 -16
app/app.R CHANGED
@@ -273,11 +273,13 @@ ui <- shinydashboardPlus::dashboardPage(
273
  h3(strong(textOutput(outputId = "text_payout"))),
274
 
275
  fluidRow(
276
- # class = "text-center",
277
- valueBoxOutput("payout_confirmed", width = 3),
278
- valueBoxOutput("payout_pending", width = 3),
279
- valueBoxOutput("payout_total", width = 3),
280
- valueBoxOutput("payout_average", width = 3)
 
 
281
  ),
282
 
283
  br(),
@@ -527,32 +529,42 @@ server <- function(input, output) {
527
 
528
  output$payout_confirmed <- renderValueBox({
529
  valueBox(value = round(sum(react_d_filter()[resolved == TRUE, ]$payout, na.rm = T), 2),
530
- subtitle = "Confirmed",
531
- icon = icon("check"),
532
- color = "green")
533
  })
534
 
535
  output$payout_pending <- renderValueBox({
536
  valueBox(value = round(sum(react_d_filter()[resolved == FALSE, ]$payout, na.rm = T), 2),
537
  subtitle = "Pending",
538
- icon = icon("clock"),
539
  color = "yellow")
540
  })
541
 
542
  output$payout_total <- renderValueBox({
543
  valueBox(value = round(sum(react_d_filter()$payout, na.rm = T), 2),
544
- subtitle = "Confirmed + Pending",
545
- icon = icon("plus"),
546
- color = "aqua")
547
  })
548
 
549
- output$payout_average <- renderValueBox({
550
- valueBox(value = round((sum(react_d_filter()$payout, na.rm = T) / length(unique(react_d_filter()$round))), 2),
551
- subtitle = "Round Average",
552
- icon = icon("credit-card"),
553
  color = "light-blue")
554
  })
555
 
 
 
 
 
 
 
 
 
 
 
 
 
 
556
 
557
  # ============================================================================
558
  # Reactive: Payout Charts
 
273
  h3(strong(textOutput(outputId = "text_payout"))),
274
 
275
  fluidRow(
276
+ class = "text-center",
277
+ valueBoxOutput("payout_confirmed", width = 2),
278
+ valueBoxOutput("payout_pending", width = 2),
279
+ valueBoxOutput("payout_total", width = 2),
280
+ valueBoxOutput("payout_n_round", width = 2),
281
+ valueBoxOutput("payout_average", width = 2),
282
+ valueBoxOutput("payout_avg_ror", width = 2)
283
  ),
284
 
285
  br(),
 
529
 
530
  output$payout_confirmed <- renderValueBox({
531
  valueBox(value = round(sum(react_d_filter()[resolved == TRUE, ]$payout, na.rm = T), 2),
532
+ subtitle = "Realised",
533
+ color = "olive")
 
534
  })
535
 
536
  output$payout_pending <- renderValueBox({
537
  valueBox(value = round(sum(react_d_filter()[resolved == FALSE, ]$payout, na.rm = T), 2),
538
  subtitle = "Pending",
 
539
  color = "yellow")
540
  })
541
 
542
  output$payout_total <- renderValueBox({
543
  valueBox(value = round(sum(react_d_filter()$payout, na.rm = T), 2),
544
+ subtitle = "Realised + Pending",
545
+ color = "light-blue")
 
546
  })
547
 
548
+ output$payout_n_round <- renderValueBox({
549
+ # Use rounds with stake > 0 only
550
+ valueBox(value = nrow(react_d_payout_summary()[total_stake > 0, ]),
551
+ subtitle = "Staked Rounds",
552
  color = "light-blue")
553
  })
554
 
555
+ output$payout_average <- renderValueBox({
556
+ # Use rounds with stake > 0 only
557
+ valueBox(value = round(mean(react_d_payout_summary()[total_stake > 0, ]$total_payout, na.rm = T), 2),
558
+ subtitle = "Avg. Round Payout",
559
+ color = "light-blue")
560
+ })
561
+
562
+ output$payout_avg_ror <- renderValueBox({
563
+ # Use rounds with stake > 0 only
564
+ valueBox(value = paste(round(mean(react_d_payout_summary()[total_stake > 0, ]$rate_of_return), 2), "%"),
565
+ subtitle = "Avg. Round ROR",
566
+ color = "light-blue")
567
+ })
568
 
569
  # ============================================================================
570
  # Reactive: Payout Charts