From 15700036e5d0d4f2cc2cd09b7ce25779c60616d8 Mon Sep 17 00:00:00 2001 From: streaper2 Date: Sun, 10 May 2026 14:30:38 +0200 Subject: [PATCH] feat: add floating social share buttons and restore text justification --- app/blog/[id]/page.tsx | 69 +++++++++++++++++++------------ app/globals.css | 34 +++++++++------ check_db.cjs | 31 ++++++++++++++ components/BlogShareButtons.tsx | 73 +++++++++++++++++++++++++++++++++ lib/sanitize.ts | 6 ++- 5 files changed, 174 insertions(+), 39 deletions(-) create mode 100644 check_db.cjs create mode 100644 components/BlogShareButtons.tsx diff --git a/app/blog/[id]/page.tsx b/app/blog/[id]/page.tsx index 5a29697..34c927c 100644 --- a/app/blog/[id]/page.tsx +++ b/app/blog/[id]/page.tsx @@ -4,25 +4,41 @@ import { notFound } from 'next/navigation'; import { ArrowLeft, User, Calendar, Share2 } from 'lucide-react'; import { sanitizeHTML } from '../../../lib/sanitize'; import { prisma } from '../../../lib/prisma'; - +import BlogShareButtons from '../../../components/BlogShareButtons'; import { Metadata } from 'next'; interface Props { params: Promise<{ id: string }>; } +// Style spécifique pour empêcher strictement la coupure des mots tout en justifiant le texte +const noBreakStyle = ` + #blog-content, + #blog-content p, + #blog-content li, + #blog-content span, + #blog-content strong { + word-break: normal !important; + overflow-wrap: break-word !important; + hyphens: none !important; + line-break: normal !important; + text-align: justify !important; + text-justify: inter-word !important; + } + + /* Sécurité supplémentaire pour les navigateurs mobiles */ + .prose * { + word-break: normal !important; + hyphens: none !important; + } +`; + export async function generateMetadata({ params }: Props): Promise { const { id } = await params; - const post = await prisma.blogPost.findFirst({ where: { - OR: [ - { id: id }, - { slug: id } - ], - publishedAt: { - lte: new Date() - }, + OR: [{ id: id }, { slug: id }], + publishedAt: { lte: new Date() }, status: 'PUBLISHED' } }); @@ -44,16 +60,10 @@ export async function generateMetadata({ params }: Props): Promise { export default async function BlogPostPage({ params }: Props) { const { id } = await params; - const post = await prisma.blogPost.findFirst({ where: { - OR: [ - { id: id }, - { slug: id } - ], - publishedAt: { - lte: new Date() - }, + OR: [{ id: id }, { slug: id }], + publishedAt: { lte: new Date() }, status: 'PUBLISHED' } }); @@ -63,7 +73,11 @@ export default async function BlogPostPage({ params }: Props) { } return ( -
+
+ {/* Injection du style de force pour le texte */} +