generated from nhcarrigan/template
feat: add primary badge selection for user profiles
Implements #49 - Allow users to select one primary badge to display on their profile instead of showing all badges at once. Changes: - Add PrimaryBadge enum to Prisma schema and shared types (STAFF, MOD, VIP, DISCORD) - Add primaryBadge field to User model and all user interfaces - Update settings component with badge selection dropdown - Only show badges the user actually has in the dropdown - Update profile component to display only selected badge (or all if none selected) - Add primaryBadge to admin profile edit modal - Update API routes and services to handle primaryBadge - Export PrimaryBadge enum from shared-types (not just as type) Additional fixes: - Fix Angular output naming: rename onEdit/onDelete to edit/delete - Update all parent components using comment-display outputs - Add type casting for Prisma PrimaryBadge enum to shared-types enum
This commit is contained in:
@@ -42,7 +42,7 @@ import { ReportModalComponent } from '../report-modal/report-modal.component';
|
||||
<button (click)="startEdit(comment)" class="btn btn-secondary btn-xs">Edit</button>
|
||||
}
|
||||
@if (canDeleteComment(comment)) {
|
||||
<button (click)="onDelete.emit(comment.id)" class="btn btn-danger btn-xs">Delete</button>
|
||||
<button (click)="delete.emit(comment.id)" class="btn btn-danger btn-xs">Delete</button>
|
||||
}
|
||||
@if (canReportComment(comment)) {
|
||||
<button (click)="openReportModal(comment)" class="btn btn-warning btn-xs">Report</button>
|
||||
@@ -245,8 +245,8 @@ export class CommentDisplayComponent {
|
||||
readonly sanitizeService = inject(SanitizeService);
|
||||
|
||||
@Input({ required: true }) comments = signal<Comment[]>([]);
|
||||
@Output() onEdit = new EventEmitter<{ commentId: string; content: string }>();
|
||||
@Output() onDelete = new EventEmitter<string>();
|
||||
@Output() edit = new EventEmitter<{ commentId: string; content: string }>();
|
||||
@Output() delete = new EventEmitter<string>();
|
||||
|
||||
editingCommentId = signal<string | null>(null);
|
||||
editCommentContent = '';
|
||||
@@ -289,7 +289,7 @@ export class CommentDisplayComponent {
|
||||
}
|
||||
|
||||
saveEdit(commentId: string): void {
|
||||
this.onEdit.emit({ commentId, content: this.editCommentContent });
|
||||
this.edit.emit({ commentId, content: this.editCommentContent });
|
||||
this.cancelEdit();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user