Skip to content

Commit 2fb5f3d

Browse files
Merge pull request #35 from Yellow-Dog-Man/feat/mmc
feat(mmc): add mmc information
2 parents fc3699d + 81d5e47 commit 2fb5f3d

File tree

5 files changed

+108
-1
lines changed

5 files changed

+108
-1
lines changed

public/images/CreatorJam.png

10.5 KB
Loading

public/stylesheets/style.css

+4
Original file line numberDiff line numberDiff line change
@@ -194,4 +194,8 @@ footer {
194194
clip: rect(0 0 0 0);
195195
clip-path: inset(50%);
196196
overflow: hidden;
197+
}
198+
199+
.mmc h2 img {
200+
width: 1.5em;
197201
}

routes/index.js

+87-1
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,10 @@ async function handle(type, req, res, next, reqInit = undefined) {
106106
json = preProcess(json, type);
107107
json = addMetadata(type, json, req, reqInit);
108108

109+
if (type =="world") {
110+
json = addMMC(json);
111+
}
112+
109113
res.status(200).render(type, json);
110114
} catch (error) {
111115
console.log(error);
@@ -204,8 +208,90 @@ function renderCredits(req, res, next) {
204208
const contributorsFile = fs.readFileSync('./.all-contributorsrc');
205209
contributorsJson = JSON.parse(contributorsFile);
206210

207-
console.log(contributorsJson);
208211
return res.render('credits', contributorsJson);
209212
}
210213

214+
var competitionTag = "mmc25"; //TODO: handle years.
215+
216+
var categories = [
217+
{
218+
title: "World Social",
219+
requiredTags: ["world", "social"]
220+
},
221+
{
222+
title: "World Game",
223+
requiredTags: ["world", "game"]
224+
},
225+
{
226+
title: "World Misc",
227+
requiredTags: ["world", "misc"]
228+
},
229+
// Avatars
230+
{
231+
title: "Avatars",
232+
requiredTags: ["avatar", "avatars"]
233+
},
234+
{
235+
title: "Avatar Miscellaneous",
236+
requiredTags: ["avatar", "misc"]
237+
},
238+
// Other
239+
{
240+
title: "Other: Tools, Apps & Utilities",
241+
requiredTags: ["other", "tau"]
242+
},
243+
{
244+
title: "Other: Miscellaneous",
245+
requiredTags: ["other", "misc"]
246+
},
247+
// Single tag categories
248+
{
249+
title: "Art",
250+
requiredTags: ["art"]
251+
},
252+
{
253+
title: "Education, Science and Data Visualization",
254+
requiredTags: ["esd"]
255+
},
256+
{
257+
title: "Meme",
258+
requiredTags: ["meme"]
259+
},
260+
{
261+
title: "Narrative",
262+
requiredTags: ["narrative"]
263+
}
264+
]
265+
266+
function matchCategories(tags) {
267+
var cats = [];
268+
for(const category of categories) {
269+
var entered = category.requiredTags.every(tag => tags.includes(tag));
270+
271+
if (!entered)
272+
continue;
273+
274+
cats.push(category);
275+
}
276+
277+
return cats;
278+
}
279+
280+
function addMMC(worldRecord) {
281+
if (!worldRecord.tags.includes(competitionTag))
282+
return worldRecord;
283+
284+
var categories = matchCategories(worldRecord.tags);
285+
286+
var multipleCategories = categories.length > 1; // IN MULTIPLE BAD
287+
288+
worldRecord.mmc = {
289+
entered:true,
290+
categories,
291+
multipleCategories
292+
}
293+
294+
return worldRecord;
295+
}
296+
211297
export default router;

views/mixins/mmc.pug

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
mixin mmcMixin(mmcData)
2+
section.mmc
3+
h2
4+
| MMC 2025 Information
5+
img(src='/images/CreatorJam.png')
6+
ul
7+
li ✅ This world is entered into the MMC 2025!
8+
li It is entered into the following Categories:
9+
ul
10+
each category in mmcData.categories
11+
li ✅ !{category.title}
12+
if mmcData.multipleCategories
13+
li ❌ It is entered into more than one category, please fix this!

views/world.pug

+4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
extends layout
22

3+
include mixins/mmc.pug
4+
35
block head
46
meta(property="og:type" content="resonite.world")
57
meta(property="og:image" content=thumbnailUri)
@@ -36,3 +38,5 @@ block content
3638
h2.subheading Alternative URLs
3739
ul
3840
li #[strong Record Url:] #{`resrec:///${ownerId}/${id}`}
41+
if mmc
42+
+mmcMixin(mmc)

0 commit comments

Comments
 (0)