feat(라이브): 달력 카드 이미지 링크에 마우스를 올리면 오른쪽 달력 아래에 미리보기
- 오른쪽 줄을 달력 + 미리보기(.lv-side)로, 첫 장·호스트·날짜·시간 표시, 벗어나면 숨김 - 키보드 탭으로 가도 표시, 좁은 화면은 미리보기 없음(링크는 그대로 새 탭) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -26,6 +26,9 @@ function check(name, cond, extra) {
|
||||
const type = f.endsWith(".css") ? "text/css" : f.endsWith(".js") ? "application/javascript" : "font/woff2";
|
||||
return r.fulfill({ status: 200, contentType: type, body: fs.readFileSync(f) });
|
||||
}
|
||||
if (u.pathname.startsWith("/live/images/")) { // 결과 이미지 미리보기 — 아무 그림이나
|
||||
return r.fulfill({ status: 200, contentType: "image/png", body: fs.readFileSync(path.join(ROOT, "app", "static", "dispatch", "courier", "tiktok.png")) });
|
||||
}
|
||||
const page = u.pathname === "/live/calendar" ? (u.searchParams.get("month") === "2026-12" ? "live_cal_dec.html" : "live_cal_ko.html") : u.pathname.slice(1);
|
||||
if (!page.endsWith(".html")) return r.fulfill({ status: 200, contentType: "application/json", body: "{}" });
|
||||
r.fulfill({ status: 200, contentType: "text/html; charset=utf-8", body: fs.readFileSync(path.join(__dirname, ".out", page), "utf8") });
|
||||
@@ -127,6 +130,22 @@ function check(name, cond, extra) {
|
||||
});
|
||||
check("합친 칸 높이 = 두 줄", tall < 2, tall);
|
||||
await p.screenshot({ path: path.join(__dirname, ".out", "live_merge.png") });
|
||||
// 이미지 링크에 마우스 → 오른쪽 달력 아래 미리보기, 벗어나면 숨김
|
||||
const imgLink = p.locator('td[data-day="2026-11-05"][data-start="06:00"] a[data-preview]');
|
||||
check("미리보기 처음엔 숨김", await p.locator("#lv-preview").isHidden());
|
||||
await imgLink.hover();
|
||||
await p.waitForTimeout(200);
|
||||
const pv = await p.evaluate(function () {
|
||||
const box = document.getElementById("lv-preview"), cal = document.getElementById("lv-side-cal").getBoundingClientRect(), b = box.getBoundingClientRect();
|
||||
const img = box.querySelector("img");
|
||||
return { hidden: box.hidden, src: img.getAttribute("src"), loaded: img.naturalWidth > 0, cap: box.querySelector("figcaption").textContent,
|
||||
below: b.top >= cal.bottom, sameCol: Math.abs(b.left - cal.left) < 2 && Math.abs(b.width - cal.width) < 2, bottom: b.bottom <= window.innerHeight };
|
||||
});
|
||||
check("이미지 링크에 마우스 = 달력 아래 미리보기", !pv.hidden && pv.src === "/live/images/7" && pv.loaded && pv.below && pv.sameCol && pv.bottom && pv.cap.includes("1/2"), pv);
|
||||
await p.screenshot({ path: path.join(__dirname, ".out", "live_preview.png") });
|
||||
await p.mouse.move(5, 5);
|
||||
await p.waitForTimeout(100);
|
||||
check("벗어나면 숨김", await p.locator("#lv-preview").isHidden());
|
||||
|
||||
await p.locator('#lv-side-cal [data-nav="1"]').click();
|
||||
await Promise.all([p.waitForURL(/month=2026-12/), day("2026-12-10").click()]);
|
||||
|
||||
@@ -36,7 +36,8 @@ class Fake:
|
||||
return []
|
||||
# 운영 화면처럼 — 6·8·16시 칸에 카드(세 줄 모두 카드가 있으면 그 줄이 가장 높다), 모든 시간 칸을 채워 높이 최악으로
|
||||
return [{"id": h, "host_id": 1, "host_name": "Nabella", "tiktok_handle": "MainAccount", "broadcast_date": date(2026, 11, 5), "start_time": time(h),
|
||||
"end_time": time(h + 2), "venue": "", "sales_amount": Decimal("500"), "images": []} for h in range(6, 24, 2) if h < 22] + \
|
||||
"end_time": time(h + 2), "venue": "", "sales_amount": Decimal("500"),
|
||||
"images": [{"id": 7, "filename": "r.png"}, {"id": 8, "filename": "s.png"}] if h == 6 else []} for h in range(6, 24, 2) if h < 22] + \
|
||||
[{"id": 22, "host_id": 1, "host_name": "Nabella", "tiktok_handle": "MainAccount", "broadcast_date": date(2026, 11, 5), "start_time": time(22),
|
||||
"end_time": time(23, 30), "venue": "", "sales_amount": Decimal("500"), "images": []}]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user