"use client";
import React, { useEffect, useState } from 'react';

export function SoundInitializer({ children }) {
  const [isReady, setIsReady] = useState(false);
  const [error, setError] = useState(null);

  useEffect(() => {
    const initializeSounds = async () => {
      try {
        // Simulate sound initialization
        setIsReady(true);
      } catch (err) {
        setError(err.message || 'Failed to initialize sounds');
      }
    };
    initializeSounds();
  }, []);

  if (error) {
    return <div className="error-container"><p>Error: {error}</p></div>;
  }

  if (!isReady) {
    return <div className="loading-container"><p>Loading sounds...</p></div>;
  }

  return <>{children}</>;
}
