feat(core): polish codebase, enhance error handling, security hardening, rate limiting, and a11y compliance
Deploy Canina / deploy (push) Successful in 1m43s

This commit is contained in:
parsa aghaei committed 2026-08-25 11:33:37 +03:30
1 parent 70c2627d93
commit 7b89e141c5
17 files changed
+237 -17

No files matched your search

+17
View File
@@ -0,0 +1,17 @@
"use client";
import React, { useEffect } from "react";
import { ServerErrorPage } from "../../components/ErrorPages";
export default function B2BErrorBoundary({
error,
reset,
}: {
error: Error & { digest?: string };
reset: () => void;
}) {
useEffect(() => {
console.error("B2B Route Error:", error);
}, [error]);
return <ServerErrorPage onRetry={reset} />;
}
+17
View File
@@ -0,0 +1,17 @@
"use client";
import React, { useEffect } from "react";
import { ServerErrorPage } from "../../components/ErrorPages";
export default function BlogErrorBoundary({
error,
reset,
}: {
error: Error & { digest?: string };
reset: () => void;
}) {
useEffect(() => {
console.error("Blog Route Error:", error);
}, [error]);
return <ServerErrorPage onRetry={reset} />;
}
+31
View File
@@ -0,0 +1,31 @@
import React from "react";
import { Skeleton } from "../../components/Skeleton";
export default function BlogLoading() {
return (
<div className="min-h-screen bg-slate-50/50 py-10 px-4 font-vazir" dir="rtl">
<div className="max-w-7xl mx-auto space-y-8">
<div className="text-center space-y-3 max-w-xl mx-auto">
<Skeleton className="w-48 h-8 rounded-full mx-auto" />
<Skeleton className="w-72 h-10 rounded-2xl mx-auto" />
<Skeleton className="w-96 h-5 rounded-xl mx-auto" />
</div>
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
{Array.from({ length: 6 }).map((_, i) => (
<div key={i} className="bg-white rounded-3xl p-5 border border-slate-100 space-y-4 shadow-sm">
<Skeleton className="w-full h-48 rounded-2xl" />
<div className="flex gap-2">
<Skeleton className="w-16 h-6 rounded-full" />
<Skeleton className="w-20 h-6 rounded-full" />
</div>
<Skeleton className="w-3/4 h-6 rounded-lg" />
<Skeleton className="w-full h-4 rounded-lg" />
<Skeleton className="w-2/3 h-4 rounded-lg" />
</div>
))}
</div>
</div>
</div>
);
}
+17
View File
@@ -0,0 +1,17 @@
"use client";
import React, { useEffect } from "react";
import { ServerErrorPage } from "../../components/ErrorPages";
export default function ShopErrorBoundary({
error,
reset,
}: {
error: Error & { digest?: string };
reset: () => void;
}) {
useEffect(() => {
console.error("Shop Route Error:", error);
}, [error]);
return <ServerErrorPage onRetry={reset} />;
}
+38
View File
@@ -0,0 +1,38 @@
import React from "react";
import { Skeleton } from "../../components/Skeleton";
export default function ShopLoading() {
return (
<div className="min-h-screen bg-slate-50/50 py-10 px-4 font-vazir" dir="rtl">
<div className="max-w-7xl mx-auto space-y-8">
{/* Banner Skeleton */}
<div className="w-full h-44 rounded-3xl bg-slate-200 animate-pulse" />
{/* Filters & Search Row */}
<div className="flex flex-wrap gap-4 items-center justify-between">
<Skeleton className="w-48 h-12 rounded-2xl" />
<div className="flex gap-2">
<Skeleton className="w-24 h-10 rounded-xl" />
<Skeleton className="w-24 h-10 rounded-xl" />
<Skeleton className="w-24 h-10 rounded-xl" />
</div>
</div>
{/* Product Cards Grid */}
<div className="grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-6">
{Array.from({ length: 8 }).map((_, i) => (
<div key={i} className="bg-white rounded-3xl p-5 border border-slate-100 space-y-4 shadow-sm">
<Skeleton className="w-full aspect-square rounded-2xl" />
<Skeleton className="w-3/4 h-5 rounded-lg" />
<Skeleton className="w-1/2 h-4 rounded-lg" />
<div className="flex items-center justify-between pt-4 border-t border-slate-100">
<Skeleton className="w-24 h-6 rounded-lg" />
<Skeleton className="w-10 h-10 rounded-xl" />
</div>
</div>
))}
</div>
</div>
</div>
);
}
@@ -247,10 +247,11 @@ export default function B2BLandingClient() {
<form onSubmit={handleSubmit} className="space-y-4">
<div className="grid sm:grid-cols-2 gap-4">
<div>
<label className="block text-xs font-bold text-medical-gray-700 mb-1.5">
<label htmlFor="b2b-businessName" className="block text-xs font-bold text-medical-gray-700 mb-1.5">
نام مجموعه / داروخانه / کلینیک <span className="text-red-500">*</span>
</label>
<input
id="b2b-businessName"
type="text"
required
placeholder="مثلاً کلینیک تخصصی دکتر البرزی"
@@ -261,10 +262,11 @@ export default function B2BLandingClient() {
</div>
<div>
<label className="block text-xs font-bold text-medical-gray-700 mb-1.5">
<label htmlFor="b2b-businessType" className="block text-xs font-bold text-medical-gray-700 mb-1.5">
نوع فعالیت <span className="text-red-500">*</span>
</label>
<select
id="b2b-businessType"
value={formData.businessType}
onChange={(e) => setFormData({ ...formData, businessType: e.target.value })}
className="w-full bg-medical-gray-50 border border-medical-gray-200 rounded-2xl px-4 py-3 text-sm text-medical-gray-900 focus:bg-white focus:border-canina-blue focus:ring-4 focus:ring-canina-blue/10 outline-none transition-all"
@@ -280,10 +282,11 @@ export default function B2BLandingClient() {
<div className="grid sm:grid-cols-3 gap-4">
<div>
<label className="block text-xs font-bold text-medical-gray-700 mb-1.5">
<label htmlFor="b2b-contactName" className="block text-xs font-bold text-medical-gray-700 mb-1.5">
نام رابط / مسئول خرید
</label>
<input
id="b2b-contactName"
type="text"
placeholder="نام و نام خانوادگی"
value={formData.contactName}
@@ -293,10 +296,11 @@ export default function B2BLandingClient() {
</div>
<div>
<label className="block text-xs font-bold text-medical-gray-700 mb-1.5">
<label htmlFor="b2b-phone" className="block text-xs font-bold text-medical-gray-700 mb-1.5">
شماره تماس همراه <span className="text-red-500">*</span>
</label>
<input
id="b2b-phone"
type="tel"
required
placeholder="۰۹۱۲۳۴۵۶۷۸۹"
@@ -307,10 +311,11 @@ export default function B2BLandingClient() {
</div>
<div>
<label className="block text-xs font-bold text-medical-gray-700 mb-1.5">
<label htmlFor="b2b-city" className="block text-xs font-bold text-medical-gray-700 mb-1.5">
شهر / استان
</label>
<input
id="b2b-city"
type="text"
placeholder="مثلاً تهران / اصفهان"
value={formData.city}
@@ -321,10 +326,11 @@ export default function B2BLandingClient() {
</div>
<div>
<label className="block text-xs font-bold text-medical-gray-700 mb-1.5">
<label htmlFor="b2b-notes" className="block text-xs font-bold text-medical-gray-700 mb-1.5">
توضیحات تکمیلی یا اقلام مدنظر (اختیاری)
</label>
<textarea
id="b2b-notes"
rows={3}
placeholder="در صورت داشتن نیاز دارویی خاص یا حجم تخمینی سفارش، در اینجا درج فرمایید..."
value={formData.notes}
@@ -189,10 +189,11 @@ export default function ContactFormClient() {
<div className="grid md:grid-cols-2 gap-6">
<div className="space-y-2">
<label className="text-xs font-black text-medical-gray-500">
<label htmlFor="contact-name" className="text-xs font-black text-medical-gray-500">
نام و نام خانوادگی *
</label>
<input
id="contact-name"
type="text"
value={name}
onChange={(e) => setName(e.target.value)}
@@ -202,8 +203,9 @@ export default function ContactFormClient() {
/>
</div>
<div className="space-y-2">
<label className="text-xs font-black text-medical-gray-500">شماره موبایل *</label>
<label htmlFor="contact-phone" className="text-xs font-black text-medical-gray-500">شماره موبایل *</label>
<input
id="contact-phone"
type="text"
value={phone}
onChange={(e) => setPhone(e.target.value)}
@@ -216,8 +218,9 @@ export default function ContactFormClient() {
</div>
<div className="space-y-2">
<label className="text-xs font-black text-medical-gray-500">موضوع پیام</label>
<label htmlFor="contact-subject" className="text-xs font-black text-medical-gray-500">موضوع پیام</label>
<input
id="contact-subject"
type="text"
value={subject}
onChange={(e) => setSubject(e.target.value)}
@@ -227,8 +230,9 @@ export default function ContactFormClient() {
</div>
<div className="space-y-2">
<label className="text-xs font-black text-medical-gray-500">متن پیام *</label>
<label htmlFor="contact-message" className="text-xs font-black text-medical-gray-500">متن پیام *</label>
<textarea
id="contact-message"
rows={4}
value={message}
onChange={(e) => setMessage(e.target.value)}