Skip to content

Commit

Permalink
Merge pull request #182 from samply/feat/add_custom_elements_to_catal…
Browse files Browse the repository at this point in the history
…ogue_entries

feat: added info link for catalogue catagories
  • Loading branch information
patrickskowronekdkfz authored Jan 31, 2025
2 parents 0a5e4b3 + 73085ee commit d9549b0
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 0 deletions.
4 changes: 4 additions & 0 deletions packages/demo/public/catalogues/catalogue-dktk-staging.json
Original file line number Diff line number Diff line change
Expand Up @@ -20359,6 +20359,10 @@
"key": "project",
"name": "Forschungsprojekte",
"infoButtonText": ["Projekt-Übersicht"],
"infoLink": {
"link": "https://hub.dkfz.de/s/EZTqXGcx7mWWapr",
"display": "↗Projekt-Übersicht"
},
"childCategories": [
{
"key": "pseudo_projects",
Expand Down
6 changes: 6 additions & 0 deletions packages/lib/src/components/catalogue/DataTreeElement.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,12 @@
<InfoButtonComponent message={element.infoButtonText} />
{/if}

{#if element.infoLink}
<a href={element.infoLink.link} target="_blank"
>{element.infoLink.display}</a
>
{/if}

{#if finalParent && open}
<button part="add-all-options-button" on:click={selectAllOptions}>
{selectAllText ? selectAllText : "Add all"}
Expand Down
19 changes: 19 additions & 0 deletions packages/lib/src/types/catalogue.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,25 @@
"pattern": "^.*$"
}
},
"infoLink": {
"type": "object",
"properties": {
"link": {
"type": "string",
"pattern": "^.+$"
},
"display": {
"type": "string",
"pattern": "^.+$"
}
},
"additionalProperties": false,
"unevaluatedProperties": false,
"required": [
"link",
"display"
]
},
"system": {
"type": "string",
"pattern": "^.*$"
Expand Down
6 changes: 6 additions & 0 deletions packages/lib/src/types/treeData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ export type CategoryNode = {
childCategories?: Category[];
infoButtonText?: string[];
subCategoryName?: string;
infoLink?: InfoLink;
};

export type InfoLink = {
link: string;
display: string;
};

export type CatagoryLeaf = {
Expand Down

0 comments on commit d9549b0

Please sign in to comment.