import { useState, useEffect } from "react";
import "./index.css";

const Portfolio = () => {
  const [iframeSrc, setIframeSrc] = useState("");

  useEffect(() => {
    // 添加时间戳参数来破坏缓存
    const timestamp = new Date().getTime();
    setIframeSrc(`https://du9uay.github.io/personal-resume-transportation/?t=${timestamp}`);
  }, []);

  const handleRefresh = () => {
    // 手动刷新iframe内容
    const timestamp = new Date().getTime();
    setIframeSrc(`https://du9uay.github.io/personal-resume-transportation/?t=${timestamp}`);
  };

  return (
    <div className="user-portfolio-page">
      {iframeSrc && (
        <iframe
          key={iframeSrc} // 使用key强制重新渲染iframe
          src={iframeSrc}
          style={{
            width: "100%",
            height: "100vh",
            border: "none",
            display: "block"
          }}
          title="个人简历"
        />
      )}
    </div>
  );
};

export default Portfolio;
