added founder table filters to the founder dashboard

This commit is contained in:
2026-11-18 18:21:07 +01:00
parent eb2fa92225
commit 722f95fad1
3 changed files with 147 additions and 6 deletions
@@ -57,8 +57,53 @@
<app-founder-filters [statistics]="statistics()" />
<div class="list-count">
{{ fmtInt(total()) }} {{ total() === 1 ? 'Person' : 'Personen' }}
<div class="controls">
<span class="controls__range">
Mindestwert
<mat-icon
class="info-icon"
[matTooltip]="thresholdTooltip"
matTooltipClass="sg-tooltip-wide"
matTooltipPosition="above">
{{ INFO_OUTLINE_ICON }}
</mat-icon>
</span>
<mat-slide-toggle
[checked]="thresholdEnabled()"
(change)="onThresholdEnabledChange($event.checked)"
[matTooltip]="thresholdToggleTooltip"
matTooltipClass="sg-tooltip-wide"
matTooltipPosition="above">
Aktiv
</mat-slide-toggle>
<mat-slider
class="controls__slider"
[min]="50"
[max]="100"
[step]="1"
[discrete]="true"
[displayWith]="formatThreshold"
[disabled]="!thresholdEnabled()">
<input
matSliderThumb
[value]="thresholdDraft()"
(valueChange)="onSliderInput($event)"
(dragEnd)="onSliderCommit($event.value)"
(keyup)="onSliderCommit()"
aria-label="Mindestwert für die Liste der Top-Kandidat:innen" />
</mat-slider>
<span class="controls__value">{{ thresholdDraft() }}</span>
<mat-slide-toggle
[checked]="screened()"
(change)="onScreenedChange($event.checked)"
[matTooltip]="screeningTooltip"
matTooltipClass="sg-tooltip-wide"
matTooltipPosition="above">
Auffällige Profile ausblenden
</mat-slide-toggle>
<span class="controls__count">
{{ fmtInt(total()) }} {{ total() === 1 ? 'Person' : 'Personen' }}
</span>
</div>
<mat-card appearance="outlined" class="list-card">
@@ -77,10 +77,42 @@
}
}
.list-count {
margin: 1rem 0;
font-size: 0.875rem;
color: var(--sg-text-soft);
.controls {
display: flex;
flex-wrap: wrap;
align-items: center;
gap: 10px 22px;
margin-bottom: 16px;
padding: 12px 14px;
border: 1px solid var(--sg-border);
border-radius: 10px;
background: var(--sg-surface-muted);
font-size: 13px;
&__range {
display: inline-flex;
align-items: center;
gap: 6px;
color: var(--sg-text-muted);
}
&__value {
display: inline-block;
min-width: 24px;
color: var(--sg-text);
font-weight: 700;
font-variant-numeric: tabular-nums;
}
&__count {
margin-left: auto;
color: var(--sg-text-soft);
}
&__slider {
width: 220px;
min-width: 160px;
}
}
.list-card {
@@ -1,8 +1,10 @@
import {
Component,
computed,
effect,
inject,
input,
signal,
TemplateRef,
viewChild,
} from '@angular/core';
@@ -13,6 +15,8 @@ import { MatCardModule } from '@angular/material/card';
import { MatButtonModule } from '@angular/material/button';
import { MatDialog } from '@angular/material/dialog';
import { MatIconModule } from '@angular/material/icon';
import { MatSliderModule } from '@angular/material/slider';
import { MatSlideToggleModule } from '@angular/material/slide-toggle';
import { MatTooltipModule } from '@angular/material/tooltip';
import { RouterLink } from '@angular/router';
import { ComponentTooltipDirective } from '../../../directives/component-tooltip.directive';
@@ -75,6 +79,8 @@ interface FounderRow {
MatCardModule,
MatButtonModule,
MatIconModule,
MatSliderModule,
MatSlideToggleModule,
MatTooltipModule,
QueryParamPaginatorComponent,
ChipComponent,
@@ -170,6 +176,15 @@ export class FounderDashboardComponent {
readonly careerBucketTooltip = careerBucketDescription;
readonly thresholdTooltip =
'Legt fest, ab welchem Rang Personen in der Liste erscheinen. 90 ist streng und zeigt nur die obersten 10 % der Vergleichsgruppe; 50 zeigt die obere Hälfte. Ohne Mindestwert werden alle Profile angezeigt.';
readonly thresholdToggleTooltip =
'Standardmäßig werden alle Profile angezeigt. Aktiviere den Mindestwert, um nur Personen ab einem bestimmten Rang zu sehen.';
readonly screeningTooltip =
'Blendet Profile aus, die vermutlich unvollständig, falsch datiert oder mit anderen Personen vermischt sind. Die Werte dieser Personen sind weniger verlässlich. Ist die Option aus, werden alle Profile angezeigt.';
// -- KPIs ---------------------------------------------------------------
readonly kpis = computed(() => {
@@ -265,6 +280,55 @@ export class FounderDashboardComponent {
// -- Controls -----------------------------------------------------------
/** Live slider value while dragging; committed to the URL on release. */
readonly thresholdDraft = signal<number>(DEFAULT_THRESHOLD);
constructor() {
effect(() => this.thresholdDraft.set(this.threshold()));
}
readonly formatThreshold = (value: number): string => String(value);
/** Enables or disables the threshold filter (writes/removes the URL param). */
onThresholdEnabledChange(enabled: boolean): void {
void this.router.navigate([], {
relativeTo: this.route,
queryParams: {
threshold: enabled ? this.thresholdDraft() : null,
page: 0,
},
queryParamsHandling: 'merge',
});
}
onSliderInput(value: number): void {
if (Number.isFinite(value)) this.thresholdDraft.set(value);
}
/** Commits the threshold value to the URL. */
onSliderCommit(value = this.thresholdDraft()): void {
if (!this.thresholdEnabled() || !Number.isFinite(value)) return;
this.thresholdDraft.set(value);
if (value === this.threshold()) return;
void this.router.navigate([], {
relativeTo: this.route,
queryParams: { threshold: value, page: 0 },
queryParamsHandling: 'merge',
});
}
/**
* `screened=false` means "only rejected profiles" on the backend, so turning
* the toggle off must REMOVE the param (everyone), not set false.
*/
onScreenedChange(checked: boolean): void {
void this.router.navigate([], {
relativeTo: this.route,
queryParams: { screened: checked ? 'true' : null, page: 0 },
queryParamsHandling: 'merge',
});
}
onLowerThreshold(): void {
const next = Math.max(50, this.threshold() - 10);
void this.router.navigate([], {