Skip to content

Commit

Permalink
FIX
Browse files Browse the repository at this point in the history
  • Loading branch information
GO-viper7 committed Sep 4, 2022
1 parent 9548692 commit 97a3957
Show file tree
Hide file tree
Showing 12 changed files with 129 additions and 116 deletions.
1 change: 1 addition & 0 deletions admins.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
[
{"userId": "761167079171686400"},
{"userId": "225622200999215104"},
{"userId": "268380828734717952"},
{"userId": "532177714203852800"},
Expand Down
1 change: 1 addition & 0 deletions public/css/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ body {
#container {
height: 100vh;
background-size: cover !important;
background: none;
display: flex;
justify-content: center;
align-items: center;font-family: 'Audiowide', cursive;
Expand Down
15 changes: 4 additions & 11 deletions public/css/response.css
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ body, html {
overflow-y: hidden;
font-family: 'Audiowide', cursive;
font-weight: 800;
background-color: #6e6565;
}


Expand All @@ -16,7 +17,7 @@ body, html {
right: 0;
z-index: 1;
background-size: cover;
background-image: url('https://cdn.discordapp.com/attachments/946793823730794588/979766152320401428/unknown-12.png');
background-color:rgba(0,0,0, 0.4);
background-repeat: no-repeat;
width: 100%;
height: 100%;
Expand Down Expand Up @@ -121,8 +122,7 @@ body, html {
}


::-webkit-scrollbar-thumb {
background: #c35eb7;
::-webkit-scrollbar-thumb {
border-radius: 10px;
}

Expand All @@ -139,7 +139,6 @@ body, html {
background-color: rgba(0,0,0, 0.4);
color: white;
font-weight: bold;
border: 3px solid #c35eb7;
margin-top: 60px;
margin-left: 140px;
z-index: 2;
Expand All @@ -154,15 +153,13 @@ body, html {

#gen {
transition: 0.3s ease;
border-color:#c35eb7;
transition: 0.3s ease;
width: 340px;
border-style: solid;
font-size: 25px;
border-radius: 10px;
background-color: transparent;
cursor: pointer;
color: #c35eb7;
padding-left: 15px;
padding-top: 10px;
padding-bottom: 10px;
Expand All @@ -171,25 +168,22 @@ body, html {
}

#gen:hover {
background-color: #c35eb7;
color: #fff;
}

#disp {
display: none; font-size: 25px; color: #c35eb7;
display: none; font-size: 25px;
}

#home {
transition: 0.3s ease;
border-color:#c35eb7;
transition: 0.3s ease;
width: 340px;
border-style: solid;
font-size: 25px;
border-radius: 10px;
background-color: transparent;
cursor: pointer;
color: #c35eb7;
padding-left: 15px;
padding-top: 10px;
padding-bottom: 10px;
Expand All @@ -198,7 +192,6 @@ body, html {
}

#home:hover {
background-color: #c35eb7;
color: #fff;
}

Expand Down
12 changes: 12 additions & 0 deletions public/css/shop.css
Original file line number Diff line number Diff line change
Expand Up @@ -265,4 +265,16 @@

.delete {
background:#e94b68 !important;
}

#alertS {
display: none;
width: 100%;
height: 70px;
color: var(--text);
font-size: 1.7rem;
font-weight: 800;
margin-top: 20px;
letter-spacing: 2px;
text-align: center;
}
2 changes: 1 addition & 1 deletion public/js/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
$(function() {

var images = ['https://cdn.discordapp.com/attachments/946793823730794588/979766152320401428/unknown-12.png'];
var images = [''];

$('#container').append('<style>#container, .acceptContainer:before, #logoContainer:before {background: url(' + images[Math.floor(Math.random() * images.length)] + ') center fixed }');

Expand Down
45 changes: 31 additions & 14 deletions public/js/shop.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,40 @@
let btn = document.querySelector(".switch");

btn.addEventListener('click', () => {
document.getElementById("mode").innerHTML = "Admin Mode";
let wrapper = document.querySelector(".admin-buttons");
wrapper.style.display = "flex";
btn.style.display = "none";
if(btn.innerHTML == 'Admin Mode'){

document.getElementById("mode").innerHTML = "Admin Mode";
let wrapper = document.querySelector(".admin-buttons");
wrapper.style.display = "flex";
btn.innerHTML = 'User Mode'

let claimText = document.querySelectorAll(".claim");
let itemButtons = document.querySelectorAll(".itemButtons");

claimText.forEach(element => {
element.style.display = "none"
});

itemButtons.forEach(element => {
element.style.display = "flex";
})
}else {
document.getElementById("mode").innerHTML = "User Mode";
let wrapper = document.querySelector(".admin-buttons");
wrapper.style.display = "none";
btn.innerHTML = 'Admin Mode'

let claimText = document.querySelectorAll(".claim");
let itemButtons = document.querySelectorAll(".itemButtons");
let claimText = document.querySelectorAll(".claim");
let itemButtons = document.querySelectorAll(".itemButtons");

claimText.forEach(element => {
element.style.display = "none"
});
claimText.forEach(element => {
element.style.display = "flex"
});

itemButtons.forEach(element => {
element.style.display = "flex";
})
itemButtons.forEach(element => {
element.style.display = "none";
})
}
})

// customize panel and addItem box
Expand Down Expand Up @@ -91,5 +110,3 @@ closeMenu.addEventListener("click", () => {
})




57 changes: 3 additions & 54 deletions routes/profile.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,9 @@ router.get('/profile', async (req, res, next) => {



router.post('/profile', async (req, res, next) => {
router.post('/settings', async (req, res, next) => {
try {
console.log(req.body)
const user = await oauth.getUser(jwt.verify(req.cookies.get('key'), process.env.jwtSecret))
profileSchema.findOneAndUpdate({userId: user.id}, {
wallet: req.body.wallet,
Expand All @@ -79,7 +80,7 @@ router.post('/profile', async (req, res, next) => {
//console.log(data)
}
})
res.redirect('/profile')
res.redirect('/settings')
}catch(error) {
console.log(error)
res.redirect('/logout')
Expand All @@ -89,56 +90,4 @@ router.post('/profile', async (req, res, next) => {



router.post('/settings', async (req, res, next) => {
try {
const user = await oauth.getUser(jwt.verify(req.cookies.get('key'), process.env.jwtSecret))
profileSchema.countDocuments({userId: user.id}, async function (err, cnt){
if (err) {
console.log(err)
}
if(cnt == 0) {
await new profileSchema({
userId: user.id,
octaCreds: 0,
wallet: req.body.wallet,
name: req.body.name,
gender: req.body.gender,
country: req.body.country,
zipCode: req.body.zip,
houseNumber: req.body.house,
city: req.body.city,
streetName: req.body.street,
}).save()
}
else {
profileSchema.findOneAndUpdate({userId: user.id}, {
wallet: req.body.wallet,
name: req.body.name,
gender: req.body.gender,
country: req.body.country,
zipCode: req.body.zip,
houseNumber: req.body.house,
city: req.body.city,
streetName: req.body.street,
}, null, async (err, data) => {
if (err) {
console.log(err)
}
else {
//console.log(data)
}
})
}
})
res.redirect('/')
}catch(error) {
console.log(error)
res.redirect('/logout')
}
})





module.exports = router;
6 changes: 2 additions & 4 deletions schemas/profile-schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,10 @@ const profileSchema = mongoose.Schema({
wallet: {
type: String
},
fname: {
type: String
},
lname: {
name: {
type: String
},

gender: {
type: String
},
Expand Down
2 changes: 1 addition & 1 deletion views/inventory.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<div class="wrapper">
<div class="left-menu">
<div class="externalWrapper">
<p class="name">LIMBO</p>
<a href="/" class="name" style="cursor: pointer">LIMBO</a>
<div class="nav">
<a href="/">
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M20 7.093v-5.093h-3v2.093l3 3zm4 5.907l-12-12-12 12h3v10h7v-5h4v5h7v-10h3zm-5 8h-3v-5h-8v5h-3v-10.26l7-6.912 7 6.99v10.182z"/></svg>
Expand Down
2 changes: 1 addition & 1 deletion views/orders.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
<div class="wrapper">
<div class="left-menu">
<div class="externalWrapper">
<p class="name">LIMBO</p>
<a href="/" class="name" style="cursor: pointer">LIMBO</a>
<div class="nav">
<a href="/">
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M20 7.093v-5.093h-3v2.093l3 3zm4 5.907l-12-12-12 12h3v10h7v-5h4v5h7v-10h3zm-5 8h-3v-5h-8v5h-3v-10.26l7-6.912 7 6.99v10.182z"/></svg>
Expand Down
63 changes: 47 additions & 16 deletions views/settings.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
<div class="wrapper">
<div class="left-menu">
<div class="externalWrapper">
<p class="name">LIMBO</p>
<a href="/" class="name" style="cursor: pointer">LIMBO</a>
<div class="nav">
<a href="/">
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M20 7.093v-5.093h-3v2.093l3 3zm4 5.907l-12-12-12 12h3v10h7v-5h4v5h7v-10h3zm-5 8h-3v-5h-8v5h-3v-10.26l7-6.912 7 6.99v10.182z"/></svg>
Expand Down Expand Up @@ -127,22 +127,18 @@
<h1>Profile Settings</h1>

<div class="grid">

<div class="left-settings">
<div>
<label for="username">Username</label>
<input type="text" placeholder="Enter Username" id="username" value="<%= user.username %>" disabled/>
</div>
<div>
<label for="wallet">Wallet Address</label>
<input type="text" placeholder="Enter/Change your Wallet Address" id="wallet"/>
</div>
<div>
<label for="username">Social Connections</label>
<input type="text" placeholder="Enter Twitter Handle" id="twitter"/>
<input type="text" placeholder="Enter Discord Handle" id="discord" value="<%= user.username %>#<%= user.discriminator %>" disabled/>
<input type="text" name="wallet" placeholder="Enter/Change your Wallet Address" id="wallet"/>
</div>

<button>Submit</button>
<button type="submit" id='sub'>Submit</button>
</div>
<div class="right-settings">
<div class="profile-image">
Expand All @@ -151,19 +147,54 @@
</div>

<p>Profile Information</p>
<input type="text" placeholder="First and Last Name" value="<%= profile.name %>">
<input type="text" placeholder="Country" value="<%= profile.country %>">
<input type="text" placeholder="Postel/Zip Code" value="<%= profile.zipCode %>">
<input type="text" placeholder="City" value="<%= profile.city %>">
<input type="text" placeholder="Street Name" value="<%= profile.streetName %>">
<input type="text" placeholder="House Number" value="<%= profile.houseNumber %>">
<input type="text" placeholder="Gender" value="<%= profile.gender %>">
<input type="text" id= "fullname" placeholder="First and Last Name" value="<%= profile.name %>">
<input type="text" id= "country" placeholder="Country" value="<%= profile.country %>">
<input type="text" id= "zip" placeholder="Postel/Zip Code" value="<%= profile.zipCode %>">
<input type="text" id= "city" placeholder="City" value="<%= profile.city %>">
<input type="text" id= "street" placeholder="Street Name" value="<%= profile.streetName %>">
<input type="text" id= "house" placeholder="House Number" value="<%= profile.houseNumber %>">
<input type="text" id= "gender" placeholder="Gender" value="<%= profile.gender %>">

</div>

</div>
</div>
</div>
<script>
document.getElementById('sub').addEventListener('click', () => {
<script src="/js/shop.js"></script>
const res = fetch(`/settings`, {
method: "POST",
headers: {
'Accept': 'application/json',
"Content-Type": "application/json",
},
body: JSON.stringify({
wallet: document.getElementById('wallet').value,
name: document.getElementById('fullname').value,
gender: document.getElementById('gender').value,
country: document.getElementById('country').value,
zip: document.getElementById('zip').value,
house: document.getElementById('house').value,
city: document.getElementById('city').value,
street: document.getElementById('street').value,
}),
}).then(res => {
if (res.status !== 200) {
console.log("error")
} else {
res.json().then(data => {
console.log(data)
})
}
})
window.location = '/settings'
})
</script>
</body>
</html>
Loading

0 comments on commit 97a3957

Please sign in to comment.