fix bookdrop metadata picker header buttons not rendering and disabled fields still showing (#3032)
This commit is contained in:
+35
-35
@@ -2,41 +2,41 @@
|
|||||||
@if (fetchedMetadata && fetchedMetadata.title) {
|
@if (fetchedMetadata && fetchedMetadata.title) {
|
||||||
<form [formGroup]="metadataForm" class="metapicker">
|
<form [formGroup]="metadataForm" class="metapicker">
|
||||||
<div class="form-scroll">
|
<div class="form-scroll">
|
||||||
<div class="metaheader">
|
<div class="column-headers">
|
||||||
<label class="field-label"></label>
|
<div class="column-label current">
|
||||||
<div class="header-fields-row">
|
<span>{{ t('fileData') }}</span>
|
||||||
<p class="header-column">{{ t('fileData') }}</p>
|
</div>
|
||||||
<div class="midbuttons">
|
<div class="column-actions">
|
||||||
<p-button
|
<button
|
||||||
size="small"
|
type="button"
|
||||||
icon="pi pi-angle-left"
|
class="p-button p-button-outlined p-button-sm p-button-icon-only"
|
||||||
class="btn-margin"
|
[pTooltip]="t('copyMissingTooltip')"
|
||||||
[outlined]="true"
|
tooltipPosition="bottom"
|
||||||
[pTooltip]="t('copyMissingTooltip')"
|
(click)="copyMissing()"
|
||||||
tooltipPosition="bottom"
|
>
|
||||||
(onClick)="copyMissing()"
|
<span class="p-button-icon pi pi-angle-left"></span>
|
||||||
></p-button>
|
</button>
|
||||||
<p-button
|
<button
|
||||||
size="small"
|
type="button"
|
||||||
icon="pi pi-angle-double-left"
|
class="p-button p-button-outlined p-button-sm p-button-icon-only"
|
||||||
class="btn-margin"
|
[pTooltip]="t('overwriteAllTooltip')"
|
||||||
[outlined]="true"
|
tooltipPosition="bottom"
|
||||||
[pTooltip]="t('overwriteAllTooltip')"
|
(click)="copyAll()"
|
||||||
tooltipPosition="bottom"
|
>
|
||||||
(onClick)="copyAll()"
|
<span class="p-button-icon pi pi-angle-double-left"></span>
|
||||||
></p-button>
|
</button>
|
||||||
<p-button
|
<button
|
||||||
size="small"
|
type="button"
|
||||||
severity="warn"
|
class="p-button p-button-outlined p-button-sm p-button-icon-only p-button-warn"
|
||||||
icon="pi pi-refresh"
|
[pTooltip]="t('resetAllTooltip')"
|
||||||
class="btn-margin"
|
tooltipPosition="bottom"
|
||||||
[outlined]="true"
|
(click)="confirmReset()"
|
||||||
[pTooltip]="t('resetAllTooltip')"
|
>
|
||||||
tooltipPosition="bottom"
|
<span class="p-button-icon pi pi-refresh"></span>
|
||||||
(onClick)="confirmReset()"
|
</button>
|
||||||
></p-button>
|
</div>
|
||||||
</div>
|
<div class="column-label fetched">
|
||||||
<p class="header-column">{{ t('fetchedData') }}</p>
|
<span>{{ t('fetchedData') }}</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="metacontent">
|
<div class="metacontent">
|
||||||
|
|||||||
+36
-22
@@ -93,18 +93,45 @@ textarea.changed,
|
|||||||
width: 8rem;
|
width: 8rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.header-fields-row {
|
.column-headers {
|
||||||
display: flex;
|
display: flex;
|
||||||
width: 100%;
|
|
||||||
align-items: center;
|
align-items: center;
|
||||||
}
|
padding: 1rem;
|
||||||
|
border-bottom: 1px dotted var(--border-color);
|
||||||
|
|
||||||
.header-column {
|
@media (min-width: 768px) {
|
||||||
width: 50%;
|
&::before {
|
||||||
}
|
content: '';
|
||||||
|
min-width: 8rem;
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.btn-margin {
|
.column-label {
|
||||||
margin: 0 0.5rem;
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
flex: 1;
|
||||||
|
color: var(--text-color-secondary);
|
||||||
|
font-size: 0.875rem;
|
||||||
|
|
||||||
|
&.current {
|
||||||
|
justify-content: flex-end;
|
||||||
|
padding-right: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.fetched {
|
||||||
|
justify-content: flex-start;
|
||||||
|
padding-left: 1rem;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.column-actions {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
gap: 0.5rem;
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.thumbnail-row {
|
.thumbnail-row {
|
||||||
@@ -217,25 +244,13 @@ textarea.changed,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
.metaheader {
|
.metaheader {
|
||||||
position: relative;
|
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
border-bottom: 1px dotted var(--border-color);
|
border-bottom: 1px dotted var(--border-color);
|
||||||
padding: 1rem;
|
padding: 1rem;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
|
|
||||||
p {
|
|
||||||
text-align: center;
|
|
||||||
|
|
||||||
@media (max-width: 768px) {
|
|
||||||
font-size: 0.875rem;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.metaheader .midbuttons {
|
|
||||||
white-space: nowrap;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.metacontent {
|
.metacontent {
|
||||||
@@ -294,7 +309,6 @@ textarea.changed,
|
|||||||
}
|
}
|
||||||
|
|
||||||
@media (min-width: 768px) {
|
@media (min-width: 768px) {
|
||||||
.metaheader,
|
|
||||||
.metapicker .metacontent,
|
.metapicker .metacontent,
|
||||||
.metaeditor .metabody {
|
.metaeditor .metabody {
|
||||||
padding-left: 3.25rem;
|
padding-left: 3.25rem;
|
||||||
|
|||||||
+24
-3
@@ -1,5 +1,7 @@
|
|||||||
import {Component, EventEmitter, inject, Input, Output} from '@angular/core';
|
import {Component, DestroyRef, EventEmitter, inject, Input, OnInit, Output} from '@angular/core';
|
||||||
|
import {takeUntilDestroyed} from '@angular/core/rxjs-interop';
|
||||||
import {FormGroup, FormsModule, ReactiveFormsModule} from '@angular/forms';
|
import {FormGroup, FormsModule, ReactiveFormsModule} from '@angular/forms';
|
||||||
|
import {filter} from 'rxjs/operators';
|
||||||
import {Button} from 'primeng/button';
|
import {Button} from 'primeng/button';
|
||||||
import {NgClass} from '@angular/common';
|
import {NgClass} from '@angular/common';
|
||||||
import {Tooltip} from 'primeng/tooltip';
|
import {Tooltip} from 'primeng/tooltip';
|
||||||
@@ -14,6 +16,8 @@ import {ConfirmationService} from 'primeng/api';
|
|||||||
import {DatePicker} from 'primeng/datepicker';
|
import {DatePicker} from 'primeng/datepicker';
|
||||||
import {ALL_METADATA_FIELDS, getArrayFields, getBottomFields, getTextareaFields, MetadataFieldConfig} from '../../../../shared/metadata';
|
import {ALL_METADATA_FIELDS, getArrayFields, getBottomFields, getTextareaFields, MetadataFieldConfig} from '../../../../shared/metadata';
|
||||||
import {MetadataUtilsService} from '../../../../shared/metadata';
|
import {MetadataUtilsService} from '../../../../shared/metadata';
|
||||||
|
import {MetadataProviderSpecificFields} from '../../../../shared/model/app-settings.model';
|
||||||
|
import {AppSettingsService} from '../../../../shared/service/app-settings.service';
|
||||||
import {TranslocoDirective, TranslocoService} from '@jsverse/transloco';
|
import {TranslocoDirective, TranslocoService} from '@jsverse/transloco';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
@@ -35,11 +39,13 @@ import {TranslocoDirective, TranslocoService} from '@jsverse/transloco';
|
|||||||
templateUrl: './bookdrop-file-metadata-picker.component.html',
|
templateUrl: './bookdrop-file-metadata-picker.component.html',
|
||||||
styleUrl: './bookdrop-file-metadata-picker.component.scss'
|
styleUrl: './bookdrop-file-metadata-picker.component.scss'
|
||||||
})
|
})
|
||||||
export class BookdropFileMetadataPickerComponent {
|
export class BookdropFileMetadataPickerComponent implements OnInit {
|
||||||
|
|
||||||
private readonly confirmationService = inject(ConfirmationService);
|
private readonly confirmationService = inject(ConfirmationService);
|
||||||
private readonly metadataUtils = inject(MetadataUtilsService);
|
private readonly metadataUtils = inject(MetadataUtilsService);
|
||||||
protected readonly urlHelper = inject(UrlHelperService);
|
protected readonly urlHelper = inject(UrlHelperService);
|
||||||
|
private readonly appSettingsService = inject(AppSettingsService);
|
||||||
|
private readonly destroyRef = inject(DestroyRef);
|
||||||
private readonly t = inject(TranslocoService);
|
private readonly t = inject(TranslocoService);
|
||||||
|
|
||||||
@Input() fetchedMetadata!: BookMetadata;
|
@Input() fetchedMetadata!: BookMetadata;
|
||||||
@@ -51,7 +57,8 @@ export class BookdropFileMetadataPickerComponent {
|
|||||||
|
|
||||||
@Output() metadataCopied = new EventEmitter<boolean>();
|
@Output() metadataCopied = new EventEmitter<boolean>();
|
||||||
|
|
||||||
// Use shared field configuration - separate publishedDate for DatePicker
|
private enabledProviderFields: MetadataProviderSpecificFields | null = null;
|
||||||
|
|
||||||
metadataFieldsTop: MetadataFieldConfig[] = ALL_METADATA_FIELDS.filter(f =>
|
metadataFieldsTop: MetadataFieldConfig[] = ALL_METADATA_FIELDS.filter(f =>
|
||||||
['title', 'subtitle', 'publisher'].includes(f.controlName)
|
['title', 'subtitle', 'publisher'].includes(f.controlName)
|
||||||
);
|
);
|
||||||
@@ -66,6 +73,20 @@ export class BookdropFileMetadataPickerComponent {
|
|||||||
|
|
||||||
metadataFieldsBottom: MetadataFieldConfig[] = getBottomFields();
|
metadataFieldsBottom: MetadataFieldConfig[] = getBottomFields();
|
||||||
|
|
||||||
|
ngOnInit(): void {
|
||||||
|
this.appSettingsService.appSettings$
|
||||||
|
.pipe(
|
||||||
|
filter(settings => !!settings?.metadataProviderSpecificFields),
|
||||||
|
takeUntilDestroyed(this.destroyRef)
|
||||||
|
)
|
||||||
|
.subscribe(settings => {
|
||||||
|
if (settings?.metadataProviderSpecificFields) {
|
||||||
|
this.enabledProviderFields = settings.metadataProviderSpecificFields;
|
||||||
|
this.metadataFieldsBottom = getBottomFields(this.enabledProviderFields);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
copyMissing(): void {
|
copyMissing(): void {
|
||||||
this.metadataUtils.copyMissingFields(
|
this.metadataUtils.copyMissingFields(
|
||||||
this.fetchedMetadata,
|
this.fetchedMetadata,
|
||||||
|
|||||||
Reference in New Issue
Block a user