User input that edits visualization in R-shiny (Collapsible Tree)

So I am trying to create an app that creates a collapsible tree (CRAN - Package collapsibleTree)

I was successfully able to generate the tree but not I want to be able to filter the df we use to generate the plot beforehand by user input. More specifically, I want a user to be able to put a date range where the data filters the table and then proceeds to plot the collapsible tree function.

Here is my attempt, I have been struggling—leave it to me to learn both R and Shiny at the same time lol.

rm(list = ls())
library(flexdashboard)
library(dplyr)
library(ggplot2)
library(collapsibleTree)
library(colorspace)
library(rsconnect)
library(shiny)
library(lubridate)
options(shiny.sanitize.errors = FALSE)

df <- read.csv("CST_Treess.csv",header =TRUE)

df$ts = df$ts / 1000

df$ts = lubridate::as_datetime(df$ts)


ui <- fluidPage(
  
  titlePanel("Hiya"),
  
  
  sidebarLayout(
    
    sidebarPanel(
    
      headerPanel("Select date range"),
      
      dateRangeInput('ts', "Range:"),
      
      submitButton(text = "Submit", icon = NULL, width = NULL),
   
    ),   
  
    mainPanel =  
    
    collapsibleTreeOutput("plot")
  )
)


server <- function(input, output) {
  
  
  output$plot <- renderCollapsibleTree({
    df %>%
      group_by(CST...Step.1,CST...Step.2,CST...Step.3,CST...Step.4,CST...Step.5,     CST...Step.6,CST...Step.7,CST...Step.8,CST...Step.9) %>%
      summarize(`n` = n()) %>%
      collapsibleTreeSummary(
       hierarchy = c('CST...Step.1','CST...Step.2','CST...Step.3','CST...Step.4','CST...Step.5','CST...Step.6','CST...Step.7','CST...Step.8','CST...Step.9'),
       root = "Open CST",
       linkLength = 500.0,
       attribute = "n",
       percentOfParent = FALSE,
       nodeSize = "n",
       fontSize = 15.0,
       tooltip = TRUE,
       inputId = "ts",
       maxPercent = 40
    )
  })

  output$str <- renderPrint(str(input$ts))
}


shinyApp(ui = ui, server = server)

For context, an image of the output is pasted below (i have also been trying to figure out the scaling, but the trees do show below—however fiddling with the date/ranges doesnt affect the actual trees)