fix: allow tags to be optional in items

related to #430
This commit is contained in:
Mathias Schopmans
2024-03-13 14:47:33 +01:00
parent 04053c6700
commit 5750723c40
4 changed files with 11 additions and 8 deletions

View File

@@ -23,9 +23,7 @@ export function ItemDetail({ item }: ItemProps) {
<>
<div className={styles.header}>
<h1 className={styles.title}>{item.title}</h1>
{item.tags.map((tag) => (
<Tag key={tag} tag={tag} />
))}
{item.tags?.map((tag) => <Tag key={tag} tag={tag} />)}
</div>
<div className={styles.revisions}>
{notMaintainedText && isNotMaintained(item.release) && (

View File

@@ -21,7 +21,7 @@ export interface Item {
ring: string;
quadrant: string;
flag: Flag;
tags: string[];
tags?: string[];
release: Release;
revisions?: Revision[];
position: [x: number, y: number];

View File

@@ -24,7 +24,7 @@ const Home: CustomPage = () => {
const quadrants = getQuadrants();
const tags = getTags();
const items = getItems(undefined, true).filter(
(item) => !tag || item.tags.includes(tag),
(item) => !tag || item.tags?.includes(tag),
);
return (
@@ -41,7 +41,7 @@ const Home: CustomPage = () => {
rings={rings}
items={items}
/>
<Tags tags={tags} activeTag={tag} />
{tags.length > 0 && <Tags tags={tags} activeTag={tag} />}
<QuadrantList items={items} />
</>
);