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
+23 -17
View File
@@ -93,9 +93,11 @@ class ProjectStore:
due_date: str | None = None,
created_by: str = "",
seed_stages: bool = False,
icon: str | None = None,
) -> dict[str, Any]:
nm = store.validate_project_name(name)
col = store.validate_color(color)
ic = store.validate_project_icon(icon)
sd = store.validate_date(start_date)
dd = store.validate_date(due_date)
with self._pool.connection() as conn:
@@ -106,24 +108,27 @@ class ProjectStore:
).fetchone()
if not parent:
raise KeyError(f"상위 프로젝트를 찾을 수 없습니다: {parent_id}")
# 아이콘을 고른 경우에만 icon 컬럼을 쓴다 — 마이그레이션 011 전에도
# 아이콘 없이 만드는 건 예전처럼 된다.
cols = ["parent_id", "name", "description", "color", "owner_email",
"start_date", "due_date", "created_by"]
vals: list[Any] = [
parent_id,
nm,
store.norm_str(description),
col,
store.norm_str(owner_email, lower=True),
sd,
dd,
store.norm_str(created_by, lower=True),
]
if ic:
cols.append("icon")
vals.append(ic)
row = conn.execute(
"""
INSERT INTO projects
(parent_id, name, description, color, owner_email,
start_date, due_date, created_by)
VALUES (%s,%s,%s,%s,%s,%s,%s,%s)
RETURNING *
""",
(
parent_id,
nm,
store.norm_str(description),
col,
store.norm_str(owner_email, lower=True),
sd,
dd,
store.norm_str(created_by, lower=True),
),
f"INSERT INTO projects ({', '.join(cols)}) "
f"VALUES ({', '.join(['%s'] * len(cols))}) RETURNING *",
vals,
).fetchone()
pid = row["id"]
if seed_stages:
@@ -143,6 +148,7 @@ class ProjectStore:
"name": lambda v: store.validate_project_name(v),
"description": lambda v: store.norm_str(v),
"color": lambda v: store.validate_color(v),
"icon": lambda v: store.validate_project_icon(v), # 마이그레이션 011
"owner_email": lambda v: store.norm_str(v, lower=True),
"start_date": lambda v: store.validate_date(v),
"due_date": lambda v: store.validate_date(v),
+15
View File
@@ -381,6 +381,7 @@ def _nav_projects(st: Any, user: dict[str, Any], admin: bool) -> list[dict[str,
"id": p["id"],
"name": p["name"],
"color": p.get("color") or "#4573d2",
"icon": p.get("icon") or "",
"created_by": p.get("created_by") or "",
"description": p.get("description") or "",
"start_date": p.get("start_date"),
@@ -587,6 +588,7 @@ def my_tasks_page(request: Request) -> HTMLResponse:
"avatars": avatars,
"priority_labels": store.PRIORITY_LABELS,
"color_palette": list(store.COLOR_PALETTE),
"project_icons": list(store.PROJECT_ICONS),
"today": today_iso,
},
)
@@ -714,6 +716,7 @@ def project_page(request: Request, project_id: int) -> HTMLResponse:
"id": p["id"],
"name": p["name"],
"color": p.get("color") or "#4573d2",
"icon": p.get("icon") or "",
"start_date": p.get("start_date"),
"due_date": p.get("due_date"),
"created_by": p.get("created_by") or "",
@@ -724,6 +727,7 @@ def project_page(request: Request, project_id: int) -> HTMLResponse:
"id": p["id"],
"name": p["name"],
"color": p.get("color") or "#4573d2",
"icon": p.get("icon") or "",
"created_by": p.get("created_by") or "",
"description": p.get("description") or "",
"start_date": p.get("start_date"),
@@ -796,6 +800,7 @@ def project_page(request: Request, project_id: int) -> HTMLResponse:
"avatars": avatars,
"priority_labels": store.PRIORITY_LABELS,
"color_palette": list(store.COLOR_PALETTE),
"project_icons": list(store.PROJECT_ICONS),
"stage_color_palette": list(store.STAGE_COLOR_PALETTE),
"today": today.isoformat(),
"year": year,
@@ -832,6 +837,9 @@ def api_list_projects(request: Request) -> JSONResponse:
return JSONResponse({"projects": projects, "tree": _build_tree(projects)})
_PROJECT_ICON_MIGRATION_MSG = "프로젝트 아이콘 기능이 아직 준비되지 않았습니다(DB 마이그레이션 011 필요)."
@router.post("/api/projects")
def api_create_project(
request: Request, payload: dict[str, Any] = Body(...)
@@ -849,9 +857,12 @@ def api_create_project(
start_date=payload.get("start_date"),
due_date=payload.get("due_date"),
created_by=user["email"],
icon=payload.get("icon"),
)
except ValueError as exc:
raise HTTPException(status_code=400, detail=str(exc))
except UndefinedColumn:
raise HTTPException(status_code=503, detail=_PROJECT_ICON_MIGRATION_MSG)
return JSONResponse({"project": project}, status_code=201)
@@ -913,6 +924,8 @@ def api_update_project(
project = st.update_project(project_id=project_id, fields=payload)
except ValueError as exc:
raise HTTPException(status_code=400, detail=str(exc))
except UndefinedColumn:
raise HTTPException(status_code=503, detail=_PROJECT_ICON_MIGRATION_MSG)
except KeyError:
raise HTTPException(status_code=404, detail="프로젝트를 찾을 수 없습니다.")
return JSONResponse({"project": project})
@@ -2001,6 +2014,7 @@ def trash_page(request: Request) -> HTMLResponse:
"page_subtitle": "삭제한 작업 — 3개월 보관, 관리자만 복구",
"force_sidebar_collapsed": True,
"color_palette": list(store.COLOR_PALETTE),
"project_icons": list(store.PROJECT_ICONS),
"trash_enabled": enabled,
"items": _trash_view_items(st.list_trash()) if enabled else [],
},
@@ -2073,6 +2087,7 @@ def inbox_page(request: Request) -> HTMLResponse:
"page_subtitle": "나를 태그한 작업과 프로젝트 알림",
"force_sidebar_collapsed": True,
"color_palette": list(store.COLOR_PALETTE),
"project_icons": list(store.PROJECT_ICONS),
"notifications": items,
"mentioned_tasks": mentioned,
"mention_unread": _safe_mention_unread(st, user["email"]),
+74 -10
View File
@@ -39,16 +39,74 @@ ACTION_STAGE_CHANGED = "stage_changed"
ACTION_REOPENED = "reopened"
ACTION_SUBTASK_MOVED = "subtask_moved" # 하위 업무를 다른 상위 업무로 옮김(보드 드래그)
# 프로젝트 색상 팔레트(아사나 느낌) — UI 선택지
# 프로젝트 색상 팔레트 — 아사나 프로젝트 색 16가지(아사나 색상표 순서 그대로).
# 새 프로젝트 기본색은 DEFAULT_PROJECT_COLOR(파랑). 예전 팔레트 색으로 만든 프로젝트는
# 그 색 그대로 둔다(검증은 hex 형식만 본다).
COLOR_PALETTE: tuple[str, ...] = (
"#c7c4c4", # none(연회색)
"#f06a6a", # red
"#ec8d71", # orange
"#f1bd6c", # yellow-orange
"#f8df72", # yellow
"#aecf55", # yellow-green
"#5da283", # green
"#4ecbc4", # blue-green
"#9ee7e3", # aqua
"#4573d2", # blue
"#37a3a3", # teal
"#62a420", # green
"#e8a33d", # amber
"#e8384f", # red
"#aa62e3", # purple
"#f06a6a", # coral
"#5a6772", # slate
"#8d84e8", # indigo
"#b36bd4", # purple
"#f9aaef", # magenta
"#f26fb2", # hot-pink
"#fc979a", # pink
"#6d6e6f", # cool-gray
)
DEFAULT_PROJECT_COLOR = "#4573d2"
# 프로젝트 아이콘 — 아사나 프로젝트 아이콘 목록과 같은 종류를 Material Symbols
# (앱이 self-host 하는 아이콘 글꼴)의 이름으로. 빈 값/목록 밖 = 아이콘 없음(첫 글자).
PROJECT_ICONS: tuple[str, ...] = (
"format_list_bulleted", # 목록
"view_kanban", # 보드
"view_timeline", # 타임라인
"calendar_month", # 캘린더
"rocket_launch", # 로켓
"groups", # 사람들
"trending_up", # 그래프
"stars", # 별
"bug_report", # 버그
"lightbulb", # 전구
"language", # 지구
"settings", # 톱니
"menu_book", # 노트
"desktop_windows", # 모니터
"check_circle", # 체크
"adjust", # 과녁
"code", # 코드
"campaign", # 확성기
"forum", # 말풍선
"work", # 서류가방
"dashboard", # 페이지 레이아웃
"flag", # 깃발
"extension", # 퍼즐
"slideshow", # 발표
"confirmation_number", # 티켓
"shopping_basket", # 장바구니
"cloud", # 구름
"payments", # 돈
"favorite", # 하트
"redeem", # 선물
"trophy", # 트로피
"photo_camera", # 카메라
"palette", # 디자인
"school", # 교육
"local_shipping", # 배송
"inventory_2", # 재고
"storefront", # 상점
"science", # 실험
"videocam", # 영상
"description", # 문서
"handshake", # 협업
"build", # 도구
)
# 세션(칸반 컬럼) 색상 팔레트 — 아사나 태그/커스텀필드에서 쓰는 10색.
@@ -187,7 +245,7 @@ def validate_task_title(title: Any) -> str:
def validate_color(color: Any) -> str:
v = norm_str(color)
if not v:
return COLOR_PALETTE[0]
return DEFAULT_PROJECT_COLOR
# 매우 단순한 hex 검증 — #RGB / #RRGGBB
if v.startswith("#") and len(v) in (4, 7):
try:
@@ -195,7 +253,13 @@ def validate_color(color: Any) -> str:
return v.lower()
except ValueError:
pass
return COLOR_PALETTE[0]
return DEFAULT_PROJECT_COLOR
def validate_project_icon(icon: Any) -> str | None:
"""프로젝트 아이콘 — PROJECT_ICONS 안의 이름만, 빈값/목록 밖은 None(첫 글자 표시)."""
v = norm_str(icon)
return v if v in PROJECT_ICONS else None
def validate_stage_color(color: Any) -> str | None:
@@ -57,11 +57,11 @@
data-name="{{ p.name }}" data-desc="{{ p.description or '' }}"
data-start="{{ p.start_date or '' }}" data-due="{{ p.due_date or '' }}"
data-color="{{ p.color }}" data-status="{{ p.status or 'active' }}"
data-creator="{{ p.created_by or '' }}">
data-creator="{{ p.created_by or '' }}" data-icon="{{ p.icon or '' }}">
<div class="pj-tree-row {% if p.id == current_pid %}is-active{% endif %}">
{% if is_admin %}<span class="pj-tree-handle" title="드래그로 순서 변경">⣿</span>{% endif %}
<a class="pj-tree-link" href="/project/p/{{ p.id }}"{% if is_admin %} draggable="false"{% endif %}>
<span class="pj-tree-avatar" style="background: {{ p.color }}">{{ p.name[0] | upper }}</span>
<span class="pj-tree-avatar{% if p.icon %} has-icon{% endif %}" style="background: {{ p.color }}">{% if p.icon %}<span class="material-symbols-outlined pj-proj-ic">{{ p.icon }}</span>{% else %}{{ p.name[0] | upper }}{% endif %}</span>
<span class="pj-tree-name">{{ p.name }}</span>
</a>
{% if is_admin %}
@@ -1,9 +1,11 @@
{# ── 좌측 프로젝트 목록(project/_side.html)용 모달 (공용) ──────────────
"+" 새 프로젝트 / ✎ 프로젝트 수정 — 수신함·내 업무·휴지통·프로젝트 화면이
모두 include 한다(동작은 project.js 의 initSideTree). 관리자만 쓰므로
관리자에게만 그린다. 색상 원은 window.PJ_COLORS(color_palette). #}
관리자에게만 그린다. 색상 원은 window.PJ_COLORS(color_palette, 아사나 16색),
아이콘은 window.PJ_ICONS(project_icons — Material Symbols 이름). #}
<script>
window.PJ_COLORS = {{ color_palette | tojson }};
window.PJ_ICONS = {{ (project_icons or []) | tojson }};
</script>
{% if is_admin %}
<!-- 새 프로젝트 모달 — 좌측 프로젝트 목록의 + 버튼 -->
@@ -15,9 +17,13 @@
{# 날짜 칸은 project.js enhanceDateInput 이 아사나식 날짜 버튼으로 바꾼다(input 은 숨긴 값 저장소).
label 로 감싸지 않는다 — label 안의 버튼을 누르면 숨긴 input 이 다시 눌리는 문제가 생긴다. #}
<div class="pj-field-label">마감일<input type="date" id="pj-f-due" /></div>
<label>색상
{# 색상·아이콘은 label 로 감싸지 않는다 — label 글자를 누르면 첫 버튼이 눌린다. #}
<div class="pj-field-label">색상
<span class="pj-color-palette" id="pj-f-colors"></span>
</label>
</div>
<div class="pj-field-label">아이콘
<div class="pj-icon-palette" id="pj-f-icons"></div>
</div>
<div class="pj-field-label">멤버
<div class="pj-member-picker" id="pj-f-members">불러오는 중…</div>
</div>
@@ -40,9 +46,12 @@
<input type="date" id="pj-e-start" />
<input type="date" id="pj-e-due" />
</div>
<label>색상
<div class="pj-field-label">색상
<span class="pj-color-palette" id="pj-e-colors"></span>
</label>
</div>
<div class="pj-field-label">아이콘
<div class="pj-icon-palette" id="pj-e-icons"></div>
</div>
<label class="pj-time-toggle">
<input type="checkbox" id="pj-e-done" /> 프로젝트 완료 (목록 끝으로 이동·비활성)
</label>
@@ -1,7 +1,7 @@
{% extends "erp_base.html" %}
{% block head_extra %}
<link rel="stylesheet" href="/static/project.css?v=20260926g" />
<link rel="stylesheet" href="/static/project.css?v=20260926h" />
<link rel="stylesheet" href="/static/vendor/material-symbols/material-symbols.css" />
{% endblock %}
@@ -99,5 +99,5 @@
{% include "project/_side_modals.html" %}
{% include "project/_member_tasks_modal.html" %}
<script src="/static/project.js?v=20260926g" defer></script>
<script src="/static/project.js?v=20260926h" defer></script>
{% endblock %}
@@ -1,7 +1,7 @@
{% extends "erp_base.html" %}
{% block head_extra %}
<link rel="stylesheet" href="/static/project.css?v=20260926g" />
<link rel="stylesheet" href="/static/project.css?v=20260926h" />
<link rel="stylesheet" href="/static/vendor/material-symbols/material-symbols.css" />
{% endblock %}
@@ -98,5 +98,5 @@
"today": {{ today | tojson }}
}
</script>
<script src="/static/project.js?v=20260926g" defer></script>
<script src="/static/project.js?v=20260926h" defer></script>
{% endblock %}
@@ -1,7 +1,7 @@
{% extends "erp_base.html" %}
{% block head_extra %}
<link rel="stylesheet" href="/static/project.css?v=20260926g" />
<link rel="stylesheet" href="/static/project.css?v=20260926h" />
<!-- 구글 머티리얼 심볼(담당자 아이콘 등) — self-host -->
<link rel="stylesheet" href="/static/vendor/material-symbols/material-symbols.css" />
<!-- 타임라인 vis-timeline — self-host -->
@@ -48,7 +48,7 @@
같은 마크업으로 다시 그린다. -->
<div class="pj-title-wrap">
<h1 class="pj-project-title">
<span class="pj-project-title-pill" style="--pj-color: {{ project.color or '#4573d2' }}">{{ project.name }}</span>
<span class="pj-project-title-pill" style="--pj-color: {{ project.color or '#4573d2' }}">{% if project.icon %}<span class="material-symbols-outlined pj-pill-ic">{{ project.icon }}</span>{% endif %}{{ project.name }}</span>
</h1>
<div class="pj-title-members" id="pj-member-list">
{% for m in members %}
@@ -466,5 +466,5 @@
</script>
<script src="/static/vendor/vis-timeline/vis-timeline-graph2d.min.js"></script>
<script src="/static/project.js?v=20260926g" defer></script>
<script src="/static/project.js?v=20260926h" defer></script>
{% endblock %}
@@ -1,7 +1,7 @@
{% extends "erp_base.html" %}
{% block head_extra %}
<link rel="stylesheet" href="/static/project.css?v=20260926g" />
<link rel="stylesheet" href="/static/project.css?v=20260926h" />
<link rel="stylesheet" href="/static/vendor/material-symbols/material-symbols.css" />
{% endblock %}
@@ -68,5 +68,5 @@
{% include "project/_side_modals.html" %}
{% include "project/_member_tasks_modal.html" %}
<script src="/static/project.js?v=20260926g" defer></script>
<script src="/static/project.js?v=20260926h" defer></script>
{% endblock %}
+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");
}
},