dfalbel commited on
Commit
b1231d6
1 Parent(s): 640a26a

add spinning icons

Browse files
Files changed (1) hide show
  1. app.R +13 -4
app.R CHANGED
@@ -147,23 +147,32 @@ server <- function(input, output, session) {
147
  # if generating is TRUE we want it to be disabled, otherwise it's enabled
148
  # if generating is `NULL`, then the model is not yet loaded
149
  btn <- if (is.null(context$generating) || context$generating == "loading") {
150
- btn <- list(class = "btn-secondary disabled", label = "Loading model ...")
 
151
  insertUI(
152
  "#sendButton",
153
- ui = actionButton("send", width = "100%", label = btn$label, class = btn$class),
 
 
 
 
 
 
154
  immediate = TRUE
155
  )
156
  btn
157
  } else if (context$generating == "error") {
158
  list(class = "btn-secondary disabled", label = "Generating error ...")
159
  } else if (context$generating) {
160
- list(class = "btn-secondary disabled", label = "Generating response ...")
 
161
  } else {
162
  list(class = "btn-primary", label = "Send")
163
  }
164
 
165
  output$sendButton <- renderUI({
166
- actionButton("send", width = "100%", label = btn$label, class = btn$class)
 
167
  })
168
  })
169
 
 
147
  # if generating is TRUE we want it to be disabled, otherwise it's enabled
148
  # if generating is `NULL`, then the model is not yet loaded
149
  btn <- if (is.null(context$generating) || context$generating == "loading") {
150
+ btn <- list(class = "btn-secondary disabled", label = "Loading model ...",
151
+ icon = icon("spinner", class="fa-spin"))
152
  insertUI(
153
  "#sendButton",
154
+ ui = actionButton(
155
+ "send",
156
+ icon = btn$icon,
157
+ width = "100%",
158
+ label = btn$label,
159
+ class = btn$class
160
+ ),
161
  immediate = TRUE
162
  )
163
  btn
164
  } else if (context$generating == "error") {
165
  list(class = "btn-secondary disabled", label = "Generating error ...")
166
  } else if (context$generating) {
167
+ list(class = "btn-secondary disabled", label = "Generating response ...",
168
+ icon = icon("spinner", class="fa-spin"))
169
  } else {
170
  list(class = "btn-primary", label = "Send")
171
  }
172
 
173
  output$sendButton <- renderUI({
174
+ actionButton("send", width = "100%", label = btn$label, class = btn$class,
175
+ icon = btn$icon)
176
  })
177
  })
178