Merge branch 'dev' of nes.uni-due.de:lbs/smartguide into feature/keywords-analysis
This commit is contained in:
@@ -18,6 +18,12 @@ import {
|
||||
} from '@angular/cdk/overlay';
|
||||
import { ComponentPortal, ComponentType } from '@angular/cdk/portal';
|
||||
|
||||
const STICKY_TOOLBAR_HEIGHT_PX = 76;
|
||||
const EDGE_MARGIN_PX = 8;
|
||||
const TOP_MARGIN_PX = STICKY_TOOLBAR_HEIGHT_PX + EDGE_MARGIN_PX;
|
||||
const MIN_PANEL_WIDTH_PX = 240;
|
||||
const MIN_PANEL_HEIGHT_PX = 150;
|
||||
|
||||
type UnwrapInputSignals<T> = {
|
||||
[K in keyof T]: T[K] extends InputSignal<infer V> ? V : T[K];
|
||||
};
|
||||
@@ -27,6 +33,10 @@ type UnwrapInputSignals<T> = {
|
||||
standalone: true,
|
||||
})
|
||||
export class ComponentTooltipDirective<T extends object> implements OnDestroy {
|
||||
private static readonly openInstances = new Set<
|
||||
ComponentTooltipDirective<any>
|
||||
>();
|
||||
|
||||
readonly component = input.required<ComponentType<T>>({
|
||||
alias: 'appComponentTooltip',
|
||||
});
|
||||
@@ -43,6 +53,7 @@ export class ComponentTooltipDirective<T extends object> implements OnDestroy {
|
||||
|
||||
private overlayRef: OverlayRef | null = null;
|
||||
private componentRef: ComponentRef<T> | null = null;
|
||||
private computedMaxWidthPx = MIN_PANEL_WIDTH_PX;
|
||||
private showTimeout?: ReturnType<typeof setTimeout>;
|
||||
private hideTimeout?: ReturnType<typeof setTimeout>;
|
||||
private dismissTimeout?: ReturnType<typeof setTimeout>;
|
||||
@@ -104,59 +115,169 @@ export class ComponentTooltipDirective<T extends object> implements OnDestroy {
|
||||
}
|
||||
|
||||
private scheduleHide(): void {
|
||||
clearTimeout(this.hideTimeout);
|
||||
this.hideTimeout = setTimeout(() => {
|
||||
if (!this.isOverHost && !this.isOverOverlay) {
|
||||
this.hide();
|
||||
if (this.isOverHost || this.isOverOverlay) {
|
||||
return;
|
||||
}
|
||||
if (this.hasOpenDescendantTooltip()) {
|
||||
this.scheduleHide();
|
||||
return;
|
||||
}
|
||||
this.hide();
|
||||
}, this.tooltipHideDelay());
|
||||
}
|
||||
|
||||
private hasOpenDescendantTooltip(): boolean {
|
||||
const paneElement = this.overlayRef?.overlayElement;
|
||||
if (!paneElement) return false;
|
||||
|
||||
for (const other of ComponentTooltipDirective.openInstances) {
|
||||
if (other === this) continue;
|
||||
if (paneElement.contains(other.elementRef.nativeElement)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private clampedOffsetX(
|
||||
alignToStart: boolean,
|
||||
triggerRect: DOMRect,
|
||||
actualWidthPx: number,
|
||||
viewportWidth: number,
|
||||
): number {
|
||||
const desiredLeft = alignToStart
|
||||
? triggerRect.left
|
||||
: triggerRect.right - actualWidthPx;
|
||||
const minLeft = EDGE_MARGIN_PX;
|
||||
const maxLeft = Math.max(
|
||||
EDGE_MARGIN_PX,
|
||||
viewportWidth - actualWidthPx - EDGE_MARGIN_PX,
|
||||
);
|
||||
const clampedLeft = Math.min(Math.max(desiredLeft, minLeft), maxLeft);
|
||||
const anchor = alignToStart ? triggerRect.left : triggerRect.right;
|
||||
return clampedLeft - anchor + (alignToStart ? 0 : actualWidthPx);
|
||||
}
|
||||
|
||||
private computePositioning(): {
|
||||
positions: ConnectedPosition[];
|
||||
maxWidthPx: number;
|
||||
maxHeightPx: number;
|
||||
} {
|
||||
const triggerRect = this.elementRef.nativeElement.getBoundingClientRect();
|
||||
const viewportWidth = window.innerWidth;
|
||||
const viewportHeight = window.innerHeight;
|
||||
|
||||
const spaceAbove = triggerRect.top - TOP_MARGIN_PX;
|
||||
const spaceBelow = viewportHeight - triggerRect.bottom - EDGE_MARGIN_PX;
|
||||
const spaceLeft = triggerRect.left - EDGE_MARGIN_PX;
|
||||
const spaceRight = viewportWidth - triggerRect.right - EDGE_MARGIN_PX;
|
||||
|
||||
const preferBelow = spaceBelow >= spaceAbove;
|
||||
const preferStartAligned = spaceRight >= spaceLeft;
|
||||
|
||||
const bestVerticalSpace = Math.max(spaceAbove, spaceBelow);
|
||||
const bestHorizontalSpace = Math.max(spaceLeft, spaceRight);
|
||||
|
||||
const maxHeightPx = Math.max(bestVerticalSpace, MIN_PANEL_HEIGHT_PX);
|
||||
const maxWidthPx = Math.max(bestHorizontalSpace, MIN_PANEL_WIDTH_PX);
|
||||
const actualWidthPx = Math.min(
|
||||
maxWidthPx,
|
||||
this.resolveConfiguredWidthPx(this.tooltipMaxWidth()) ?? maxWidthPx,
|
||||
);
|
||||
|
||||
const primaryOffsetX = this.clampedOffsetX(
|
||||
preferStartAligned,
|
||||
triggerRect,
|
||||
actualWidthPx,
|
||||
viewportWidth,
|
||||
);
|
||||
const secondaryOffsetX = this.clampedOffsetX(
|
||||
!preferStartAligned,
|
||||
triggerRect,
|
||||
actualWidthPx,
|
||||
viewportWidth,
|
||||
);
|
||||
|
||||
const verticalPrimary: ConnectedPosition = preferBelow
|
||||
? {
|
||||
originX: preferStartAligned ? 'start' : 'end',
|
||||
originY: 'bottom',
|
||||
overlayX: preferStartAligned ? 'start' : 'end',
|
||||
overlayY: 'top',
|
||||
offsetX: primaryOffsetX,
|
||||
offsetY: EDGE_MARGIN_PX,
|
||||
}
|
||||
: {
|
||||
originX: preferStartAligned ? 'start' : 'end',
|
||||
originY: 'top',
|
||||
overlayX: preferStartAligned ? 'start' : 'end',
|
||||
overlayY: 'bottom',
|
||||
offsetX: primaryOffsetX,
|
||||
offsetY: -EDGE_MARGIN_PX,
|
||||
};
|
||||
const verticalSecondary: ConnectedPosition = preferBelow
|
||||
? {
|
||||
originX: preferStartAligned ? 'end' : 'start',
|
||||
originY: 'top',
|
||||
overlayX: preferStartAligned ? 'end' : 'start',
|
||||
overlayY: 'bottom',
|
||||
offsetX: secondaryOffsetX,
|
||||
offsetY: -EDGE_MARGIN_PX,
|
||||
}
|
||||
: {
|
||||
originX: preferStartAligned ? 'end' : 'start',
|
||||
originY: 'bottom',
|
||||
overlayX: preferStartAligned ? 'end' : 'start',
|
||||
overlayY: 'top',
|
||||
offsetX: secondaryOffsetX,
|
||||
offsetY: EDGE_MARGIN_PX,
|
||||
};
|
||||
const sidePrimary: ConnectedPosition = preferStartAligned
|
||||
? {
|
||||
originX: 'end',
|
||||
originY: 'center',
|
||||
overlayX: 'start',
|
||||
overlayY: 'center',
|
||||
offsetX: EDGE_MARGIN_PX,
|
||||
}
|
||||
: {
|
||||
originX: 'start',
|
||||
originY: 'center',
|
||||
overlayX: 'end',
|
||||
overlayY: 'center',
|
||||
offsetX: -EDGE_MARGIN_PX,
|
||||
};
|
||||
|
||||
const positions: ConnectedPosition[] = [
|
||||
verticalPrimary,
|
||||
verticalSecondary,
|
||||
sidePrimary,
|
||||
];
|
||||
|
||||
return { positions, maxWidthPx, maxHeightPx };
|
||||
}
|
||||
|
||||
private show(): void {
|
||||
if (this.overlayRef?.hasAttached()) return;
|
||||
|
||||
const positions: ConnectedPosition[] = [
|
||||
{
|
||||
originX: 'center',
|
||||
originY: 'top',
|
||||
overlayX: 'center',
|
||||
overlayY: 'bottom',
|
||||
offsetY: -8,
|
||||
},
|
||||
{
|
||||
originX: 'center',
|
||||
originY: 'bottom',
|
||||
overlayX: 'center',
|
||||
overlayY: 'top',
|
||||
offsetY: 8,
|
||||
},
|
||||
{
|
||||
originX: 'end',
|
||||
originY: 'center',
|
||||
overlayX: 'start',
|
||||
overlayY: 'center',
|
||||
offsetX: 8,
|
||||
},
|
||||
{
|
||||
originX: 'start',
|
||||
originY: 'center',
|
||||
overlayX: 'end',
|
||||
overlayY: 'center',
|
||||
offsetX: -8,
|
||||
},
|
||||
];
|
||||
const { positions, maxWidthPx, maxHeightPx } = this.computePositioning();
|
||||
this.computedMaxWidthPx = maxWidthPx;
|
||||
|
||||
const positionStrategy = this.overlayPositionBuilder
|
||||
.flexibleConnectedTo(this.elementRef)
|
||||
.withPositions(positions)
|
||||
.withFlexibleDimensions(false)
|
||||
.withViewportMargin(12)
|
||||
.withViewportMargin(EDGE_MARGIN_PX)
|
||||
.withPush(true);
|
||||
|
||||
this.overlayRef = this.overlay.create({
|
||||
positionStrategy,
|
||||
scrollStrategy: this.overlay.scrollStrategies.reposition(),
|
||||
panelClass: 'app-tooltip-panel',
|
||||
maxWidth: this.tooltipMaxWidth() ?? 'calc(100vw - 24px)',
|
||||
maxWidth: this.resolveMaxWidth(this.tooltipMaxWidth()),
|
||||
maxHeight: `${maxHeightPx}px`,
|
||||
});
|
||||
|
||||
const portal = new ComponentPortal(this.component(), null, this.injector);
|
||||
@@ -175,18 +296,34 @@ export class ComponentTooltipDirective<T extends object> implements OnDestroy {
|
||||
overlayElement.addEventListener('mouseenter', this.onOverlayEnter);
|
||||
overlayElement.addEventListener('mouseleave', this.onOverlayLeave);
|
||||
overlayElement.addEventListener('click', this.onOverlayClick, true);
|
||||
|
||||
ComponentTooltipDirective.openInstances.add(this);
|
||||
}
|
||||
|
||||
private applyMaxWidth(
|
||||
element: HTMLElement,
|
||||
maxWidth: string | number | null,
|
||||
): void {
|
||||
if (maxWidth === null) {
|
||||
element.style.maxWidth = '';
|
||||
return;
|
||||
element.style.maxWidth = this.resolveMaxWidth(maxWidth);
|
||||
}
|
||||
|
||||
private resolveMaxWidth(maxWidth: string | number | null): string {
|
||||
const configuredPx = this.resolveConfiguredWidthPx(maxWidth);
|
||||
if (configuredPx === null) {
|
||||
return typeof maxWidth === 'number'
|
||||
? `${maxWidth}px`
|
||||
: (maxWidth ?? `${this.computedMaxWidthPx}px`);
|
||||
}
|
||||
element.style.maxWidth =
|
||||
typeof maxWidth === 'number' ? `${maxWidth}px` : maxWidth;
|
||||
return `${Math.min(configuredPx, this.computedMaxWidthPx)}px`;
|
||||
}
|
||||
|
||||
private resolveConfiguredWidthPx(
|
||||
maxWidth: string | number | null,
|
||||
): number | null {
|
||||
if (maxWidth === null) return null;
|
||||
if (typeof maxWidth === 'number') return maxWidth;
|
||||
const trimmed = maxWidth.trim();
|
||||
return trimmed.endsWith('px') ? parseFloat(trimmed) : null;
|
||||
}
|
||||
|
||||
private readonly onOverlayEnter = (): void => {
|
||||
@@ -212,12 +349,14 @@ export class ComponentTooltipDirective<T extends object> implements OnDestroy {
|
||||
this.overlayRef.detach();
|
||||
}
|
||||
this.componentRef = null;
|
||||
ComponentTooltipDirective.openInstances.delete(this);
|
||||
}
|
||||
|
||||
ngOnDestroy(): void {
|
||||
clearTimeout(this.showTimeout);
|
||||
clearTimeout(this.hideTimeout);
|
||||
clearTimeout(this.dismissTimeout);
|
||||
ComponentTooltipDirective.openInstances.delete(this);
|
||||
this.overlayRef?.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -455,6 +455,7 @@
|
||||
[queryParams]="authorQueryParams(dataset, entry)"
|
||||
[appComponentTooltip]="AuthorTooltipComponent"
|
||||
[tooltipInputs]="{ authorId: entry.id }"
|
||||
[tooltipMaxWidth]="'500px'"
|
||||
[title]="authorDisplayName(dataset, entry)">
|
||||
{{ authorDisplayName(dataset, entry) }}
|
||||
</a>
|
||||
|
||||
@@ -141,7 +141,8 @@
|
||||
[appComponentTooltip]="AuthorTooltipComponent"
|
||||
[tooltipInputs]="{
|
||||
authorId: author.openalex_author_id,
|
||||
}">
|
||||
}"
|
||||
[tooltipMaxWidth]="'500px'">
|
||||
{{ author.author_name }}
|
||||
</a>
|
||||
</li>
|
||||
|
||||
@@ -131,7 +131,8 @@
|
||||
[appComponentTooltip]="AppPublicationTooltipComponent"
|
||||
[tooltipInputs]="{
|
||||
workId: this.stripOpenAlexIdPrefix(work.id),
|
||||
}">
|
||||
}"
|
||||
[tooltipMaxWidth]="'500px'">
|
||||
<li>{{ work.display_name }}</li>
|
||||
</a>
|
||||
}
|
||||
@@ -150,7 +151,8 @@
|
||||
[appComponentTooltip]="AppInstitutionTooltipComponent"
|
||||
[tooltipInputs]="{
|
||||
institutionId: this.stripOpenAlexIdPrefix(institution.id),
|
||||
}">
|
||||
}"
|
||||
[tooltipMaxWidth]="'500px'">
|
||||
<li>{{ institution.display_name }}</li>
|
||||
</a>
|
||||
}
|
||||
@@ -188,7 +190,8 @@
|
||||
[appComponentTooltip]="AppAuthorTooltipComponent"
|
||||
[tooltipInputs]="{
|
||||
authorId: this.stripOpenAlexIdPrefix(collaborator.id),
|
||||
}">
|
||||
}"
|
||||
[tooltipMaxWidth]="'500px'">
|
||||
{{ collaborator.display_name }}
|
||||
</a>
|
||||
</li>
|
||||
@@ -227,7 +230,8 @@
|
||||
[appComponentTooltip]="AppAuthorTooltipComponent"
|
||||
[tooltipInputs]="{
|
||||
authorId: this.stripOpenAlexIdPrefix(collaborator.id),
|
||||
}">
|
||||
}"
|
||||
[tooltipMaxWidth]="'500px'">
|
||||
{{ collaborator.display_name }}
|
||||
</a>
|
||||
</li>
|
||||
|
||||
@@ -2,12 +2,13 @@
|
||||
class="author-chip"
|
||||
[appComponentTooltip]="AuthorTooltipComponent"
|
||||
[tooltipInputs]="{ author: _author(), authorId: rawOaAuthorId() }"
|
||||
[tooltipMaxWidth]="'500px'"
|
||||
(keydown)="_onChipClick($event)"
|
||||
(click)="_onChipClick($event)">
|
||||
<span class="chip-content">
|
||||
@if (showIcon()) {
|
||||
<mat-icon class="author-icon">{{ icon() }}</mat-icon>
|
||||
}
|
||||
{{ _author()?.display_name }}
|
||||
<span class="chip-label">{{ _author()?.display_name }}</span>
|
||||
</span>
|
||||
</mat-chip>
|
||||
|
||||
@@ -1,8 +1,16 @@
|
||||
:host {
|
||||
display: inline-flex;
|
||||
min-width: 0;
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
.author-chip {
|
||||
font-weight: 500;
|
||||
border-radius: var(--sg-radius-sm);
|
||||
background-color: var(--sg-surface-soft);
|
||||
border: var(--border-width) solid var(--border-color);
|
||||
max-width: 100%;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
:host ::ng-deep .author-chip .mat-mdc-chip-action,
|
||||
@@ -29,6 +37,7 @@
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.5rem;
|
||||
min-width: 0;
|
||||
color: var(--sg-text);
|
||||
|
||||
mat-icon {
|
||||
@@ -36,6 +45,13 @@
|
||||
}
|
||||
}
|
||||
|
||||
.chip-label {
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
:host.is-mini-size {
|
||||
::ng-deep .mat-mdc-chip {
|
||||
height: 1.5rem;
|
||||
|
||||
@@ -8,10 +8,17 @@
|
||||
">
|
||||
<mat-card-header>
|
||||
<mat-card-title>{{ displayName() }}</mat-card-title>
|
||||
<mat-card-subtitle class="city-country"
|
||||
>{{ institution().geo?.city }},
|
||||
{{ institution().geo?.country }}</mat-card-subtitle
|
||||
>
|
||||
<mat-card-subtitle class="city-country">
|
||||
{{ institution().geo?.city }},
|
||||
{{ institution().geo?.country }}
|
||||
@if (institution().geo?.country_code) {
|
||||
<app-country-flag
|
||||
[countryCode]="institution().geo?.country_code"
|
||||
[height]="10"
|
||||
[bordered]="false"
|
||||
style="margin-left: 6px" />
|
||||
}
|
||||
</mat-card-subtitle>
|
||||
</mat-card-header>
|
||||
|
||||
<mat-divider />
|
||||
|
||||
@@ -15,6 +15,7 @@ import { MatIconModule } from '@angular/material/icon';
|
||||
import { MatButtonModule } from '@angular/material/button';
|
||||
import { DecimalPipe } from '@angular/common';
|
||||
import { CredentialService } from '../../services/credential.service';
|
||||
import { CountryFlagComponent } from '../country-flag/country-flag.component';
|
||||
|
||||
@Component({
|
||||
selector: 'app-institution-card',
|
||||
@@ -25,6 +26,7 @@ import { CredentialService } from '../../services/credential.service';
|
||||
MatIconModule,
|
||||
MatButtonModule,
|
||||
DecimalPipe,
|
||||
CountryFlagComponent,
|
||||
],
|
||||
templateUrl: './app-institution-card.component.html',
|
||||
styleUrl: './app-institution-card.component.scss',
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
institution: _institution(),
|
||||
institutionId: rawOaInstitutionId(),
|
||||
}"
|
||||
[tooltipMaxWidth]="'500px'"
|
||||
(keydown)="_onChipClick($event)"
|
||||
(click)="_onChipClick($event)">
|
||||
<span class="chip-content">
|
||||
|
||||
@@ -67,8 +67,7 @@
|
||||
class="nav-icon-button"
|
||||
[routerLink]="item.disabled ? null : item.route"
|
||||
[queryParams]="item.queryParams || null"
|
||||
routerLinkActive="active"
|
||||
[routerLinkActiveOptions]="navLinkActiveOptions"
|
||||
[class.active]="isItemActive(item)"
|
||||
[class.disabled]="item.disabled"
|
||||
[matTooltip]="item.label"
|
||||
matTooltipPosition="right"
|
||||
@@ -80,8 +79,7 @@
|
||||
mat-list-item
|
||||
[routerLink]="item.disabled ? null : item.route"
|
||||
[queryParams]="item.queryParams || null"
|
||||
routerLinkActive="active"
|
||||
[routerLinkActiveOptions]="navLinkActiveOptions"
|
||||
[class.active]="isItemActive(item)"
|
||||
[class.disabled]="item.disabled">
|
||||
<mat-icon matListItemIcon>{{ item.icon }}</mat-icon>
|
||||
<span matListItemTitle>{{ item.label }}</span>
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
import { Component, computed, inject, input, output } from '@angular/core';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { IsActiveMatchOptions, Router, RouterModule } from '@angular/router';
|
||||
import { NavigationEnd, Router, RouterModule } from '@angular/router';
|
||||
import { toSignal } from '@angular/core/rxjs-interop';
|
||||
import { filter, map } from 'rxjs';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
import { MatListModule } from '@angular/material/list';
|
||||
import { MatButtonModule } from '@angular/material/button';
|
||||
@@ -42,6 +44,7 @@ type NavItem = {
|
||||
adminOnly?: boolean;
|
||||
superAdminOnly?: boolean;
|
||||
managerOrAdminOnly?: boolean;
|
||||
detailRoutePrefixes?: string[];
|
||||
};
|
||||
|
||||
type NavItemGroup = {
|
||||
@@ -75,12 +78,26 @@ export class AppMenuComponent {
|
||||
collapsed = input(false);
|
||||
canCollapse = input(false);
|
||||
toggleCollapsed = output<void>();
|
||||
readonly navLinkActiveOptions: IsActiveMatchOptions = {
|
||||
paths: 'subset',
|
||||
queryParams: 'ignored',
|
||||
matrixParams: 'ignored',
|
||||
fragment: 'ignored',
|
||||
};
|
||||
|
||||
private readonly router = inject(Router);
|
||||
|
||||
private readonly currentPath = toSignal(
|
||||
this.router.events.pipe(
|
||||
filter((event): event is NavigationEnd => event instanceof NavigationEnd),
|
||||
map((event) => event.urlAfterRedirects.split('?')[0]),
|
||||
),
|
||||
{ initialValue: this.router.url.split('?')[0] },
|
||||
);
|
||||
|
||||
isItemActive(item: NavItem): boolean {
|
||||
const path = this.currentPath();
|
||||
if (path === item.route || path.startsWith(`${item.route}/`)) {
|
||||
return true;
|
||||
}
|
||||
return (item.detailRoutePrefixes ?? []).some((prefix) =>
|
||||
path.startsWith(prefix),
|
||||
);
|
||||
}
|
||||
|
||||
readonly navItems = computed<NavItem[]>(() => {
|
||||
const items: NavItem[] = [
|
||||
@@ -99,6 +116,7 @@ export class AppMenuComponent {
|
||||
this.credentialService.organizationName(),
|
||||
),
|
||||
disabled: false,
|
||||
detailRoutePrefixes: ['/person/'],
|
||||
},
|
||||
{
|
||||
label: 'Bookmarks',
|
||||
@@ -124,6 +142,7 @@ export class AppMenuComponent {
|
||||
sort_by: 'works_count',
|
||||
sorting_order: SortDirection.Desc,
|
||||
},
|
||||
detailRoutePrefixes: ['/institution/'],
|
||||
},
|
||||
{
|
||||
label: 'Publikationen',
|
||||
@@ -137,6 +156,7 @@ export class AppMenuComponent {
|
||||
[workQueryParamKeys.sortBy]: WorkSortBy.CitedByCount,
|
||||
[workQueryParamKeys.sortDirection]: SortDirection.Desc,
|
||||
},
|
||||
detailRoutePrefixes: ['/publication/'],
|
||||
},
|
||||
{
|
||||
label: 'Themen',
|
||||
@@ -150,6 +170,7 @@ export class AppMenuComponent {
|
||||
[topicQueryParamKeys.sortBy]: TopicSortBy.CitedByCount,
|
||||
[topicQueryParamKeys.sortDirection]: SortDirection.Desc,
|
||||
},
|
||||
detailRoutePrefixes: ['/topic/'],
|
||||
},
|
||||
{
|
||||
label: 'Projekte',
|
||||
@@ -170,6 +191,7 @@ export class AppMenuComponent {
|
||||
icon: PATENT_ICON,
|
||||
route: '/patents',
|
||||
disabled: false,
|
||||
detailRoutePrefixes: ['/patent/'],
|
||||
},
|
||||
{
|
||||
label: 'Keywords',
|
||||
@@ -230,10 +252,7 @@ export class AppMenuComponent {
|
||||
];
|
||||
});
|
||||
|
||||
constructor(
|
||||
public credentialService: CredentialService,
|
||||
private readonly router: Router,
|
||||
) {}
|
||||
constructor(public credentialService: CredentialService) {}
|
||||
|
||||
isNavigating = computed(() => !!this.router.currentNavigation());
|
||||
readonly themeService = inject(ThemeService);
|
||||
|
||||
@@ -17,7 +17,9 @@
|
||||
<mat-icon>label</mat-icon>
|
||||
<span>Themen</span>
|
||||
</div>
|
||||
<div class="chips chips-column">
|
||||
<div
|
||||
class="chips chips-column"
|
||||
[class.chips-column--size-to-content]="sizeTopicsToContent()">
|
||||
@for (topic of visibleTopics(); track topic.id) {
|
||||
<app-topic-chip-2
|
||||
[topic]="topic"
|
||||
|
||||
@@ -93,6 +93,10 @@ mat-card-title {
|
||||
min-height: calc(3 * 32px + 2 * 0.5rem);
|
||||
}
|
||||
|
||||
.chips-column--size-to-content {
|
||||
min-height: 0;
|
||||
}
|
||||
|
||||
.chips-authors {
|
||||
flex-wrap: nowrap;
|
||||
align-content: flex-start;
|
||||
|
||||
@@ -33,6 +33,7 @@ const MAX_VISIBLE_AUTHORS = 3;
|
||||
})
|
||||
export class AppPublicationCardComponent {
|
||||
work = input.required<Work>();
|
||||
sizeTopicsToContent = input(false);
|
||||
|
||||
topicChipClick = output<Topic>();
|
||||
authorChipClick = output<Author>();
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
@let work = this._work();
|
||||
|
||||
@if (work) {
|
||||
<app-publication-card [work]="work" />
|
||||
<app-publication-card [work]="work" [sizeTopicsToContent]="true" />
|
||||
}
|
||||
|
||||
@@ -9,6 +9,6 @@
|
||||
@if (showIcon()) {
|
||||
<mat-icon>{{ icon() }}</mat-icon>
|
||||
}
|
||||
{{ topic().display_name }}
|
||||
<span class="chip-label">{{ topic().display_name }}</span>
|
||||
</span>
|
||||
</mat-chip>
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
:host {
|
||||
display: inline-flex;
|
||||
min-width: 0;
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
.topic-chip {
|
||||
--topic-background: color-mix(
|
||||
in srgb,
|
||||
@@ -20,6 +26,8 @@
|
||||
align-items: center;
|
||||
gap: 0.5rem;
|
||||
color: var(--sg-text);
|
||||
max-width: 100%;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
:host ::ng-deep .topic-chip .mat-mdc-chip-action,
|
||||
@@ -54,6 +62,7 @@
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.5rem;
|
||||
min-width: 0;
|
||||
color: var(--sg-text);
|
||||
|
||||
mat-icon {
|
||||
@@ -61,6 +70,13 @@
|
||||
}
|
||||
}
|
||||
|
||||
.chip-label {
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
:host.is-mini-size {
|
||||
::ng-deep .mat-mdc-chip {
|
||||
height: 1.5rem;
|
||||
|
||||
@@ -104,6 +104,7 @@
|
||||
[routerLink]="['/person', author.openalex_author_id]"
|
||||
[appComponentTooltip]="AuthorTooltipComponent"
|
||||
[tooltipInputs]="{ authorId: author.openalex_author_id }"
|
||||
[tooltipMaxWidth]="'500px'"
|
||||
(click)="$event.stopPropagation()">
|
||||
{{ author.author_name }}
|
||||
</a>
|
||||
|
||||
@@ -582,6 +582,11 @@ html.dark-theme {
|
||||
line-height: 1.4;
|
||||
}
|
||||
|
||||
.cdk-overlay-pane.app-tooltip-panel {
|
||||
max-height: 70vh;
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
.cdk-overlay-pane .mat-mdc-option {
|
||||
padding: 0 18px;
|
||||
font-size: 13px;
|
||||
|
||||
Reference in New Issue
Block a user