-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathui.R
136 lines (127 loc) · 5.35 KB
/
ui.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
#
# This is the user-interface definition of a Shiny web application. You can
# run the application by clicking 'Run App' above.
#
# Find out more about building applications with Shiny here:
#
# http://shiny.rstudio.com/
#
library(shiny)
library(leaflet)
library(dplyr)
library(data.table)
library(maps)
library(lubridate)
library(DT)
library(shinyjs)
# Define UI for application that draws a histogram
shinyUI(fluidPage(
tags$title("The Life Path Project"),
tags$head(
includeScript("www/app.js")
),
tags$head(
# tags$link(rel = "shortcut icon", type="image/x-icon", href="http://daattali.com/shiny/img/favicon.ico"),
# Facebook OpenGraph tags
tags$meta(property = "fb:app_id", content = "298487377558708"),
tags$meta(property = "og:title", content = share$title),
tags$meta(property = "og:type", content = "website"),
tags$meta(property = "og:url", content = share$url),
tags$meta(property = "og:image", content = share$image),
tags$meta(property = "og:description", content = share$description),
# Twitter summary cards
tags$meta(name = "twitter:card", content = "summary"),
tags$meta(name = "twitter:site", content = paste0("@", share$twitter_user)),
tags$meta(name = "twitter:creator", content = paste0("@", share$twitter_user)),
tags$meta(name = "twitter:title", content = share$title),
tags$meta(name = "twitter:description", content = share$description),
tags$meta(name = "twitter:image", content = share$image)
),
useShinyjs(),
tags$head(
tags$script(src="getIP.js")
),
# textOutput("test"),
h2(HTML("The Life Path Project")),
br(),
sidebarLayout(
sidebarPanel(width = 4,
HTML("<p style=\"font-size:16px;\">This website generates a map of your life path.
Please report how long you spent in each city.</p>"),
HTML("<p style=\"font-size:16px;\">
You can either use the <b>dropdown menu</b> or <b>type in</b> the city names.
</p>"),
br(),
HTML("<p style=\"font-size:16px;\">
Please start with your birth city.
</p>"),
br(),
br(),
fluidRow(
column(width = 6,
selectizeInput(inputId = "country", label = "Country",
choices = c("", (world.cities %>% select(country.etc) %>%
arrange(country.etc) %>% unique())[[1]]),
selected = "")
),
column(width = 6,
selectizeInput(inputId = "city", label = "City",
choices = "",
selected = "")
)
),
br(),
br(),
dateRangeMonthsInput('dateRange',label = "Duration in selected city",
format = "mm/yyyy", start = "", end = "", max = Sys.Date(),
startview = "year"),
br(),
br(),
selectInput(inputId = "reason", label = "Reason",
choices = c("", "Residence", "Study", "Tourism", "Work", "Other")),
conditionalPanel(condition = "input.reason == 'Other'", {
textInput(inputId = "reasonOther", label = "Specify: ")
}),
br(),
br(),
actionButton(inputId = "add", label = "Add to map"),
htmlOutput(outputId = "nextInput"),
htmlOutput(outputId = "warning"),
br(),
br(),
br(),
br()
),
mainPanel(
leafletOutput(outputId = "map"),
uiOutput(outputId = "main"),
div(
fluidRow(
actionButton(inputId = "showCountries", label = "Show country names"),
actionButton(inputId = "qnaire", label = "Generate your map")
),
style="float:right"),
br(),
br(),
# conditionalPanel("input.gender != '' && input.age != ''",
absolutePanel(right = "2%",
downloadButton(outputId = "downloadMap", label = "Download your life trajectory map"),
br(),
br(),
# downloadButton(outputId = "downloadText", label = "Download your trajectory in .csv file")
# div(HTML(" <a id='gShare' href=\"https://plus.google.com/share?url=http://54.210.79.190:3838/traj_map\" target=\"_blank\">
# <img src=\"google.png\" width=\"50px\" height=\"50px\" alt=\"Google\" />
# </a>"), style = "float:right"),
# div(HTML(" <a id='tShare' href=\"https://twitter.com/share?url=http://54.210.79.190:3838/traj_map&text=Create%20my%20life%20path&hashtags=lifepath\" target=\"_blank\">
# <img src=\"twitter.png\" width=\"50px\" height=\"50px\" alt=\"Twitter\" />
# </a>"), style = "float:right"),
# div(HTML(" <a id='fShare' href='http://www.facebook.com/sharer.php?u=http://54.210.79.190:3838/traj_map' target='_blank'>
# <img src='facebook.png' width=\"50px\" height=\"50px\" alt='Facebook' />
# </a>"), style = "float:right"),
actionButton(inputId = "fbShareBtn", label = "Facebook Share", icon = icon("calendar")),
style = "float:right"
),
uiOutput(outputId = "popup")
)
)
))