import { use } from 'react';

import { SiteFooter } from '~/(marketing)/_components/site-footer';
import { SiteHeader } from '~/(marketing)/_components/site-header';
import { withI18n } from '~/lib/i18n/with-i18n';

import { loadUserWorkspace } from '../home/(user)/_lib/server/load-user-workspace';

function SiteLayout(props: React.PropsWithChildren) {
  const workspace = use(loadUserWorkspace());

  return (
    <div className={'flex min-h-[100vh] flex-col'}>
      <SiteHeader accounts={workspace.accounts} />

      {props.children}

      <SiteFooter />
    </div>
  );
}

export default withI18n(SiteLayout);
