fix post generate

This commit is contained in:
2026-01-15 19:46:01 +09:00
parent 162072d980
commit 9980e596ca
13 changed files with 1834 additions and 120 deletions

View File

@@ -41,13 +41,25 @@ export function mountHeader(
currentHandle: string,
isLoggedIn: boolean,
userHandle: string | undefined,
callbacks: HeaderCallbacks
callbacks: HeaderCallbacks,
isStatic: boolean = false
): void {
container.innerHTML = renderHeader(currentHandle, isLoggedIn, userHandle)
// For static pages, only update if login state requires it
const existingLoginBtn = container.querySelector('#login-btn')
const existingUserBtn = container.querySelector('#user-btn')
const needsUpdate = !isStatic ||
(isLoggedIn && existingLoginBtn) || // Need to show user button
(!isLoggedIn && existingUserBtn) // Need to show login button
if (needsUpdate) {
container.innerHTML = renderHeader(currentHandle, isLoggedIn, userHandle)
}
const form = document.getElementById('header-form') as HTMLFormElement
const input = document.getElementById('header-input') as HTMLInputElement
if (!form) return
form.addEventListener('submit', (e) => {
e.preventDefault()
const handle = input.value.trim()