import { redirect } from "next/navigation"
import { MailSettingsSectionFromSegments } from "@/components/gmail/settings/mail-settings-section-view"
import { MAIL_SETTINGS_BASE_PATH } from "@/lib/mail-settings/settings-nav"

export default async function SettingsSectionPage({
  params,
}: {
  params: Promise<{ section?: string[] }>
}) {
  const { section } = await params
  if (section?.[0] === "signatures") {
    redirect(`${MAIL_SETTINGS_BASE_PATH}/accounts`)
  }
  return <MailSettingsSectionFromSegments segments={section} />
}
