import Header from '@/components/template/Header'
import UserDropdown from '@/components/template/UserDropdown'
import MobileNav from '@/components/template/MobileNav'
import StackedSideNav from '@/components/template/StackedSideNav'
import View from '@/views/Views'
import LanguageSelector from '../template/LanguageSelector'
import {
  DeferredAiAssistant,
  DeferredMessengerWidget,
  DeferredNotification,
  DeferredSearch,
  DeferredSidePanel,
} from '../template/DeferredShellActions'

const HeaderActionsStart = () => {
  return (
    <>
      <MobileNav />
      <DeferredSearch />
    </>
  )
}

const HeaderActionsEnd = () => {
  return (
    <>
      <DeferredAiAssistant />
      <DeferredNotification />
      <DeferredMessengerWidget />
      <LanguageSelector />
      <DeferredSidePanel />
      <UserDropdown hoverable={false} />
    </>
  )
}

const StackedSideLayout = () => {
  return (
    <div className="app-layout-stacked-side flex flex-auto flex-col">
      <div className="flex flex-auto min-w-0">
        <StackedSideNav />
        <div className="flex flex-col flex-auto min-h-screen min-w-0 relative w-full">
          <Header
            container={false}
            className="shadow dark:shadow-2xl"
            headerStart={<HeaderActionsStart />}
            headerEnd={<HeaderActionsEnd />}
          />
          <div className="h-full flex flex-auto flex-col">
            <View />
          </div>
        </div>
      </div>
    </div>
  )
}

export default StackedSideLayout
