Skip to content

Commit

Permalink
Allow visiting the shop without an account
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielDavis05 committed Oct 16, 2023
1 parent f8ef7dc commit 47d39b8
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 5 deletions.
6 changes: 4 additions & 2 deletions leaderboard/shop/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,10 @@
<div style="font-size: 150%; position:absolute; top:100px; padding-bottom: 90px;">
<p id="error-display" class="error-text center-text"></p>
</div>
<div class="notices">
<p class="alert" id="alert-signin" style="display: none;">You are not signed in<span class="close-alert" onclick="this.parentElement.style.display='none';">&times;</span></p>
</div>
<div class="main">

<div id="side-cards" style="position: absolute; top: 0px;">
<div class="side-card pure-g">
<div class="card-content center-text">
Expand All @@ -70,7 +72,7 @@ <h3><p>Summary</p></h3>
<div>
<p id="account-description" class="center-text">Loading your account info...</p>
<a class="button-container" href="./past.html">
<button type="button" class="pure-button pure-button-primary">
<button type="button" id="past-purchase-button" class="pure-button pure-button-primary">
<div class="button-content">
<p class="button-text">View my items</p>
</div>
Expand Down
8 changes: 6 additions & 2 deletions scripts/leaderboard/store.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
document.addEventListener("DOMContentLoaded", async function () {
let userinfo;
await verifyUser().then(userInfo => {
userinfo = userInfo;
if (userInfo != null) {
if (userInfo.name == null) {
window.location.href = "/leaderboard/onboarding/claim.html";
}
} else {
window.location.href = "/401";
document.getElementById("alert-signin").style = "display: inline-flex;";
document.getElementById("account-description").innerText = "Sign in to see your account details.";
document.getElementById("past-purchase-button").classList.add("pure-button-disabled");
}


Expand All @@ -19,7 +23,7 @@ document.addEventListener("DOMContentLoaded", async function () {
} else {
latestPurchase = "Never";
}
document.getElementById("account-description").innerHTML = "Shekels: " + userInfo.shekels + "<br>Last Purchase: " + latestPurchase;
document.getElementById("account-description").innerText = "Shekels: " + userInfo.shekels + "<br>Last Purchase: " + latestPurchase;
document.getElementById("account-title").innerHTML = userInfo.name;
}
})
Expand Down
6 changes: 6 additions & 0 deletions style/leaderboard/store.css
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,12 @@
width: auto;
}

.notices {
position: absolute;
z-index: 100;
top: 90px;
}

@media screen and (max-width: 1700px) {
.side-card {
margin-left: -275px;
Expand Down
35 changes: 34 additions & 1 deletion style/theme.css
Original file line number Diff line number Diff line change
Expand Up @@ -241,4 +241,37 @@ a:hover {
-ms-transform: scale(0.9);
transform: scale(0.9);
}
}
}

.alert {
padding: 0 2vh 0 3vh;
background-color: var(--darkred);
color: var(--light);
display: inline-flex;
align-items: center;
justify-content: space-between;

border-style: dashed;
border-width: 2.5px;
border-radius: 10px;
border-color: var(--superdarkred);
}

.alert > p {
text-shadow: 2px 2px 3px var(--dark);
margin-right: 5vh;
}

.close-alert {
display: inline-flex;
align-items: center;
font-weight: bold;
font-size: 5vh;
cursor: pointer;
transition: 0.3s;
padding: 0;
}

.close-alert:hover {
color: var(--superdarkred);
}

0 comments on commit 47d39b8

Please sign in to comment.