From 300b35190d6dabe4a98f31d2d54caf63fa0ede7c Mon Sep 17 00:00:00 2001 From: bokhonglo Date: Sat, 18 Apr 2026 18:02:21 +0700 Subject: [PATCH] update --- .../(forms)/role-upgrade/page.tsx | 68 ++++++++-- .../(tables)/applications-tables/page.tsx | 3 +- .../(tables)/user-table/page.tsx | 2 +- .../profile/applications/page.tsx | 103 +++++++++++--- .../(admin)/(others-pages)/profile/page.tsx | 3 +- src/components/auth/SignUpForm.tsx | 3 +- .../tables/ApplicationDetailModal.tsx | 128 ++++++++++++++---- src/components/tables/Pagination.tsx | 2 +- src/components/ui/IsolatedContent.tsx | 41 ++++++ .../user-profile/ApplicationList.tsx | 87 +++++++++--- src/components/user-profile/UserInfoCard.tsx | 12 +- src/components/user-profile/UserMetaCard.tsx | 87 +++++++++--- src/service/adminService.ts | 1 - src/service/userService.ts | 6 +- 14 files changed, 439 insertions(+), 107 deletions(-) create mode 100644 src/components/ui/IsolatedContent.tsx diff --git a/src/app/(admin)/(others-pages)/(forms)/role-upgrade/page.tsx b/src/app/(admin)/(others-pages)/(forms)/role-upgrade/page.tsx index 10f8b74..f299f93 100644 --- a/src/app/(admin)/(others-pages)/(forms)/role-upgrade/page.tsx +++ b/src/app/(admin)/(others-pages)/(forms)/role-upgrade/page.tsx @@ -7,7 +7,7 @@ import { getPresignedUrl, uploadFileToS3, } from "@/service/mediaService"; -import React, { useState } from "react"; +import React, { useRef, useState } from "react"; import Image from "next/image"; import Lightbox from "yet-another-react-lightbox"; import Zoom from "yet-another-react-lightbox/plugins/zoom"; @@ -37,6 +37,37 @@ export default function RoleUpgrade() { const [lightboxIndex, setLightboxIndex] = useState(-1); const [isPreparingFiles, setIsPreparingFiles] = useState(false); const [showPreview, setShowPreview] = useState(false); + const iframeRef = useRef(null); + + const handleIframeLoad = () => { + const iframe = iframeRef.current; + // Đảm bảo iframe và nội dung bên trong đã sẵn sàng và cùng nguồn gốc (same-origin) + if (!iframe || !iframe.contentDocument) return; + + const updateHeight = () => { + if (iframe.contentDocument) { + // Mẹo: Reset height về 'auto' trước để lấy được chiều cao thực tế + // (đặc biệt khi người dùng xóa bớt nội dung làm chiều cao ngắn lại) + iframe.style.height = "auto"; + const scrollHeight = + iframe.contentDocument.documentElement.scrollHeight; + iframe.style.height = `${scrollHeight}px`; + } + }; + + // 1. Cập nhật chiều cao ngay khi iframe load xong HTML + updateHeight(); + + // 2. Dùng ResizeObserver để theo dõi những thay đổi sau khi load + // (VD: ảnh bên trong tải xong làm nội dung dài ra) + const resizeObserver = new ResizeObserver(() => { + updateHeight(); + }); + + if (iframe.contentDocument.body) { + resizeObserver.observe(iframe.contentDocument.body); + } + }; const cleanHTMLContent = (rawHtml: string) => { if (!rawHtml) return ""; @@ -198,13 +229,34 @@ export default function RoleUpgrade() { ) : (
{content ? ( -
-
-
+