Skip to content

Commit 60cb2ce

Browse files
committedApr 5, 2020
Initial commit
0 parents  commit 60cb2ce

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+14997
-0
lines changed
 

‎api/user.js

+154
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,154 @@
1+
class User {
2+
constructor() {
3+
this.array = [];
4+
}
5+
}
6+
7+
// Create payload -- redundant everywhere, now in neat make() function
8+
let make = function(payload) {
9+
return { method: 'post',
10+
headers: { 'Accept': 'application/json', 'Content-Type': 'application/json' },
11+
body: JSON.stringify(payload) };
12+
}
13+
14+
/* Add user to mongo
15+
payload = { x : 0, y : 0, lat: 0.0, lon: 0.0 } */
16+
User.add = function(payload) {
17+
fetch("/api/add/user", make(payload))
18+
.then(promise => promise.json()).then(json => {
19+
if (json.success) {
20+
console.log(`User data was entered.`);
21+
// Update user array
22+
//console.log(json.userList);
23+
} else
24+
console.warn(`User could not be entered!`);
25+
});
26+
}
27+
28+
/* Get all users who logged into the app within last "10000" seconds
29+
payload = { secondsAgo : 10000 } */
30+
User.create = function(payload) {
31+
fetch("/api/get/users", make(payload))
32+
.then(promise => promise.json())
33+
.then(json => {
34+
if (json.success) {
35+
console.log(`User data was successfully fetched.`);
36+
// Update user array
37+
//console.log(json.userList);
38+
}
39+
else
40+
console.warn(`Users could not be fetched!`);
41+
});
42+
}
43+
44+
/* Create user in database
45+
payload = {
46+
username : "felix",
47+
email : "felix@thecat.net",
48+
first_name : "Felix",
49+
last_name : "Felicis",
50+
password : "Password123",
51+
type : "normal" } */
52+
User.create = function(payload) {
53+
fetch("/api/user/register", make(payload))
54+
.then(promise => promise.json())
55+
.then(json => {
56+
if (json.success)
57+
console.log(`User <${payload.username}> <${payload.email_address}> was successfully registered.`);
58+
else
59+
console.warn(`User with email address <${payload.email_address}> already exists!`);
60+
});
61+
}
62+
63+
64+
65+
/* Read (get) user from database:
66+
payload = {
67+
id: 1,
68+
token: "ABC123xyz" } */
69+
User.get = function(payload) {
70+
fetch("/api/user/get", make(payload)).then(promise => promise.json()).then(json => {
71+
//console.log(json);
72+
});
73+
}
74+
75+
/* Update user table in database
76+
payload = {
77+
id: 1,
78+
token: "ABC123xyz" } */
79+
User.update = function(payload) {
80+
fetch("/api/user/update", make(payload)).then(promise => promise.json()).then(json => {
81+
//console.log(json);
82+
});
83+
}
84+
85+
/* Delete user from database
86+
payload = {
87+
id: 1,
88+
token: "ABC123xyz" } */
89+
User.delete = function(payload) {
90+
fetch("/api/user/delete", make(payload)).then(promise => promise.json()).then(json => {
91+
console.log(json);
92+
});
93+
}
94+
95+
/* Login and create user session (if credentials match)
96+
payload = {
97+
username: "username",
98+
password: "password" } */
99+
User.login = function(payload) {
100+
fetch("/api/user/login", make(payload)).then(promise => promise.json()).then(json => {
101+
console.log(json);
102+
});
103+
}
104+
105+
/* Confirm verification code (optional)
106+
payload = {
107+
email: "felix@gmail.com",
108+
verification_code: "12345AbcXyz" } */
109+
User.verify = function(payload) {
110+
fetch("/api/user/verify", make(payload)).then(promise => promise.json()).then(json => {
111+
console.log(json)
112+
});
113+
}
114+
115+
// Authenticate user (check if session exists and receive back auth id)
116+
// token.id = "ABC123xyz"
117+
// token.timestamp = 12334545670
118+
// (token in session on server must match token.id from localStorage)
119+
User.authenticate = function(payload) {
120+
fetch("/api/user/authenticate", make(payload)).then(promise => promise.json()).then(json => {
121+
console.log(json);
122+
});
123+
}
124+
125+
/* Post a tweet
126+
payload = {
127+
id: 1,
128+
payload.message: "hello" } */
129+
User.tweet = function(payload) {
130+
fetch("/api/tweet/post", make(payload)).then(promise => promise.json()).then(json => {
131+
console.log(json);
132+
});
133+
}
134+
135+
/* Like a tweet
136+
payload = {id: 1,
137+
tweet_id: 100 } */
138+
User.like = function(payload) {
139+
fetch("/api/tweet/like", make(payload)).then(promise => promise.json()).then(json => {
140+
console.log(json);
141+
});
142+
}
143+
144+
/* Comment on a tweet
145+
payload = {id: 1,
146+
tweet_id: 100,
147+
message: "I'm right, #yourewrong"}; */
148+
User.comment = function(payload) {
149+
fetch("/api/tweet/comment", make(payload)).then(promise => promise.json()).then(json => {
150+
console.log(json);
151+
});
152+
}
153+
154+
export { User };

‎css/sunset.css

