"use client";

import { useState, useEffect } from "react";
import { DashboardLayout } from "@/components/layouts/DashboardLayout";
import { WebsiteSettings } from "@/components/dashboard/WebsiteSettings";

export default function WebsiteSettingsPage(props: any) {
  const [id, setId] = useState<string | null>(null);

  useEffect(() => {
    const resolveParams = async () => {
      try {
        const params = await Promise.resolve(props?.params);
        setId(params?.id || null);
      } catch (error) {
        console.error("Failed to resolve params:", error);
      }
    };
    resolveParams();
  }, [props?.params]);

  return (
    <DashboardLayout>
      {id ? <WebsiteSettings websiteId={id} /> : <div>Loading...</div>}
    </DashboardLayout>
  );
}
