import { AppSidebar } from "@repo/rdx-ui/components/layout/app-sidebar";
import { ChartAreaInteractive } from "@repo/rdx-ui/components/layout/chart-area-interactive";
import { SiteHeader } from "@repo/rdx-ui/components/layout/site-header";
import { SidebarInset, SidebarProvider } from "@repo/shadcn-ui/components";
import { PropsWithChildren } from "react";

import { SectionCards } from "@repo/rdx-ui/components/layout/section-cards";
import { useTranslation } from "react-i18next";

export const InvoicesLayout = ({ children }: PropsWithChildren) => {
  const { t } = useTranslation("invoices");

  return (
    <SidebarProvider
      style={
        {
          "--sidebar-width": "calc(var(--spacing) * 72)",
          "--header-height": "calc(var(--spacing) * 12)",
        } as React.CSSProperties
      }
    >
      <AppSidebar variant='inset' />
      <SidebarInset>
        <SiteHeader title={t("invoices.title")} />
        <div className='flex flex-1 flex-col'>
          <div className='@container/main flex flex-1 flex-col gap-2'>
            <div className='flex flex-col gap-4 py-4 md:gap-6 md:py-6'>
              <SectionCards />
              <div className='px-4 lg:px-6'>
                <ChartAreaInteractive />
              </div>
              {children}
            </div>
          </div>
        </div>
      </SidebarInset>
    </SidebarProvider>
  );
};
