Add field-based color indicators to person search cards filtering
This commit is contained in:
@@ -67,6 +67,10 @@
|
||||
matTooltipPosition="above"
|
||||
(focusin)="tooltip.show()"
|
||||
(focusout)="tooltip.hide()">
|
||||
<span
|
||||
class="field-dot"
|
||||
[style.background]="getFieldColor(topic.fieldName)"
|
||||
aria-hidden="true"></span>
|
||||
<span class="topic-name">{{ topic.name }}</span>
|
||||
</mat-checkbox>
|
||||
<span class="topic-path" [title]="topic.path">{{
|
||||
@@ -112,7 +116,10 @@
|
||||
: 'chevron_right'
|
||||
}}
|
||||
</mat-icon>
|
||||
<mat-icon class="folder-icon">folder</mat-icon>
|
||||
<span
|
||||
class="field-dot"
|
||||
[style.background]="getFieldColor(field.name)"
|
||||
aria-hidden="true"></span>
|
||||
<span class="node-title field-title">{{
|
||||
field.name
|
||||
}}</span>
|
||||
|
||||
@@ -93,6 +93,18 @@
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.field-dot {
|
||||
flex: 0 0 auto;
|
||||
display: inline-block;
|
||||
vertical-align: middle;
|
||||
width: 9px;
|
||||
height: 9px;
|
||||
margin-right: 7px;
|
||||
border-radius: 50%;
|
||||
border: 1px solid rgba(255, 255, 255, 0.85);
|
||||
box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.2);
|
||||
}
|
||||
|
||||
.node-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
@@ -6,6 +6,7 @@ import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
|
||||
import { MatRadioModule } from '@angular/material/radio';
|
||||
import { MatTooltipModule } from '@angular/material/tooltip';
|
||||
import { TopicsService } from '../../api/api/topics.service';
|
||||
import { topicHierarchyColor } from '../../shared/utils/topic-colors';
|
||||
import { combineLatest, of } from 'rxjs';
|
||||
import { toObservable } from '@angular/core/rxjs-interop';
|
||||
import {
|
||||
@@ -39,6 +40,7 @@ interface FlatTopic {
|
||||
id: string;
|
||||
name: string;
|
||||
path: string;
|
||||
fieldName: string;
|
||||
}
|
||||
|
||||
@Component({
|
||||
@@ -120,6 +122,7 @@ export class TopicHierarchyComponent implements OnInit {
|
||||
name: topic.display_name || '',
|
||||
path:
|
||||
parts.length > 0 ? parts.join(' > ') : topic.description || '',
|
||||
fieldName: topic.field?.display_name || '',
|
||||
};
|
||||
});
|
||||
}
|
||||
@@ -151,6 +154,7 @@ export class TopicHierarchyComponent implements OnInit {
|
||||
id: topic.id,
|
||||
name: topic.name,
|
||||
path: `${domain.name} > ${field.name} > ${subfield.name}`,
|
||||
fieldName: field.name,
|
||||
});
|
||||
}
|
||||
});
|
||||
@@ -164,6 +168,10 @@ export class TopicHierarchyComponent implements OnInit {
|
||||
this.searchType.set(type);
|
||||
}
|
||||
|
||||
getFieldColor(fieldName: string | null | undefined): string {
|
||||
return topicHierarchyColor({ field_name: fieldName });
|
||||
}
|
||||
|
||||
toggleTopic(name: string): void {
|
||||
const nextSelection = new Set(this.selectedTopics());
|
||||
if (nextSelection.has(name)) {
|
||||
|
||||
Reference in New Issue
Block a user