Skip to content

Commit 5da4e52

Browse files
authored
Merge pull request #44 from 6mile0/features/improvements-to-the-Notification-System
通知受信画面の改良
2 parents a76b558 + dab8fc4 commit 5da4e52

4 files changed

Lines changed: 71 additions & 7 deletions

File tree

Cone/Areas/Admin/Dtos/Res/AdminUserStatusResDto.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,5 @@ public class CurrentTicketDto
1212
{
1313
public long Id { get; init; }
1414
public string Title { get; init; } = string.Empty;
15+
public string StudentGroupName { get; init; } = string.Empty;
1516
}

Cone/Services/NotificationService/StaffStatusBroadcastService.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,8 @@ private async Task BroadcastStaffStatusAsync(CancellationToken cancellationToken
6060
var currentTicketDtos = currentTickets.Select(t => new CurrentTicketDto
6161
{
6262
Id = t.Id,
63-
Title = t.Title
63+
Title = t.Title,
64+
StudentGroupName = t.StudentGroup.GroupName
6465
}).ToList();
6566

6667
return new AdminUserStatusResDto

Cone/wwwroot/css/notification.css

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,37 @@
3131
text-align: center;
3232
transform: scale(0.7);
3333
transition: transform 0.3s ease-in-out;
34+
position: relative;
35+
}
36+
37+
.notification-close-btn {
38+
position: absolute;
39+
top: 20px;
40+
right: 20px;
41+
background: rgba(255, 255, 255, 0.2);
42+
border: 2px solid rgba(255, 255, 255, 0.5);
43+
color: white;
44+
font-size: 32px;
45+
width: 50px;
46+
height: 50px;
47+
border-radius: 50%;
48+
cursor: pointer;
49+
display: flex;
50+
align-items: center;
51+
justify-content: center;
52+
transition: all 0.2s ease-in-out;
53+
padding: 0;
54+
line-height: 1;
55+
}
56+
57+
.notification-close-btn:hover {
58+
background: rgba(255, 255, 255, 0.3);
59+
border-color: rgba(255, 255, 255, 0.8);
60+
transform: scale(1.1);
61+
}
62+
63+
.notification-close-btn:active {
64+
transform: scale(0.95);
3465
}
3566

3667
.ticket-notification-overlay.show .ticket-notification {
@@ -90,6 +121,14 @@
90121
width: 95%;
91122
}
92123

124+
.notification-close-btn {
125+
top: 15px;
126+
right: 15px;
127+
width: 40px;
128+
height: 40px;
129+
font-size: 24px;
130+
}
131+
93132
.notification-content h2 {
94133
font-size: 32px;
95134
margin-bottom: 30px;

Cone/wwwroot/js/notification.js

Lines changed: 29 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
overlay.className = 'ticket-notification-overlay';
4040
overlay.innerHTML = `
4141
<div class="ticket-notification">
42+
<button class="notification-close-btn" aria-label="閉じる">&times;</button>
4243
<div class="notification-content">
4344
<h2>🔔 新しいチケット</h2>
4445
<div class="notification-info">
@@ -60,12 +61,33 @@
6061
`;
6162

6263
document.body.appendChild(overlay);
63-
64+
65+
// 通知を閉じる関数
66+
function closeNotification() {
67+
if (autoCloseTimeout) {
68+
clearTimeout(autoCloseTimeout);
69+
}
70+
overlay.classList.remove('show');
71+
setTimeout(() => overlay.remove(), 300);
72+
}
73+
74+
// 閉じるボタンのイベント
75+
const closeBtn = overlay.querySelector('.notification-close-btn');
76+
closeBtn.addEventListener('click', closeNotification);
77+
78+
// オーバレイの背景をクリックしても閉じる
79+
overlay.addEventListener('click', (e) => {
80+
if (e.target === overlay) {
81+
closeNotification();
82+
}
83+
});
84+
6485
setTimeout(() => overlay.classList.add('show'), 10);
65-
86+
6687
setTimeout(() => overlay.classList.add('flash'), 100);
67-
68-
setTimeout(() => {
88+
89+
// 10秒後に自動的に閉じる
90+
const autoCloseTimeout = setTimeout(() => {
6991
overlay.classList.remove('show');
7092
setTimeout(() => overlay.remove(), 300);
7193
}, 10000);
@@ -110,18 +132,19 @@
110132

111133
function createStaffCard(staff) {
112134
const escapedName = escapeHtml(staff.fullName);
113-
const ticketCount = staff.currentTickets ? staff.currentTickets.length : 0;
114135
const statusBadge = staff.isWorking
115-
? `<span class="badge bg-success">対応中 (${ticketCount})</span>`
136+
? '<span class="badge bg-success">対応中</span>'
116137
: '<span class="badge bg-secondary">待機中</span>';
117138

118139
let ticketInfo = '';
119140
if (staff.isWorking && staff.currentTickets && staff.currentTickets.length > 0) {
120141
const ticketList = staff.currentTickets.map(ticket => {
121142
const escapedTitle = escapeHtml(ticket.title);
143+
const escapedGroupName = escapeHtml(ticket.studentGroupName);
122144
return `
123145
<div class="mb-1">
124146
<a href="/admin/tickets/${ticket.id}" class="text-decoration-none">
147+
<span class="badge bg-info text-dark me-1" style="font-size: 0.95rem; padding: 0.4rem 0.6rem;">${escapedGroupName}</span>
125148
${escapedTitle}
126149
<i class="bi bi-box-arrow-up-right ms-1"></i>
127150
</a>

0 commit comments

Comments
 (0)