Skip to content

Commit af47dd9

Browse files
committed
dont show filter on pages
1 parent 9fc52ad commit af47dd9

File tree

1 file changed

+21
-19
lines changed

1 file changed

+21
-19
lines changed

src/components/changelogs/Header.astro

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@ import { releaseNotesSchema } from "~/schemas";
1010
type Props = z.infer<typeof props>;
1111
1212
const props = z.object({
13-
entries: z.array(z.any()),
13+
entries: z.array(z.any()).optional(),
1414
});
1515
1616
const { entries } = props.parse(Astro.props);
1717
1818
async function uniqueProducts(
19-
entries: Array<CollectionEntry<"release-notes">>,
19+
entries?: Array<CollectionEntry<"release-notes">>,
2020
) {
21-
const products = entries.flatMap((entry) => entry.data.products ?? []);
21+
const products = entries?.flatMap((entry) => entry.data.products ?? []);
2222
2323
const unique = [...new Set(products)];
2424
@@ -57,22 +57,24 @@ const products = await uniqueProducts(entries);
5757
</a>
5858
</span>
5959
</p>
60-
<div>
61-
<select id="release-notes-filter" class="mt-2 h-8 w-52">
62-
<option value="all">All products</option>
63-
{
64-
products
65-
.sort((a, b) => a.id.localeCompare(b.id))
66-
.map(async (product) => {
67-
return (
68-
<option value={product.id}>
69-
{product.data.product.title}
70-
</option>
71-
);
72-
})
73-
}
74-
</select>
75-
</div>
60+
{
61+
entries && (
62+
<div>
63+
<select id="release-notes-filter" class="mt-2 h-8 w-52">
64+
<option value="all">All products</option>
65+
{products
66+
.sort((a, b) => a.id.localeCompare(b.id))
67+
.map(async (product) => {
68+
return (
69+
<option value={product.id}>
70+
{product.data.product.title}
71+
</option>
72+
);
73+
})}
74+
</select>
75+
</div>
76+
)
77+
}
7678
</div>
7779
<div class="!mt-0 hidden sm:block">
7880
<Image src={HeroImage} alt="hero image" height="240" />

0 commit comments

Comments
 (0)