added quartz external wiki
This commit is contained in:
@@ -3,13 +3,19 @@
|
||||
import { motion } from 'framer-motion'
|
||||
import Navigation from '@/components/Navigation'
|
||||
import Footer from '@/components/Footer'
|
||||
import { useState } from 'react'
|
||||
import { useState, useEffect } from 'react'
|
||||
|
||||
export default function Wiki() {
|
||||
const [showFullPage, setShowFullPage] = useState(true)
|
||||
const [iframeError, setIframeError] = useState(false)
|
||||
|
||||
// Wiki URL über den Next.js API Proxy
|
||||
const wikiUrl = '/api/wiki'
|
||||
// Wiki URL - konfigurierbar über Umgebungsvariable, Standard: localhost:3033
|
||||
const wikiUrl = process.env.NEXT_PUBLIC_WIKI_URL || 'http://localhost:3033'
|
||||
|
||||
useEffect(() => {
|
||||
// Reset error when URL changes
|
||||
setIframeError(false)
|
||||
}, [wikiUrl])
|
||||
|
||||
if (showFullPage) {
|
||||
// Vollständige Wiki-Seite als iframe
|
||||
@@ -39,17 +45,59 @@ export default function Wiki() {
|
||||
Zur Übersicht
|
||||
</button>
|
||||
</div>
|
||||
<iframe
|
||||
src={wikiUrl}
|
||||
style={{
|
||||
width: '100%',
|
||||
{iframeError ? (
|
||||
<div style={{
|
||||
display: 'flex',
|
||||
flexDirection: 'column',
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
height: '100%',
|
||||
border: 'none',
|
||||
padding: '40px',
|
||||
marginTop: '50px',
|
||||
background: '#fff'
|
||||
}}
|
||||
title="doing-it Wiki"
|
||||
/>
|
||||
textAlign: 'center'
|
||||
}}>
|
||||
<h2 style={{ fontSize: '24px', fontWeight: '600', marginBottom: '20px' }}>
|
||||
Wiki konnte nicht geladen werden
|
||||
</h2>
|
||||
<p style={{ color: 'var(--color-text-secondary)', marginBottom: '30px' }}>
|
||||
Bitte versuchen Sie es später erneut oder kontaktieren Sie den Support.
|
||||
</p>
|
||||
<button
|
||||
onClick={() => {
|
||||
setIframeError(false)
|
||||
window.location.reload()
|
||||
}}
|
||||
className="btn btn-primary"
|
||||
>
|
||||
Seite neu laden
|
||||
</button>
|
||||
</div>
|
||||
) : (
|
||||
<iframe
|
||||
src={wikiUrl}
|
||||
style={{
|
||||
width: '100%',
|
||||
height: '100%',
|
||||
border: 'none',
|
||||
marginTop: '50px',
|
||||
background: '#fff'
|
||||
}}
|
||||
title="doing-it Wiki"
|
||||
onError={() => setIframeError(true)}
|
||||
onLoad={(e) => {
|
||||
// Check if iframe loaded successfully
|
||||
try {
|
||||
const iframe = e.target as HTMLIFrameElement
|
||||
if (iframe.contentDocument?.location.href === 'about:blank') {
|
||||
// Iframe might have error
|
||||
setTimeout(() => setIframeError(true), 3000)
|
||||
}
|
||||
} catch (err) {
|
||||
// Cross-origin - can't check, assume it's working
|
||||
}
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
</main>
|
||||
</>
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user