import { message } from 'antd'; import type { UploadFile } from 'antd'; import { i18nText } from '../i18nKeys'; const ROUTES = ['sessions', 'notifications', 'support', 'information', 'settings', 'messages', 'expert-profile']; const COUNTS: Record = { sessions: 12, notifications: 5, messages: 113 }; export const getMenuConfig = (locale: string) => ROUTES.map((path) => ({ path, title: i18nText(`accountMenu.${path}`, locale), count: COUNTS[path] || undefined })); export const validateImage = (file: UploadFile, showMessage?: boolean): boolean => { const isImage = file.type === 'image/jpg' || file.type === 'image/jpeg' || file.type === 'image/png' || file.type === 'image/gif'; if (!isImage && showMessage) { message.error('You can only upload JPG/PNG file'); } const isLt5M = file.size / 1024 / 1024 <= 5; if (!isLt5M && showMessage) { message.error('Image must smaller than 5MB'); } return isImage && isLt5M; }; export const validateDoc = (file: UploadFile): boolean => { const isDoc = file.type === 'image/jpg' || file.type === 'image/jpeg' || file.type === 'image/png' || file.type === 'image/gif' || file.type === 'application/pdf'; if (!isDoc) { message.error('You can only upload JPG/PNG/PDF file'); } const isLt5M = file.size / 1024 / 1024 <= 5; if (!isLt5M) { message.error('Image must smaller than 5MB'); } return isDoc && isLt5M; };