-
Notifications
You must be signed in to change notification settings - Fork 0
/
account.html
299 lines (293 loc) · 13.9 KB
/
account.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
<html lang="en">
<head>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Nunito:ital,wght@0,200;0,300;0,400;0,600;0,700;0,800;0,900;1,200;1,300;1,400;1,600;1,700;1,800;1,900&display=swap" rel="stylesheet">
<link rel="icon" href="resources/icons/favicon.png" />
<link rel="stylesheet" href="styles/account.css" />
<link rel="stylesheet" href="styles/menu.css" />
<link rel="stylesheet" href="styles/footer.css" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta charset="UTF-8" />
<title>Account - Timed</title>
<script src="reload.js"></script>
<script src="resources/productPage/productDetails.js"></script>
<script src="https://www.gstatic.com/firebasejs/8.10.0/firebase-app.js"></script>
<script src="https://www.gstatic.com/firebasejs/8.10.0/firebase-firestore.js"></script>
<script src="https://www.gstatic.com/firebasejs/8.10.0/firebase-auth.js"></script>
<script src="https://js.stripe.com/v3/"></script>
</head>
<body>
<div id="bigdiv">
<div id="THEDIV">
<div id="TimedShopMainLogo">
<a href="./index.html"><img src="resources/icons/timedShopMainLogo.svg" alt="TIMED SHOP" /></a>
</div>
<div id="clockLogo">
<a href="./index.html"><img src="/resources/icons/clockLogo.svg" alt="TIMED SHOP"/></a>
</div>
<div id="menu">
<div id="row">
<a href="account.html" id="account" class="icons">
<img
alt="ACCOUNT"
src="/resources/icons/userPurple.svg"
onmouseover="this.src='resources/icons/userPurple.svg'"
onmouseout="this.src='resources/icons/user.svg'"
/>
</a>
<a href="favorites.html" id="favorites" class="icons">
<img
class="icon-badge-icon-favorites"
id="favoritesIMG"
alt="FAVORITES"
src="/resources/icons/favorites.svg"
onmouseover="this.src='resources/icons/favoritesPurple.svg'"
onmouseout="this.src='resources/icons/favorites.svg'"
/>
<div id="favoritesCount" class="icon-badge-favorites">6</div>
</a>
<a href="cart.html" id="cart" class="icon-badge-container" class="icons">
<img
class="icon-badge-icon"
alt="CART"
src="/resources/icons/cart.svg"
onmouseover="this.src='resources/icons/cartPurple.svg'"
onmouseout="this.src='resources/icons/cart.svg'"
/>
<div id="cartCount" class="icon-badge">6</div>
</a>
<a href="javascript:void(0);" id="expandMenu" class="icon" onclick="expandMenu()">
<img src="/resources/icons/expandMenu.svg">
</a>
</div>
<nav class="navMenu" id="navMenu">
<a href="sale.html?c=men&type=">SALE</a>
<a href="women.html?sortBy=newArrival&type=" id="women">WOMEN</a>
<a href="men.html">MEN</a>
<a>ABOUT</a>
<a href="register.html" id="register">REGISTER</a>
<a href="login.html" id="LogIn">LOG IN</a>
</nav>
</div>
<div id="mainDiv">
<div id="leftDiv">
<a id="accountTitle">ACCOUNT</a>
<div id="accountImgDiv">
<img src="resources/icons/user.svg" alt="userIcon" id="accountUserIcon">
<a id="accountName"></a>
<a id="signOut" onclick="signOut()">Sign Out</a>
</div>
<div id="divider"></div>
<div id="accountInfo">
<div id="firstNameDiv">
<a id="firstNameText">First Name: </a>
<a id="firstName"></a>
</div>
<div id="lastNameDiv">
<a id="lastNameText">Last Name: </a>
<a id="lastName"></a>
</div>
<div id=emailDiv>
<a id="emailText">Email: </a>
<a id="email"></a>
</div>
<div id="genderDiv">
<a id="genderText">Gender: </a>
<a id="gender"></a>
</div>
</div>
</div>
<div id="orders">
<a id="ordersTitle">YOUR ORDERS</a>
<div id="ordersDiv">
</div>
</div>
</div>
<div id="footer">
<div id="followUsDiv">
<a id="followUsText"> FOLLOW US </a>
<div id="iconsDiv">
<div id="iconsDivTop">
<a id="instagram" href="https://www.instagram.com">
<img
src="resources/icons/socials/instagram.svg"
alt="instagram"
/>
</a>
<a id="tiktok">
<img
src="resources/icons/socials/tiktok.svg"
alt="tiktok"
/>
</a>
</div>
<div id="iconsDivBottom">
<a id="twitter">
<img
src="resources/icons/socials/twitter.svg"
alt="twitter"
/>
</a>
<a id="facebook">
<img
src="resources/icons/socials/facebook.svg"
alt="facebook"
/>
</a>
</div>
</div>
</div>
<div id="helpAndInfoDiv">
<a id="helpAndInfoText"> HELP AND INFORMATION </a>
<div id="HILinks">
<a class="alink">Help</a>
<a class="alink">Privacy Policy</a>
<a class="alink">Terms & Conditions</a>
<a class="alink">Delivery</a>
<a class="alink">Return</a>
<a class="alink">FAQ</a>
</div>
</div>
<div id="timedShopDiv">
<a id="timedShopText">TIMED SHOP</a>
<div id="timedShopLinks">
<a class="alink">About</a>
<a class="alink">Contact</a>
</div>
</div>
</div>
</div>
<div id="loading">
<div class="wrapper">
<svg class="hourglass" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 120 206" preserveAspectRatio="none">
</svg>
</div>
</div>
</div>
<script>
function loader(loaded)
{
if(loaded)
{
setTimeout(()=>{
document.getElementById("loading").style.display = "none";
document.getElementById("THEDIV").style.display = "block";
}, 1000);
}
else
{
setTimeout(()=>{
document.getElementById("THEDIV").style.display = "none";
document.getElementById("loading").style.display = "flex";
}, 1000);
}
}
loader(false);
</script>
<script>
// Initialize Firebase
// TODO: Replace with your project's customized code snippet
var config = {
apiKey: "AIzaSyCkBvDNzSvorpEdz2twDAVI09x-FaVsDGg",
authDomain: "timedshop-a5a66.firebaseapp.com",
projectId: "timedshop-a5a66",
storageBucket: "timedshop-a5a66.appspot.com",
messagingSenderId: "172835576987",
appId: "1:172835576987:web:2e588ca7a77cc008affa3e",
measurementId: "G-3VCHXLRX5K",
};
firebase.initializeApp(config);
const db = firebase.firestore();
let cartCount = document.getElementById("cartCount");
var signOutPressed = false;
var w = window.innerWidth
|| document.documentElement.clientWidth
|| document.body.clientWidth;
firebase.auth().onAuthStateChanged((user) => {
if (user) {
var uid = user.uid;
console.log("logged in user: ", user.email);
document.getElementById("LogIn").setAttribute("style","display: none !important")
document.getElementById("register").setAttribute("style","display: none !important")
document.getElementById("account").style.display = "flex";
if(w > 768 && w <= 1024)
{
document.getElementById("navMenu").setAttribute("style", "width:50vw !important");
}
document.getElementById("favorites").style.display = "inline";
db.collection("users")
.doc(uid)
.get()
.then((data) => {
if(data.data().cart)
{
cartCount.innerText = data.data().cart.length;
}
else
{
cartCount.innerText = 0;
}
if(data.data().favorites)
{
favoritesCount.innerText = data.data().favorites.length;
}
else
{
favoritesCount.innerText = 0;
}
})
} else {
// User is signed out
setTimeout(()=>{
if(!signOutPressed)
window.open("/error.html","_self");
}, 500);
document.getElementById("account").setAttribute("style","display: none !important")
document.getElementById("favorites").setAttribute("style","display: none !important")
document.getElementById("LogIn").style.display = "flex";
console.log(w);
if(w > 768)
{
document.getElementById("row").setAttribute("style","margin-left: 0 !important; width: 10% !important");
}
document.getElementById("register").style.display = "flex";
if(localStorage.getItem("cartCount"))
{
document.getElementById("cartCount").innerText = localStorage.getItem("cartCount");
}
else
{
document.getElementById("cartCount").innerText = "0";
}
}
});
function signOut() {
signOutPressed = true;
firebase
.auth()
.signOut()
.then(() => {
// Sign-out successful.
loader(false);
setTimeout(()=>{
window.open("/login.html","_self");
}, 1000);
})
.catch((error) => {
window.open("/error.html","_self");
});
}
function expandMenu() {
console.log('coco')
var x = document.getElementById("navMenu");
if (x.className === "navMenu") {
x.className += " responsive";
} else {
x.className = "navMenu";
}
}
</script>
<script src="/resources/account/account.js"></script>
</body>
</html>