import { PreloadPickOrder } from "@/app/api/pickOrder";
import PickOrderSearch from "@/components/PickOrderSearch";
import { getServerI18n } from "@/i18n";
import { I18nProvider } from "@/i18n";
import { Stack, Typography } from "@mui/material";
import { Metadata } from "next";
import { Suspense } from "react";

export const metadata: Metadata = {
    title: "Pick Order"
}

const PickOrder: React.FC = async () => {
    const { t } = await getServerI18n("pickOrder")

    PreloadPickOrder()

    return (
        <>
            <Stack
                direction={"row"}
                justifyContent={"space-between"}
                flexWrap={"wrap"}
                rowGap={2}
            >
                <Typography variant="h4" marginInlineEnd={2}>
                    {t("Pick Order")}
                </Typography>
            </Stack>
            <I18nProvider namespaces={["pickOrder", "common"]}>
                <Suspense fallback={<PickOrderSearch.Loading />}>
                    <PickOrderSearch />
                </Suspense>
            </I18nProvider>
        </>
    )
}

export default PickOrder;