canina/frontend/application/components/EnamadBadge.tsx
parsaaghayi bd49fbc4a0
Some checks failed
Deploy Canina / deploy (push) Successful in 2m25s
E2E Playwright Tests / Run Full E2E & Security Suites (push) Failing after 7s
fix(security): remediate audit vulnerabilities SEC-001 through SEC-023
2026-09-23 23:00:25 +03:30

39 lines
1.8 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/* eslint-disable @next/next/no-img-element */
'use client';
import React from 'react';
import DOMPurify from 'dompurify';
import { useSettingsStore } from '../lib/store/settingsStore';
const DEFAULT_ENAMAD_HTML = `<a referrerpolicy='origin' target='_blank' href='https://trustseal.enamad.ir/?id=765218&Code=dOdphRTqZwp3Kep5m07XwaqA0DTFh5ny'><img referrerpolicy='origin' src='https://trustseal.enamad.ir/logo.aspx?id=765218&Code=dOdphRTqZwp3Kep5m07XwaqA0DTFh5ny' alt='' style='cursor:pointer' code='dOdphRTqZwp3Kep5m07XwaqA0DTFh5ny'></a>`;
export default function EnamadBadge() {
const getText = useSettingsStore((state) => state.getText);
const enamadHtml = getText('ENAMAD_HTML_CODE', DEFAULT_ENAMAD_HTML);
const cleanEnamadHtml =
typeof window !== 'undefined'
? DOMPurify.sanitize(enamadHtml, {
ALLOWED_TAGS: ['a', 'img'],
ALLOWED_ATTR: ['referrerpolicy', 'target', 'href', 'src', 'alt', 'style', 'code', 'width', 'height'],
})
: enamadHtml;
return (
<div className="relative flex flex-col items-center justify-center p-6 bg-white/90 backdrop-blur-md rounded-2xl border border-gray-100 shadow-sm hover:shadow-md transition-all duration-300">
<div className="text-xs font-semibold text-teal-600 bg-teal-50 px-3 py-1 rounded-full mb-3">
نماد اعتماد الکترونیکی (eNamad)
</div>
<div
className="relative min-w-[120px] min-h-[120px] flex items-center justify-center bg-white rounded-xl overflow-hidden border border-gray-100 p-2"
dangerouslySetInnerHTML={{ __html: cleanEnamadHtml }}
/>
<p className="text-xs text-gray-500 mt-4 text-center leading-relaxed font-medium">
صادر شده توسط مرکز توسعه تجارت الکترونیکی (وزارت صمت)
</p>
</div>
);
}