This repository has been archived by the owner on Apr 8, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathindex.html
299 lines (267 loc) · 14.7 KB
/
index.html
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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>c1-airbnb</title>
<!--for scaling across various devices-->
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="theme-color" content="#22313F">
<!--stylesheet-->
<link rel="stylesheet" type="text/css" href="styles.min.css">
<!--PapaParse for CSV to JSON conversion-->
<script src="https://cdnjs.cloudflare.com/ajax/libs/PapaParse/4.3.6/papaparse.min.js"></script>
<!--for visualizing the data (using Charts.js) -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.4.0/Chart.min.js"></script>
<!--Vuejs-->
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.5.3/vue.min.js" type="text/javascript"></script>
<!--link the functionality written in JS-->
<script defer type="text/javascript" src="app.js"></script>
<!--Font Awesome Icons loaded at the end of the body-->
</head>
<body>
<section id="loading-screen" class="hero is-light is-fullheight">
<div class="hero-body">
<div class="container has-text-centered">
<h1 class="title">
give us a few moments...
</h1>
<progress id="loading-bar" class="progress is-primary has-text-centered" value="5" max="100"></progress>
</div>
</div>
</section>
<script>
var loading_screen = document.getElementById("loading-screen");
setInterval(frame, 10);
function frame() {
if (progress.value >= 100) {
loading_screen.style.display = 'none';
document.getElementById("app").style.display = 'block';
}
}
</script>
<section id="app">
<nav class="navbar is-transparent">
<div class="navbar-brand">
<a class="navbar-item" href="#app">
<h1 class="title">c1-airbnb</h1>
</a>
</div>
<div class="navbar-menu">
<div class="navbar-end">
<div class="navbar-item">
<div class="field is-grouped">
<p class="control">
<a class="button is-primary is-outlined" href="https://github.com/konaraddio/c1-airbnb" target="_blank" rel="noopener">
<span class="icon">
<i class="fa fa-github"></i>
</span>
<span>Github</span>
</a>
</p>
</div>
</div>
</div>
</div>
</nav>
<section class="hero is-primary">
<div class="hero-body">
<div class="container has-text-centered">
<h1 class="title is-spaced">
Thinking about being an Airbnb Host?
</h1>
<h2 class="subtitle">
Checkout the data below and learn about hosting in San Francisco.
</h2>
</div>
</div>
</section>
<div class="section group">
<div class="col span_1_of_2">
<h1 class="title is-3 is-spaced"> Latest Trends</h1>
<div class="box">
<h1 class="title is-5 is-spaced">Average Number of Reviews Per Host vs Host Since Year</h1>
<canvas id="avg-rev-year-chart" class="chart"></canvas>
<br>
<h5 class="subtitle is-6 is-spaced">You know what they say; the best time to be an Airbnb host was 9 years ago.</h5>
</div>
<div class="box">
<h1 class="title is-5 is-spaced">Review Score Rating vs Square Feet</h1>
<canvas id="rating-squareft-plot" class="chart"></canvas>
<br>
<h5 class="subtitle is-6 is-spaced">
You don't need the largest place to be a successful Airbnb host!
In fact, most hosts don't specify their square feet.
</h5>
</div>
<div class="box">
<h1 class="title is-5 is-spaced">Price vs Bedrooms</h1>
<canvas id="bedrooms-price-plot" class="chart"></canvas>
<br>
<h5 class="subtitle is-6 is-spaced">
On average, the more bedrooms there are, the higher the price. If you got a lot of bedrooms, it may be best to keep the price relatively high.
</h5>
</div>
</div>
<div id="locate-me" class="col span_1_of_2">
<hr class="is-hidden-desktop">
<h1 class="title is-spaced">Tell us where you are!</h1>
<h3 class="subtitle is-5">And we'll tell you how much you could be making.</h3>
<div class="field has-addons">
<p class="control">
<a class="button is-dark" onclick="inputUserLocation();">
<span class="icon is-small">
<i class="fa fa-map-marker"></i>
</span>
<span>Locate Me</span>
</a>
</p>
<p class="control is-expanded">
<input id="lat-input" class="input" type="number" step="0.01" placeholder="Latitude">
</p>
<p class="control is-expanded">
<input id="long-input" class="input" type="number" step="0.01" placeholder="Longitude">
</p>
<p class="control">
<a id="go-btn" class="button is-primary" onclick="submitLatLongValues();">
Go!
</a>
</p>
</div>
<nav class="level is-mobile">
<div class="level-item is-hidden-mobile"></div>
<div class="level-item has-text-centered">
<div>
<p class="heading">Weekly Average Income</p>
<p id="weekly-avg-income" class="title">$_______</p>
</div>
</div>
<div class="level-item has-text-centered">
<div>
<p class="heading">Ideal Price Per Night</p>
<p id="ideal-price" class="title">$_______</p>
</div>
</div>
<div class="level-item is-hidden-mobile"></div>
</nav>
<hr>
<h1 class="title is-spaced">Popular Neighborhoods</h1>
<h3 class="subtitle is-5">Neighborhoods that average the most positive reviews.</h3>
<!--Create list of popular neighborhoods with Vuejs-->
<div id="neighborhood-list">
<div class="box level" v-for="n in neighborhoods">
<div class="level-left">
<h1 class="title is-5 is-spaced">{{n.name}}</h1>
</div>
<div class="level-right">
<p class="field">
<a class="button is-primary is-outlined" v-on:click="document.getElementById('modal-'+n.hashtag).classList = 'modal is-active'; setMap(n);">
<span class="icon">
<i class="fa fa-map-marker"></i>
</span>
<span>{{n.lat}}° N, {{n.long}}° W</span>
</a>
<a class="button is-link" v-bind:href="'https://twitter.com/hashtag/'+n.hashtag+'/?lang=en'" target="_blank" rel="noopener">
<span class="icon">
<i class="fa fa-twitter"></i>
</span>
</a>
<a class="button is-black" v-bind:href="'https://www.instagram.com/explore/tags/'+n.hashtag+'/?hl=en'" target="_blank" rel="noopener">
<span class="icon">
<i class="fa fa-instagram"></i>
</span>
</a>
</p>
</div>
<!--Modal with embedded map and info about neighborhood-->
<div v-bind:id="'modal-'+n.hashtag" class="modal">
<div class="modal-background" v-on:click="document.getElementById('modal-'+n.hashtag).classList = 'modal'"></div>
<div class="modal-content">
<div class="box">
<h1 class="title is-spaced">{{n.name}}</h1>
<div v-bind:id="'map-'+n.hashtag" class="map"></div>
<br>
<nav class="level is-mobile">
<div class="level-item"></div>
<div class="level-item has-text-centered">
<div>
<p class="heading">Weekly Average Income</p>
<p class="title">{{n.weekly_avg_income}}</p>
</div>
</div>
<div class="level-item has-text-centered is-hidden-mobile">
<div>
<p class="heading">Average Rating</p>
<p class="title">{{n.avg_rating}}%</p>
</div>
</div>
<div class="level-item has-text-centered">
<div>
<p class="heading">Ideal Price Per Night</p>
<p class="title">{{n.ideal_price_per_night}}</p>
</div>
</div>
<div class="level-item is-hidden-mobile"></div>
</nav>
</div>
</div>
<button class="modal-close is-large" aria-label="close" v-on:click="document.getElementById('modal-'+n.hashtag).classList = 'modal'"></button>
</div>
</div>
</div>
<hr>
<h1 class="title is-spaced">Let's Invest</h1>
<h3 class="subtitle is-5 is-spaced">Take a look at the properties worth purchasing.</h3>
<div id="best-properties-list">
<h3 class="subtitle is-5">If you invest $100 million into the following properties, and keep them listed everyday, you'll make your money back in <b>{{daysUntilBreakEven}}</b> days.</h3>
<div class="box level" v-for="p in properties">
<div class="level-left">
<h1 class="title is-5 is-spaced">{{truncate(p.name,30)}}</h1>
</div>
<div class="level-right">
<p class="field">
<a class="button is-primary is-outlined" v-on:click="document.getElementById('modal-'+p.id).classList = 'modal is-active'">
<span class="icon">
<i class="fa fa-image"></i>
</span>
<span>
{{p.display_cost}}
</span>
</a>
<a class="button is-dark is-outlined" v-bind:href="p.listing_url" target="_blank">
<span>
${{p.price}} per night
</span>
<span class="icon">
<i class="fa fa-external-link"></i>
</span>
</a>
</p>
</div>
<!--Modal with picture of property-->
<div v-bind:id="'modal-'+p.id" class="modal">
<div class="modal-background" v-on:click="document.getElementById('modal-'+p.id).classList = 'modal'"></div>
<div class="modal-content">
<div class="box">
<h1 class="title is-5 is-spaced">{{p.name}}</h1>
<figure class="image">
<img v-bind:src="p.picture_url"></img>
</figure>
</div>
</div>
<button class="modal-close is-large" aria-label="close" v-on:click="document.getElementById('modal-'+p.id).classList = 'modal'"></button>
</div>
</div>
<a class="button is-dark" style="width: 100%;" v-on:click="disabled?'':showAnotherProperty()" v-bind:disabled = "disabled ? true : false">Show me more</a>
</div>
</div>
</div>
</section>
<!--Font Awesome Icons-->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
<!--Google Maps API-->
<script async defer src="https://maps.googleapis.com/maps/api/js?key=AIzaSyAViFn5Z1pT5gG_lo9h5FZdCHNFMUq0-mQ"></script>
<div id="notification" class="has-text-centered notification is-warning">
<h5 class="subtitle is-5">Hmmm, something went wrong</h5>
</div>
</body>
</html>