fix(admin): resolve TypeScript errors and unused variables in SmsSettingsPage
Some checks failed
Deploy Canina / deploy (push) Successful in 32s
E2E Playwright Tests / Run Full E2E & Security Suites (push) Failing after 0s

This commit is contained in:
parsa aghaei 2026-09-05 15:40:03 +03:30
parent 29f5122f14
commit 330d960502

View File

@ -8,12 +8,10 @@ import {
Coins,
User,
Hash,
HelpCircle,
CheckCircle2,
AlertCircle,
Eye,
EyeOff,
Sparkles,
Smartphone,
Plus,
RefreshCw,
@ -30,7 +28,6 @@ import {
Search,
Trash2,
TrendingUp,
RotateCcw,
Info,
ChevronLeft,
ChevronRight,
@ -432,7 +429,7 @@ export default function SmsSettingsPage() {
setRuleFormVariables(rule.variables ? [...rule.variables] : []);
setRuleFormDescription(rule.description ? `${rule.description} (رونوشت)` : '');
setIsRuleModalOpen(true);
toast.info('اطلاعات سناریو تکثیر شد. پس از بازبینی، ذخیره نمایید.');
toast('اطلاعات سناریو تکثیر شد. پس از بازبینی، ذخیره نمایید.', { icon: '📋' });
};
const handleSaveRule = async (e: React.FormEvent) => {
@ -617,22 +614,6 @@ export default function SmsSettingsPage() {
}
};
const handleAssignPattern = async (type: keyof SmsConfigState, patternId: number) => {
const updated = { ...config, [type]: String(patternId) };
setConfig(updated);
try {
await api.patch('/settings/sms', {
...updated,
[type]: Number(patternId),
});
toast.success(`الگوی ${patternId} به عنوان رویداد مورد نظر تنظیم شد`);
refreshPatterns();
} catch {
toast.error('خطا در ذخیره اتصال پترن');
}
};
const handleDeleteLog = async (id: string) => {
if (!window.confirm('آیا از حذف این لاگ پیامک اطمینان دارید؟')) return;
try {
@ -1221,6 +1202,18 @@ export default function SmsSettingsPage() {
/>
</div>
<div>
<label className="block text-xs font-bold text-gray-700 mb-1">متغیر تستی ۲ (مبلغ یا نام)</label>
<input
type="text"
value={testArg2}
onChange={(e) => setTestArg2(e.target.value)}
placeholder="150000"
className="w-full border border-gray-200 rounded-xl p-2.5 outline-none focus:ring-2 focus:ring-blue-500 text-xs font-mono font-bold"
dir="ltr"
/>
</div>
{testResult && (
<div
className={`p-3 rounded-xl border text-xs flex items-start gap-2 ${
@ -1267,7 +1260,7 @@ export default function SmsSettingsPage() {
<button
type="button"
onClick={handleOpenAddRuleModal}
onClick={() => handleOpenAddRuleModal()}
className="bg-amber-600 hover:bg-amber-700 text-white text-xs font-bold py-3 px-5 rounded-xl transition-all flex items-center gap-2 shadow-md shadow-amber-200 shrink-0"
>
<Plus className="w-4 h-4" />
@ -1289,7 +1282,7 @@ export default function SmsSettingsPage() {
</div>
<button
type="button"
onClick={handleOpenAddRuleModal}
onClick={() => handleOpenAddRuleModal()}
className="bg-amber-600 hover:bg-amber-700 text-white text-xs font-bold py-2.5 px-5 rounded-xl transition-all inline-flex items-center gap-2 shadow-sm"
>
<Plus className="w-4 h-4" />