@@ -13,10 +13,28 @@ import { productsByGroup } from "~/util/products";
1313
1414import { render } from " astro:content" ;
1515
16- const notes = await getChangelogs ({
16+ let notes = await getChangelogs ({
1717 filter : (entry ) => ! entry .data .hidden ,
1818});
1919
20+ const seen = new Map <string , number >();
21+
22+ notes = notes .flatMap ((note ) => {
23+ const products = note .data .products .map ((product ) => product .id );
24+
25+ for (const product of products ) {
26+ const previous = seen .get (product ) || 0 ;
27+
28+ seen .set (product , previous + 1 );
29+
30+ if (previous >= 5 ) {
31+ return [];
32+ }
33+ }
34+
35+ return note ;
36+ });
37+
2038const props = {
2139 frontmatter: {
2240 title: " Changelogs" ,
@@ -48,7 +66,7 @@ const props = {
4866
4967 return (
5068 <div
51- class :list = { [" mt-0! sm:flex" , { " hidden!" : idx >= 10 }]}
69+ class :list = { [" mt-0! sm:flex" , { " hidden!" : idx >= 50 }]}
5270 data-products = { JSON .stringify (
5371 productIds .concat (
5472 productGroups .map ((group ) =>
@@ -86,12 +104,13 @@ const props = {
86104 })
87105 }
88106 <div class =" flex items-center justify-center" >
89- <button
90- id =" changelogs-next-button"
91- class =" bg-cl1-brand-orange text-cl1-black h-12 cursor-pointer rounded-sm px-6 font-medium"
107+ <a
108+ id =" changelog-search-button"
109+ href =" /search/?contentType=Changelog+entry"
110+ class =" bg-cl1-brand-orange text-cl1-black mr-2 flex h-12 items-center justify-center rounded-sm px-6 font-medium no-underline"
92111 >
93- Load more items
94- </button >
112+ Search for historical entries
113+ </a >
95114 </div >
96115</StarlightPage >
97116
@@ -100,10 +119,6 @@ const props = {
100119 "#changelogs-next-filter",
101120 );
102121
103- const button = document.querySelector<HTMLButtonElement>(
104- "#changelogs-next-button",
105- );
106-
107122 const url = new URL(window.location.href);
108123
109124 if (filter && url.searchParams.has("product")) {
@@ -126,21 +141,6 @@ const props = {
126141 return products.includes(value);
127142 }
128143
129- button?.addEventListener("click", () => {
130- const hidden = [
131- ...document.querySelectorAll<HTMLElement>("[data-products]"),
132- ]
133- .filter(
134- (e) =>
135- e.classList.contains("hidden!") && filterByProduct(e, filter!.value),
136- )
137- .slice(0, 10);
138-
139- hidden.forEach((e) => e.classList.remove("hidden!"));
140-
141- hideButton();
142- });
143-
144144 function updateFilter() {
145145 const entries = [
146146 ...document.querySelectorAll<HTMLElement>("[data-products]"),
@@ -152,7 +152,7 @@ const props = {
152152
153153 const filtered = entries
154154 .filter((e) => filterByProduct(e, value))
155- .slice(0, 10 );
155+ .slice(0, 5 );
156156
157157 for (const entry of entries) {
158158 const show = filtered.includes(entry);
@@ -173,27 +173,6 @@ const props = {
173173 }
174174
175175 history.replaceState(null, "", url.href);
176-
177- hideButton();
178- }
179-
180- function hideButton() {
181- const entries = [
182- ...document.querySelectorAll<HTMLDivElement>("[data-products]"),
183- ];
184-
185- if (entries.length === 0) return;
186-
187- const filtered = entries.filter((p) => filterByProduct(p, filter!.value));
188-
189- const visible = filtered.filter((p) => !p.classList.contains("hidden!"));
190- const hidden = filtered.length - visible.length;
191-
192- if (hidden > 0) {
193- button!.classList.remove("hidden!");
194- } else {
195- button!.classList.add("hidden!");
196- }
197176 }
198177</script >
199178
0 commit comments