Skip to content

Commit

Permalink
show added products
Browse files Browse the repository at this point in the history
how did I miss this
  • Loading branch information
ajgeiss0702 committed Jan 8, 2025
1 parent 5b08797 commit 097f49b
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/lib/lttstore/diff/CollectionProductsDiff.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,19 @@
let html: string;
$: {
html = "";
const beforeTitles = parsedBefore.map(p => p.title)
let removed: string[] = [];
console.debug({before, after, parsedBefore, parsedAfter})
const added = parsedAfter.filter(p => !beforeTitles.includes(p.title));
console.debug({before, after, parsedBefore, parsedAfter});
for (let addedProduct of added) {
if(displaying === "before") {
html += "<span style='background-color: rgba(0, 255, 0, 0.2)' class='opacity-40 pl-1'></span><br>";
} else {
html += "<a href='/lttstore/products/" + addedProduct.handle + "' class='hidden-link' style='background-color: rgba(0, 255, 0, 0.2)'>" +
"Added " + addedProduct.title +
"</a><br>";
}
}
for (let i = 0; i < parsedBefore.length; i++) {
const beforeProduct = parsedBefore[i];
const afterProduct = parsedAfter.find(v => v.title === beforeProduct.title);
Expand Down

0 comments on commit 097f49b

Please sign in to comment.