| 1 |
# ------------------------------------------------------------------- |
| 2 |
# - NAME: ui.R |
| 3 |
# - AUTHOR: Reto Stauffer |
| 4 |
# - DATE: 2017-09-16 |
| 5 |
# ------------------------------------------------------------------- |
| 6 |
# - DESCRIPTION: |
| 7 |
# ------------------------------------------------------------------- |
| 8 |
# - EDITORIAL: 2017-09-16, RS: Created file on thinkreto. |
| 9 |
# ------------------------------------------------------------------- |
| 10 |
# - L@ST MODIFIED: 2018-10-08 18:57 on marvin |
| 11 |
# ------------------------------------------------------------------- |
| 12 |
desc <- paste("Please select a file from your disc which you want", |
| 13 |
"to convert. Only PNG/JPG/JPEG files are allowed.", |
| 14 |
"Maximum allowed file size is 1 Megabyte.") |
| 15 |
|
| 16 |
# Define UI for data upload app ---- |
| 17 |
shiny::shinyUI(bootstrapPage( |
| 18 |
|
| 19 |
tags$head( |
| 20 |
tags$link(rel = "stylesheet", type = "text/css", href = "cvdemulator.css"), |
| 21 |
tags$link(rel = "stylesheet", type = "text/css", href = "cvdemulator_darkmode.css") |
| 22 |
), |
| 23 |
tags$script(" |
| 24 |
$(document).ready(function() { |
| 25 |
$(document).on(\"keyup\", function(event) { |
| 26 |
console.log(event.which); |
| 27 |
Shiny.onInputChange(\"key_pressed\", event.which); |
| 28 |
event.stopPropagation(); |
| 29 |
}); |
| 30 |
}); |
| 31 |
"), |
| 32 |
shinyjs::useShinyjs(), |
| 33 |
|
| 34 |
div(class = "version-info", htmlOutput("version_info")), |
| 35 |
|
| 36 |
|
| 37 |
tabsetPanel(id = "maintabs", |
| 38 |
# Upload or control panel |
| 39 |
tabPanel("Upload", icon = icon("cog", lib = "font-awesome"), |
| 40 |
|
| 41 |
# Severity slider |
| 42 |
column(4, class = "col-severity", |
| 43 |
withTags(div(class = "fa-large", |
| 44 |
icon("eye-slash", lib = "font-awesome"))), |
| 45 |
h2("Severity"), |
| 46 |
sliderInput("severity", label = NULL, min = 0, max = 100, step = 1, value = 100, |
| 47 |
width = "100%"), |
| 48 |
p(paste("Different levels of severity for the color vision deficiency can be", |
| 49 |
"emulated. A value of 100% means maximum deficiency, a value of", |
| 50 |
"0% no deficiency at all. This value has to be adjusted before", |
| 51 |
"uploading the image.")) |
| 52 |
), |
| 53 |
|
| 54 |
# Input: file upload |
| 55 |
column(4, class = "col-file", |
| 56 |
withTags(div(class = "fa-large", icon("image", lib = "font-awesome"))), |
| 57 |
uiOutput("filebox"), |
| 58 |
htmlOutput("file_info") # Will be filled with the file upload element. |
| 59 |
), |
| 60 |
|
| 61 |
# Status information |
| 62 |
column(4, class = "col-status", |
| 63 |
withTags(div(class = "fa-large", icon("spinner", lib = "font-awesome"))), |
| 64 |
h2("Status"), |
| 65 |
textOutput("status"), |
| 66 |
h2("Tip"), |
| 67 |
p(paste("You can use the keys \"a\", \"s\", \"d\", \"f\", \"g\", \"h\"", |
| 68 |
"to navigate trough the different tabs.")), |
| 69 |
h3("Dark Mode"), |
| 70 |
checkboxInput("darkmode", "Activate dark mode (check figures on black background).", value = FALSE, width = NULL) |
| 71 |
) |
| 72 |
), |
| 73 |
|
| 74 |
|
| 75 |
# Horizontal line ---- |
| 76 |
|
| 77 |
tabPanel("Original", |
| 78 |
withTags(div(class = "img-single", |
| 79 |
uiOutput("imageorig"), |
| 80 |
h4("Original image as uploaded.")) |
| 81 |
) |
| 82 |
), |
| 83 |
tabPanel("Desaturated", |
| 84 |
withTags(div(class = "img-single", |
| 85 |
uiOutput("imagedesaturate"), |
| 86 |
h4("Reduction in chroma until no color is left (\"total color blindness\").", |
| 87 |
"Full desaturation yields to a pure grayscale image (only differences", |
| 88 |
"in luminance left).") |
| 89 |
)) |
| 90 |
), |
| 91 |
tabPanel("Deuteranope", |
| 92 |
withTags(div(class = "img-single", |
| 93 |
uiOutput("imagedeutan"), |
| 94 |
h4(paste("Most common color vision deficiency (6% of males/0.4% of females).", |
| 95 |
"Mutated green pigment which yeilds reduced sensitivity of the green", |
| 96 |
"area of the spectrum, also known as \"red-green color blindness\".")) |
| 97 |
)) |
| 98 |
), |
| 99 |
tabPanel("Protanope", |
| 100 |
withTags(div(class = "img-single", |
| 101 |
uiOutput("imageprotan"), |
| 102 |
h4("Mutated red pigment and less able to discriminate colors. Less common", |
| 103 |
"than deuteranomaly (1% of males, 0.01% of females). The deficiency also", |
| 104 |
"yields a darkening of red colors such that red colors can appear nearly black.") |
| 105 |
)) |
| 106 |
), |
| 107 |
tabPanel("Tritanope", |
| 108 |
withTags(div(class = "img-single", |
| 109 |
uiOutput("imagetritan"), |
| 110 |
h4("Mutated blue pigment which makes it difficult to distingiush between", |
| 111 |
"blueish and greenish hues, as well as between yellowish and reddish hues.", |
| 112 |
"tritanomaly is also known as \"blue-yellow color blindness\" but is relatively", |
| 113 |
"rare (0.01% for both, males and females).") |
| 114 |
)) |
| 115 |
), |
| 116 |
tabPanel("All", |
| 117 |
withTags(div(class="img-all", |
| 118 |
div(class = "img-container", uiOutput("all_imageorig"), h4("Original")), |
| 119 |
div(class = "img-container", uiOutput("all_imagedesaturate"), h4("Desaturated")), |
| 120 |
div(class = "img-container", uiOutput("all_imagedeutan"), h4("Deuteranope")), |
| 121 |
div(class = "img-container", uiOutput("all_imageprotan"), h4("Protanope")), |
| 122 |
div(class = "img-container", uiOutput("all_imagetritan"), h4("Tritanope")) |
| 123 |
)) |
| 124 |
), |
| 125 |
tabPanel("Info", class = "info-tab", icon = icon("info-circle", lib = "font-awesome"), |
| 126 |
htmlOutput("appInfo"), |
| 127 |
includeHTML("html/info.html"), |
| 128 |
includeHTML("html/appInfo.html") |
| 129 |
), |
| 130 |
selected = "Upload" |
| 131 |
) |
| 132 |
|
| 133 |
)) # End of shinyUI |