update 30/01

This commit is contained in:
2026-01-30 17:09:41 +07:00
parent bf78d0583d
commit eb44cc2575
17 changed files with 6781 additions and 6473 deletions

View File

@@ -1,7 +1,17 @@
'use client';
import { useEffect, useState } from 'react'
export default function ProductSummary({ item }: any) {
const [mounted, setMounted] = useState(false)
useEffect(() => {
setMounted(true)
}, [])
if (!mounted) return null
return (
<div className="mb-3 pd-summary-group">
<p className="leading-6 mb-2 text-16 font-600"> Thông số sản phẩm </p>
@@ -12,33 +22,33 @@ export default function ProductSummary({ item }: any) {
}
function renderSummary(data:any) {
function renderSummary(data: any) {
if (!data) return null;
if (typeof data === 'string' && data.includes('<')) {
if (typeof window === 'undefined') return null;
const parser = new DOMParser();
const doc = parser.parseFromString(data, 'text/html');
const parser = new DOMParser()
const doc = parser.parseFromString(data, 'text/html')
return Array.from(doc.body.childNodes)
.filter(
node =>
node.nodeType === 1 && node.textContent !== null && node.textContent.trim() !== ''
node.nodeType === 1 &&
node.textContent &&
node.textContent.trim() !== ''
)
.map((node, index) => (
<div key={index} className="item-circle">
{node.textContent?.trim()}
{node.textContent!.trim()}
</div>
));
))
}
return data
.split(/\r?\n/)
.filter((line:any) => line.trim() !== '')
.map((line:any, index:any) => (
.filter((line: string) => line.trim() !== '')
.map((line: string, index: number) => (
<div key={index} className="item-circle">
{line.trim()}
</div>
));
))
}