Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add display of colours in concept hierarchy and object page #89

Merged
merged 3 commits into from
Aug 8, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/components/ConceptComponent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ function loadMoreNarrowers() {
<i :class="`fa-regular fa-${collapse ? 'plus' : 'minus'}`"></i>
</button>
<div v-else class="concept-left"></div>
<RouterLink class="concept" :to="props.link">{{ props.title || props.iri }}</RouterLink>
<RouterLink class="concept" :to="props.link">{{ props.title || props.iri }}</RouterLink> <span v-if="!!props.color" :style="{color: props.color}" class="fa-solid fa-circle fa-2xs"></span>
</div>
<div v-if="props.childrenCount > 0" :class="`concept-children ${collapse ? 'collapse' : ''}`">
<ConceptComponent
Expand Down
1 change: 1 addition & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ export interface Concept {
children: Concept[];
narrower?: string[];
broader?: string;
color?: string;
};

// extending an interface for defineProps in-file causes errors, defined here instead
Expand Down
10 changes: 8 additions & 2 deletions src/views/PropTableView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,8 @@ function getTopConcepts(page: number = 1) {
title: "",
link: "",
childrenCount: 0,
children: []
children: [],
color: "",
};
conceptStore.value.forEach(q => {
if (q.predicate.value === conceptQnameToIri("skos:prefLabel")) {
Expand All @@ -417,6 +418,8 @@ function getTopConcepts(page: number = 1) {
c.link = q.object.value;
} else if (q.predicate.value === conceptQnameToIri("prez:childrenCount")) {
c.childrenCount = Number(q.object.value);
} else if (q.predicate.value === conceptQnameToIri("sdo:color")) {
c.color = q.object.value;
}
}, object, null, null, null);
concepts.value.push(c);
Expand Down Expand Up @@ -452,7 +455,8 @@ function getNarrowers({ iriPath, link, page = 1 }: { iriPath: string, link: stri
title: "",
link: "",
childrenCount: 0,
children: []
children: [],
color: "",
};
conceptStore.value.forEach(q => {
if (q.predicate.value === conceptQnameToIri("skos:prefLabel")) {
Expand All @@ -461,6 +465,8 @@ function getNarrowers({ iriPath, link, page = 1 }: { iriPath: string, link: stri
c.link = q.object.value;
} else if (q.predicate.value === conceptQnameToIri("prez:childrenCount")) {
c.childrenCount = Number(q.object.value);
} else if (q.predicate.value === conceptQnameToIri("sdo:color")) {
c.color = q.object.value;
}
}, object, null, null, null);
parent!.children.push(c);
Expand Down