diff --git a/DESCRIPTION b/DESCRIPTION index 0f5db81..ed2149b 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -14,6 +14,9 @@ License: MIT + file LICENSE Encoding: UTF-8 Roxygen: list(markdown = TRUE) RoxygenNote: 7.3.2 +Imports: + shiny (>= 1.9.1), + bslib (>= 0.8.0) Suggests: testthat (>= 3.0.0) Config/testthat/edition: 3 diff --git a/NAMESPACE b/NAMESPACE index 6ae9268..636c8ad 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -1,2 +1,5 @@ # Generated by roxygen2: do not edit by hand +export(run) +import(bslib) +import(shiny) diff --git a/R/ADSPlanner-package.R b/R/ADSPlanner-package.R new file mode 100644 index 0000000..9bbd50e --- /dev/null +++ b/R/ADSPlanner-package.R @@ -0,0 +1,6 @@ +# This file is used to define the imports that will be updated by roxygen2 when running `devtools::document()`. + +#' @import shiny +#' @import bslib +NULL +#> NULL diff --git a/R/main.R b/R/main.R deleted file mode 100644 index e41f4a1..0000000 --- a/R/main.R +++ /dev/null @@ -1 +0,0 @@ -print("Bonjour INSA !") diff --git a/R/run.R b/R/run.R new file mode 100644 index 0000000..6fdeadd --- /dev/null +++ b/R/run.R @@ -0,0 +1,16 @@ +library(shiny) + +source("R/ui.R") +source("R/server.R") + +#' Run the Shiny application +#' +#' This function launches the Shiny application. +#' +#' @export +run <- function() { + runApp(shinyApp( + ui = ui, + server = server + )) +} diff --git a/R/server.R b/R/server.R new file mode 100644 index 0000000..41494fb --- /dev/null +++ b/R/server.R @@ -0,0 +1,10 @@ +library(shiny) + +server <- function(input, output) { + output$download <- downloadHandler( + filename = "affectations.xlsx", + content = function(file) { + write("Not implemented yet.", file) + } + ) +} diff --git a/R/ui.R b/R/ui.R new file mode 100644 index 0000000..86bc5e3 --- /dev/null +++ b/R/ui.R @@ -0,0 +1,26 @@ +library(bslib) + +ui <- page_sidebar( + title = "ADS-Planner", + sidebar = sidebar( + width = 350, + card( + fileInput("file", "R\u00E9sultats du sondage", accept = c(".xlsx", ".ods"), buttonLabel = "Parcourir...", placeholder = "Aucun fichier", multiple = FALSE), + ), + downloadButton("download", "T\u00E9l\u00E9charger affectations"), + ), + navset_tab( + nav_panel( + "Visualisation des choix", + "Not implemented yet.", + ), + nav_panel( + "Sans r\u00E9ponse", + "Not implemented yet.", + ), + nav_panel( + "Affectations", + "Not implemented yet.", + ), + ), +) diff --git a/README.md b/README.md index 88af7ee..24cddd8 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,24 @@ A tool to distribute INSA students into ADS sessions. +## Installing & Running + +To install (or update) the ADS-Planner R package, simply clone this repo, start an interactive R session from the root folder and run : + +```R +install.packages(".",repos=NULL) +``` + +And to run the app : + +```R +ADSPlanner::run() +``` + +The web interface should open automatically. If it doesn't, you can open the link next to `Browsing` in the command output. + +For development purposes, the app can be started more simply by running `shiny::runApp("R")` from the root of the repo. + ## ADS ADS (Action Découverte des Spécialités) is a teaching module aimed at presenting the specialties of the engineering program at INSA to students in the preparatory program. This module consists of three sessions. Each student is asked to rank the specialties by preference to assign them to the three half-day sessions. diff --git a/man/run.Rd b/man/run.Rd new file mode 100644 index 0000000..04f708a --- /dev/null +++ b/man/run.Rd @@ -0,0 +1,11 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/run.R +\name{run} +\alias{run} +\title{Run the Shiny application} +\usage{ +run() +} +\description{ +This function launches the Shiny application. +}