diff --git a/browse/extensions/index.html b/browse/extensions/index.html index aae7f0f..adeb98a 100644 --- a/browse/extensions/index.html +++ b/browse/extensions/index.html @@ -228,12 +228,17 @@

/** @param {Product[]} products */ function displayProduct(data) { const productContainer = document.getElementById("productContainer"); - let date = new Date(data.created); - date = date.toLocaleDateString('en-US', { + const createdDate = new Date(data.created); + const date = createdDate.toLocaleDateString('en-US', { year: 'numeric', month: 'long', day: 'numeric', }); + + const twoWeeksAgo = new Date(); + twoWeeksAgo.setDate(twoWeeksAgo.getDate() - 14); + const isNew = createdDate > twoWeeksAgo; + productContainer.innerHTML = `
@@ -320,6 +325,14 @@

+ ${ + (isNew) ? (` + + + new + + `) : ('') + } ${ (data.type == "THEME") ? (` @@ -335,10 +348,6 @@

${data.identifier} - - - ${data.id} -

diff --git a/browse/index.html b/browse/index.html index 7d17077..7f85d45 100644 --- a/browse/index.html +++ b/browse/index.html @@ -398,17 +398,22 @@

function displayProducts(products) { const productList = document.getElementById("products"); productList.innerHTML = ""; + const twoWeeksAgo = new Date(); + twoWeeksAgo.setDate(twoWeeksAgo.getDate() - 14); for (const product of sortProducts(products)) { const listItem = document.createElement("div"); const categoryClass = product.type === "THEME" ? "filter-themes" : "filter-extensions"; + + const createdDate = new Date(product.created); + const isNew = createdDate > twoWeeksAgo; listItem.className = "col-sm-12 col-md-6 col-lg-4 mb-4 " + categoryClass; listItem.innerHTML = ` -
- + +
${ product.name } by ${product.author.name}
-

${product.summary}

+

${product.summary}

+ ${ + (isNew) ? (` + + + NEW + + `) : ('') + }
-
-
+ + `; productList.appendChild(listItem);