12/02/2026

This commit is contained in:
2026-02-12 17:14:04 +07:00
parent 2bc93383a0
commit 756cf6410c
35 changed files with 784 additions and 299 deletions

View File

@@ -1,6 +1,7 @@
'use client';
import { useEffect, useState } from 'react'
import { renderSummary } from "@/lib/utils"
export default function ProductSummary({ item }: any) {
const [mounted, setMounted] = useState(false)
@@ -22,33 +23,4 @@ export default function ProductSummary({ item }: any) {
}
function renderSummary(data: any) {
if (!data) return null;
if (typeof data === 'string' && data.includes('<')) {
const parser = new DOMParser()
const doc = parser.parseFromString(data, 'text/html')
return Array.from(doc.body.childNodes)
.filter(
node =>
node.nodeType === 1 &&
node.textContent &&
node.textContent.trim() !== ''
)
.map((node, index) => (
<div key={index} className="item-circle">
{node.textContent!.trim()}
</div>
))
}
return data
.split(/\r?\n/)
.filter((line: string) => line.trim() !== '')
.map((line: string, index: number) => (
<div key={index} className="item-circle">
{line.trim()}
</div>
))
}