Browse Source

Implement direct links to shows

Use URL like basename?show=id
Default to Game of Thrones if no show, display the current show in the URL
Use server-side selectize for performance
master
Maxime Wack 1 year ago
parent
commit
14601205a7
1 changed files with 11 additions and 1 deletions
  1. +11
    -1
      app.R

+ 11
- 1
app.R View File

@@ -17,13 +17,23 @@ if (shows %>% names %>% is.na %>% which %>% length > 0)
ui <- fluidPage(
inputPanel(width = "20%", height = "100%",
h1("GraphTV"),
selectizeInput("show", "Search show", shows, selected = "tt0944947", width = "600px")
selectizeInput("show", "Search show", NULL, width = "600px")
),
plotlyOutput("show_graph", width = "100%", height = "800px")
)

server <- function(input, output, session)
{
observe({
queryString <- getQueryString(session)
selected <- ifelse(queryString$show %>% is.null, "tt0944947", queryString$show)
updateSelectizeInput(session, "show", choices = shows, selected = selected, server = T)
})

observe({
updateQueryString(str_c("?show=", input$show), "replace", session)
})

output$show_graph <- renderPlotly({
req(input$show)



Loading…
Cancel
Save