fix type persian numbers && change design loading && fix warnings && handle icons size in device mobile
This commit is contained in:
@@ -44,9 +44,13 @@ function SearchBar({ selected, setSelected, state, handleSearch }) {
|
||||
<Button
|
||||
onClick={handleSearch}
|
||||
className="
|
||||
!rounded-[4px] !gap-2.5 !p-2 md:!p-3 lg:!p-4 !min-w-fit
|
||||
!rounded-[4px] !gap-2.5 !p-2 md:!p-3 lg:!p-4
|
||||
!w-[38px] sm:!w-[44px] md:!w-[50px] lg:!w-[56px]
|
||||
!h-[38px] sm:!h-[44px] md:!h-[50px] lg:!h-[56px]
|
||||
!min-w-[38px] sm:!min-w-[44px] md:!min-w-[50px] lg:!min-w-[56px]
|
||||
!min-h-[38px] sm:!min-h-[44px] md:!min-h-[50px] lg:!min-h-[56px]
|
||||
!max-w-[38px] sm:!max-w-[44px] md:!max-w-[50px] lg:!max-w-[56px]
|
||||
!max-h-[38px] sm:!max-h-[44px] md:!max-h-[50px] lg:!max-h-[56px]
|
||||
"
|
||||
>
|
||||
<SearchD />
|
||||
|
||||
+27
-2
@@ -92,7 +92,7 @@ export const alert = (type, text, prop) => {
|
||||
</p>
|
||||
<p className="text-[14px] font-normal">{text}</p>
|
||||
</div>,
|
||||
{ prop },
|
||||
{ prop }
|
||||
);
|
||||
};
|
||||
|
||||
@@ -105,10 +105,19 @@ export const addLabelToList = (list) =>
|
||||
});
|
||||
|
||||
export const formatPhoneNumber = (input) => {
|
||||
const digits = input.replace(/\D/g, "");
|
||||
if (typeof input !== 'string') input = String(input);
|
||||
|
||||
const normalized = input
|
||||
.replace(/[\u06F0-\u06F9]/g, d => String(d.charCodeAt(0) - 0x06F0))
|
||||
.replace(/[\u0660-\u0669]/g, d => String(d.charCodeAt(0) - 0x0660));
|
||||
|
||||
const digits = normalized.replace(/\D/g, "");
|
||||
|
||||
const trimmed = digits.substring(0, 9);
|
||||
|
||||
const match = trimmed.match(/^(\d{0,2})(\d{0,3})(\d{0,4})$/);
|
||||
if (!match) return trimmed;
|
||||
|
||||
return [match[1], match[2], match[3]].filter(Boolean).join(" ");
|
||||
};
|
||||
|
||||
@@ -175,3 +184,19 @@ export const filterList = (data) => {
|
||||
childrenList: filteredChildrenList,
|
||||
};
|
||||
};
|
||||
|
||||
export function getCleanNumberValue(value, defaultValue = 0) {
|
||||
if (typeof value !== 'string') value = String(value);
|
||||
|
||||
// Convert Persian and Arabic digits to English digits
|
||||
const persianArabicToEnglish = value
|
||||
.replace(/[\u06F0-\u06F9]/g, d => String(d.charCodeAt(0) - 0x06F0))
|
||||
.replace(/[\u0660-\u0669]/g, d => String(d.charCodeAt(0) - 0x0660));
|
||||
|
||||
// Remove non-numeric characters except dots (for decimal support)
|
||||
const cleaned = persianArabicToEnglish.replace(/[^0-9.]/g, '');
|
||||
|
||||
// Return number or default if invalid
|
||||
const number = parseFloat(cleaned);
|
||||
return isNaN(number) ? defaultValue : number;
|
||||
}
|
||||
|
||||
+2
-2
@@ -28,7 +28,7 @@ api.interceptors.request.use(
|
||||
}
|
||||
return request;
|
||||
},
|
||||
(err) => Promise.reject(err),
|
||||
(err) => Promise.reject(err)
|
||||
);
|
||||
|
||||
api.interceptors.response.use(
|
||||
@@ -41,7 +41,7 @@ api.interceptors.response.use(
|
||||
window.location.pathname = "/login";
|
||||
} else {
|
||||
}
|
||||
},
|
||||
}
|
||||
);
|
||||
|
||||
export default api;
|
||||
|
||||
Reference in New Issue
Block a user