feat(project): 수신함도 좌측 사이드바 + 우측 프레임 2단 레이아웃으로

수신함이 사이드바 없이 화면 전체를 쓰고 있어, 내 업무·프로젝트 화면과
같은 2단 구조로 맞췄다. 내용은 오른쪽 프레임 안에서만 스크롤한다.

- inbox.html 을 .pj-layout + 공용 _side.html + <section class="pj-main">
  으로 감쌌다. 사이드바로 이동할 수 있으니 "← 프로젝트" 버튼은 뺐다.
- _side.html 에 side_active('inbox' | 'mytasks' | '')를 받아 지금 보고 있는
  개인 메뉴를 강조한다. 새 프로젝트 "+" 는 그 모달을 갖고 배선하는 화면
  (내 업무·프로젝트)에서만 보인다.
- 라우터: 사이드바 데이터를 세 화면이 같이 쓰므로 _nav_projects 헬퍼로
  묶고, 수신함에도 nav_projects/my_open_total 을 넘긴다.
- 내 업무·수신함 본문은 폭 1180px 로 제한 — 표/목록이 화면 끝까지 늘어나
  눈이 따라가기 힘들던 문제(보드·달력 등은 종전대로 전체 폭).

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-09-22 13:27:07 +09:00
parent f41733aa3f
commit 8f73c0dcb9
8 changed files with 147 additions and 106 deletions
+36 -19
View File
@@ -236,6 +236,31 @@ def _fmt_date_kr(d: str | None) -> str:
return dd.strftime("%m/%d") + f"({_WEEKDAYS_KR[dd.weekday()]})"
def _nav_projects(st: Any, user: dict[str, Any], admin: bool) -> list[dict[str, Any]]:
"""좌측 사이드바(project/_side.html)의 프로젝트 트리 데이터.
내 업무 · 수신함 · 프로젝트 화면이 같은 사이드바를 쓰므로 한 곳에서 만든다.
"""
projects = st.list_projects(
include_archived=False,
member_email=None if admin else user["email"],
)
return [
{
"id": p["id"],
"name": p["name"],
"color": p.get("color") or "#4573d2",
"created_by": p.get("created_by") or "",
"description": p.get("description") or "",
"start_date": p.get("start_date"),
"due_date": p.get("due_date"),
"status": p.get("status") or "active",
}
for p in projects
if not p.get("parent_id")
]
def _build_tree(projects: list[dict[str, Any]]) -> list[dict[str, Any]]:
"""평면 프로젝트 목록 → parent_id 기준 트리(children 키)."""
by_id: dict[int, dict[str, Any]] = {}
@@ -395,24 +420,7 @@ async def my_tasks_page(request: Request) -> HTMLResponse:
return _render_config_needed(request, user)
admin = is_admin(user)
projects = st.list_projects(
include_archived=False,
member_email=None if admin else user["email"],
)
nav_projects = [
{
"id": p["id"],
"name": p["name"],
"color": p.get("color") or "#4573d2",
"created_by": p.get("created_by") or "",
"description": p.get("description") or "",
"start_date": p.get("start_date"),
"due_date": p.get("due_date"),
"status": p.get("status") or "active",
}
for p in projects
if not p.get("parent_id")
]
nav_projects = _nav_projects(st, user, admin)
today_iso = today_kst().isoformat()
my_tasks = st.list_tasks(assignee_email=user["email"], limit=1000)
@@ -1485,17 +1493,26 @@ async def inbox_page(request: Request) -> HTMLResponse:
st = _store(request)
if st is None:
return _render_config_needed(request, user)
admin = is_admin(user)
items = st.list_notifications(recipient_email=user["email"], limit=100)
mentioned = _safe_mentions(st, user["email"])
for t in mentioned:
t["due_label"] = _fmt_date_kr(t.get("due_date"))
# 좌측 사이드바(project/_side.html)는 세 화면 공용 — 같은 데이터가 필요하다.
nav_projects = _nav_projects(st, user, admin)
my_open_total = sum(
1 for t in st.list_tasks(assignee_email=user["email"], limit=1000)
if not t.get("completed_at")
)
return render_template(
request,
"project/inbox.html",
{
"user": user,
"is_admin": is_admin(user),
"is_admin": admin,
"nav_items": build_erp_nav(user, active="project"),
"nav_projects": nav_projects,
"my_open_total": my_open_total,
"page_title": "수신함",
"page_subtitle": "나를 태그한 업무와 프로젝트 알림",
"force_sidebar_collapsed": True,
@@ -5,7 +5,8 @@
mention_unread 미확인 @태그 개수 (수신함 배지)
my_open_total 진행 중인 내 업무 개수 (내 업무 배지)
nav_projects 프로젝트 목록(평면)
current_pid 지금 보고 있는 프로젝트 id (내 업무 화면이면 0)
current_pid 지금 보고 있는 프로젝트 id (내 업무/수신함 화면이면 0)
side_active 'inbox' | 'mytasks' | '' — 개인 메뉴 활성 표시
is_admin 프로젝트 생성/수정/삭제 권한
프로젝트 수정/삭제(✎/×) 버튼은 그 동작을 배선하는 initProject 가 도는
프로젝트 화면에서만 그린다(current_pid 로 판별). #}
@@ -13,13 +14,13 @@
<!-- 아사나처럼 맨 위에 개인 메뉴(수신함 / 내 업무). 내 업무는 접었다 펴는
패널이 아니라 오른쪽 화면 전체에 목록을 띄우는 별도 페이지다. -->
<nav class="pj-side-nav">
<a class="pj-side-navlink" href="/project/inbox">
<a class="pj-side-navlink {% if side_active == 'inbox' %}is-active{% endif %}" href="/project/inbox">
<span class="material-symbols-outlined pj-side-navic">inbox</span>
<span class="pj-side-navtext">수신함</span>
<span class="pj-side-navbadge" id="pj-mention-badge"
{% if not mention_unread %}hidden{% endif %}>{{ mention_unread }}</span>
</a>
<a class="pj-side-navlink {% if not current_pid %}is-active{% endif %}" href="/project/">
<a class="pj-side-navlink {% if side_active == 'mytasks' %}is-active{% endif %}" href="/project/">
<span class="material-symbols-outlined pj-side-navic">checklist</span>
<span class="pj-side-navtext">내 업무</span>
<span class="pj-side-navbadge pj-side-navbadge-open" id="pj-myopen-badge"
@@ -30,7 +31,9 @@
<div class="pj-side-block">
<div class="pj-side-head">
<span>프로젝트</span>
{% if is_admin %}
{# 새 프로젝트 모달(#pj-modal-project)을 갖고 그 동작을 배선하는
화면에서만 보인다 — 수신함에는 그 모달이 없다. #}
{% if is_admin and side_active != 'inbox' %}
<button type="button" class="pj-icon-btn" id="pj-new-project-side" title="새 프로젝트">+</button>
{% endif %}
</div>
@@ -1,88 +1,97 @@
{% extends "erp_base.html" %}
{% block head_extra %}
<link rel="stylesheet" href="/static/project.css?v=20260922d" />
<link rel="stylesheet" href="/static/project.css?v=20260922e" />
<link rel="stylesheet" href="/static/vendor/material-symbols/material-symbols.css" />
{% endblock %}
{% block content %}
<div class="pj-wrap">
<div class="pj-section-head">
<h2>수신함</h2>
<div style="display:flex; gap:8px;">
<a class="pj-btn" href="/project/">← 프로젝트</a>
<button type="button" class="pj-btn" id="pj-mentions-readall">태그 모두 확인</button>
<button type="button" class="pj-btn pj-btn-primary" id="pj-readall">알림 모두 읽음</button>
</div>
</div>
{# 내 업무/프로젝트 화면과 같은 2단 레이아웃 — 좌측은 공용 사이드바,
내용은 오른쪽 프레임 안에서만 스크롤한다. #}
<div class="pj-wrap pj-inbox-view">
<div class="pj-layout">
{% with current_pid = 0, side_active = "inbox" %}{% include "project/_side.html" %}{% endwith %}
<!-- 아사나 Inbox 처럼 "나를 태그(@)한 업무"를 맨 위에 리스트로 보여준다.
업무를 누르면 그 프로젝트 화면이 열리면서 업무 편집 팝업이 뜬다
(?task= 파라미터 — project.js 가 처리). -->
<div class="pj-inbox-section">
<h3 class="pj-inbox-h3">
나를 태그한 업무
<span class="pj-inbox-count" id="pj-mention-unread"
{% if not mention_unread %}hidden{% endif %}>{{ mention_unread }}</span>
</h3>
{% if not mentioned_tasks %}
<div class="pj-empty">태그된 업무가 없습니다.</div>
{% else %}
<ul class="pj-inbox pj-mention-list" id="pj-mention-tasks">
{% for t in mentioned_tasks %}
<li class="pj-inbox-item pj-mention-item {% if t.unread_mentions %}is-unread{% endif %}"
data-task-id="{{ t.id }}" data-project="{{ t.project_id }}">
<span class="material-symbols-outlined pj-inbox-icon">alternate_email</span>
<div class="pj-inbox-body">
<div class="pj-inbox-title {% if t.completed_at %}is-done{% endif %}">{{ t.title }}</div>
<div class="pj-inbox-meta">
<span class="pj-inbox-proj" style="color: {{ t.project_color or '#4573d2' }}">● {{ t.project_name }}</span>
{% if t.stage_name %} · {{ t.stage_name }}{% endif %}
{% if t.due_label %} · 마감 {{ t.due_label }}{% endif %}
{% if t.mention_actor %} · {{ t.mention_actor.split('@')[0] }}님이 태그{% endif %}
</div>
<section class="pj-main">
<div class="pj-section-head">
<h2>수신함</h2>
<div style="display:flex; gap:8px;">
<button type="button" class="pj-btn" id="pj-mentions-readall">태그 모두 확인</button>
<button type="button" class="pj-btn pj-btn-primary" id="pj-readall">알림 모두 읽음</button>
</div>
<a class="pj-btn pj-inbox-go" href="/project/p/{{ t.project_id }}?task={{ t.id }}">열기</a>
</li>
{% endfor %}
</ul>
{% endif %}
</div>
</div>
<div class="pj-view pj-inbox-pane">
<div class="pj-inbox-section">
<h3 class="pj-inbox-h3">알림</h3>
{% if not notifications %}
<div class="pj-empty">알림이 없습니다.</div>
{% else %}
<ul class="pj-inbox" id="pj-inbox">
{% for n in notifications %}
<li class="pj-inbox-item {% if not n.is_read %}is-unread{% endif %}"
data-id="{{ n.id }}"
{% if n.task_id %}data-project="{{ n.project_id }}"{% endif %}>
<span class="material-symbols-outlined pj-inbox-icon">
{% if n.type == 'assigned' %}assignment_ind
{% elif n.type == 'completed' %}task_alt
{% elif n.type == 'comment' %}chat_bubble
{% elif n.type == 'mention' %}alternate_email
{% else %}notifications{% endif %}
</span>
<div class="pj-inbox-body">
<div class="pj-inbox-title">{{ n.title }}</div>
{% if n.body %}<div class="pj-inbox-sub">{{ n.body }}</div>{% endif %}
<div class="pj-inbox-meta">
{% if n.actor_email %}{{ n.actor_email.split('@')[0] }} · {% endif %}{{ n.created_at[:16].replace('T',' ') }}
</div>
<!-- 아사나 Inbox 처럼 "나를 태그(@)한 업무"를 맨 위에 리스트로 보여준다.
업무를 누르면 그 프로젝트 화면이 열리면서 업무 편집 팝업이 뜬다
(?task= 파라미터 — project.js 가 처리). -->
<div class="pj-inbox-section">
<h3 class="pj-inbox-h3">
나를 태그한 업무
<span class="pj-inbox-count" id="pj-mention-unread"
{% if not mention_unread %}hidden{% endif %}>{{ mention_unread }}</span>
</h3>
{% if not mentioned_tasks %}
<div class="pj-empty">태그된 업무가 없습니다.</div>
{% else %}
<ul class="pj-inbox pj-mention-list" id="pj-mention-tasks">
{% for t in mentioned_tasks %}
<li class="pj-inbox-item pj-mention-item {% if t.unread_mentions %}is-unread{% endif %}"
data-task-id="{{ t.id }}" data-project="{{ t.project_id }}">
<span class="material-symbols-outlined pj-inbox-icon">alternate_email</span>
<div class="pj-inbox-body">
<div class="pj-inbox-title {% if t.completed_at %}is-done{% endif %}">{{ t.title }}</div>
<div class="pj-inbox-meta">
<span class="pj-inbox-proj" style="color: {{ t.project_color or '#4573d2' }}">● {{ t.project_name }}</span>
{% if t.stage_name %} · {{ t.stage_name }}{% endif %}
{% if t.due_label %} · 마감 {{ t.due_label }}{% endif %}
{% if t.mention_actor %} · {{ t.mention_actor.split('@')[0] }}님이 태그{% endif %}
</div>
</div>
<a class="pj-btn pj-inbox-go" href="/project/p/{{ t.project_id }}?task={{ t.id }}">열기</a>
</li>
{% endfor %}
</ul>
{% endif %}
</div>
{% if n.project_id %}
<a class="pj-btn pj-inbox-go"
href="/project/p/{{ n.project_id }}{% if n.task_id %}?task={{ n.task_id }}{% endif %}">이동</a>
{% endif %}
</li>
{% endfor %}
</ul>
{% endif %}
<div class="pj-inbox-section">
<h3 class="pj-inbox-h3">알림</h3>
{% if not notifications %}
<div class="pj-empty">알림이 없습니다.</div>
{% else %}
<ul class="pj-inbox" id="pj-inbox">
{% for n in notifications %}
<li class="pj-inbox-item {% if not n.is_read %}is-unread{% endif %}"
data-id="{{ n.id }}"
{% if n.task_id %}data-project="{{ n.project_id }}"{% endif %}>
<span class="material-symbols-outlined pj-inbox-icon">
{% if n.type == 'assigned' %}assignment_ind
{% elif n.type == 'completed' %}task_alt
{% elif n.type == 'comment' %}chat_bubble
{% elif n.type == 'mention' %}alternate_email
{% else %}notifications{% endif %}
</span>
<div class="pj-inbox-body">
<div class="pj-inbox-title">{{ n.title }}</div>
{% if n.body %}<div class="pj-inbox-sub">{{ n.body }}</div>{% endif %}
<div class="pj-inbox-meta">
{% if n.actor_email %}{{ n.actor_email.split('@')[0] }} · {% endif %}{{ n.created_at[:16].replace('T',' ') }}
</div>
</div>
{% if n.project_id %}
<a class="pj-btn pj-inbox-go"
href="/project/p/{{ n.project_id }}{% if n.task_id %}?task={{ n.task_id }}{% endif %}">이동</a>
{% endif %}
</li>
{% endfor %}
</ul>
{% endif %}
</div>
</div>
</section>
</div>
</div>
<script src="/static/project.js?v=20260922d" defer></script>
<script src="/static/project.js?v=20260922e" defer></script>
{% endblock %}
@@ -1,7 +1,7 @@
{% extends "erp_base.html" %}
{% block head_extra %}
<link rel="stylesheet" href="/static/project.css?v=20260922d" />
<link rel="stylesheet" href="/static/project.css?v=20260922e" />
<link rel="stylesheet" href="/static/vendor/material-symbols/material-symbols.css" />
{% endblock %}
@@ -18,7 +18,7 @@
data-is-admin="{{ 'true' if is_admin else 'false' }}"
data-is-super="{{ 'true' if user.is_super_admin else 'false' }}">
<div class="pj-layout">
{% with current_pid = 0 %}{% include "project/_side.html" %}{% endwith %}
{% with current_pid = 0, side_active = "mytasks" %}{% include "project/_side.html" %}{% endwith %}
<section class="pj-main">
<div class="pj-toolbar">
@@ -100,5 +100,5 @@
"today": {{ today | tojson }}
}
</script>
<script src="/static/project.js?v=20260922d" defer></script>
<script src="/static/project.js?v=20260922e" defer></script>
{% endblock %}
@@ -1,7 +1,7 @@
{% extends "erp_base.html" %}
{% block head_extra %}
<link rel="stylesheet" href="/static/project.css?v=20260922d" />
<link rel="stylesheet" href="/static/project.css?v=20260922e" />
<!-- 구글 머티리얼 심볼(담당자 아이콘 등) — self-host -->
<link rel="stylesheet" href="/static/vendor/material-symbols/material-symbols.css" />
<!-- 타임라인 vis-timeline — self-host -->
@@ -28,7 +28,7 @@
<div class="pj-layout">
<!-- ── 좌측 사이드바 — 내 업무 화면과 공용(project/_side.html) ── -->
{% with current_pid = project.id %}{% include "project/_side.html" %}{% endwith %}
{% with current_pid = project.id, side_active = "" %}{% include "project/_side.html" %}{% endwith %}
<!-- ── 우측: 뷰 ── -->
<section class="pj-main">
@@ -453,5 +453,5 @@
</script>
<script src="/static/vendor/vis-timeline/vis-timeline-graph2d.min.js"></script>
<script src="/static/project.js?v=20260922d" defer></script>
<script src="/static/project.js?v=20260922e" defer></script>
{% endblock %}
+11 -2
View File
@@ -85,9 +85,9 @@
스크롤 위치에 맞춰 움직이는 막대를 직접 그려 어떤 환경에서도 항상
보이게 한다. 휠·키보드·드래그 스크롤은 그대로 동작. 막대가 들어갈 자리로
각 패널의 padding-right 를 14px 확보한다. */
.pj-side, .pj-board, .pj-mytasks-pane { scrollbar-width: none; }
.pj-side, .pj-board, .pj-mytasks-pane, .pj-inbox-pane { scrollbar-width: none; }
.pj-side::-webkit-scrollbar, .pj-board::-webkit-scrollbar,
.pj-mytasks-pane::-webkit-scrollbar { display: none; width: 0; height: 0; }
.pj-mytasks-pane::-webkit-scrollbar, .pj-inbox-pane::-webkit-scrollbar { display: none; width: 0; height: 0; }
/* anchor = 스크롤러의 첫 자식(높이 0, sticky) → 화면에 보이는 영역의 맨 위에
항상 붙어 있고, 그 안의 track 이 보이는 높이만큼 오른쪽 padding 자리에 걸린다. */
.pj-vbar-anchor { position: sticky; top: 0; height: 0; z-index: 5; }
@@ -1010,3 +1010,12 @@ label.pj-desc-fmtbtn { line-height: 26px; }
@media (max-width: 980px) {
.pj-mtk-proj, .pj-mtk-stage, .pj-mtk-pri { display: none; }
}
/* ── 수신함 (/project/inbox) — 내 업무와 같은 2단 레이아웃 ── */
.pj-inbox-view .pj-layout { flex: 1 1 auto; min-height: 0; }
.pj-inbox-pane { overflow-y: auto; padding-right: 14px; }
.pj-inbox-view .pj-section-head { flex: none; }
/* 내 업무·수신함은 표/목록이라 화면 끝까지 늘어나면 눈이 따라가기 힘들다 —
읽기 좋은 폭으로 제한한다(보드/달력 등 프로젝트 뷰는 종전대로 전체 폭). */
.pj-mytasks-view .pj-main, .pj-inbox-view .pj-main { max-width: 1180px; }
+1 -1
View File
@@ -4065,7 +4065,7 @@
update();
}
function initScrollIndicators() {
document.querySelectorAll(".pj-side, .pj-mytasks-pane")
document.querySelectorAll(".pj-side, .pj-mytasks-pane, .pj-inbox-pane")
.forEach(attachScrollIndicator);
}
+4 -1
View File
@@ -90,7 +90,9 @@
오른쪽에 진행/완료/지연 요약. 체크박스는 그 자리에서 완료 토글, 행을 누르면 그
프로젝트로 이동하며 업무 편집 팝업이 열리고(`?task=`), 우클릭은 열기/완료/삭제 메뉴.
완료된 업무 행은 반투명 + 취소선. 8초 주기로 목록을 다시 받는다.
좌측 사이드바는 프로젝트 화면과 공용(`project/_side.html`) — 수신함 · 내 업무 ·
표/목록 화면이라 본문 폭은 1180px 로 제한한다(보드·달력 등 프로젝트 뷰는 전체 폭).
좌측 사이드바는 프로젝트·수신함 화면과 공용(`project/_side.html`, `side_active` 로
활성 메뉴 표시) — 수신함 · 내 업무 ·
프로젝트 트리(+ 새 프로젝트). "전체 멤버"는 그 팝업을 배선하는 코드가 `initProject`
안에 있어 프로젝트 화면에서만 나온다.
- **프로젝트** (`/project/p/{id}`): 좌측 사이드바(공용 `_side.html`) + 우측 뷰 토글.
@@ -176,6 +178,7 @@ description 을 항상 HTML로 취급하기 때문). 두 번 실행하면 이중
새로 태그된 사람에게만 알림(`type=mention`)이 생긴다 — 같은 자리에서 중복 저장 안 됨.
- **수신함** (`/project/inbox`) — 위쪽 "나를 태그한 업무"(업무 1건당 1행, 최근 태그순.
누르면 확인 처리, "열기"는 `?task=` 로 그 업무 편집 팝업까지 연다) + 아래쪽 "알림".
내 업무·프로젝트 화면과 같은 2단 레이아웃(좌측 공용 사이드바 + 우측 프레임)이다.
API: `GET /api/mentions`, `GET /api/mentions/unread-count`, `POST /api/mentions/read`
(`task_id` 주면 그 업무만, 없으면 전부).
006 마이그레이션이 아직 안 돌아간 환경에서도 화면이 죽지 않게 조회/기록은 모두 감싸져 있다.