UI bug fixes

This commit is contained in:
ivan-pelly
2026-03-14 18:22:49 -07:00
parent 4d9b83c327
commit f431fb3e94
9 changed files with 32 additions and 6 deletions
@@ -82,6 +82,7 @@ export class BenchmarkCardFull implements OnDestroy {
if (result.success) { if (result.success) {
this.successMessage.set('Benchmark created.'); this.successMessage.set('Benchmark created.');
this.savedBenchmarkText = this.benchmarkText; this.savedBenchmarkText = this.benchmarkText;
this.studentService.notifyDataChanged();
if (result.payload?.benchmarkId) { if (result.payload?.benchmarkId) {
this.router.navigate(['/students', this.studentId, 'goals', this.goalId, 'benchmarks', result.payload.benchmarkId]); this.router.navigate(['/students', this.studentId, 'goals', this.goalId, 'benchmarks', result.payload.benchmarkId]);
} }
@@ -15,8 +15,8 @@
@if (loaded()) { @if (loaded()) {
<div class="detail-card"> <div class="detail-card">
<div class="field"> <div class="field">
<label class="field-label" for="baseline">Baseline</label> <label class="field-label" for="category">Category</label>
<input id="baseline" class="field-input" type="text" [(ngModel)]="baseline" /> <input id="category" class="field-input" type="text" [(ngModel)]="category" />
</div> </div>
<div class="field"> <div class="field">
<label class="field-label" for="description">Description</label> <label class="field-label" for="description">Description</label>
@@ -24,8 +24,9 @@
placeholder="Enter description..."></textarea> placeholder="Enter description..."></textarea>
</div> </div>
<div class="field"> <div class="field">
<label class="field-label" for="category">Category</label> <label class="field-label" for="baseline">Baseline</label>
<input id="category" class="field-input" type="text" [(ngModel)]="category" /> <textarea id="baseline" class="field-input field-textarea" [(ngModel)]="baseline" rows="3"
placeholder="Enter baseline..."></textarea>
</div> </div>
<div class="actions"> <div class="actions">
<button class="toolbar-btn" (click)="onCancel()" [disabled]="!hasChanges()">Cancel</button> <button class="toolbar-btn" (click)="onCancel()" [disabled]="!hasChanges()">Cancel</button>
@@ -113,7 +113,7 @@ export class GoalCardFull implements OnDestroy {
} }
onBenchmarks() { onBenchmarks() {
this.router.navigate(['/students', this.studentId, 'benchmarks']); this.router.navigate(['/students', this.studentId, 'goals', this.goalId, 'benchmarks']);
} }
ngOnDestroy() { ngOnDestroy() {
@@ -50,6 +50,7 @@ export class GoalList implements OnDestroy {
this.goals.update(list => [...list, goal]); this.goals.update(list => [...list, goal]);
this.showAddModal.set(false); this.showAddModal.set(false);
this.studentService.notifyDataChanged(); this.studentService.notifyDataChanged();
this.router.navigate(['/students', this.studentId, 'goals', goal.goalId]);
} }
onModalCancelled() { onModalCancelled() {
@@ -1,4 +1,5 @@
import { Component, inject, signal } from '@angular/core'; import { Component, inject, signal } from '@angular/core';
import { Router } from '@angular/router';
import { StudentCard } from '../student-card/student-card'; import { StudentCard } from '../student-card/student-card';
import { AddStudentModal } from '../add-student-modal/add-student-modal'; import { AddStudentModal } from '../add-student-modal/add-student-modal';
import { DummyStudentService } from '../../../shared/services/dummy-student.service'; import { DummyStudentService } from '../../../shared/services/dummy-student.service';
@@ -24,6 +25,7 @@ export class StudentCardList {
// ************************** Declarations ************************* // ************************** Declarations *************************
private readonly studentService = inject(StudentService); private readonly studentService = inject(StudentService);
private readonly router = inject(Router);
protected readonly students = signal<StudentCardDto[]>([]); protected readonly students = signal<StudentCardDto[]>([]);
protected readonly displayMode = signal<DisplayMode>('card'); protected readonly displayMode = signal<DisplayMode>('card');
protected readonly showAddModal = signal(false); protected readonly showAddModal = signal(false);
@@ -45,6 +47,7 @@ export class StudentCardList {
this.students.update(list => this.sortByIdentifier([...list, student])); this.students.update(list => this.sortByIdentifier([...list, student]));
this.showAddModal.set(false); this.showAddModal.set(false);
this.studentService.notifyDataChanged(); this.studentService.notifyDataChanged();
this.router.navigate(['/students', student.studentId]);
} }
onModalCancelled() { onModalCancelled() {
@@ -153,6 +153,7 @@ export class Home implements OnDestroy {
.filter(b => b.goalId === goalId) .filter(b => b.goalId === goalId)
.map(b => ({ .map(b => ({
label: b.benchmark, label: b.benchmark,
routerLink: ['/students', studentId, 'goals', goalId, 'benchmarks', b.benchmarkId],
})); }));
} }
@@ -1,5 +1,12 @@
@if (loaded() && students().length === 0) {
<div class="empty-state">
<p>You don't currently have any students.</p>
<p>Please log into the <strong>desktop app</strong> to add your students.</p>
</div>
} @else {
<div class="card-grid"> <div class="card-grid">
@for (student of students(); track student.studentId) { @for (student of students(); track student.studentId) {
<app-student-card [student]="student" /> <app-student-card [student]="student" />
} }
</div> </div>
}
@@ -6,4 +6,14 @@
display: grid; display: grid;
grid-template-columns: repeat(2, 1fr); grid-template-columns: repeat(2, 1fr);
gap: 0.75rem; gap: 0.75rem;
}
.empty-state {
padding: 1.5rem 1rem;
text-align: center;
color: #888;
font-size: 0.875rem;
background: #fff;
border-radius: 10px;
border: 1px solid #e5e5e5;
} }
@@ -22,6 +22,7 @@ export class Students {
private readonly studentService = inject(StudentService); private readonly studentService = inject(StudentService);
protected readonly students = signal<StudentCardDto[]>([]); protected readonly students = signal<StudentCardDto[]>([]);
protected readonly loaded = signal(false);
public errorMessage = signal<String | null>(null); public errorMessage = signal<String | null>(null);
@@ -46,6 +47,7 @@ export class Students {
else else
{ {
this.students.set(data.payload || []); this.students.set(data.payload || []);
this.loaded.set(true);
} }
}); });
} }