This commit is contained in:
@@ -36,18 +36,6 @@ TOPIC_HEATMAP_YEARS = 5
|
||||
WorksPeriod = Literal["all_time", "last_5_years"]
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
DFG_INSTITUTION_FIELDS = [
|
||||
"Antragstellende Institution",
|
||||
"Mitantragstellende Institution",
|
||||
"Beteiligte Einrichtung",
|
||||
"Beteiligte Hochschule",
|
||||
"Beteiligte Institution",
|
||||
"IGK-Partnerinstitution",
|
||||
"Partnerorganisation",
|
||||
"Unternehmen",
|
||||
]
|
||||
|
||||
|
||||
def _total(response: dict[str, Any]) -> int:
|
||||
total = response.get("hits", {}).get("total", 0)
|
||||
if isinstance(total, dict):
|
||||
@@ -249,7 +237,7 @@ async def get_dashboard_dfg_projects(
|
||||
normalized_id = _normalize_institution_id(institution_id)
|
||||
aliases = await _institution_aliases(normalized_id, organization_name)
|
||||
response = await elasticsearch.search(
|
||||
index=ESIndex.PROJECTS_DFG_ALL,
|
||||
index=ESIndex.DFG_PROJECTS_V2,
|
||||
query=_dfg_institution_query(aliases),
|
||||
size=0,
|
||||
track_total_hits=True,
|
||||
@@ -317,8 +305,42 @@ def _dfg_institution_query(aliases: list[str]) -> dict[str, Any]:
|
||||
return {
|
||||
"bool": {
|
||||
"should": [
|
||||
_alias_match_query(field, aliases)
|
||||
for field in DFG_INSTITUTION_FIELDS
|
||||
{
|
||||
"nested": {
|
||||
"path": "institutions",
|
||||
"query": {
|
||||
"bool": {
|
||||
"should": [
|
||||
_alias_match_query(
|
||||
"institutions.institute_name_de", aliases
|
||||
),
|
||||
_alias_match_query(
|
||||
"institutions.institute_name_en", aliases
|
||||
),
|
||||
],
|
||||
"minimum_should_match": 1,
|
||||
}
|
||||
},
|
||||
}
|
||||
},
|
||||
{
|
||||
"nested": {
|
||||
"path": "persons",
|
||||
"query": {
|
||||
"bool": {
|
||||
"should": [
|
||||
_alias_match_query(
|
||||
"persons.affiliation_de", aliases
|
||||
),
|
||||
_alias_match_query(
|
||||
"persons.affiliation_en", aliases
|
||||
),
|
||||
],
|
||||
"minimum_should_match": 1,
|
||||
}
|
||||
},
|
||||
}
|
||||
},
|
||||
],
|
||||
"minimum_should_match": 1,
|
||||
}
|
||||
|
||||
@@ -58,20 +58,25 @@ async def test_dashboard_statistics_counts_organization_data_and_all_projects():
|
||||
"bmbf_projects": 5,
|
||||
}
|
||||
calls = mocked_search.await_args_list
|
||||
assert calls[0].kwargs["index"] == config.settings.openalex_works_search_index
|
||||
assert calls[0].kwargs["query"]["nested"]["query"]["term"] == {
|
||||
calls_by_index = {call.kwargs["index"]: call for call in calls}
|
||||
works_call = calls_by_index[config.settings.openalex_works_search_index]
|
||||
authors_call = calls_by_index[ESIndex.OPENALEX_AUTHORS]
|
||||
eu_call = calls_by_index[ESIndex.CORDIS_EU_ORGANIZATIONS_WILDCARD]
|
||||
bmbf_call = calls_by_index[ESIndex.PROJECTS_BUND_V1]
|
||||
dfg_call = calls_by_index[ESIndex.DFG_PROJECTS_V2]
|
||||
assert works_call.kwargs["query"]["nested"]["query"]["term"] == {
|
||||
"authorships.institutions.id": ORG_INSTITUTION_ID
|
||||
}
|
||||
assert calls[1].kwargs["query"]["nested"]["query"]["term"] == {
|
||||
"affiliations.institution.id": ORG_INSTITUTION_ID
|
||||
assert authors_call.kwargs["query"]["bool"]["should"][0]["bool"]["filter"][
|
||||
0
|
||||
]["nested"]["query"]["match_phrase"] == {
|
||||
"last_known_institutions.id": ORG_INSTITUTION_ID
|
||||
}
|
||||
assert all(call.kwargs["cluster"] == ESCluster.INSE for call in calls[2:])
|
||||
assert [call.kwargs["index"] for call in calls[2:]] == [
|
||||
ESIndex.CORDIS_EU_ORGANIZATIONS_WILDCARD,
|
||||
ESIndex.PROJECTS_BUND_V1,
|
||||
ESIndex.PROJECTS_DFG_ALL,
|
||||
]
|
||||
assert calls[2].kwargs["body"]["query"] == {
|
||||
assert all(
|
||||
call.kwargs["cluster"] == ESCluster.INSE
|
||||
for call in [eu_call, bmbf_call, dfg_call]
|
||||
)
|
||||
assert eu_call.kwargs["body"]["query"] == {
|
||||
"terms": {
|
||||
"name.keyword": [
|
||||
"EXAMPLE ORG",
|
||||
@@ -80,22 +85,25 @@ async def test_dashboard_statistics_counts_organization_data_and_all_projects():
|
||||
]
|
||||
}
|
||||
}
|
||||
assert calls[3].kwargs["query"]["bool"]["minimum_should_match"] == 1
|
||||
assert calls[3].kwargs["query"]["bool"]["should"][0]["match"] == {
|
||||
assert bmbf_call.kwargs["query"]["bool"]["minimum_should_match"] == 1
|
||||
assert bmbf_call.kwargs["query"]["bool"]["should"][0]["match"] == {
|
||||
"Zuwendungsempfänger": {
|
||||
"query": "Example Org",
|
||||
"operator": "and",
|
||||
}
|
||||
}
|
||||
assert calls[4].kwargs["query"]["bool"]["minimum_should_match"] == 1
|
||||
assert calls[4].kwargs["query"]["bool"]["should"][0]["bool"]["should"][0][
|
||||
"match"
|
||||
] == {
|
||||
"Antragstellende Institution": {
|
||||
dfg_query = dfg_call.kwargs["query"]
|
||||
assert dfg_query["bool"]["minimum_should_match"] == 1
|
||||
assert dfg_query["bool"]["should"][0]["nested"]["path"] == "institutions"
|
||||
assert dfg_query["bool"]["should"][0]["nested"]["query"]["bool"]["should"][
|
||||
0
|
||||
]["bool"]["should"][0]["match"] == {
|
||||
"institutions.institute_name_de": {
|
||||
"query": "Example Org",
|
||||
"operator": "and",
|
||||
}
|
||||
}
|
||||
assert dfg_query["bool"]["should"][1]["nested"]["path"] == "persons"
|
||||
|
||||
|
||||
@pytest.mark.anyio
|
||||
@@ -181,7 +189,7 @@ async def test_top_authors_maps_works_patents_and_news_without_project_queries()
|
||||
call
|
||||
for call in mocked_search.await_args_list
|
||||
if call.kwargs["index"]
|
||||
in {ESIndex.PROJECTS_DFG_ALL, ESIndex.PROJECTS_BUND_V1}
|
||||
in {ESIndex.DFG_PROJECTS_V2, ESIndex.PROJECTS_BUND_V1}
|
||||
]
|
||||
assert project_calls == []
|
||||
eu_calls = [
|
||||
|
||||
@@ -101,6 +101,7 @@ def _index_to_cluster(index: ESIndex) -> Optional[ESCluster]:
|
||||
ESIndex.CORDIS_EU_PUBLICATIONS_WILDCARD,
|
||||
ESIndex.PROJECTS_BUND_V1,
|
||||
ESIndex.PROJECTS_DFG_ALL,
|
||||
ESIndex.DFG_PROJECTS_V2,
|
||||
}:
|
||||
return ESCluster.INSE
|
||||
else:
|
||||
|
||||
@@ -61,6 +61,7 @@ class ESIndex(StrEnum):
|
||||
|
||||
PROJECTS_BUND_V1 = "projects_bund_v1"
|
||||
PROJECTS_DFG_ALL = "projects_dfg_all"
|
||||
DFG_PROJECTS_V2 = "dfg_projects_2.0"
|
||||
|
||||
CORDIS_EU_ORGANIZATIONS_WILDCARD = "cordis_eu_*_organizations"
|
||||
CORDIS_EU_PROJECTS_WILDCARD = "cordis_eu_*_projects"
|
||||
|
||||
@@ -3,6 +3,7 @@ import { MatDialog } from '@angular/material/dialog';
|
||||
import { EChartsOption } from 'echarts';
|
||||
import { NgxEchartsDirective } from 'ngx-echarts';
|
||||
|
||||
import { topicHierarchyColor } from '../../../resolvers/utils/topic-colors';
|
||||
import { TopicHeatmap } from '../dashboard-statistics.service';
|
||||
import {
|
||||
TopicWordCloudDialogComponent,
|
||||
@@ -17,22 +18,11 @@ import {
|
||||
})
|
||||
export class TopicHeatmapComponent implements OnChanges {
|
||||
private readonly dialog = inject(MatDialog);
|
||||
private readonly fieldColorOpacity = 0.78;
|
||||
@Input() heatmap?: TopicHeatmap;
|
||||
@Input() loading = false;
|
||||
|
||||
options: EChartsOption = {};
|
||||
private readonly colors = [
|
||||
'#2563eb',
|
||||
'#059669',
|
||||
'#d97706',
|
||||
'#dc2626',
|
||||
'#7c3aed',
|
||||
'#0284c7',
|
||||
'#ea580c',
|
||||
'#4f46e5',
|
||||
'#0f766e',
|
||||
'#be123c',
|
||||
];
|
||||
|
||||
ngOnChanges(): void {
|
||||
this.options = this.buildOptions();
|
||||
@@ -60,49 +50,118 @@ export class TopicHeatmapComponent implements OnChanges {
|
||||
|
||||
private buildOptions(): EChartsOption {
|
||||
const fields = this.heatmap?.fields ?? [];
|
||||
const data = fields.map((field) => ({
|
||||
id: field.id,
|
||||
name: field.name,
|
||||
value: field.total || this.totalCount(field.values),
|
||||
label: {
|
||||
show: true,
|
||||
formatter: (params: any) =>
|
||||
`${params.name}\n${this.formatCount(params.value)}`,
|
||||
color: '#ffffff',
|
||||
fontWeight: 700,
|
||||
lineHeight: 18,
|
||||
overflow: 'truncate' as const,
|
||||
},
|
||||
children: (field.subfields ?? [])
|
||||
.filter((subfield) => subfield.total > 0)
|
||||
.map((subfield) => ({
|
||||
id: subfield.id,
|
||||
name: subfield.name,
|
||||
value: subfield.total,
|
||||
fieldName: field.name,
|
||||
children: (subfield.topics ?? [])
|
||||
.filter((topic) => topic.total > 0)
|
||||
.map((topic) => ({
|
||||
id: topic.id,
|
||||
name: topic.name,
|
||||
value: topic.total,
|
||||
fieldName: field.name,
|
||||
subfieldName: subfield.name,
|
||||
})),
|
||||
})),
|
||||
}));
|
||||
const data = fields.map((field) => {
|
||||
const fieldColor = topicHierarchyColor({
|
||||
field_id: field.id,
|
||||
field_name: field.name,
|
||||
});
|
||||
|
||||
return {
|
||||
id: field.id,
|
||||
name: field.name,
|
||||
value: field.total || this.totalCount(field.values),
|
||||
itemStyle: {
|
||||
color: fieldColor,
|
||||
opacity: this.fieldColorOpacity,
|
||||
},
|
||||
emphasis: {
|
||||
itemStyle: {
|
||||
color: fieldColor,
|
||||
opacity: this.fieldColorOpacity,
|
||||
},
|
||||
},
|
||||
label: {
|
||||
show: true,
|
||||
formatter: (params: any) =>
|
||||
`${params.name}\n${this.formatCount(params.value)}`,
|
||||
color: '#ffffff',
|
||||
fontWeight: 700,
|
||||
lineHeight: 18,
|
||||
overflow: 'truncate' as const,
|
||||
},
|
||||
children: (field.subfields ?? [])
|
||||
.filter((subfield) => subfield.total > 0)
|
||||
.map((subfield) => ({
|
||||
id: subfield.id,
|
||||
name: subfield.name,
|
||||
value: subfield.total,
|
||||
fieldName: field.name,
|
||||
itemStyle: {
|
||||
color: fieldColor,
|
||||
opacity: this.fieldColorOpacity,
|
||||
},
|
||||
emphasis: {
|
||||
itemStyle: {
|
||||
color: fieldColor,
|
||||
opacity: this.fieldColorOpacity,
|
||||
},
|
||||
},
|
||||
children: (subfield.topics ?? [])
|
||||
.filter((topic) => topic.total > 0)
|
||||
.map((topic) => ({
|
||||
id: topic.id,
|
||||
name: topic.name,
|
||||
value: topic.total,
|
||||
fieldName: field.name,
|
||||
subfieldName: subfield.name,
|
||||
itemStyle: {
|
||||
color: fieldColor,
|
||||
opacity: this.fieldColorOpacity,
|
||||
},
|
||||
emphasis: {
|
||||
itemStyle: {
|
||||
color: fieldColor,
|
||||
opacity: this.fieldColorOpacity,
|
||||
},
|
||||
},
|
||||
})),
|
||||
})),
|
||||
};
|
||||
});
|
||||
|
||||
return {
|
||||
tooltip: {
|
||||
trigger: 'item',
|
||||
confine: true,
|
||||
backgroundColor: '#ffffff',
|
||||
borderColor: '#d8cafe',
|
||||
borderWidth: 1,
|
||||
padding: 0,
|
||||
extraCssText:
|
||||
'max-width: 360px; border-radius: 12px; box-shadow: 0 14px 36px rgba(16, 26, 61, 0.18);',
|
||||
formatter: (params: any) => {
|
||||
const count = Number(params.value ?? 0);
|
||||
const field = params.data?.fieldName
|
||||
? `<br />Field: ${params.data.fieldName}`
|
||||
const name = this.escapeHtml(String(params.name ?? ''));
|
||||
const fieldName = params.data?.fieldName
|
||||
? this.escapeHtml(String(params.data.fieldName))
|
||||
: '';
|
||||
const subfield = params.data?.subfieldName
|
||||
? `<br />Subfield: ${params.data.subfieldName}`
|
||||
const subfieldName = params.data?.subfieldName
|
||||
? this.escapeHtml(String(params.data.subfieldName))
|
||||
: '';
|
||||
return `${params.name}${field}${subfield}<br /><strong>${count}</strong> Publikationen`;
|
||||
const hierarchy = [fieldName, subfieldName]
|
||||
.filter(Boolean)
|
||||
.map(
|
||||
(item) =>
|
||||
`<span style="display:inline-flex;align-items:center;gap:4px;">${item}</span>`,
|
||||
)
|
||||
.join('<span style="color:#a8b2c8;padding:0 3px;">›</span>');
|
||||
|
||||
return `
|
||||
<div style="min-width:220px;padding:14px 16px;white-space:normal;">
|
||||
${
|
||||
hierarchy
|
||||
? `<div style="margin-bottom:7px;color:#64708f;font-size:11px;line-height:1.4;">${hierarchy}</div>`
|
||||
: ''
|
||||
}
|
||||
<div style="color:#101a3d;font-size:15px;font-weight:700;line-height:1.4;overflow-wrap:anywhere;">${name}</div>
|
||||
<div style="display:flex;align-items:baseline;gap:5px;margin-top:10px;color:#64708f;font-size:12px;">
|
||||
<strong style="color:#7255d9;font-size:16px;">${this.formatCount(count)}</strong>
|
||||
Publikationen
|
||||
</div>
|
||||
<div style="margin-top:9px;padding-top:9px;border-top:1px solid #edf0f6;color:#8a95b3;font-size:11px;">
|
||||
Klicken, um diesen Bereich zu vergrößern
|
||||
</div>
|
||||
</div>`;
|
||||
},
|
||||
},
|
||||
series: [
|
||||
@@ -141,8 +200,6 @@ export class TopicHeatmapComponent implements OnChanges {
|
||||
},
|
||||
},
|
||||
},
|
||||
color: this.colors,
|
||||
colorMappingBy: 'id',
|
||||
label: {
|
||||
show: true,
|
||||
formatter: (params: any) =>
|
||||
@@ -166,7 +223,6 @@ export class TopicHeatmapComponent implements OnChanges {
|
||||
},
|
||||
levels: [
|
||||
{
|
||||
color: this.colors,
|
||||
label: {
|
||||
show: true,
|
||||
position: 'inside',
|
||||
@@ -181,7 +237,6 @@ export class TopicHeatmapComponent implements OnChanges {
|
||||
},
|
||||
},
|
||||
{
|
||||
color: this.colors,
|
||||
label: {
|
||||
show: true,
|
||||
position: 'inside',
|
||||
@@ -196,7 +251,6 @@ export class TopicHeatmapComponent implements OnChanges {
|
||||
},
|
||||
},
|
||||
{
|
||||
colorSaturation: [0.45, 0.78],
|
||||
label: {
|
||||
show: true,
|
||||
formatter: (params: any) =>
|
||||
@@ -224,9 +278,18 @@ export class TopicHeatmapComponent implements OnChanges {
|
||||
left: 8,
|
||||
animationDurationUpdate: 450,
|
||||
emphasis: {
|
||||
focus: 'self',
|
||||
label: {
|
||||
color: '#ffffff',
|
||||
fontSize: 15,
|
||||
fontWeight: 800,
|
||||
textShadowBlur: 4,
|
||||
textShadowColor: 'rgba(15, 23, 42, 0.45)',
|
||||
},
|
||||
itemStyle: {
|
||||
borderColor: '#ffffff',
|
||||
borderWidth: 5,
|
||||
shadowBlur: 18,
|
||||
shadowColor: 'rgba(15, 23, 42, 0.35)',
|
||||
},
|
||||
},
|
||||
itemStyle: {
|
||||
@@ -247,4 +310,18 @@ export class TopicHeatmapComponent implements OnChanges {
|
||||
private formatCount(value: unknown): string {
|
||||
return Number(value ?? 0).toLocaleString('de-DE');
|
||||
}
|
||||
|
||||
private escapeHtml(value: string): string {
|
||||
return value.replace(
|
||||
/[&<>'"]/g,
|
||||
(character) =>
|
||||
({
|
||||
'&': '&',
|
||||
'<': '<',
|
||||
'>': '>',
|
||||
"'": ''',
|
||||
'"': '"',
|
||||
})[character] ?? character,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
+88
-27
@@ -1,37 +1,98 @@
|
||||
<div class="dialog-title" mat-dialog-title>
|
||||
<div>
|
||||
<h2>{{ data.topicName }}</h2>
|
||||
<p>
|
||||
{{ data.fieldName }}
|
||||
@if (data.subfieldName) {
|
||||
<span>· {{ data.subfieldName }}</span>
|
||||
}
|
||||
</p>
|
||||
<div class="dialog-heading">
|
||||
<div>
|
||||
<span class="dialog-eyebrow">Topic Insights</span>
|
||||
<h2>Keyword Wordcloud</h2>
|
||||
<p>Die wichtigsten Begriffe zum ausgewählten Forschungsthema</p>
|
||||
</div>
|
||||
</div>
|
||||
<button mat-icon-button type="button" aria-label="Dialog schließen" mat-dialog-close>
|
||||
<button
|
||||
class="dialog-close"
|
||||
mat-icon-button
|
||||
type="button"
|
||||
aria-label="Dialog schließen"
|
||||
mat-dialog-close>
|
||||
<mat-icon>close</mat-icon>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<mat-dialog-content>
|
||||
@if (loading) {
|
||||
<div class="word-cloud-state">Verwandte Themen werden geladen ...</div>
|
||||
} @else if (loadFailed) {
|
||||
<div class="word-cloud-state error">Wordcloud konnte nicht geladen werden.</div>
|
||||
} @else if (words.length) {
|
||||
<div class="word-cloud-chart" aria-label="Wordcloud verwandter Themen">
|
||||
@for (word of words; track word.id) {
|
||||
<span
|
||||
class="word-cloud-word"
|
||||
[style.color]="word.color"
|
||||
[style.fontSize.px]="word.fontSize"
|
||||
[style.fontWeight]="word.fontWeight"
|
||||
[title]="word.count + ' Publikationen'">
|
||||
{{ word.name }}
|
||||
</span>
|
||||
<div class="topic-context-card" aria-label="Ausgewählte Themenhierarchie">
|
||||
<div class="topic-context-item">
|
||||
<span class="topic-context-icon topic-context-icon--field" aria-hidden="true">
|
||||
<mat-icon>category</mat-icon>
|
||||
</span>
|
||||
<span class="topic-context-copy">
|
||||
<span class="topic-context-label">Field</span>
|
||||
<strong [title]="data.fieldName || ''">{{ data.fieldName || '–' }}</strong>
|
||||
</span>
|
||||
</div>
|
||||
<mat-icon class="topic-context-arrow" aria-hidden="true">chevron_right</mat-icon>
|
||||
<div class="topic-context-item">
|
||||
<span class="topic-context-icon topic-context-icon--subfield" aria-hidden="true">
|
||||
<mat-icon>account_tree</mat-icon>
|
||||
</span>
|
||||
<span class="topic-context-copy">
|
||||
<span class="topic-context-label">Subfield</span>
|
||||
<strong [title]="data.subfieldName || ''">{{ data.subfieldName || '–' }}</strong>
|
||||
</span>
|
||||
</div>
|
||||
<mat-icon class="topic-context-arrow" aria-hidden="true">chevron_right</mat-icon>
|
||||
<div class="topic-context-item topic-context-item--topic">
|
||||
<span class="topic-context-icon topic-context-icon--topic" aria-hidden="true">
|
||||
<mat-icon>label</mat-icon>
|
||||
</span>
|
||||
<span class="topic-context-copy">
|
||||
<span class="topic-context-label">Topic</span>
|
||||
<strong [title]="data.topicName">{{ data.topicName }}</strong>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<section class="word-cloud-panel" aria-labelledby="word-cloud-heading">
|
||||
<div class="word-cloud-panel-header">
|
||||
<div>
|
||||
<h3 id="word-cloud-heading">Top Keywords</h3>
|
||||
<p>Die Schriftgröße entspricht der Anzahl der Publikationen.</p>
|
||||
</div>
|
||||
@if (!loading && !loadFailed && words.length) {
|
||||
<span class="word-count">{{ words.length }} Begriffe</span>
|
||||
}
|
||||
</div>
|
||||
} @else {
|
||||
<div class="word-cloud-state">Keine verwandten Themen gefunden.</div>
|
||||
}
|
||||
|
||||
@if (loading) {
|
||||
<div class="word-cloud-state">
|
||||
<span class="state-icon state-icon--loading" aria-hidden="true">
|
||||
<mat-icon>hourglass_top</mat-icon>
|
||||
</span>
|
||||
<strong>Wordcloud wird erstellt</strong>
|
||||
<span>Die wichtigsten Keywords werden geladen …</span>
|
||||
</div>
|
||||
} @else if (loadFailed) {
|
||||
<div class="word-cloud-state word-cloud-state--error">
|
||||
<span class="state-icon" aria-hidden="true"><mat-icon>cloud_off</mat-icon></span>
|
||||
<strong>Wordcloud nicht verfügbar</strong>
|
||||
<span>Die Keywords konnten nicht geladen werden.</span>
|
||||
</div>
|
||||
} @else if (words.length) {
|
||||
<div class="word-cloud-chart" aria-label="Wordcloud verwandter Themen">
|
||||
@for (word of words; track word.id) {
|
||||
<span
|
||||
class="word-cloud-word"
|
||||
[style.color]="word.color"
|
||||
[style.fontSize.px]="word.fontSize"
|
||||
[style.fontWeight]="word.fontWeight"
|
||||
[title]="word.name + ': ' + word.count + ' Publikationen'">
|
||||
{{ word.name }}
|
||||
</span>
|
||||
}
|
||||
</div>
|
||||
} @else {
|
||||
<div class="word-cloud-state">
|
||||
<span class="state-icon" aria-hidden="true"><mat-icon>search_off</mat-icon></span>
|
||||
<strong>Keine Keywords gefunden</strong>
|
||||
<span>Für dieses Topic sind im gewählten Zeitraum keine Daten vorhanden.</span>
|
||||
</div>
|
||||
}
|
||||
</section>
|
||||
</mat-dialog-content>
|
||||
|
||||
+276
-17
@@ -2,48 +2,307 @@
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
justify-content: space-between;
|
||||
gap: 16px;
|
||||
gap: 24px;
|
||||
padding: 24px 28px 20px;
|
||||
border-bottom: 1px solid var(--sg-border, #dde5f2);
|
||||
background: linear-gradient(135deg, #ffffff 52%, #f6f0ff 100%);
|
||||
|
||||
h2 {
|
||||
margin: 0;
|
||||
margin: 1px 0 3px;
|
||||
color: var(--sg-text, #101a3d);
|
||||
font-family: 'Montserrat', sans-serif;
|
||||
font-size: 1.375rem;
|
||||
font-weight: 700;
|
||||
line-height: 1.25;
|
||||
}
|
||||
|
||||
p {
|
||||
margin: 4px 0 0;
|
||||
color: #64748b;
|
||||
font-size: 0.875rem;
|
||||
margin: 0;
|
||||
color: var(--sg-text-muted, #64708f);
|
||||
font-size: 0.8125rem;
|
||||
font-weight: 400;
|
||||
}
|
||||
}
|
||||
|
||||
.dialog-heading {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.dialog-eyebrow {
|
||||
display: block;
|
||||
color: #7255d9;
|
||||
font-size: 0.6875rem;
|
||||
font-weight: 700;
|
||||
letter-spacing: 0.08em;
|
||||
line-height: 1.2;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
.dialog-close {
|
||||
flex: 0 0 auto;
|
||||
color: var(--sg-text-muted, #64708f);
|
||||
|
||||
&:hover {
|
||||
background: #f1f3f7;
|
||||
color: var(--sg-text, #101a3d);
|
||||
}
|
||||
}
|
||||
|
||||
mat-dialog-content {
|
||||
min-height: 330px;
|
||||
min-height: 410px;
|
||||
padding: 20px 28px 28px !important;
|
||||
background: #ffffff;
|
||||
}
|
||||
|
||||
.topic-context-card {
|
||||
display: grid;
|
||||
grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) auto minmax(0, 1fr);
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
margin-bottom: 18px;
|
||||
padding: 12px;
|
||||
border: 1px solid var(--sg-border, #dde5f2);
|
||||
border-radius: 12px;
|
||||
background: var(--sg-surface-muted, #f7f9ff);
|
||||
}
|
||||
|
||||
.topic-context-item {
|
||||
display: flex;
|
||||
min-width: 0;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
padding: 5px 6px;
|
||||
}
|
||||
|
||||
.topic-context-icon {
|
||||
display: grid;
|
||||
width: 34px;
|
||||
height: 34px;
|
||||
flex: 0 0 34px;
|
||||
place-items: center;
|
||||
border-radius: 9px;
|
||||
|
||||
mat-icon {
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
font-size: 18px;
|
||||
}
|
||||
}
|
||||
|
||||
.topic-context-icon--field {
|
||||
border: 1px solid #bdd4ff;
|
||||
background: #f0f6ff;
|
||||
color: #0b63ce;
|
||||
}
|
||||
|
||||
.topic-context-icon--subfield {
|
||||
border: 1px solid #bdebcf;
|
||||
background: #effaf3;
|
||||
color: #24834f;
|
||||
}
|
||||
|
||||
.topic-context-icon--topic {
|
||||
border: 1px solid #d8cafe;
|
||||
background: #f6f0ff;
|
||||
color: #7255d9;
|
||||
}
|
||||
|
||||
.topic-context-copy {
|
||||
display: flex;
|
||||
min-width: 0;
|
||||
flex-direction: column;
|
||||
gap: 2px;
|
||||
|
||||
strong {
|
||||
overflow: hidden;
|
||||
color: #334155;
|
||||
font-size: 0.8125rem;
|
||||
font-weight: 600;
|
||||
line-height: 1.35;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
}
|
||||
|
||||
.topic-context-item--topic strong {
|
||||
color: #7255d9;
|
||||
}
|
||||
|
||||
.topic-context-label {
|
||||
color: var(--sg-text-soft, #8a95b3);
|
||||
font-size: 0.625rem;
|
||||
font-weight: 700;
|
||||
letter-spacing: 0.07em;
|
||||
line-height: 1.2;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
.topic-context-arrow {
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
color: #a8b2c8;
|
||||
font-size: 18px;
|
||||
}
|
||||
|
||||
.word-cloud-panel {
|
||||
overflow: hidden;
|
||||
border: 1px solid var(--sg-border, #dde5f2);
|
||||
border-radius: 16px;
|
||||
background: #ffffff;
|
||||
box-shadow: var(--sg-shadow-sm);
|
||||
}
|
||||
|
||||
.word-cloud-panel-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 16px;
|
||||
padding: 14px 18px;
|
||||
border-bottom: 1px solid #e8edf5;
|
||||
|
||||
h3 {
|
||||
margin: 0 0 2px;
|
||||
color: var(--sg-text, #101a3d);
|
||||
font-family: 'Montserrat', sans-serif;
|
||||
font-size: 0.9375rem;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
p {
|
||||
margin: 0;
|
||||
color: var(--sg-text-muted, #64708f);
|
||||
font-size: 0.75rem;
|
||||
}
|
||||
}
|
||||
|
||||
.word-count {
|
||||
flex: 0 0 auto;
|
||||
padding: 5px 9px;
|
||||
border: 1px solid #d8cafe;
|
||||
border-radius: 999px;
|
||||
background: #f6f0ff;
|
||||
color: #7255d9;
|
||||
font-size: 0.6875rem;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.word-cloud-chart {
|
||||
min-height: 300px;
|
||||
display: flex;
|
||||
min-height: 280px;
|
||||
flex-wrap: wrap;
|
||||
align-content: center;
|
||||
align-items: baseline;
|
||||
justify-content: center;
|
||||
gap: 12px 18px;
|
||||
padding: 24px;
|
||||
border-radius: 12px;
|
||||
background: linear-gradient(145deg, #f8fafc, #ffffff);
|
||||
gap: 14px 20px;
|
||||
padding: 30px 34px;
|
||||
background:
|
||||
radial-gradient(circle at 15% 20%, rgba(114, 85, 217, 0.06), transparent 28%),
|
||||
radial-gradient(circle at 85% 75%, rgba(11, 99, 206, 0.05), transparent 30%),
|
||||
#ffffff;
|
||||
}
|
||||
|
||||
.word-cloud-word {
|
||||
padding: 3px 5px;
|
||||
border-radius: 6px;
|
||||
cursor: help;
|
||||
line-height: 1.1;
|
||||
text-align: center;
|
||||
transition:
|
||||
transform 150ms ease,
|
||||
background-color 150ms ease;
|
||||
|
||||
&:hover {
|
||||
background: rgba(241, 243, 247, 0.9);
|
||||
transform: translateY(-2px);
|
||||
}
|
||||
}
|
||||
|
||||
.word-cloud-state {
|
||||
min-height: 300px;
|
||||
display: grid;
|
||||
place-items: center;
|
||||
color: #64748b;
|
||||
display: flex;
|
||||
min-height: 280px;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
flex-direction: column;
|
||||
gap: 6px;
|
||||
padding: 24px;
|
||||
color: var(--sg-text-muted, #64708f);
|
||||
text-align: center;
|
||||
|
||||
&.error {
|
||||
color: #b91c1c;
|
||||
strong {
|
||||
margin-top: 4px;
|
||||
color: var(--sg-text, #101a3d);
|
||||
font-size: 0.9375rem;
|
||||
}
|
||||
|
||||
> span:last-child {
|
||||
font-size: 0.8125rem;
|
||||
}
|
||||
}
|
||||
|
||||
.state-icon {
|
||||
display: grid;
|
||||
width: 46px;
|
||||
height: 46px;
|
||||
place-items: center;
|
||||
border-radius: 50%;
|
||||
background: #f1f3f7;
|
||||
color: #64708f;
|
||||
}
|
||||
|
||||
.state-icon--loading {
|
||||
background: #f6f0ff;
|
||||
color: #7255d9;
|
||||
animation: state-pulse 1.4s ease-in-out infinite;
|
||||
}
|
||||
|
||||
.word-cloud-state--error .state-icon {
|
||||
background: #fff1f5;
|
||||
color: #d12f61;
|
||||
}
|
||||
|
||||
@keyframes state-pulse {
|
||||
50% {
|
||||
box-shadow: 0 0 0 8px rgba(114, 85, 217, 0.08);
|
||||
transform: scale(1.04);
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 700px) {
|
||||
.dialog-title {
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
mat-dialog-content {
|
||||
padding: 16px 20px 20px !important;
|
||||
}
|
||||
|
||||
.topic-context-card {
|
||||
grid-template-columns: 1fr;
|
||||
gap: 4px;
|
||||
}
|
||||
|
||||
.topic-context-arrow {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.topic-context-copy strong {
|
||||
white-space: normal;
|
||||
}
|
||||
|
||||
.word-cloud-chart {
|
||||
min-height: 240px;
|
||||
gap: 10px 14px;
|
||||
padding: 24px 18px;
|
||||
}
|
||||
}
|
||||
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
.state-icon--loading {
|
||||
animation: none;
|
||||
}
|
||||
|
||||
.word-cloud-word {
|
||||
transition: none;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,13 +22,16 @@ export type TopicChipColor = TopicChipPaletteColor | string;
|
||||
export type TopicChipSize = 'normal' | 'mini';
|
||||
export type TopicChipTooltipTarget = 'label' | 'button';
|
||||
|
||||
interface TopicChipColorTokens {
|
||||
export interface TopicChipColorTokens {
|
||||
border: string;
|
||||
background: string;
|
||||
color: string;
|
||||
}
|
||||
|
||||
const TOPIC_CHIP_COLORS: Record<TopicChipPaletteColor, TopicChipColorTokens> = {
|
||||
export const TOPIC_CHIP_COLORS: Record<
|
||||
TopicChipPaletteColor,
|
||||
TopicChipColorTokens
|
||||
> = {
|
||||
purple: {
|
||||
border: '#d8cafe',
|
||||
background: '#f6f0ff',
|
||||
|
||||
Reference in New Issue
Block a user