diff --git a/apps/blogai/app/[locale]/details/[slug]/page.tsx b/apps/blogai/app/[locale]/details/[slug]/page.tsx index be54b00..68583ea 100644 --- a/apps/blogai/app/[locale]/details/[slug]/page.tsx +++ b/apps/blogai/app/[locale]/details/[slug]/page.tsx @@ -75,64 +75,77 @@ export async function generateMetadata({ params }: Props): Promise { }; } +const BlogArticleWrapper = async ({ params }: { params: { slug: string, locale: string, } }) => { - -const BlogArticleWrapper = async ({ params }: { params: { slug: string, locale: string } }) => { const { serialized, frontmatter, headings } = await getPostContent(params.locale, params.slug); - console.log("..........................frontmatter", frontmatter); + console.log("..........................frontmatter", frontmatter) - const defaultImage = "https://gimg3.baidu.com/search/src=http%3A%2F%2Fpics3.baidu.com%2Ffeed%2F4ec2d5628535e5dd7c7cdc23847e08e2cc1b62c4.jpeg%40f_auto%3Ftoken%3D38327d5cbefb2cd45af58f8d47c0a0b5&refer=http%3A%2F%2Fwww.baidu.com&app=2021&size=f360,240&n=0&g=0n&q=75&fmt=auto?sec=1710435600&t=eafc0a27ff3295bb5b0b9065fc33a523"; + const defaultImage = "https://gimg3.baidu.com/search/src=http%3A%2F%2Fpics3.baidu.com%2Ffeed%2F4ec2d5628535e5dd7c7cdc23847e08e2cc1b62c4.jpeg%40f_auto%3Ftoken%3D38327d5cbefb2cd45af58f8d47c0a0b5&refer=http%3A%2F%2Fwww.baidu.com&app=2021&size=f360,240&n=0&g=0n&q=75&fmt=auto?sec=1710435600&t=eafc0a27ff3295bb5b0b9065fc33a523" - const [detailData, setDetailData] = useState(null); - - // 新增:用来刷新文章组件的部署状态 - const fetchDetailData = async () => { - // 这里可以根据你的后端接口具体来,如果 frontmatter 里有足够信息就不需要 - setDetailData({ - id: frontmatter.id, - icon: frontmatter.logo_url, - name: frontmatter.p_name, - category: frontmatter.tags, - updated_at: frontmatter.date, - company: frontmatter.title, - progress: "0%", - statusText: "", - }); - }; - - useEffect(() => { - fetchDetailData(); - }, [frontmatter]); + // // 请求部署状态 + let statusText = ''; + let progress = '0%'; return ( <> - {detailData && ( - { - console.log("📢 部署完成,刷新 DetailPageHeader 数据!"); - fetchDetailData(); // 🚀 部署完成/删除完成后重新刷新 - }} - /> - )} + {/* */} + -
+
-
-
-
- {frontmatter.title} +
+
+ + {/*
+ + + Blog + +

>

+

{frontmatter.title}

+ +
+ +
+ { + frontmatter.tags && frontmatter.tags?.length > 0 && frontmatter.tags?.map((item, index) => { + return

{item}

+ }) + } +
+ + + +

+ {frontmatter.title} +

*/} + +
+ {frontmatter.title}
@@ -144,99 +157,12 @@ const BlogArticleWrapper = async ({ params }: { params: { slug: string, locale:
+ ); + + }; - -// const BlogArticleWrapper = async ({ params }: { params: { slug: string, locale: string, } }) => { - -// const { serialized, frontmatter, headings } = await getPostContent(params.locale, params.slug); - -// console.log("..........................frontmatter", frontmatter) - -// const defaultImage = "https://gimg3.baidu.com/search/src=http%3A%2F%2Fpics3.baidu.com%2Ffeed%2F4ec2d5628535e5dd7c7cdc23847e08e2cc1b62c4.jpeg%40f_auto%3Ftoken%3D38327d5cbefb2cd45af58f8d47c0a0b5&refer=http%3A%2F%2Fwww.baidu.com&app=2021&size=f360,240&n=0&g=0n&q=75&fmt=auto?sec=1710435600&t=eafc0a27ff3295bb5b0b9065fc33a523" - - -// // // 请求部署状态 -// let statusText = ''; -// let progress = '0%'; -// return ( -// <> -// {/* */} -// - -//
-// -//
-//
- -// {/*
- -// -// Blog -// -//

>

-//

{frontmatter.title}

- -//
- -//
-// { -// frontmatter.tags && frontmatter.tags?.length > 0 && frontmatter.tags?.map((item, index) => { -// return

{item}

-// }) -// } -//
- -// - -//

-// {frontmatter.title} -//

*/} - -//
-// {frontmatter.title} -//
- -//
-// -//
-//
- -//
-//
-//
-//
- -// -// ); - - -// }; - export default BlogArticleWrapper; diff --git a/apps/blogai/components/header.tsx b/apps/blogai/components/header.tsx index 5910bc8..b3e29bc 100644 --- a/apps/blogai/components/header.tsx +++ b/apps/blogai/components/header.tsx @@ -403,7 +403,7 @@ export function Header() { -export function DetailPageHeader({ data, onStatusChange }: { data: any; onStatusChange?:() => void }) { +export function DetailPageHeader({ data }: { data: any }) { const [loading, setLoading] = useState(false); const [statusText, setStatusText] = useState(data?.statusText || "加载中..."); const [progress, setProgress] = useState(data?.progress || "0%"); @@ -433,10 +433,11 @@ export function DetailPageHeader({ data, onStatusChange }: { data: any; onStatus setProgress(match[1] + "%"); if (match[1] === "100") { - console.log("部署完成 ✅,触发 onStatusChange"); - onStatusChange?.(); // ✅ 部署完成,通知父组件刷新 + setStatusText("运行中"); + setProgressBarColor("bg-green-500"); + setShowDelete(true); // 部署完成允许删除 } - + } setProgressBarColor("bg-blue-500"); // 保持默认颜色 @@ -539,7 +540,6 @@ export function DetailPageHeader({ data, onStatusChange }: { data: any; onStatus setStatusText("删除成功"); setProgress("0%"); setShowDelete(false); // 删除成功后隐藏按钮 - onStatusChange?.(); } else { setStatusText(json?.header?.message || "删除失败(后端返回错误)"); }