import ProHeader from "components/ProHeader/ProHeader";
import { useTranslation } from "react-i18next";
import { useParams } from "react-router-dom";
import OrdersList from "./OrdersList";
import OrderDetails from "./OrderDetails";

export default function OrdersPage() {
  const { t } = useTranslation();
  const { orderId } = useParams();

  return (
    <>
      {orderId ? (
        <OrderDetails orderId={orderId} />
      ) : (
        <>
          <ProHeader>{t("orders.title")}</ProHeader>
          <OrdersList />
        </>
      )}
    </>
  );
}
