fix: cleanup book reviews HTML and improve about layout
Some checks failed
Dev Deployment (Zero Downtime) / deploy-dev (push) Has been cancelled

Stripped HTML tags from book reviews, added a grid layout for About section on desktop, and fixed hobby icon mapping.
This commit is contained in:
2026-02-16 00:42:57 +01:00
parent 931843a5c6
commit 0b1a45038d
4 changed files with 71 additions and 56 deletions

View File

@@ -35,6 +35,12 @@ const StarRating = ({ rating }: { rating: number }) => {
);
};
const stripHtml = (html: string) => {
if (typeof window === 'undefined') return html; // Fallback for SSR
const doc = new DOMParser().parseFromString(html, 'text/html');
return doc.body.textContent || "";
};
const ReadBooks = () => {
const locale = useLocale();
const t = useTranslations("home.about.readBooks");
@@ -75,8 +81,12 @@ const ReadBooks = () => {
fetchReviews();
}, [locale]);
if (loading || reviews.length === 0) {
return null;
if (loading) {
return <div className="text-stone-400 text-sm animate-pulse">Lade Buch-Bewertungen...</div>;
}
if (reviews.length === 0) {
return null; // Hier kannst du temporär "Keine Bücher gefunden" reinschreiben zum Testen
}
const visibleReviews = expanded ? reviews : reviews.slice(0, INITIAL_SHOW);
@@ -169,7 +179,7 @@ const ReadBooks = () => {
{/* Review Text (Optional) */}
{review.review && (
<p className="text-sm text-stone-700 dark:text-stone-300 leading-relaxed line-clamp-3 italic">
&ldquo;{review.review}&rdquo;
&ldquo;{stripHtml(review.review)}&rdquo;
</p>
)}