+150
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,150 @@
1+
.lds-roller { position: absolute; top: 100px; left: 100px; }
2+
.lds-roller {
3+
display: inline-block;
4+
position: relative;
5+
width: 80px;
6+
height: 80px;
7+
}
8+
.lds-roller div {
9+
animation: lds-roller 1.2s cubic-bezier(0.5, 0, 0.5, 1) infinite;
10+
transform-origin: 40px 40px;
11+
}
12+
.lds-roller div:after {
13+
content: " ";
14+
display: block;
15+
position: absolute;
16+
width: 7px;
17+
height: 7px;
18+
border-radius: 50%;
19+
background: #fff;
20+
margin: -4px 0 0 -4px;
21+
}
22+
.lds-roller div:nth-child(1) {
23+
animation-delay: -0.036s;
24+
}
25+
.lds-roller div:nth-child(1):after {
26+
top: 63px;
27+
left: 63px;
28+
}
29+
.lds-roller div:nth-child(2) {
30+
animation-delay: -0.072s;
31+
}
32+
.lds-roller div:nth-child(2):after {
33+
top: 68px;
34+
left: 56px;
35+
}
36+
.lds-roller div:nth-child(3) {
37+
animation-delay: -0.108s;
38+
}
39+
.lds-roller div:nth-child(3):after {
40+
top: 71px;
41+
left: 48px;
42+
}
43+
.lds-roller div:nth-child(4) {
44+
animation-delay: -0.144s;
45+
}
46+
.lds-roller div:nth-child(4):after {
47+
top: 72px;
48+
left: 40px;
49+
}
50+
.lds-roller div:nth-child(5) {
51+
animation-delay: -0.18s;
52+
}
53+
.lds-roller div:nth-child(5):after {
54+
top: 71px;
55+
left: 32px;
56+
}
57+
.lds-roller div:nth-child(6) {
58+
animation-delay: -0.216s;
59+
}
60+
.lds-roller div:nth-child(6):after {
61+
top: 68px;
62+
left: 24px;
63+
}
64+
.lds-roller div:nth-child(7) {
65+
animation-delay: -0.252s;
66+
}
67+
.lds-roller div:nth-child(7):after {
68+
top: 63px;
69+
left: 17px;
70+
}
71+
.lds-roller div:nth-child(8) {
72+
animation-delay: -0.288s;
73+
}
74+
.lds-roller div:nth-child(8):after {
75+
top: 56px;
76+
left: 12px;
77+
}
78+
@keyframes lds-roller {
79+
0% {
80+
transform: rotate(0deg);
81+
}
82+
100% {
83+
transform: rotate(360deg);
84+
}
85+
}
86+
87+
* { background: black !important; color: #666;}
88+
89+
body { margin: auto; max-width: 1400px; }
90+
main, body { }
91+
nav,aside,section,article,footer {
92+
padding: 8px;
93+
margin: 8px;
94+
95+
}
96+
aside { min-width: 300px; }
97+
article { max-width: 1000px; }
98+
main { display: flex; }
99+
body { display: flex; }
100+
.row { display: flex; flex-direction: row; }
101+
.col { display: flex; flex-direction: column; }
102+
* { font-size: 22px; font-family: Arial; line-height: 26px; color: #888; }
103+
h1 { font-family: verdana; font-weight: normal; color: #ccc; font-size: 50px; line-height: 42px; }
104+
h2 { font-family: verdana; font-weight: normal; color: #eee; font-size: 20px; line-height: 22px; }
105+
.separator { height: 32px; }
106+
.short-separator { height: 16px; }
107+
.shortest-separator { height: 7px; }
108+
109+
.noselect {
110+
-webkit-touch-callout: none; /* iOS Safari */
111+
-webkit-user-select: none; /* Safari */
112+
-khtml-user-select: none; /* Konqueror HTML */
113+
-moz-user-select: none; /* Old versions of Firefox */
114+
-ms-user-select: none; /* Internet Explorer/Edge */
115+
user-select: none; /* Non-prefixed version, currently
116+
supported by Chrome, Opera and Firefox */ }
117+
118+
input[type="filef"], input[type="submfit"] {
119+
display: none;
120+
}
121+
122+
.upload-button, .custom-file-upload {
123+
border: 1px solid #ccc;
124+
display: inline-block;
125+
padding: 6px 12px;
126+
cursor: pointer;
127+
}
128+
129+
#sunset * { line-height: 64px; }
130+
131+
input[type='file']:after {
132+
content: "Upload your sunset photo";
133+
}
134+
135+
a { color: teal; }
136+
#msgc { background: #eee; margin-bottom: 8px; padding: 8px; line-height: 22px;}
137+
#msg, #msg * { font-size: 14px; font-family: verdana; }
138+
#loading { background: transparent !important; position: absolute; top: 180px; left: 420px; display: block; }
139+
.note { bottom: -32px; left: 16px; display: block; line-height: 32px;
140+
width: 874px; background: black; position: relative; padding-left: 16px; }
141+
.note, .note * { color: white !important; font-family: verdana; font-size: 14px; }
142+
#locs { color: #00ff96 !important; }
143+
#suns { color: yellow !important; }
144+
h1 { font-size: 24px !important; margin: 0; color: #444; margin-top: 24px; }
145+
#timeline { display: flex; display: flex; flex-wrap: wrap; align-items: flex-start; }
146+
sunsetbox { width: 220px; height: 150px; display: block; color: #666; margin: 16px !important; background-image: url('https://www.infinitesunset.app/static/empty-sunset.png') !important; }
147+
.custom-file-upload { border: 1px solid #333; width: 250px; font-size: 40px; background: yellow; color: orangered; text-align: center; line-height: 40px; }
148+
.upload-button { border: 1px solid #333; width: 200px; font-size: 40px; background: orangered; color: yellow; text-align: center; line-height: 40px; }
149+
label { display: inline-block; margin: 10px; }
150+
form { display: flex; flex-direction: row; }

0 commit comments

Comments
 (0)
Please sign in to comment.