feat(project): 댓글 채팅에 상대방 프로필 아이콘 + 보드 세션 이름 클릭 인라인 변경
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+59
-3
@@ -440,19 +440,26 @@
|
||||
comments.forEach(function (c) {
|
||||
const mine = (c.author_email || "").toLowerCase() === me;
|
||||
const li = document.createElement("li");
|
||||
li.className = "pj-chat-msg" + (mine ? " mine" : "");
|
||||
li.className = "pj-chat-msg" + (mine ? " mine" : " other");
|
||||
const atts = attByComment[c.id] || [];
|
||||
const attsHtml = atts.length
|
||||
? '<div class="pj-chat-atts">' + atts.map(function (a) { return attachmentHtml(a, me); }).join("") + "</div>"
|
||||
: "";
|
||||
li.innerHTML =
|
||||
(mine ? "" : '<span class="pj-chat-name">' + escapeHtml(idOf(c.author_email)) + "</span>") +
|
||||
const inner =
|
||||
(c.body ? '<div class="pj-chat-bubble"></div>' : "") +
|
||||
attsHtml +
|
||||
'<span class="pj-chat-meta">' +
|
||||
(mine ? '<button type="button" class="pj-icon-btn pj-chat-del" title="삭제"><span class="material-symbols-outlined">close</span></button>' : "") +
|
||||
'<span class="pj-chat-time">' + (c.created_at || "").slice(0, 16).replace("T", " ") + "</span>" +
|
||||
"</span>";
|
||||
// 상대방 댓글 — 카톡처럼 왼쪽에 프로필 아이콘, 그 옆에 이름 + 말풍선.
|
||||
li.innerHTML = mine
|
||||
? inner
|
||||
: '<span class="pj-chat-av">' + avatarHtml(c.author_email, "pj-chat-avatar") + "</span>" +
|
||||
'<div class="pj-chat-body">' +
|
||||
'<span class="pj-chat-name">' + escapeHtml(idOf(c.author_email)) + "</span>" +
|
||||
inner +
|
||||
"</div>";
|
||||
const bubble = li.querySelector(".pj-chat-bubble");
|
||||
if (bubble) bubble.textContent = c.body;
|
||||
if (mine) {
|
||||
@@ -2079,6 +2086,55 @@
|
||||
renderBoard();
|
||||
} catch (err) { showToast("삭제 실패: " + err.message, "error"); }
|
||||
}
|
||||
// 세션 이름 클릭 → 그 자리에서 이름 변경(Enter/포커스 이탈=저장, Esc=취소).
|
||||
// 헤더가 드래그(세션 재정렬) 대상이라 편집 중엔 draggable 을 꺼 둔다 —
|
||||
// 안 끄면 입력칸 안에서 글자 선택하려고 끌면 컬럼이 끌려간다.
|
||||
const nameEl = col.querySelector(".pj-col-name");
|
||||
if (nameEl) {
|
||||
nameEl.classList.add("pj-col-name-editable");
|
||||
nameEl.title = "클릭해서 이름 변경";
|
||||
nameEl.addEventListener("click", function (e) {
|
||||
e.stopPropagation();
|
||||
const head = col.querySelector(".pj-col-head");
|
||||
const wasDraggable = head.getAttribute("draggable");
|
||||
head.setAttribute("draggable", "false");
|
||||
const input = document.createElement("input");
|
||||
input.type = "text";
|
||||
input.className = "pj-col-name-input";
|
||||
input.value = s.name;
|
||||
input.maxLength = 100;
|
||||
nameEl.replaceWith(input);
|
||||
input.focus();
|
||||
input.select();
|
||||
let done = false;
|
||||
async function finish(save) {
|
||||
if (done) return;
|
||||
done = true;
|
||||
const name = input.value.trim();
|
||||
if (!save || !name || name === s.name) {
|
||||
input.replaceWith(nameEl);
|
||||
if (wasDraggable) head.setAttribute("draggable", wasDraggable);
|
||||
return;
|
||||
}
|
||||
try {
|
||||
await api("PUT", "/project/api/projects/" + projectId + "/stages/" + s.id, { name: name });
|
||||
await reloadStagesForCurrentProject();
|
||||
renderBoard();
|
||||
} catch (err) {
|
||||
showToast("이름 변경 실패: " + err.message, "error");
|
||||
input.replaceWith(nameEl);
|
||||
if (wasDraggable) head.setAttribute("draggable", wasDraggable);
|
||||
}
|
||||
}
|
||||
input.addEventListener("keydown", function (ev) {
|
||||
if (ev.isComposing) return; // 한글 조합 중 Enter 는 무시
|
||||
if (ev.key === "Enter") { ev.preventDefault(); finish(true); }
|
||||
else if (ev.key === "Escape") { ev.preventDefault(); finish(false); }
|
||||
});
|
||||
input.addEventListener("blur", function () { finish(true); });
|
||||
input.addEventListener("click", function (ev) { ev.stopPropagation(); });
|
||||
});
|
||||
}
|
||||
const renameBtn = col.querySelector(".pj-col-rename");
|
||||
if (renameBtn) renameBtn.addEventListener("click", function (e) { e.stopPropagation(); editStage(); });
|
||||
const doneBtn = col.querySelector(".pj-col-toggledone");
|
||||
|
||||
Reference in New Issue
Block a user