story-research-zapwall/pages/presentation.tsx
Nicolas Cantu 2a191f35f4 Fix all TypeScript errors and warnings
- Fix unused function warnings by renaming to _unusedExtractTags
- Fix type errors in nostrTagSystem.ts for includes() calls
- Fix type errors in reviews.ts for filter kinds array
- Fix ArrayBuffer type errors in articleEncryption.ts
- Remove unused imports (DecryptionKey, decryptArticleContent, extractTagsFromEvent)
- All TypeScript checks now pass without disabling any controls
2025-12-27 22:26:13 +01:00

69 lines
2.1 KiB
TypeScript

import { useEffect, useCallback } from 'react'
import { useRouter } from 'next/router'
import Head from 'next/head'
import { ConnectButton } from '@/components/ConnectButton'
import { AuthorPresentationEditor } from '@/components/AuthorPresentationEditor'
import { useNostrConnect } from '@/hooks/useNostrConnect'
import { useAuthorPresentation } from '@/hooks/useAuthorPresentation'
import { t } from '@/lib/i18n'
function usePresentationRedirect(connected: boolean, pubkey: string | null) {
const router = useRouter()
const { checkPresentationExists } = useAuthorPresentation(pubkey ?? null)
const redirectIfExists = useCallback(async () => {
if (!connected || !pubkey) {
return
}
const presentation = await checkPresentationExists()
if (presentation) {
await router.push('/')
}
}, [checkPresentationExists, connected, pubkey, router])
useEffect(() => {
void redirectIfExists()
}, [redirectIfExists])
}
function PresentationLayout() {
return (
<>
<Head>
<title>{t('presentation.title')} - {t('home.title')}</title>
<meta
name="description"
content={t('presentation.description')}
/>
<meta name="viewport" content="width=device-width, initial-scale=1" />
</Head>
<main className="min-h-screen bg-gray-50">
<header className="bg-white shadow-sm">
<div className="max-w-4xl mx-auto px-4 py-4 flex justify-between items-center">
<h1 className="text-2xl font-bold text-gray-900">zapwall.fr</h1>
<ConnectButton />
</div>
</header>
<div className="max-w-4xl mx-auto px-4 py-8">
<div className="mb-6">
<h2 className="text-3xl font-bold">{t('presentation.title')}</h2>
<p className="text-gray-600 mt-2">
{t('presentation.description')}
</p>
</div>
<AuthorPresentationEditor />
</div>
</main>
</>
)
}
export default function PresentationPage() {
const { connected, pubkey } = useNostrConnect()
usePresentationRedirect(connected, pubkey)
return <PresentationLayout />
}