Refactor ManagementPanel and PeoplePanel to remove unused painted property and streamline card painting logic. Updated paintCard method to use a more concise function for determining card placement.
This commit is contained in:
@@ -63,7 +63,6 @@ export class ManagementPanel {
|
||||
private cardToken = 0;
|
||||
private busy = false;
|
||||
private locate: ((id: string) => string) | null = null;
|
||||
private painted: PersonCard | null = null;
|
||||
private poolDialog: ApplicantsDialog | null = null;
|
||||
private readonly cardHost = new PersonCardHost();
|
||||
|
||||
@@ -402,7 +401,6 @@ export class ManagementPanel {
|
||||
}
|
||||
|
||||
private paintCard(card: PersonCard | null): void {
|
||||
this.painted = card;
|
||||
if (card === null) {
|
||||
clear(this.card);
|
||||
this.card.append(el('p', { class: 'panel__empty', text: t('staffPickHint') }));
|
||||
@@ -413,7 +411,7 @@ export class ManagementPanel {
|
||||
this.card,
|
||||
card,
|
||||
(id) => void this.openRelative(id),
|
||||
this.placeOf(card.id),
|
||||
(id) => this.placeOf(id),
|
||||
(overview, painted) => {
|
||||
this.mountPersonTimetable(overview, painted);
|
||||
this.appendActions(overview, painted.id);
|
||||
|
||||
@@ -62,7 +62,6 @@ export class PeoplePanel {
|
||||
private token = 0;
|
||||
private cardToken = 0;
|
||||
private locate: ((id: string) => string) | null = null;
|
||||
private painted: PersonCard | null = null;
|
||||
private readonly cardHost = new PersonCardHost();
|
||||
|
||||
constructor(private readonly options: PeoplePanelOptions) {
|
||||
@@ -364,7 +363,6 @@ export class PeoplePanel {
|
||||
}
|
||||
|
||||
private paintCard(card: PersonCard | null): void {
|
||||
this.painted = card;
|
||||
if (card === null) {
|
||||
clear(this.card);
|
||||
this.card.append(el('p', { class: 'panel__empty', text: t('peoplePickHint') }));
|
||||
@@ -375,7 +373,7 @@ export class PeoplePanel {
|
||||
this.card,
|
||||
card,
|
||||
(id) => void this.openCard(id),
|
||||
this.placeOf(card.id),
|
||||
(id) => this.placeOf(id),
|
||||
(overview, painted) => this.mountPersonTimetable(overview, painted),
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user