feat(project): tooltips stay above the cursor; create project/section from meeting task table

- Hover tips: keep above the cursor even near the top edge (tighter tail gap); flip below only
  when there is no room, 28px under the cursor so the pointer never covers the text
- Meeting task table: "new project" (Pro user+) and "new section" at the top of the pickers,
  created by name and selected right away
- Help + docs; jsdom tests

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-12 13:52:34 +09:00
parent 7cdca852bd
commit fa6e7066ae
11 changed files with 117 additions and 29 deletions
+55 -20
View File
@@ -9092,15 +9092,20 @@
tipEl.textContent = text;
tipEl.hidden = false;
// 화면 가장자리 보정 — 좌우로 넘치면 말풍선만 안쪽으로 밀고 꼬리는
// 커서를 계속 가리키게(--pj-tip-shift). 위가 모자라면 커서 아래로 뒤집는다.
// 커서를 계속 가리키게(--pj-tip-shift).
// 늘 커서 **위**에 — 마우스 화살표(핫스팟에서 아래로 약 20px)에 가려지지 않게. 화면 맨 위(회의록 머리 버튼 등)라
// 여유가 적으면 꼬리 간격을 줄여서라도 위에(말풍선 아래 끝 = 커서 8px 위), 그래도 안 들어갈 때만 아래로 뒤집되
// 화살표 길이만큼 띄운다(예전엔 위 여백 20px 미만이면 커서 바로 아래 22px — 화살표가 글자를 가렸다).
const w = tipEl.offsetWidth, h = tipEl.offsetHeight;
const vw = document.documentElement.clientWidth;
const cx = Math.min(Math.max(x, 8 + w / 2), vw - 8 - w / 2);
const below = y - 16 - h < 4;
// CSS 기본 위치: 말풍선 아래 끝 = top − 6px(transform). top = y−10 → 커서 16px 위, top = y−2 → 커서 8px 위.
const roomy = y - 16 - h >= 2;
const below = !roomy && y - 8 - h < 0;
tipEl.classList.toggle("is-below", below);
tipEl.style.setProperty("--pj-tip-shift", (x - cx) + "px");
tipEl.style.left = cx + "px";
tipEl.style.top = (below ? y + 22 : y - 10) + "px";
tipEl.style.top = (below ? y + 28 : roomy ? y - 10 : y - 2) + "px";
}
function hide() { shown = false; if (tipEl) tipEl.hidden = true; }
document.addEventListener("mouseover", function (e) {
@@ -10724,23 +10729,41 @@
const r = btn.getBoundingClientRect();
showContextMenu(r.left, r.bottom + 2, items.length ? items : [{ label: "고를 항목이 없습니다", onClick: function () {} }]);
}
async function chooseProject(r, p) {
if (r.projectId !== p.id) { r.stageId = null; r.stageName = ""; }
r.projectId = p.id; r.projectName = p.name;
try {
const [mem, stages] = await Promise.all([membersOf(p.id), stagesOf(p.id)]);
if (r.assignee && mem.indexOf(r.assignee.toLowerCase()) < 0) {
showToast(nameOf(r.assignee) + "님은 이 프로젝트 멤버가 아니어서 담당자를 비웠습니다.");
r.assignee = "";
}
if (!r.stageId && stages.length) { r.stageId = stages[0].id; r.stageName = stages[0].name; }
} catch (e) { showToast("프로젝트 정보를 읽지 못했습니다: " + e.message, "error"); }
save(); render();
}
// 목록 맨 위 "+ 새 프로젝트" — 새 프로젝트는 Pro user 이상(서버 POST /api/projects 도 같은 기준), 만든 사람이 소유자.
// 새 프로젝트는 섹션 없이 시작하므로 섹션 칸은 비워 둔다(섹션 칸 맨 위 "+ 새 섹션"으로 바로 만들 수 있다).
async function addProject(r) {
const name = await prompt("새 프로젝트 이름", "");
if (name == null || !String(name).trim()) return;
try {
const res = await api("POST", "/project/api/projects", { name: String(name).trim() });
const p = res.project;
if (projects) projects.push(p);
memberCache[p.id] = [String(p.owner_email || "").toLowerCase()].filter(Boolean);
stageCache[p.id] = [];
showToast("프로젝트 ‘" + p.name + "’를 만들었습니다.");
await chooseProject(r, p);
} catch (e) { showToast("프로젝트 만들기 실패: " + e.message, "error"); }
}
async function pickProject(r, btn) {
const list = await loadProjects();
menuAt(btn, list.map(function (p) {
return { label: p.name, icon: menuIcon("folder"), checked: r.projectId === p.id, onClick: async function () {
if (r.projectId !== p.id) { r.stageId = null; r.stageName = ""; }
r.projectId = p.id; r.projectName = p.name;
try {
const [mem, stages] = await Promise.all([membersOf(p.id), stagesOf(p.id)]);
if (r.assignee && mem.indexOf(r.assignee.toLowerCase()) < 0) {
showToast(nameOf(r.assignee) + "님은 이 프로젝트 멤버가 아니어서 담당자를 비웠습니다.");
r.assignee = "";
}
if (!r.stageId && stages.length) { r.stageId = stages[0].id; r.stageName = stages[0].name; }
} catch (e) { showToast("프로젝트 정보를 읽지 못했습니다: " + e.message, "error"); }
save(); render();
} };
}));
const pro = el("pj-meet-pane") && el("pj-meet-pane").dataset.pro === "true";
const head = pro ? [{ label: "새 프로젝트", icon: menuIcon("add"), onClick: function () { addProject(r); } }, null] : [];
menuAt(btn, head.concat(list.map(function (p) {
return { label: p.name, icon: menuIcon("folder"), checked: r.projectId === p.id, onClick: function () { chooseProject(r, p); } };
})));
}
async function pickAssignee(r, btn) {
// 프로젝트를 골랐으면 그 프로젝트 멤버·소유자만(작업을 볼 수 있는 사람), 아니면 프로젝트 권한이 있는 전체 직원
@@ -10754,9 +10777,21 @@
async function pickStage(r, btn) {
if (!r.projectId) { showToast("프로젝트를 먼저 고르세요."); return; }
const stages = await stagesOf(r.projectId);
menuAt(btn, stages.map(function (st) {
const pid = r.projectId;
// 목록 맨 위 "+ 새 섹션" — 그 프로젝트 멤버 누구나(서버 POST …/stages). 만든 섹션을 바로 고른다.
const head = [{ label: "새 섹션", icon: menuIcon("add"), onClick: async function () {
const name = await prompt("‘" + r.projectName + "’에 만들 섹션 이름", "");
if (name == null || !String(name).trim()) return;
try {
const res = await api("POST", "/project/api/projects/" + pid + "/stages", { name: String(name).trim() });
(stageCache[pid] = stageCache[pid] || []).push(res.stage);
if (r.projectId === pid) { r.stageId = res.stage.id; r.stageName = res.stage.name; save(); render(); }
showToast("섹션 ‘" + res.stage.name + "’를 만들었습니다.");
} catch (e) { showToast("섹션 만들기 실패: " + e.message, "error"); }
} }, null];
menuAt(btn, head.concat(stages.map(function (st) {
return { label: st.name, icon: menuIcon("view_column"), checked: r.stageId === st.id, onClick: function () { r.stageId = st.id; r.stageName = st.name; save(); render(); } };
}));
})));
}
async function apply(r, btn) {
if (!r.title.trim()) { showToast("작업 제목을 쓰세요."); return; }