Ajout de drag'n drop là ou c'est possible ; ajout de l'import des ennemis depuis foundryVTT
All checks were successful
All checks were successful
This commit is contained in:
@@ -11,7 +11,7 @@
|
||||
|
||||
<!-- Étape 1 : upload (masqué une fois en revue) -->
|
||||
@if (!reviewing) {
|
||||
<section class="upload-area">
|
||||
<section class="upload-area" appFileDrop [dropDisabled]="importing" (filesDropped)="onPdfDropped($event)">
|
||||
<input #pdfInput type="file" accept="application/pdf,.pdf" hidden (change)="onPdfSelected($event)" />
|
||||
<button type="button" class="btn-primary big" [disabled]="importing" (click)="pdfInput.click()">
|
||||
<lucide-icon [img]="Upload" [size]="16"></lucide-icon>
|
||||
|
||||
@@ -32,6 +32,9 @@
|
||||
border-radius: 12px;
|
||||
text-align: center;
|
||||
background: #0b1220;
|
||||
transition: border-color 0.15s, background 0.15s;
|
||||
|
||||
&.drag-over { border-color: #667eea; background: #141d33; }
|
||||
}
|
||||
|
||||
.btn-primary,
|
||||
|
||||
@@ -20,6 +20,7 @@ import { CampaignImportProposal } from '../../../services/campaign-import.model'
|
||||
import { loadCampaignTreeData, CampaignTreeData } from '../../campaign-tree.helper';
|
||||
import { of } from 'rxjs';
|
||||
import { catchError } from 'rxjs/operators';
|
||||
import { FileDropDirective } from '../../../shared/file-drop.directive';
|
||||
|
||||
/**
|
||||
* Nœuds éditables (= proposition + état d'UI). `existing` = déjà présent dans la
|
||||
@@ -54,7 +55,7 @@ interface NpcNode { name: string; description: string; selected: boolean; existi
|
||||
*/
|
||||
@Component({
|
||||
selector: 'app-campaign-import',
|
||||
imports: [FormsModule, LucideAngularModule, TranslatePipe],
|
||||
imports: [FormsModule, LucideAngularModule, TranslatePipe, FileDropDirective],
|
||||
templateUrl: './campaign-import.component.html',
|
||||
styleUrls: ['./campaign-import.component.scss']
|
||||
})
|
||||
@@ -135,6 +136,11 @@ export class CampaignImportComponent implements OnInit {
|
||||
if (file) this.importPdf(file);
|
||||
}
|
||||
|
||||
/** Drop d'un PDF sur la zone d'upload. */
|
||||
onPdfDropped(files: File[]): void {
|
||||
if (!this.importing && files[0]) this.importPdf(files[0]);
|
||||
}
|
||||
|
||||
private importPdf(file: File): void {
|
||||
this.importing = true;
|
||||
this.reviewing = false;
|
||||
|
||||
Reference in New Issue
Block a user