Skip to content
This repository has been archived by the owner on Nov 27, 2022. It is now read-only.

Commit

Permalink
dashboard
Browse files Browse the repository at this point in the history
  • Loading branch information
ion05 committed Jul 31, 2022
1 parent c81ad28 commit 0232bbf
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 36 deletions.
2 changes: 1 addition & 1 deletion public/css/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@ h3,h2{
border-radius: 10px;
margin-top: 7.5vw;
}
.project img{
.project img, .model img{
transform: scale(0.25);
position: absolute;
margin-left: -27.5vw;
Expand Down
13 changes: 7 additions & 6 deletions routes/dashboardRoute.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ const { checkUser } = require("../middleware/auth");

router.get("/", checkUser, async (req, res) => {
const templates = await template.find({ userId: req.user["_id"] });
res.render("dashboard/index", { templates,user:req.user });
console.log(templates);
res.render("dashboard/index", { templates, user: req.user });
});

// Model Section
Expand All @@ -25,11 +26,11 @@ router.post("/model/new", async (req, res) => {
router.get("/dashboard/model/pref/1", checkUser, async (req, res) => {
res.render("model/pref/1");
});
router.get('/model',checkUser,async(req,res)=>{
router.get("/model", checkUser, async (req, res) => {
const templates = await template.find({ userId: req.user["_id"] });
res.render('dashboard/model',{
res.render("dashboard/model", {
templates,
user:req.user
})
})
user: req.user,
});
});
module.exports = router;
8 changes: 6 additions & 2 deletions services/preferences.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,14 @@ module.exports = {
if (preferences[i].includes("large")) {
pref += 3;
}
if (preferences[i].includes("traditional")) {
pref += 1;
}
}
console.log(pref);
if (pref < 3) {
const modelId = req.cookies.modelId;

console.log("model 1");
let modelLink =
"https://drive.google.com/file/d/1R6ypLV0LcQln-8nDV-XXqJYJo7QQaXYh/view?usp=sharing";
let modelName = "Old is Gold";
Expand All @@ -54,8 +57,9 @@ module.exports = {
res.render("market/nocredits");
}
return { modelLink, modelName, model, credits: model.credits };
} else if (pref > 3 && pref <= 4) {
} else if (pref >= 3 && pref <= 4) {
const modelId = req.cookies.modelId;
console.log("model 2");
let modelLink =
"https://drive.google.com/file/d/1SL3tvIJpAj69qrG91V0HXfo4bH2puSh2/view?usp=sharing";
let modelName = "Blast from the West";
Expand Down
34 changes: 17 additions & 17 deletions views/dashboard/index.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -30,28 +30,28 @@
No houses built yet :(
</h2>
<%} else{ %>
<% for( let i = 0; i < 2; i++ ) { %>
<div class="project">
<h2>
Project <span style="color: rgba(255, 255, 255, 0.568);"><%= templates[i].name %></span>
</h2>
<button>
Continue
</button>
<img src="https://drive.google.com/uc?id=<%= templates.model.slice(32,65)%>">
<div class="project-blob"></div>
</div>
<% } %>
<a class="check" href="/dashboard/model">
Checkout your models
</a>
<% for( let i = 0; i < 2; i++ ) { %>
<div class="project">
<h2>
Project <span style="color: rgba(255, 255, 255, 0.568);"><%= templates[i].name %></span>
</h2>
<button>
Continue
</button>
<img src="https://drive.google.com/uc?id=<%= templates[i]['model'].slice(32,65)%>">
<div class="project-blob"></div>
</div>
<% } %>
<a class="check" href="/dashboard/model">
Checkout your models
</a>
<% } %>
</div>
</div>
<div class="profile-div">
<div class="header">
<h3>Profile</h3>
<img style="margin-left: 10vw;" src="/assets/image/arrow2.svg">
<img style="margin-left: 10vw;" src="/assets/image/arrow2.svg">
<div class="circle"></div>
<div class="prof">
<p class="name">
Expand All @@ -62,7 +62,7 @@
</p>
</div>
</div>
</div>
Expand Down
20 changes: 10 additions & 10 deletions views/dashboard/model.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,16 @@
</div>
<div class="model-display">
<% for (var i =0; i<templates.length;i++){%>
<div class="model">
<h2>
Project <span style="color: rgba(255, 255, 255, 0.568);"><%= templates[i].name %></span>
</h2>
<button>
Continue
</button>
<img src="https://drive.google.com/uc?id=<%= templates.model.slice(32,65)%>">
<div class="project-blob"></div>
</div>
<div class="model">
<h2>
Project <span style="color: rgba(255, 255, 255, 0.568);"><%= templates[i].name %></span>
</h2>
<button>
Continue
</button>
<img src="https://drive.google.com/uc?id=<%= templates[i]["model"].slice(32,65)%>">
<div class="project-blob"></div>
</div>
<% } %>
</div>
</div>

0 comments on commit 0232bbf

Please sign in to comment.