Conditional layout problem


#1

Hi,

My app implements a cookie-based authentication approach loosely based on this (example) . When the app starts on the server, an output object (isCookieValid) stores the result of the cookie check executed on the server side. Then based upon this output, the UI function aims at either showing the app (using shinydashboard), if the check passes, or showing nothing and redirecting to another webpage (this last bit is actually done on the server side), if the check does not pass.

The best I could get is to define my ui function using conditionalPanels calls in a fillPage call:

ui <- fillPage(
  tags$head(
    tags$script(src = 'js.cookie.js'),
  ),
  useShinyjs(),
  extendShinyjs(text = jsCode, functions = c('getcookie', 'setcookie', 'rmcookie')),
  conditionalPanel(
    condition = 'output.isCookieValid == 0', 
    NULL
  ),
  conditionalPanel(
    condition = 'output.isCookieValid == 1',
    dashboardPage(
      <some content>
    )
  )
)

This works well, except that the content shown in the shinydashboard is sometimes complex and higher that one screen and that fillPage does not seem to provide vertical scrollbars, so some content is simply truncated.
If I use a fluidPage instead of a fillPage call, vertical scrollbars are available but there is a white padding around my shinydashboard, which is very unpleasant.

Any suggestion is welcome.

Thank you


#2

Problem resolved by switching to a fluidPage call and using the following arguments:
offset = 0
style = ‘adding:0px;’