-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.html
1983 lines (1713 loc) · 64.1 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
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!doctype html>
<html class="no-js" lang="en">
<head>
<meta charset="utf-8">
<title>Catalyze SV Project Tracker Map</title>
<!-- ! IMPORTANT ! -->
<!-- Update this version in wix/public/versionCheck and here to match when you change the code! -->
<meta name="version" content="1.0.0">
<!-- ! IMPORTANT ! -->
<meta name="description" content="Maps development projects in the Silicon Valley area and shares Catalyze SV project scores/evaluations for each">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/8.0.1/normalize.min.css" integrity="sha256-l85OmPOjvil/SOvVt3HnSSjzF1TUMyT9eV0c2BzEGzU=" crossorigin="anonymous" />
<!-- Google Fonts -->
<link rel="preconnect" href="https://fonts.gstatic.com/" crossorigin>
<link href="https://fonts.googleapis.com/css?family=Lato:400,700&display=swap" rel="stylesheet">
<!-- Mapbox -->
<link rel="preconnect" href="https://api.mapbox.com/" crossorigin>
<link rel="preconnect" href="https://events.mapbox.com/" crossorigin>
<script src='https://api.tiles.mapbox.com/mapbox-gl-js/v1.4.1/mapbox-gl.js'></script>
<link href='https://api.tiles.mapbox.com/mapbox-gl-js/v1.4.1/mapbox-gl.css' rel='stylesheet' />
<style>
/* Opinionated Defaults */
html{color:#222;font-size:1em;line-height:1.4}::-moz-selection{background:#b3d4fc;text-shadow:none}::selection{background:#b3d4fc;text-shadow:none}hr{display:block;height:1px;border:0;border-top:1px solid #ccc;margin:1em 0;padding:0}audio,canvas,iframe,img,svg,video{vertical-align:middle}fieldset{border:0;margin:0;padding:0}textarea{resize:vertical}@media print{*,*:before,*:after{background:transparent!important;color:#000!important;-webkit-box-shadow:none!important;box-shadow:none!important;text-shadow:none!important}a,a:visited{text-decoration:underline}a[href]:after{content:" (" attr(href) ")"}abbr[title]:after{content:" (" attr(title) ")"}a[href^="#"]:after,a[href^="javascript:"]:after{content:""}pre{white-space:pre-wrap!important}pre,blockquote{border:1px solid #999;page-break-inside:avoid}thead{display:table-header-group}tr,img{page-break-inside:avoid}p,h2,h3{orphans:3;widows:3}h2,h3{page-break-after:avoid}}
</style>
<style>
/* general styles */
* {
box-sizing: border-box;
}
a {
color: #27718e;
}
body {
overflow: hidden;
font-family: 'Lato',Arial,Helvetica Neue,Helvetica,sans-serif;
color: #283B62;
}
#map {
position:absolute; top:0; bottom:0; left: 0; right: 0; width:100%; z-index: 1;
transition: filter 0.2s;
will-change: filter;
}
/* layout */
.no-margin {
margin: 0;
}
/* Tooltips */
[tooltip]::before {
content: "";
position: absolute;
left:50%;
top: 100%;
/* margin-top: 8px; */
transform: translateX(-50%) translatey(-100%) rotate(-180deg);
border-width: 4px 6px 0 6px;
border-style: solid;
border-color: rgba(0, 0, 0, 0.7) transparent transparent transparent;
opacity: 0;
}
[tooltip]::after {
content: attr(tooltip);
position: absolute;
right: -7em;
top: 100%;
/* margin-top: 8px; */
transform: translateX(-50%) translateY(0%);
background: rgba(0, 0, 0, 0.7);
text-align: center;
color: #fff;
padding: 4px;
font-size: 1em;
min-width: 170px;
border-radius: 5px;
pointer-events: none;
opacity:0;
}
[tooltip]:hover::after,
[tooltip]:hover::before {
opacity:1
}
[tooltip]:active::after,
[tooltip]:active::before {
opacity:1
}
/* loading screen */
.loader {
position: absolute;
top: 0;
bottom: 0;
right: 0;
left: 0;
z-index: 200;
display: flex;
align-items: center;
justify-content: center;
background-color: #fff;
flex-direction: column;
text-transform: uppercase;
letter-spacing: 0.2em;
will-change: opacity;
}
.loader.hidden {
display: none;
}
.loader-title {
will-change: transform;
font-weight: 400;
}
.loader-title strong {
color: #F0B50C;
}
.lds-dual-ring {
display: inline-block;
width: 64px;
height: 64px;
will-change: transform;
}
.lds-dual-ring:after {
content: " ";
display: block;
width: 51px;
height: 51px;
margin: 1px;
border-radius: 50%;
border: 5px solid #48647c;
border-color: #48647c transparent #48647c transparent;
animation: lds-dual-ring 1.2s linear infinite;
}
/* Map View/List View picker menu */
.view-menu {
text-align: center;
position: absolute;
top: 0;
left: 0;
right: 0;
padding: 0.5em;
pointer-events: none;
z-index: 3;
transition: background-color 0.2s;
}
.view-menu.list {
background-color: #000;
pointer-events: auto;
}
.view-btn {
pointer-events: auto;
background: #fff;
border: 1px solid #ccc;
padding: 0.5em;
cursor: pointer;
}
.view-btn.active {
background: #283B62;
color: #fff;
text-shadow: -1px -1px #000;
border: 1px solid #000;
}
.view-btn:hover {
border: 1px solid #000;
opacity: 0.8;
}
.view-btn.active:hover {
opacity: 1;
}
/* Flyout sidebar where marker info is displayed */
.sidebar {
position: absolute;
right: 1em;
top: 1em;
width: 45%;
min-width: 12em;
transform: translateX(0);
transition: transform 0.25s ease-in-out;
z-index: 200;
}
.sidebar.hidden {
transform: translateX(200%);
}
.sidebar .content {
overflow-y: auto;
height: 100%;
max-height: 90vh;
border-top: 4px solid #617482;
position: relative;
background: #fff;
padding: 1em;
pointer-events: auto;
opacity: 1;
word-wrap: break-word;
box-shadow: 0px 1px 3px #00000069;
transition: height 0.3s ease-in-out,
max-height 0.3s ease-in-out;;
}
.sidebar .minimized {
height: 2.7em;
max-height: 2.7em;
transition: height 0.3s ease-in-out,
max-height 0.3s ease-in-out;;
}
.sidebar label {
font-weight: 600;
}
.sidebar .title {
padding-bottom: 0.5em;
border-bottom: 1px solid #ccc;
}
.sidebar .status {
border-bottom: 1px solid #ccc;
padding-bottom: 1.1em;
text-align: center;
display: flex;
justify-content: space-between;
}
.sidebar .status-tag {
background: #000;
padding: 0.3em 0.7em;
color: #fff;
margin-right: 0.5em;
display: inline-block;
}
.sidebar .status-detail {
margin-right: 0.5em;
max-width: 60%;
}
.sidebar .status-explain {
font-size: 0.8em;
font-style: italic;
position: relative;
}
.sidebar .address {
display: inline-block;
font-style: italic;
margin: 0 0.5em 0 0;
margin-right: 0.5em;
}
.sidebar .locate {
font-size: 0.9em;
background-color: #fff;
color: #666;
border: 1px solid #ccc;
padding: 0.2em 0.5em;
margin: 0.2em 0;
cursor: pointer;
}
.sidebar .locate:hover {
color: #000;
border-color: #000;
}
.sidebar .action-btn {
display: inline-block;
padding: 0.35em 1.2em;
border: 2px solid #1995a6;
border-radius: 1px;
text-decoration: none;
margin: 0 0.4em 0.5em 0;
background-color: transparent;
color: #1995a6;
text-align: center;
transition: background-color 0.2s, color 0.2s;
}
.sidebar .action-btn:hover {
color: #fff;
background-color: #1995a6;
}
.sidebar .controls {
position: absolute;
right: 0;
padding: 0.5em;
top: 0;
font-size: 1em;
}
.sidebar .close-btn,
.sidebar .minimize-btn {
color: #666;
border: 0;
cursor: pointer;
background-color: transparent;
}
.sidebar .close-btn:hover {
color: #27718e;
}
.sidebar .minimize-btn:hover {
color: #27718e;
}
/* map legend */
.legend {
position: absolute;
right: 0.5em;
bottom: 0.5em;
background: #ffffffad;
z-index: 2;
padding: 0.75rem 1em;
transition: opacity 0.2s ease-in-out;
box-shadow: 1px 1px 3px #00000069;
}
.legend ul {
margin: 0;
padding: 0;
list-style: none;
}
.legend span {
width: 1em;
height: 1em;
display: inline-block;
border-radius: 999px;
margin-right: 0.5em;
}
.legend-title {
margin: 0 0 0.5em;
font-style: italic;
font-weight: normal;
}
.legend .legend-icon {
grid-auto-flow: column;
align-items: center;
justify-content: start;
display: grid;
font-weight: bold;
}
.legend .legend-last-row {
margin-bottom: 0.5rem;
}
.legend .icon-marker {
background: url("data:image/svg+xml,%3Csvg id='Layer_1' data-name='Layer 1' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 23.8 29.8'%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bfill:none;stroke:%23555;stroke-linecap:round;stroke-miterlimit:10;stroke-width:2px;%7D%3C/style%3E%3C/defs%3E%3Cpath class='cls-1' d='M5.1,15.4a10,10,0,0,1-1-4.2C4.2,5.7,9.1,1.1,15,1.1S25.9,5.7,25.9,11.2a10,10,0,0,1-1,4.2' transform='translate(-3.1 -0.1)'/%3E%3Cline class='cls-1' x1='12' y1='28.8' x2='12' y2='28.8'/%3E%3Cpath class='cls-1' d='M5.1,15.4C7,19.5,13.4,25.9,15,28.9' transform='translate(-3.1 -0.1)'/%3E%3Cpath class='cls-1' d='M24.9,15.4C23,19.5,16.6,25.9,15,28.9h0' transform='translate(-3.1 -0.1)'/%3E%3C/svg%3E") no-repeat center/contain;
}
.legend .icon-star {
background: url("data:image/svg+xml,%3Csvg id='Layer_1' data-name='Layer 1' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30.06 28.58'%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bfill:none;stroke:%23555655;stroke-miterlimit:10;stroke-width:2px;%7D%3C/style%3E%3C/defs%3E%3Cpolygon class='cls-1' points='15.03 2.26 19.01 10.32 27.91 11.62 21.47 17.89 22.99 26.76 15.03 22.57 7.07 26.76 8.59 17.89 2.15 11.62 11.05 10.32 15.03 2.26'/%3E%3C/svg%3E") no-repeat center/contain;
}
/* Branding Attribution */
.branding {
position: absolute;
z-index: 1;
bottom: 0.5em;
left: 0.5em;
}
/* List View */
.list-view {
z-index: 2;
position: absolute;
overflow-y: auto;
bottom: 0;
/* equal to the height of the view menu bar background */
top: 3.25em;
width: 100%;
transform: translateX(-110%);
will-change: transform;
transition: transform 0.2s ease, filter 0.2s ease;
}
.list-header {
}
.list-view.active {
background: #fff;
transform: translateX(0);
}
.list-content {
list-style: none;
padding: 0;
margin: 0;
}
.list-content li {
display: grid;
justify-content: left;
align-items: center;
grid-auto-flow: column;
background: #fff;
padding: 1em;
border-bottom: 1px solid #ccc;
cursor: pointer;
}
.list-content .active,
.list-content .active:hover {
background: #b4dee4;
}
.list-content li:hover {
background: #ddd;
}
.ListItemTag {
display: inline-grid;
width: fit-content;
margin-right: 1rem;
}
.list-item-type {
text-transform: uppercase;
font-size: small;
text-align: center;
font-weight: bold;
background: #000000;
line-height: 1.9;
color: #eee;
}
.list-content .status {
background: #000;
padding: 0.3em 0.7em;
color: #fff;
}
.list-content .title {
display: inline-block;
margin-right: 1em;
}
.list-content .address {
font-style: italic;
margin: 0;
display: inline-block;
}
/* hover marker */
.marker {
cursor: pointer;
/* prevent mouseout event trigger of feature */
pointer-events: none;
will-change: opacity;
animation: fadeInOut ease 2s infinite;
-webkit-animation: fadeInOut ease 2s infinite;
}
/* hover popup */
.popup-title {
margin: 0;
}
.popup-developer-name {
margin: 0;
font-style: italic;
}
.popup-type {
margin: 0;
}
/* animation / effects */
.darken {
-webkit-filter: brightness(0.8);
filter: brightness(0.8);
}
.transparent {
opacity: 0.5;
}
.fade-in {
animation: fadeIn ease 0.2s;
-webkit-animation: fadeIn ease 0.2s;
}
.fade-out {
animation: fadeOut ease 0.2s;
-webkit-animation: fadeOut ease 0.2s;
}
.fade-out-slow {
animation: fadeOut ease 1s;
-webkit-animation: fadeOut ease 1s;
}
.fade-in-out {
animation: fadeInOut ease 2s infinite;
-webkit-animation: fadeInOut ease 2s infinite;
}
.slide-out-top {
animation: slideOutTop ease 1s;
-webkit-animation: slideOutTop ease 1s;
}
.slide-out-bottom {
animation: slideOutBottom ease 1s;
-webkit-animation: slideOutBottom ease 1s;
}
@keyframes slideOutTop{
0% {
transform: translateY(0);
}
100% {
transform: translateY(-100vh);
}
}
@keyframes slideOutBottom{
0% {
transform: translateY(0);
}
100% {
transform: translateY(100vh);
}
}
@keyframes lds-dual-ring {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
}
@keyframes fadeIn{
0% {
opacity:0;
}
100% {
opacity:1;
}
}
@-webkit-keyframes fadeIn {
0% {
opacity:0;
}
100% {
opacity:1;
}
}
@keyframes fadeOut{
0% {
opacity:1;
}
100% {
opacity:0;
}
}
@-webkit-keyframes fadeOut {
0% {
opacity:1;
}
100% {
opacity:0;
}
}
@keyframes fadeInOut{
0% {
opacity:1;
}
50% {
opacity: 0;
}
100% {
opacity:1;
}
}
@-webkit-keyframes fadeInOut {
0% {
opacity:1;
}
50% {
opacity: 0;
}
100% {
opacity:1;
}
}
/* Responsive Styles */
/* tablet/small screens */
@media screen and (max-width: 1200px) {
}
/* mobile */
@media screen and (max-width: 768px) {
.sidebar {
width: 100%;
left: 0;
right: 0;
top: 0;
}
.sidebar .content {
max-height: 100vh;
}
.sidebar .close-btn {
font-size: 1.1em;
}
}
</style>
<script>
// place to stash early sent data for use in the app
window._publicState = {
message: '',
parent_domain: '',
}
// message listener declared early as possible due to timing of parent message
window.onmessage = function(e){
const {data = '', origin = ''} = e;
// save the domain if sent from parent for later messaging
if (data.includes('PARENT=')) {
window._publicState.parent_domain = data.replace('PARENT=', '');
}
window._publicState.message = data;
};
</script>
<meta name="theme-color" content="#fafafa">
</head>
<body>
<!--[if IE]>
<p class="browserupgrade">You are using an <strong>outdated</strong> browser. Please <a href="https://browsehappy.com/">upgrade your browser</a> to improve your experience and security.</p>
<![endif]-->
<!-- Add your site or application content here -->
<section class="loader">
<h3 class="loader-title">Catalyze <strong>SV</strong></h3>
<div class="lds-dual-ring"></div>
<p class="fade-in-out">
Loading
</p>
</section>
<main id="map"></main>
<nav class="view-menu"></nav>
<article class="sidebar hidden">
<div class="content">
<div class="controls">
<button class="minimize-btn">[ - ]</button>
<button class="close-btn">CLOSE [ X ]</button>
</div>
<div class="info fade-in"></div>
</div>
</article>
<aside class="legend">
</aside>
<section class="branding"></section>
<section id="list" class="list-view">
<div class="list-header"></div>
</section>
<script>
// Avoid `console` errors in browsers that lack a console.
(function(){var e;var d=function(){};var b=["assert","clear","count","debug","dir","dirxml","error","exception","group","groupCollapsed","groupEnd","info","log","markTimeline","profile","profileEnd","table","time","timeEnd","timeline","timelineEnd","timeStamp","trace","warn"];var c=b.length;var a=(window.console=window.console||{});while(c--){e=b[c];if(!a[e]){a[e]=d}}}());
</script>
<script>
//
// CONSTANTS & STATE
//
const state = {
sidebar_open: false,
sidebar_min: false,
tabs: {},
popups: [],
listings: {},
active_tab: null,
active_project: null,
active_view: null,
active_marker: null,
preset_marker_name: '',
retries: 0,
}
const CODE_VERSION = document.querySelector('meta[name="version"]')?.getAttribute("content");
const CONSTANTS = {
// IMPORTANT! Update this version in wix/public and here to match when you change the code!
version: CODE_VERSION,
authorized_parent_domains: ['https://www.catalyzesiliconvalley.org', "https://editor.wix.com/"],
mapbox_key: 'pk.eyJ1IjoiY2F0YWx5emVzdiIsImEiOiJjazZ4d2RoN2gwa2QyM2tydnF6dG1zbjNrIn0.erXugBYot80KgmE2egMXCA',
mapbox_style_url: 'mapbox://styles/catalyzesv/ck85b2nvx09ba1ipcl1itwh9r',
css: {
map: 'map',
hidden: 'hidden',
transparent: 'transparent',
fade: 'fade-in',
fade_out: 'fade-out',
fade_out_slow: 'fade-out-slow',
slide_top: 'slide-out-top',
slide_bottom: 'slide-out-bottom',
darken: 'darken',
active: 'active',
list: 'list',
locate_btn: 'locate',
marker: 'marker',
minimized: 'minimized'
},
offsets: {
popup: [0,-15],
marker: [0,-14],
marker_workshop: [0, 0],
},
layers: {
projects: 'projects-catalyze-sv',
projects_source: 'Projects_Catalyze_SV',
dev_zones: 'dev-zones-catalyze-sv',
dev_zones_source: 'Dev_Zones_Catalyze_SV',
workshops: 'community-workshops',
workshops_source: 'Community_Workshops',
},
marker_size: '18px',
marker_svg: "%3Csvg xmlns='http://www.w3.org/2000/svg' width='auto' height='auto' viewBox='0 0 100 100' xml:space='preserve'%3E%3Cpath opacity='0.8' fill='%23fff' d='M91.532,39.844c-0.278-0.804-1.036-1.343-1.888-1.343H61.482l-9.597-27.159c-0.284-0.799-1.039-1.334-1.886-1.334 c-0.846,0-1.602,0.534-1.885,1.334l-9.598,27.159H10.357c-0.851,0-1.609,0.539-1.891,1.343c-0.278,0.804-0.018,1.698,0.651,2.226 l21.986,17.409l-9.84,27.846c-0.281,0.795-0.031,1.682,0.62,2.215c0.654,0.536,1.573,0.603,2.297,0.167l25.818-15.488l25.818,15.488 c0.317,0.191,0.677,0.285,1.032,0.285c0.447,0,0.898-0.152,1.266-0.452c0.651-0.533,0.901-1.42,0.62-2.215l-9.84-27.846 l21.992-17.409C91.553,41.542,91.813,40.648,91.532,39.844z'/%3E%3C/svg%3E",
projects_id_key: 'Project Name',
workshops_id_key: 'Project Name',
webpage_key: 'Website Page',
status_tip: 'Projects go through several phases. Developers submit applications to the City, get their design reviewed, do redesigns based on City & community feedback, resubmit proposals for review, and get approval (though can even redesign after approval)',
catalyze_logo_img: 'https://static.wixstatic.com/media/f632f7_4b161d28a60f4906aea2a55c528ce323~mv2.png/v1/fill/w_151,h_16/catalyzelogo.png',
max_icon: '+',
min_icon: '-'
}
const data = {
features: [],
features_map: {},
feature_types: {
project: 'project',
workshop: 'workshop'
},
// phase names and their associated colors
phases: {
'Withdrawn': '#A0A09F', // gray
'In Design': '#1995A6', // teal
'In Review': '#283B62', // navy
'Approved': '#38761D', // dark green
'Construction': '#8F2993', // purple
'Completed': '#F0B50C' // gold
},
// the order to output the legend items in
legend_order: [
'Withdrawn',
'In Design',
'In Review',
'Approved',
'Construction',
'Completed'
],
// view types in the view menu
view_types: [{
name: 'List View',
id: 'list'
}, {
name: 'Map View',
id: 'map'
}]
}
// dom elements references
const map_element = document.querySelector('#map');
const sidebar = document.querySelector('.sidebar');
const sidebar_content = document.querySelector('.sidebar .content');
const sidebar_info = document.querySelector('.info');
const close_btn = document.querySelector('.close-btn');
const min_btn = document.querySelector('.minimize-btn');
const legend = document.querySelector('.legend');
const branding = document.querySelector('.branding');
const list_view = document.querySelector('.list-view');
const view_menu = document.querySelector('.view-menu');
const loader = document.querySelector('.loader');
const loader_text = document.querySelector('.loader p');
const loader_title = document.querySelector('.loader .loader-title');
//
// Utilities
//
function format_to_only_letters_numbers(text = '') {
/*
Replaces any non-letter or number character like punctuation or spaces
in a string with empty.
Args: text (str) - the text to reformat
Return: reformatted text (str) - the string with all the extra stuff stripped out
*/
const matchingExclusions = /[^A-Za-z0-9]+/gm;
return text.replaceAll(matchingExclusions, '');
}
function fuzzy_match_strings(first_text = '', second_text = '') {
/*
Check whether 2 text strings match, excluding puncutation, white space, and casing.
Args: first_text (str) - 1st string to reformat and check
second_text (str) - 2nd string to reformat and check
Return: boolean - whether the 2 words match
*/
const normalized_first_text = format_to_only_letters_numbers(first_text.toLowerCase());
const normalized_second_text = format_to_only_letters_numbers(second_text.toLowerCase());
return normalized_first_text === normalized_second_text
}
function is_valid(input) {
/*
Returns truthy or falsey values based on the validation conditions being met.
If undefined, empty string, or 'na', it'll return falsey.
Args: input (str, undefined, null) - typically a string with the input text to validate
but can also be undefined or null if a blank input field
Return: truthey/falsey (booleanish) - true or one of several falsey values:
undefined, null, '', false, depending on the value inputted
*/
// check that input is defined
return !!(input &&
// check if na
input.toLowerCase() !== 'n/a')
}
//
// APP COMPONENTS
//
function generate_view_menu_item(view_type, id) {
/*
Creates a view menu navigation item to select the view type.
Args: view_type (str) - the type of view to show for this button
id (str) - the id of the view to retrieve in the event listener
Return: btn (obj) - button dom element w/ attributes set
*/
const btn = document.createElement('button');
btn.textContent = view_type;
btn.setAttribute('data-view-id', id);
btn.classList.add('view-btn');
return btn;
}
function LegendIcon(type = '') {
/*
Creates a dom element for an icon in the legend
Args: type (string) - what type of icon to display
Return: span dom element for the icon (obj)
*/
const list_item = document.createElement('li');
list_item.classList.add('legend-icon');
// create the legend title
const icon = document.createElement('span');
switch(type) {
case 'marker':
icon.classList.add('icon-marker');
list_item.textContent = 'Project';
break;
case 'star':
icon.classList.add('icon-star');
list_item.textContent = 'Workshop';
break;
default:
console.log('No icon set for that type', type);
return null
}
list_item.prepend(icon);
return list_item
}
function LegendTitle(text = '', name = '') {
/*
Creates a heading dom element for the map legend / key
Args: text (string) - text to display in the heading element
name (string) - class name to add to the elements class list
Return: heading h4 dom element with title (obj)
*/
const list_item = document.createElement('li');
// create the legend title
const title = document.createElement('h4');
title.classList.add('legend-title');
title.classList.add(name);
title.textContent = text;
list_item.append(title)
return list_item
}
function generate_legend(phases, order) {
/*
Creates and populates the dom elements for the map legend / key
Args: phases (obj) - obj containing name/color info for each label
order (array) - array of keys = phases showing order to output
Return: legend ul dom element (obj)
*/
const legend_list = document.createElement('ul');
const marker_icon = LegendIcon('marker');
const workshop_icon = LegendIcon('star');
workshop_icon.classList.add('legend-last-row');
legend_list.append(marker_icon, workshop_icon);
// create the legend title
const city_status_title = LegendTitle('Status With City', 'city-status');
legend_list.append(city_status_title);
order.forEach((current_item) => {
// create labels and key colors per legend item
let item_color = document.createElement('span');
item_color.style.backgroundColor = phases[current_item];
let list_item = document.createElement('li');
list_item.textContent = current_item;
// so the color appears first
list_item.prepend(item_color);
legend_list.append(list_item);
});
return legend_list
}
function ProjectInfo(marker_properties = {}) {
/*
Creates the sidebar info element dom contents for a project item.
Args: marker_properties (obj) - contains the properties for a given marker
feature_type (str) - if its a project or workshop so we use different templates
Return: template string literal (str) - html string to set the info template element to
*/
let { Address,
City,
State,
Phase,
"Project Name" : project_name,
"ZIP Code": Zip,
"Type of Project/ Overview" : project_type,
"Link to City Documents" : city_docs,
"Date Presented to PAC" : presented_date,
"Current Status in Catalyze SV" : catalyze_status,
"Next Public Meeting" : next_meet,
"Project Website" : website,
"Owner/Developer Name" : developer,
"Current Status With City" : phase_detail,
"Catalyze SV's Scorecard" : score,
"Catalyze SV's Letter" : catalyze_letter,