Skip to content

Commit 7054a0b

Browse files
committed
fix mark as read and some UI/UX
1 parent 0150356 commit 7054a0b

File tree

5 files changed

+20
-21
lines changed

5 files changed

+20
-21
lines changed

README.md

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -165,22 +165,18 @@ Dự án Angular này áp dụng nhiều **design pattern chuẩn** để đảm
165165
- **Guards** (`AuthGuard`, `RoleGuard`) áp dụng strategy để quyết định quyền truy cập.
166166
- **Environments** (`dev`, `staging`, `prod`) chọn cấu hình phù hợp theo môi trường.
167167

168-
### 6. Facade Pattern
169-
- **Router Manager** gom logic routing vào 1 chỗ.
170-
- **NgRx Facade** (nếu sử dụng) để tách component khỏi chi tiết state management.
171-
172-
### 7. Template Pattern
168+
### 6. Template Pattern
173169
- Các **layout** (`header`, `sidebar`, `footer`) định nghĩa khung sẵn, feature module nhúng nội dung vào khu vực content.
174170

175-
### 8. Smart & Dumb Components (Container/Presenter)
171+
### 7. Smart & Dumb Components (Container/Presenter)
176172
- Component **Smart** xử lý logic, data fetching, và state.
177173
- Component **Dumb** nhận `@Input()` và emit `@Output()`, chỉ chịu trách nhiệm hiển thị.
178174

179-
### 9. Decorator Pattern
175+
### 8. Decorator Pattern
180176
- Angular decorators: `@Component`, `@Directive`, `@Pipe`, `@Injectable`.
181177
- Cho phép mở rộng chức năng mà không sửa code gốc.
182178

183-
### 10. DTO Pattern
179+
### 9. DTO Pattern
184180
- Các **model** trong `core/models` quản lý dữ liệu giữa API và component, đảm bảo type safety.
185181

186182
---

src/app/core/services/config-service/api.enpoints.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ export const API_CONFIG = {
288288
ADD_ADMIN: '/identity/admin',
289289
ADD_STUDENT: '/identity/teacher',
290290
ADD_TEACHER: '/identity/user',
291-
MARK_AS_READ_NOTIFICATION: '/my/mark-read',
291+
MARK_AS_READ_NOTIFICATION: '/notification/my/mark-read',
292292
},
293293
PUT: {
294294
EDIT_FILE: (id: string) => `/file/api/FileDocument/edit/${id}`,

src/app/features/excercise/exercise-pages/exercise-details/exercise-details.component.html

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ <h2>{{ exercise.title }}</h2>
158158
<div class="stats">
159159
<span title="Số câu hỏi"
160160
><i class="fa-regular fa-question-circle"></i>
161-
{{ exercise.quizDetail?.totalElements ?? 0 }}</span
161+
{{ exercise.quizDetail?.totalElements ?? 0 }} Câu</span
162162
>
163163
<span title="Thời lượng"
164164
><i class="fa-regular fa-hourglass-half"></i>
@@ -199,6 +199,8 @@ <h2>{{ exercise.title }}</h2>
199199
@for (q of exercise.quizDetail?.questions; track q; let i = $index) {
200200
<div class="question-item">
201201
<div class="question-header">
202+
<div class="question-number-index">Câu hỏi số {{ i + 1 }}</div>
203+
202204
<div class="btn-control">
203205
@if (isActionActive) {
204206
<button

src/app/features/excercise/exercise-pages/exercise-details/exercise-details.component.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,10 @@
341341
}
342342
}
343343
}
344+
345+
.question-number-index {
346+
font-weight: 700;
347+
}
344348
}
345349
.confirm-modal-overlay {
346350
position: fixed;

src/app/shared/components/my-shared/header/header.ts

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import { SetPasswordModalComponent } from '../../../../features/auth/components/
1515
import { NotificationModalComponent } from './notification-modal/notification-modal.component';
1616
import { NotificationSocketService } from '../../../../core/services/socket-service/notification-socket.service';
1717
import { NotificationListService } from '../../../../core/services/api-service/notification-list.service';
18+
import { sendNotification } from '../../../utils/notification';
1819

1920
@Component({
2021
selector: 'app-header',
@@ -82,18 +83,14 @@ export class HeaderComponent {
8283
localStorage.getItem('needPasswordSetup') || 'false'
8384
);
8485

85-
// 👇 Đăng ký lắng nghe notification từ socket
86-
this.notificationService
87-
.listenNoticeCount()
88-
.subscribe((event: { unread: number }) => {
89-
console.log('Header nhận count notification:', event.unread);
90-
91-
// Tăng counter
92-
this.notificationCount = event.unread;
86+
//Đăng ký lắng nghe notification từ socket
87+
this.notificationService.listenNoticeCount().subscribe((event) => {
88+
this.notificationCount = event.unread;
89+
});
9390

94-
// Nếu muốn push vào modal hoặc show toast
95-
// this.notifications.unshift(event);
96-
});
91+
this.notificationService.listenNotifications().subscribe((notice) => {
92+
sendNotification(this.store, 'Thông báo mới', notice.body, 'info');
93+
});
9794

9895
this.getCountNotice();
9996
}

0 commit comments

Comments
 (0)