This commit is contained in:
Sabda Yagra 2025-08-14 10:38:00 +07:00
parent cd7f7aec86
commit 7e1ffe2d2f
1 changed files with 21 additions and 8 deletions

View File

@ -144,17 +144,30 @@ export default function ContentBlast(props: { type: string }) {
const response = await detailMediaSummary(String(id)); const response = await detailMediaSummary(String(id));
const details = response?.data?.data; const details = response?.data?.data;
let pageUrl = details?.pageUrl || ""; let pageUrl = details?.pageUrl || "";
if (process.env.NODE_ENV === "production") { if (pageUrl.includes("mediahub.polri.go.id")) {
pageUrl = pageUrl.replace(/(\.com|\.id)(\/|$)/, "$1/in$2"); pageUrl = pageUrl.replace(
/(\.id)(\/|$)/,
(match: any, p1: any, p2: any) => {
return p2.startsWith("/in") ? match : `${p1}/in${p2}`;
}
);
} }
if (details != undefined) { if (details != undefined) {
form.setValue("thumbnail", details.smallThumbnailLink); form.setValue("thumbnail", details.smallThumbnailLink);
let body = `<div><p>Berita hari ini !!!</p><div style='margin-top:20px;border:1px solid;border-radius:10px;width:500px;background-color:#f7f7f7'><div><img style='width:500px;height:auto;border-radius:10px;object-fit:cover' src='${ let body = `<div><p>Berita hari ini !!!</p>
details?.smallThumbnailLink <div style='margin-top:20px;border:1px solid;border-radius:10px;width:500px;background-color:#f7f7f7'>
}'></div> <a style='padding:5px 20px;margin:0;text-decoration:none' href='${pageUrl}'>${pageUrl}</a><h3 style='padding:5px 20px;margin:0'>${ <div>
details?.title <img style='width:500px;height:auto;border-radius:10px;object-fit:cover' src='${
}</h3><p style='padding:0 20px;margin:0;margin-bottom:10px'> details?.smallThumbnailLink
${textEllipsis(details?.description, 150)}</p></div></div>`; }'>
</div>
<a style='padding:5px 20px;margin:0;text-decoration:none' href='${pageUrl}'>${pageUrl}</a>
<h3 style='padding:5px 20px;margin:0'>${details?.title}</h3>
<p style='padding:0 20px;margin:0;margin-bottom:10px'>
${textEllipsis(details?.description, 150)}
</p>
</div>
</div>`;
form.setValue("title", `${details?.title}`); form.setValue("title", `${details?.title}`);
form.setValue( form.setValue(
"url", "url",