Skip to content

create teal user guide using intro.js #1680

@donyunardi

Description

@donyunardi

Feature description

Continuation of #1010

As mentioned here, we want to try using intro.js to create guided tour on how to use teal app.

intro.js written in JS and targeting css element.

Acceptance Criteria:

  • Create a very simple guided tour on how to use the teal app (i.e. explain the layout, what each button do, how to add a filter, etc.).

Image

Code
library(teal)
library(shiny)

app <- init(
  data = teal_data(
    iris = iris[1:10, ]
  ),
  modules = modules(
    example_module(label = "my module")
  )
) |>
  modify_title(
    title = "my teal app"
  ) |>
  modify_header(
    tags$head(
      tags$link(
        rel = "stylesheet",
        href = "https://cdnjs.cloudflare.com/ajax/libs/intro.js/8.3.2/intro.min.css"
      ),
      tags$link(
        rel = "stylesheet",
        href = "https://cdnjs.cloudflare.com/ajax/libs/intro.js/8.3.2/introjs.min.css"
      ),
      tags$style(HTML("
      .introjs-tooltip {
        background-color: white !important;
        border: 1px solid #ccc !important;
        border-radius: 5px !important;
        padding: 15px !important;
        box-shadow: 0 4px 6px rgba(0,0,0,0.3) !important;
        min-width: 250px !important;
        max-width: 400px !important;
      }

      .introjs-tooltip {
        z-index: 10000000 !important;
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
        position: absolute !important;
      }
      .introjs-overlay {
        z-index: 9999999 !important;
        opacity: 0.8 !important;
      }
      .introjs-helperLayer {
        z-index: 9999998 !important;
      }
      .introjs-tooltipbuttons {
        display: block !important;
      }
      .introjs-button {
        display: inline-block !important;
      }
    ")),
      tags$script(
        src = "https://cdnjs.cloudflare.com/ajax/libs/intro.js/8.3.2/intro.min.js"
      ),
      tags$script(HTML('
      $(document).on("shiny:connected", function() {
        setTimeout(function() {
          console.log("Starting intro.js tour");
          introJs.tour().setOptions({
            steps: [
              {x
                intro: "Welcome to my Teal app! Click Next to continue."
              },
              {
                element: document.querySelector(".teal-navbar"),
                intro: "This is the teal navigation bar."
              },
              {
                element: document.querySelector(".teal-sidebar"),
                intro: "This is the filter panel."
              },
              {
                element: document.querySelector("#teal-teal_modules-nav-my_module-teal_module_ui"),
                intro: "This is the analysis output area."
              }
            ],
            showProgress: true,
            showBullets: false,
            exitOnOverlayClick: false,
            doneLabel: "Done",
            nextLabel: "Next →",
            prevLabel: "← Back"
          }).start();
        }, 2000);
      });
    '))
    )
  )

shinyApp(app$ui, app$server)

Code of Conduct

  • I agree to follow this project's Code of Conduct.

Contribution Guidelines

  • I agree to follow this project's Contribution Guidelines.

Security Policy

  • I agree to follow this project's Security Policy.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions