-
Notifications
You must be signed in to change notification settings - Fork 1
/
beyous.html
276 lines (248 loc) · 12 KB
/
beyous.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
<!doctype html>
<html>
<head>
<link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/flowbite.min.css" />
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css" />
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap" />
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/tw-elements/dist/css/index.min.css" />
<script src="https://cdn.tailwindcss.com"></script>
<script src="https://cdn.plot.ly/plotly-2.14.0.min.js"></script>
<script src="https://unpkg.com/[email protected]/dist/flowbite.js"></script>
<script>
tailwind.config = {
theme: {
extend: {
darkMode: 'class',
colors: {
'regal-blue': '#243c5a',
/*
nord0->nord3, dark colors,"polar night"
nord4->nord6, light colors, "snow storm"
nord7 = pale green
nord8 = blue
nord9 = blue
nord10 = blue
nord11 = red
nord12 = orange
nord13 = yellow
nord14 = green
nord15 = purple
*/
'nord0': '#2e3440',
'nord1': '#3b4252',
'nord2': '#434c5e',
'nord3': '#4c566a',
'nord4': '#d8dee9',
'nord5': '#e5e9f0',
'nord6': '#eceff4',
'nord7': '#8fbcbb',
'nord8': '#88c0d0',
'nord9': '#81a1c1',
'nord10': '#5e81ac',
'nord11': '#bf616a',
'nord12': '#d08770',
'nord13': '#ebcb8b',
'nord14': '#a3be8c',
'nord15': '#b48ead'
},
fontFamily: {
// sans: ['Inter var', ...defaultTheme.fontFamily.sans]
}
}
}
}
</script>
<link rel="stylesheet" href="https://rsms.me/inter/inter.css">
</head>
<body class="flex flex-col bg-nord0">
<!-- This example requires Tailwind CSS v2.0+ -->
<nav class="bg-nord0 divide-y">
<div class="mx-auto max-w-7xl px-2 sm:px-6 lg:px-8">
<div class="relative flex h-20 items-center justify-between">
<div class="absolute inset-y-0 left-0 flex items-center sm:hidden">
<!-- Mobile menu button-->
</div>
<div class="flex flex-1 items-center justify-center sm:items-stretch sm:justify-start">
<div class="flex flex-shrink-0 items-center">
<img class="block h-8 w-auto lg:hidden" src="beyoulogo.svg" alt="Your Company">
<img class="hidden h-8 w-auto lg:block" src="beyoulogo.svg" alt="Your Company">
<h1 class="text-nord4 px-3 py-1 text-3xl">BeYou.</h1>
</div>
<div class="hidden sm:ml-6 sm:block">
<div class="flex flex-1 space-x-4 items-center justify-center">
<!-- Current: "bg-gray-900 text-nord4", Default: "text-nord5 hover:bg-nord1 hover:text-nord4" -->
<a href="beyous.html" class="bg-nord3 text-nord4 m-2 px-3 py-2 rounded-md text-sm font-medium"
aria-current="page">See Beyous</a>
<a href="find.html"
class="text-nord5 hover:bg-nord1 hover:text-nord4 px-3 py-2 rounded-md text-sm font-medium">Find
BeYous</a>
</div>
</div>
</div>
<div class="absolute inset-y-0 right-0 flex items-center pr-2 sm:static sm:inset-auto sm:ml-6 sm:pr-0">
<button class="flex flex-cols">
<a href="index.html"
class="flex flex-cols items-center space-x-4 text-nord5 hover:bg-nord1 hover:text-nord4 px-3 py-2 rounded-md text-sm font-medium">Add
Your BeYou
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5"
stroke="currentColor" class="w-6 h-6 ml-2 text-nord5">
<path stroke-linecap="round" stroke-linejoin="round" d="M17.25 8.25L21 12m0 0l-3.75 3.75M21 12H3" />
</svg>
</a>
</button>
</div>
</div>
</div>
<!-- Mobile menu, show/hide based on menu state. -->
<hr class="space-y-1 border-1 border-nord3">
</nav>
<!-- NAVBAR 2.0 -->
<div class="dark bg-nord0 pt-10 rounded-md py-2 bg-nord-7 flex items-center justify-center" role="group">
<button id="Sad" type="button"
class="dark py-2 px-4 text-sm font-medium text-gray-900 bg-white border-t border-b border-gray-200 hover:bg-nord3 hover:text-nord4 focus:z-10 focus:ring-2 dark:bg-gray-700 dark:border-gray-600 dark:text-white dark:hover:text-white dark:hover:hover:bg-nord10 dark:focus:text-white rounded-l-md">
BeSads
</button>
<button id="Down" type="button"
class="dark py-2 px-4 text-sm font-medium text-gray-900 bg-white border-t border-b border-gray-200 hover:bg-nord3 hover:text-nord4 focus:z-10 focus:ring-2 dark:bg-gray-700 dark:border-gray-600 dark:text-white dark:hover:text-white dark:hover:bg-nord15 dark:focus:text-white">
BeDowns
</button>
<button id="content" type="button"
class="dark py-2 px-4 text-sm font-medium text-gray-900 bg-white border-t border-b border-gray-200 hover:bg-nord3 hover:text-nord4 focus:z-10 focus:ring-2 dark:bg-gray-700 dark:border-gray-600 dark:text-white dark:hover:text-white dark:hover:bg-nord0 dark:focus:text-white">
BeContents
</button>
<button id="happy" type="button"
class="dark py-2 px-4 text-sm font-medium text-gray-900 bg-white border-t border-b border-gray-200 hover:bg-nord3 hover:text-nord4 focus:z-10 focus:ring-2 dark:bg-gray-700 dark:border-gray-600 dark:text-white dark:hover:text-white dark:hover:bg-nord14 dark:focus:text-white">
BeHappys
</button>
<button id="ecstatic" type="button"
class="dark py-2 px-4 text-sm font-medium text-gray-900 bg-white border-t border-b border-gray-200 hover:bg-nord3 hover:text-nord4 focus:z-10 focus:ring-2 dark:bg-gray-700 dark:border-gray-600 dark:text-white dark:hover:text-white dark:hover:bg-nord13 dark:focus:text-white rounded-r-md">
BeEcstatics
</button>
</div>
<div class="flex my-20 flex-col justify-center items-center border-3 bg-nord0">
<div class="w-4/5 h-4/5 px-20 flex flex-col space-y-5">
<!-- BODY BELOW -->
<!-- SIDEBAR -->
<!-- <div class="w-1/4">
<div class="overflow-y-auto rounded bg-nord4 text-center">
<ul>
<a href=""><li class="py-5 rounded ease-in-out duration-200 hover:bg-nord13">
BeEcstatics
</li></a>
<a href=""><li class="py-5 rounded ease-in-out duration-200 hover:bg-nord14">
BeHappys
</li></a>
<a href=""><li class="py-5 rounded ease-in-out duration-200 hover:bg-nord2">
BeContents
</li></a>
<a href=""><li class="py-5 rounded ease-in-out duration-200 hover:bg-nord15">
BeDowns
</li></a>
<a href=""><li class="py-5 rounded ease-in-out duration-200 hover:bg-nord10">
BeSad
</li></a>
</ul>
</div>
</div> -->
<!-- TITLE -->
<h1 id="typeText"
class="font-extrabold text-transparent text-6xl bg-clip-text bg-gradient-to-r from-nord4 to-nord5">
See BeHappys.
</h1>
<div id="beYouGrid" class="w-full grid grid-cols-2 gap-4"></div>
</div>
</div>
<hr class="space-y-1 border-1 border-nord3">
<footer class="h20 py-5 flex flex-1 flex-col justify-center items-center text-center">
<h2 class="text-nord4 text-l text-medium">Made with ❤️ by the <b>bonobo</b> team at HackCMU.</h2>
</footer>
<script type="module">
import { initializeApp } from "https://www.gstatic.com/firebasejs/9.10.0/firebase-app.js";
import { getDatabase, push, set, child, ref, onValue} from "https://www.gstatic.com/firebasejs/9.10.0/firebase-database.js";
const firebaseConfig = {
apiKey: "AIzaSyAHRbCmE_ynGBxlW0x5J9u9H3XBOrFhedA",
authDomain: "beyou-21d2f.firebaseapp.com",
databaseURL: "https://beyou-21d2f-default-rtdb.firebaseio.com",
projectId: "beyou-21d2f",
storageBucket: "beyou-21d2f.appspot.com",
messagingSenderId: "718679255077",
appId: "1:718679255077:web:a5d19b54e474a1d968b7cc",
measurementId: "G-FVD7M6CJ1Z"
};
const app = initializeApp(firebaseConfig);
// So we don't add duplicate posts
let current_posts_added = [];
// So we can access the current type in findPost / onValue
var types = ["See BeSads.", "See BeDowns.", "See BeContents.", "See BeHappys.", "See BeEcstatics."];
var type = document.getElementById("typeText");
var active = document.getElementById("content");
var postDatabase = getDatabase(app);
function findPost() {
current_posts_added = [];
const happyPost = ref(postDatabase);
var posts = child(happyPost, 'Posts');
var grid = document.getElementById("beYouGrid");
grid.innerHTML = "";
onValue(posts, (snapshot) => {
snapshot.forEach(function (childSnapshot) {
// get current "be" subsection
let type_subsection = type.innerText.substring(4, type.innerText.length - 2) + ".";
console.log("----------------");
console.log(childSnapshot.val().text);
console.log(childSnapshot.val().type, childSnapshot.key);
console.log(type_subsection);
console.log(current_posts_added);
if ((childSnapshot.val().type == type_subsection) && (!current_posts_added.includes(childSnapshot.key))) {
console.log("SUCCESS");
current_posts_added.push(childSnapshot.key);
// Adding the html component
grid.innerHTML += "<a href='#' class='dark bg-nord12 block w-full p-6 bg-nord1 rounded-lg border border-nord3 shadow-md hover:bg-nord2 dark:bg-nord1 dark:border-nord3 dark:hover:bg-nord3'> <h5 class='mb-2 text-2xl font-bold tracking-tight text-transparent text-3xl bg-clip-text bg-gradient-to-r from-nord8 to-nord9'>" + childSnapshot.val().text + "</h5> <p class='font-normal text-gray-700 dark:text-gray-400'>" + childSnapshot.val().time + "</p> </a>";
}
});
});
}
// When we submit a post:
if (location.search.split("=")[1] < 20) {
type.innerText = types[0];
findPost("BeSad.");
} else if (location.search.split("=")[1] < 40) {
type.innerText = types[1];
findPost("BeDown.");
} else if (location.search.split("=")[1] < 60) {
type.innerText = types[2];
findPost("BeContent.");
} else if (location.search.split("=")[1] < 80) {
type.innerText = types[3];
findPost("BeHappy.");
} else if (location.search.split("=")[1] < 100) {
type.innerText = types[4];
findPost("BeEcstatic.");
} else {
type.innerText = types[3];
findPost("BeHappy.");
}
document.getElementById("Sad").addEventListener("click", function () {
document.getElementById("typeText").innerText = "See BeSads.";
findPost("BeSad.");
});
document.getElementById("Down").addEventListener("click", function () {
document.getElementById("typeText").innerText = "See BeDowns.";
findPost("BeDown.");
});
document.getElementById("content").addEventListener("click", function () {
document.getElementById("typeText").innerText = "See BeContents.";
findPost("BeContent.");
});
document.getElementById("happy").addEventListener("click", function () {
document.getElementById("typeText").innerText = "See BeHappys.";
findPost("BeHappy.");
});
document.getElementById("ecstatic").addEventListener("click", function () {
document.getElementById("typeText").innerText = "See BeEcstatics.";
findPost("BeEcstatic.");
});
</script>
</body>
</html>