Skip to content

Commit

Permalink
Use meta ID if present for card IDs
Browse files Browse the repository at this point in the history
  • Loading branch information
karelhala committed Feb 21, 2024
1 parent 509c856 commit 57d2953
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
7 changes: 7 additions & 0 deletions packages/dev/src/CustomCatalog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,13 @@ export const CustomCatalog: React.FC = () => {
<Gallery className="pfext-quick-start-catalog__gallery" hasGutter>
{allQuickStarts
.filter((quickStart: QuickStart) => quickStart.metadata.instructional)
.map((quickStart: QuickStart) => ({
...quickStart,
metadata: {
...quickStart.metadata,
id: `${quickStart.metadata.name}-bookmar`
}
}))
.map((quickStart: QuickStart) => {
const {
metadata: { name: id },
Expand Down
5 changes: 3 additions & 2 deletions packages/module/src/catalog/QuickStartTile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,11 @@ const QuickStartTile: React.FC<QuickStartTileProps> = ({
action,
}) => {
const {
metadata: { name: id },
metadata: { name, id: metaId },
spec: { icon, tasks, displayName, description, durationMinutes, prerequisites, link, type },
} = quickStart;

const id = metaId || name;
const { setActiveQuickStart, footer } =
React.useContext<QuickStartContextValues>(QuickStartContext);

Expand Down Expand Up @@ -71,7 +72,7 @@ const QuickStartTile: React.FC<QuickStartTileProps> = ({
if (link) {
window.open(link.href);
} else {
setActiveQuickStart(id, tasks?.length);
setActiveQuickStart(name, tasks?.length);
}
onClick();
}
Expand Down

0 comments on commit 57d2953

Please sign in to comment.