2026-02-24 20:44:16 +00:00
|
|
|
import View from '@/views/Views'
|
2026-09-09 06:06:25 +00:00
|
|
|
import { useEffect, useState } from 'react'
|
|
|
|
|
import { useLocation } from 'react-router-dom'
|
2026-02-24 20:44:16 +00:00
|
|
|
import Demo from '@/views/public/Demo'
|
2026-06-29 07:13:58 +00:00
|
|
|
import { DemoProvider } from '@/contexts/DemoContext'
|
2026-09-09 06:06:25 +00:00
|
|
|
import { PUBLIC_FOOTER_COMPONENT, PUBLIC_HEADER_COMPONENT } from '@/utils/hooks/usePublicMenu'
|
|
|
|
|
import { useComponents } from '@/contexts/ComponentContext'
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Public site kabugu. Ust ve alt bilgi birer Custom Component'tir: tasarimlari
|
|
|
|
|
* Visual Designer'dan duzenlenir, icerikleri kendi dugum agaclarinda yasar.
|
|
|
|
|
* Burada yalnizca rota degisiminde basa sarma ve demo penceresi kalir.
|
|
|
|
|
*/
|
2026-02-24 20:44:16 +00:00
|
|
|
const PublicLayout = () => {
|
|
|
|
|
const location = useLocation()
|
|
|
|
|
const [isDemoOpen, setIsDemoOpen] = useState(false)
|
2026-09-09 06:06:25 +00:00
|
|
|
const { isComponentRegistered, renderComponent } = useComponents()
|
2026-02-24 20:44:16 +00:00
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
|
window.scrollTo(0, 0)
|
|
|
|
|
}, [location.pathname])
|
|
|
|
|
|
|
|
|
|
return (
|
2026-06-29 07:13:58 +00:00
|
|
|
<DemoProvider value={{ openDemo: () => setIsDemoOpen(true) }}>
|
2026-09-09 06:06:25 +00:00
|
|
|
<div className="flex min-h-screen flex-col overflow-x-hidden">
|
|
|
|
|
{isComponentRegistered(PUBLIC_HEADER_COMPONENT) &&
|
|
|
|
|
renderComponent(PUBLIC_HEADER_COMPONENT)}
|
2026-08-14 11:32:31 +00:00
|
|
|
|
2026-09-09 06:06:25 +00:00
|
|
|
<main className="flex-grow">
|
|
|
|
|
<View />
|
|
|
|
|
</main>
|
2026-08-14 11:32:31 +00:00
|
|
|
|
2026-09-09 06:06:25 +00:00
|
|
|
{isComponentRegistered(PUBLIC_FOOTER_COMPONENT) && renderComponent(PUBLIC_FOOTER_COMPONENT)}
|
2026-02-24 20:44:16 +00:00
|
|
|
|
2026-09-09 06:06:25 +00:00
|
|
|
<Demo isOpen={isDemoOpen} onClose={() => setIsDemoOpen(false)} />
|
|
|
|
|
</div>
|
2026-06-29 07:13:58 +00:00
|
|
|
</DemoProvider>
|
2026-02-24 20:44:16 +00:00
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export default PublicLayout
|