Skip to content

Commit d11ed65

Browse files
committed
fix(import): allow users to import more than one file at a time
1 parent 6bcad7c commit d11ed65

2 files changed

Lines changed: 22 additions & 12 deletions

File tree

src/app/components/import/import.component.html

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -94,15 +94,13 @@ <h2 class="import-heading w-full py-6 font-bold">
9494
</div>
9595

9696
<div class="flex flex-col px-5">
97-
@if (!importSucceeded()) {
98-
@if (file) {
99-
<span class="text-base">{{ file.name }}</span>
100-
} @else {
101-
<dct-file-upload-button
102-
class=""
103-
(fileSelected)="onFileSelected($event)"
104-
></dct-file-upload-button>
105-
}
97+
@if (file) {
98+
<span class="text-base">{{ file.name }}</span>
99+
} @else {
100+
<dct-file-upload-button
101+
class=""
102+
(fileSelected)="onFileSelected($event)"
103+
></dct-file-upload-button>
106104
}
107105

108106
@if (importing && importNotStarted()) {

src/app/components/import/import.component.ts

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { ChangeDetectionStrategy, Component } from '@angular/core';
1+
import { ChangeDetectionStrategy, Component, effect } from '@angular/core';
22
import { CommonModule } from '@angular/common';
33
import { FileUploadButtonComponent } from './file-upload-button/file-upload-button.component';
44
import { FormsModule } from '@angular/forms';
@@ -17,7 +17,12 @@ import { TranslateModule } from '@ngx-translate/core';
1717
@Component({
1818
selector: 'dct-import',
1919
standalone: true,
20-
imports: [CommonModule, FormsModule, FileUploadButtonComponent, TranslateModule],
20+
imports: [
21+
CommonModule,
22+
FormsModule,
23+
FileUploadButtonComponent,
24+
TranslateModule,
25+
],
2126
templateUrl: './import.component.html',
2227
styleUrl: './import.component.css',
2328
changeDetection: ChangeDetectionStrategy.Default,
@@ -43,7 +48,14 @@ export class ImportComponent {
4348
error = true;
4449
loading = false;
4550

46-
constructor(private store: Store) {}
51+
constructor(private store: Store) {
52+
effect(() => {
53+
if (this.importSucceeded()) {
54+
this.file = undefined;
55+
this.store.dispatch(XmlManipulationActions.resetImport());
56+
}
57+
});
58+
}
4759

4860
onFileSelected(file: File) {
4961
// Handle the selected file here

0 commit comments

Comments
 (0)