feat(project): 프로젝트 색상·아이콘을 아사나식으로(16색 + 아이콘 42종)

- 색상표: 아사나 프로젝트 16색(8칸×2줄, 고른 색에 체크), 새 프로젝트 기본 파랑.
  예전 팔레트 색 프로젝트는 그대로 유지(수정 팝업이 첫 칸으로 바꾸지 않음)
- 아이콘: 아사나 프로젝트 아이콘과 같은 종류 42개(Material Symbols, self-host
  글꼴에 전부 있는 것 확인). 새 프로젝트·수정 팝업에 아이콘 격자(첫 칸 Aa=없음),
  사이드바 배지·프로젝트 제목에 흰 아이콘
- DB: projects.icon (scripts/sql/project_db_011_project_icon.sql). 아이콘은
  고르거나 바꿨을 때만 보내서 011 적용 전에도 다른 생성·수정은 그대로 동작,
  아이콘을 고르면 "마이그레이션 011 필요" 안내(503)
- 색상·아이콘 칸을 label 대신 div 로(글자를 누르면 첫 버튼이 눌리던 문제)
- 정적 파일 버전 20260926h

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-09-26 13:07:46 +09:00
parent 426febe5d5
commit c77ce8e151
14 changed files with 241 additions and 53 deletions
+28 -3
View File
@@ -128,6 +128,7 @@
display: inline-flex; align-items: center; justify-content: center;
color: #fff; font-size: 11px; font-weight: 700;
}
.pj-tree-avatar .pj-proj-ic { font-size: 16px; color: #fff; }
.pj-tree-name { font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pj-tree-acts { display: none; gap: 0; flex: 0 0 auto; }
.pj-tree-row:hover .pj-tree-acts { display: inline-flex; }
@@ -169,6 +170,8 @@
color: #6b7280; font-size: 15px; line-height: 1; cursor: pointer;
}
.pj-title-addmember:hover { border-style: solid; border-color: var(--pj-accent); color: var(--pj-accent); }
/* 제목 알약 안 프로젝트 아이콘 */
.pj-pill-ic { font-size: 26px; vertical-align: -5px; margin-right: 8px; }
.pj-project-title-pill {
display: inline-block; max-width: 100%; vertical-align: middle;
font-size: 22px; font-weight: 800; color: #fff;
@@ -631,9 +634,31 @@
.pj-btn-complete:hover { background: #d9f2e4; }
.pj-btn-complete.is-done { background: #f2f2f4; color: #6b6f76; border-color: var(--pj-border); }
.pj-color-palette, #pj-f-colors { display: flex; gap: 8px; margin-top: 6px; }
.pj-color-swatch { width: 24px; height: 24px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; }
.pj-color-swatch.is-active { border-color: #1e1f21; box-shadow: 0 0 0 2px #fff inset; }
/* 색상표(아사나) — 8칸씩 둥근 네모, 고른 색엔 체크 */
.pj-color-palette, #pj-f-colors { display: grid; grid-template-columns: repeat(8, 26px); gap: 8px; margin-top: 6px; }
.pj-color-swatch {
position: relative; width: 26px; height: 26px; padding: 0; border: none; border-radius: 6px; cursor: pointer;
box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .06);
}
.pj-color-swatch:hover { box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .25); }
.pj-color-swatch.is-active::after {
content: "check"; font-family: "Material Symbols Outlined"; font-size: 18px; line-height: 26px;
position: absolute; inset: 0; text-align: center; color: #1e1f21;
-webkit-font-feature-settings: "liga"; font-feature-settings: "liga";
}
/* 프로젝트 아이콘 고르기(아사나) — 회색 아이콘 격자, 고른 것은 보라 강조. 길면 칸 안에서 스크롤 */
.pj-icon-palette {
display: grid; grid-template-columns: repeat(auto-fill, 38px); gap: 6px; margin-top: 6px;
max-height: 186px; overflow-y: auto; padding: 2px;
}
.pj-icon-pick {
width: 38px; height: 38px; padding: 0; border: none; border-radius: 8px; background: transparent;
color: #6d6e6f; cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
}
.pj-icon-pick .material-symbols-outlined { font-size: 24px; }
.pj-icon-pick:hover { background: #f1f2f4; color: var(--pj-ink); }
.pj-icon-pick.is-active { background: var(--pj-accent-tint); color: var(--pj-accent); box-shadow: inset 0 0 0 1.5px var(--pj-accent); }
.pj-icon-pick-aa { font-size: 14px; font-weight: 800; }
/* ── 알림 벨 ── */
.pj-toolbar-right { display: flex; align-items: center; gap: 12px; }
+46 -6
View File
@@ -805,7 +805,9 @@
// window.PJ_STAGE_COLORS(아사나 10색)를 넘겨 같은 UI를 재사용한다.
function renderColorPalette(container, onPick, initial, palette) {
const colors = palette || window.PJ_COLORS || ["#4573d2"];
let selected = (initial && colors.indexOf(initial) >= 0) ? initial : colors[0];
// 목록에 없는 현재 색(예전 팔레트로 만든 프로젝트)은 고르기 전까지 그대로 둔다 —
// 첫 칸으로 바꿔 버리면 수정 팝업에서 저장만 해도 색이 바뀐다.
let selected = initial || colors[0];
container.innerHTML = "";
colors.forEach(function (c) {
const b = document.createElement("button");
@@ -826,6 +828,32 @@
return function () { return selected; };
}
// ── 프로젝트 아이콘(아사나식) — window.PJ_ICONS(Material Symbols 이름) 격자.
// 첫 칸 "Aa" = 아이콘 없음(프로젝트 색 + 이름 첫 글자). 반환 = 지금 고른 이름("" = 없음).
function renderIconPalette(container, initial) {
if (!container) return function () { return ""; };
const icons = window.PJ_ICONS || [];
let selected = initial && icons.indexOf(initial) >= 0 ? initial : "";
container.innerHTML = [""].concat(icons).map(function (ic) {
return '<button type="button" class="pj-icon-pick' + (ic === selected ? " is-active" : "") +
'" data-icon="' + ic + '" title="' + (ic ? "아이콘" : "아이콘 없음(첫 글자)") + '">' +
(ic ? '<span class="material-symbols-outlined">' + ic + "</span>" : '<span class="pj-icon-pick-aa">Aa</span>') +
"</button>";
}).join("");
container.querySelectorAll(".pj-icon-pick").forEach(function (b) {
b.addEventListener("click", function () {
selected = b.dataset.icon;
container.querySelectorAll(".pj-icon-pick").forEach(function (x) { x.classList.toggle("is-active", x === b); });
});
});
return function () { return selected; };
}
// 프로젝트 배지 안쪽 — 아이콘이 있으면 흰 아이콘, 없으면 이름 첫 글자(사이드바 목록·제목 공용).
function projBadgeInner(p) {
if (p && p.icon) return '<span class="material-symbols-outlined pj-proj-ic">' + escapeHtml(p.icon) + "</span>";
return escapeHtml(((p && p.name) || "?").trim().charAt(0).toUpperCase() || "?");
}
// ════════════════════════════════════════════════════════════
// 댓글만 보는 채팅형 팝업(#pj-modal-comments) — 홈 카드/내 업무, 프로젝트
// 화면 우측 "내 업무" 패널 전부 공용(마크업 id 는 두 페이지가 같은 걸 씀).
@@ -842,7 +870,8 @@
const modal = el("pj-modal-project");
if (!btn || !modal) return;
wireModalClose(modal);
const getColor = renderColorPalette(el("pj-f-colors"));
let getColor = renderColorPalette(el("pj-f-colors"), null, "#4573d2");
let getIcon = renderIconPalette(el("pj-f-icons"), "");
const membersBox = el("pj-f-members");
btn.addEventListener("click", async function () {
openModal(modal);
@@ -875,6 +904,7 @@
description: el("pj-f-desc").value.trim(),
due_date: el("pj-f-due").value || null,
color: getColor(),
icon: getIcon() || undefined,
});
const pid = res.project.id;
for (const email of memberEmails) {
@@ -884,6 +914,8 @@
closeModal(modal);
el("pj-f-name").value = ""; el("pj-f-desc").value = "";
el("pj-f-due").value = "";
getColor = renderColorPalette(el("pj-f-colors"), null, "#4573d2");
getIcon = renderIconPalette(el("pj-f-icons"), "");
if (onCreated) onCreated(res.project);
} catch (e) { showToast("생성 실패: " + e.message, "error"); }
});
@@ -921,6 +953,7 @@
id: parseInt(d.id, 10), name: d.name || "", description: d.desc || "",
start_date: d.start || null, due_date: d.due || null,
color: d.color || "#4573d2", status: d.status || "active", created_by: d.creator || "",
icon: d.icon || "",
};
}
);
@@ -938,14 +971,14 @@
'" data-name="' + escapeHtml(p.name) + '" data-creator="' + escapeHtml(p.created_by || "") + '" title="프로젝트 삭제">×</button>' +
"</span>";
}
const initial = escapeHtml((p.name || "?").trim().charAt(0).toUpperCase() || "?");
// 드래그로 순서 변경 가능함을 알려주는 손잡이(⣿) — 관리자에게만 보인다.
const handle = isAdmin ? '<span class="pj-tree-handle" title="드래그로 순서 변경">⣿</span>' : "";
return '<li class="pj-tree-li"' + (isAdmin ? ' draggable="true"' : "") + ' data-id="' + p.id + '"><div class="pj-tree-row ' +
(p.id === currentId ? "is-active" : "") + '">' +
handle +
'<a class="pj-tree-link" href="/project/p/' + p.id + '">' +
'<span class="pj-tree-avatar" style="background:' + (p.color || "#4573d2") + '">' + initial + "</span>" +
'<span class="pj-tree-avatar' + (p.icon ? " has-icon" : "") + '" style="background:' + (p.color || "#4573d2") + '">' +
projBadgeInner(p) + "</span>" +
'<span class="pj-tree-name">' + escapeHtml(p.name) + "</span></a>" + acts + "</div></li>";
}
async function deleteTreeProject(id, name, createdBy) {
@@ -1096,7 +1129,7 @@
// ── ✎ 버튼 — 프로젝트 수정 모달. 트리는 render() 로 매번 다시 그려지므로
// 열기 로직을 함수로 두고 wireTreeHandlers 에서 매번 다시 건다.
const editModal = el("pj-modal-edit");
let getEditColor = null;
let getEditColor = null, getEditIcon = null, editOrigIcon = "";
function openProjectEditModal(data) {
if (!editModal) return;
el("pj-e-id").value = data.id;
@@ -1106,6 +1139,9 @@
el("pj-e-due").value = data.due || "";
el("pj-e-done").checked = data.status === "completed";
getEditColor = renderColorPalette(el("pj-e-colors"), null, data.color);
const cur = projects.find(function (x) { return String(x.id) === String(data.id); });
editOrigIcon = (cur && cur.icon) || "";
getEditIcon = renderIconPalette(el("pj-e-icons"), editOrigIcon);
openModal(editModal);
}
if (editModal) {
@@ -1121,6 +1157,8 @@
start_date: el("pj-e-start").value || null,
due_date: el("pj-e-due").value || null,
color: getEditColor ? getEditColor() : undefined,
// 아이콘은 바뀐 경우에만 — 안 바꾼 저장이 마이그레이션 011 전에도 되게.
icon: getEditIcon && getEditIcon() !== editOrigIcon ? (getEditIcon() || null) : undefined,
status: el("pj-e-done").checked ? "completed" : "active",
});
merge(res.project);
@@ -2079,7 +2117,9 @@
Object.assign(currentProject, p);
const pillEl = document.querySelector(".pj-project-title-pill");
if (pillEl) {
pillEl.textContent = currentProject.name || "";
pillEl.innerHTML = (currentProject.icon
? '<span class="material-symbols-outlined pj-pill-ic">' + escapeHtml(currentProject.icon) + "</span>" : "") +
escapeHtml(currentProject.name || "");
pillEl.style.setProperty("--pj-color", currentProject.color || "#4573d2");
}
},