import React from "react";
import { useWordpressCustomData } from "../services/WordpressFetchData";
import { useUser } from "../hooks/useUser";
import Loading from "../components/animations/Loading";
import AnimatedPage from "../components/AnimatedPage";
import Nav from "../components/ui/Nav";
import Footer from "../components/ui/Footer";

export default function Confidentiality() {
	const pageDatas = useWordpressCustomData(`/page/174`);
	const { screensTranslations } = useUser();

	if (!pageDatas) return <Loading />;

	const uiTranslations = screensTranslations.ui;

	const dateObject = new Date(pageDatas.post_date);
	const formattedPostDate = dateObject.toLocaleDateString("fr-FR", {
		year: "numeric",
		month: "2-digit",
		day: "2-digit",
	});
	return (
		<AnimatedPage className='page-container page-container--cookies  '>
			<div className='content-page '>
				<Nav />

				<div className='editor_inner_content'>
					<div className='page-title'>
						<h1 className='page-title__title'>{pageDatas.post_title}</h1>
						<p className='page-title__last-update'>
							{uiTranslations?.last_update} {" : "} {formattedPostDate}
						</p>
					</div>
					<div
						className='editor_inner_content__wp-content'
						dangerouslySetInnerHTML={{ __html: pageDatas.post_content }}
					/>
					<Footer />
				</div>
			</div>
		</AnimatedPage>
	);
}
