Skip to content

Commit

Permalink
Add metadata for set lists
Browse files Browse the repository at this point in the history
  • Loading branch information
lannonbr committed Aug 11, 2024
1 parent dfbe7d7 commit 5935cf9
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 3 deletions.
14 changes: 12 additions & 2 deletions mvc/controllers/setListing.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ module.exports = (router, app) => {
res.render("setListing", model);
});

router.route("/new/:id").get((req, res) => {
router.route("/new/:id").get(async (req, res) => {
const setId = req.params.id;

let model = require("../models/global")(req, res);
Expand All @@ -56,7 +56,17 @@ module.exports = (router, app) => {
)
);

model.content.pageTitle = `Set Listing: ${setId}`;
const set = await pokemon.set.find(setId);

model.set = {
name: set.name,
image: set.images.logo,
releaseDate: set.releaseDate,
total: set.printedTotal,
secretRares: set.total - set.printedTotal,
};

model.content.pageTitle = `Set Listing: ${set.name}`;
res.render("setList", model);
});

Expand Down
15 changes: 14 additions & 1 deletion mvc/views/setList.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,20 @@
<include src="layouts/main">
<arg pageContent>
<article id="homepage">
<a href="/new">Back to Set Listing</a>
<a class="back-to-set-listing" href="/new">&laquo; Back to Set Listing</a>
<h2>Set Information</h2>
<div id="set-list-header">
<div>
<img class="set-logo" src="{set.image}" alt="Logo for {set.name}" />
</div>
<div>
<p>Release Date: {set.releaseDate}</p>
<p>
Card Count: {set.total} cards (+{set.secretRares} secret rare cards)
</p>
</div>
</div>
<h2>Cards:</h2>
<ul class="setList">
<loop through="setList" val="card">
<li>
Expand Down
30 changes: 30 additions & 0 deletions statics/css/styles.less
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,36 @@ ul.setList {
gap: 1em;
}

.set-logo {
width: 250px;
}

#set-list-header {
display: flex;
margin-top: 32px;
}

#set-list-header div:first-child {
padding-right: 48px;
}

#set-list-header div:last-child {
font-size: 20px;
}

a.back-to-set-listing {
padding: 8px;
border-radius: 4px;
color: white;
background-color: rgb(22 163 74);
text-decoration: none;
}

a.back-to-set-listing:hover {
box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.1),
0 8px 10px -6px rgb(0 0 0 / 0.1);
}

main {
display: flex;
flex-direction: column;
Expand Down

0 comments on commit 5935cf9

Please sign in to comment.