통계 콘텐츠 세션 원장 추가

This commit is contained in:
2026-07-29 14:48:14 +09:00
parent 1a5a1542b7
commit 4e7e12d8fe
15 changed files with 481 additions and 47 deletions

View File

@@ -520,6 +520,28 @@ const getActivePageTitle = (page) => {
return page.path || '알 수 없음'
}
/**
* 접속 페이지의 공개 바로가기 경로를 반환한다.
* @param {Object} page - 접속 페이지
* @returns {string} 공개 경로
*/
const getActivePageHref = (page) => {
if (page.postSlug) {
return `/post/${encodeURIComponent(page.postSlug)}`
}
if (page.pageSlug) {
return `/pages/${encodeURIComponent(page.pageSlug)}`
}
const path = String(page.path || '').trim()
if (path.startsWith('/') && !path.startsWith('/admin')) {
return path
}
return ''
}
/**
* 통계 목록의 날짜를 짧은 문자열로 변환한다.
* @param {string | null | undefined} value - ISO 날짜
@@ -1123,9 +1145,23 @@ watch(trendRows, () => {
</p>
<p
v-if="Number(session.pageCount || 0) <= 1"
class="admin-dashboard__live-path mt-0.5 truncate text-xs text-muted"
class="admin-dashboard__live-path group mt-0.5 flex min-w-0 items-center gap-1 text-xs text-muted"
>
{{ getSessionViewingTitle(session) }}
<span class="min-w-0 truncate">{{ getSessionViewingTitle(session) }}</span>
<a
v-if="getActivePageHref(session)"
:href="getActivePageHref(session)"
target="_blank"
rel="noopener noreferrer"
class="admin-dashboard__live-link grid h-5 w-5 shrink-0 place-items-center rounded border border-line bg-white text-muted opacity-0 transition hover:border-ink hover:text-ink group-hover:opacity-100 focus:opacity-100"
aria-label="현재 페이지 새 창으로 열기"
>
<svg class="h-3.5 w-3.5" viewBox="0 0 24 24" aria-hidden="true">
<path d="M14 5h5v5" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" />
<path d="M10 14 19 5" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" />
<path d="M19 14v4a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V7a2 2 0 0 1 2-2h4" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" />
</svg>
</a>
</p>
<ul
v-if="Number(session.pageCount || 0) > 1"
@@ -1134,9 +1170,23 @@ watch(trendRows, () => {
<li
v-for="page in session.pages"
:key="page.key"
class="admin-dashboard__live-page truncate"
class="admin-dashboard__live-page group flex min-w-0 items-center gap-1"
>
{{ getActivePageTitle(page) }}
<span class="min-w-0 truncate">{{ getActivePageTitle(page) }}</span>
<a
v-if="getActivePageHref(page)"
:href="getActivePageHref(page)"
target="_blank"
rel="noopener noreferrer"
class="admin-dashboard__live-link grid h-5 w-5 shrink-0 place-items-center rounded border border-line bg-white text-muted opacity-0 transition hover:border-ink hover:text-ink group-hover:opacity-100 focus:opacity-100"
aria-label="열린 페이지 새 창으로 열기"
>
<svg class="h-3.5 w-3.5" viewBox="0 0 24 24" aria-hidden="true">
<path d="M14 5h5v5" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" />
<path d="M10 14 19 5" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" />
<path d="M19 14v4a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V7a2 2 0 0 1 2-2h4" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" />
</svg>
</a>
</li>
</ul>
</div>