@@ -143,7 +157,7 @@
arrow_back
- Zur Listenuebersicht
+ Zur Listenübersicht
}
diff --git a/listify-client/src/app/lists/list-detail/list-detail.component.scss b/listify-client/src/app/lists/list-detail/list-detail.component.scss
index bdbbbaf..d28c880 100644
--- a/listify-client/src/app/lists/list-detail/list-detail.component.scss
+++ b/listify-client/src/app/lists/list-detail/list-detail.component.scss
@@ -34,6 +34,16 @@
background: color-mix(in srgb, var(--mat-sys-surface-container-low) 94%, white);
}
+.editor-card mat-card-header {
+ align-items: center;
+ justify-content: space-between;
+ gap: 0.75rem;
+}
+
+.editor-card mat-card-header button {
+ flex: 0 0 auto;
+}
+
.list-form,
.item-form {
display: grid;
@@ -72,6 +82,17 @@
font-size: 48px;
}
+.list-summary {
+ padding-top: 0.75rem;
+}
+
+.list-summary p {
+ margin: 0;
+ color: var(--mat-sys-on-surface-variant);
+ overflow-wrap: anywhere;
+ line-height: 1.45;
+}
+
.error-state mat-icon {
color: var(--mat-sys-error);
}
diff --git a/listify-client/src/app/lists/list-detail/list-detail.component.ts b/listify-client/src/app/lists/list-detail/list-detail.component.ts
index 92ca274..1b1ec32 100644
--- a/listify-client/src/app/lists/list-detail/list-detail.component.ts
+++ b/listify-client/src/app/lists/list-detail/list-detail.component.ts
@@ -46,10 +46,12 @@ export class ListDetailComponent implements OnInit {
protected readonly isCreateMode = signal(false);
protected readonly loading = signal(true);
protected readonly saving = signal(false);
+ protected readonly editing = signal(false);
protected readonly addingItem = signal(false);
protected readonly errorMessage = signal
(null);
protected readonly updatingItemId = signal(null);
protected readonly canEditItems = computed(() => Boolean(this.list()?.id));
+ protected readonly showEditor = computed(() => this.isCreateMode() || this.editing());
protected readonly listForm = this.formBuilder.group({
name: ['', [Validators.required]],
@@ -66,6 +68,7 @@ export class ListDetailComponent implements OnInit {
if (this.isCreateMode()) {
this.loading.set(false);
+ this.editing.set(true);
this.listForm.reset({ name: '', description: '' });
return;
}
@@ -128,7 +131,10 @@ export class ListDetailComponent implements OnInit {
this.setList(list);
if (this.isCreateMode()) {
this.isCreateMode.set(false);
+ this.editing.set(false);
void this.router.navigate(['/lists', list.id], { replaceUrl: true });
+ } else {
+ this.editing.set(false);
}
this.snackBar.open('Liste gespeichert.', 'OK', { duration: 2500 });
},
@@ -196,6 +202,29 @@ export class ListDetailComponent implements OnInit {
});
}
+ protected startEditing(): void {
+ this.editing.set(true);
+ }
+
+ protected cancelEditing(): void {
+ const list = this.list();
+
+ if (this.isCreateMode()) {
+ void this.router.navigateByUrl('/lists');
+ return;
+ }
+
+ if (list) {
+ this.listForm.reset({
+ name: list.name,
+ description: list.description ?? '',
+ });
+ }
+
+ this.itemForm.reset({ title: '', required: true });
+ this.editing.set(false);
+ }
+
protected checkedCount(list: UserList): number {
return list.items.filter((item) => item.checked).length;
}