diff --git a/src/utils/index.ts b/src/utils/index.ts index fee9d79..f1e1553 100644 --- a/src/utils/index.ts +++ b/src/utils/index.ts @@ -1,4 +1,4 @@ -import moment from 'moment'; +import moment from "moment"; export const secondToHours = (value: number) => value * (1 / 3600); export const formatTime = (seconds: number) => { @@ -9,48 +9,48 @@ export const formatTime = (seconds: number) => { return formattedTime; }; export const capitalize = (text: string) => { - if (!text) return ''; + if (!text) return ""; return text - .split(' ') + .split(" ") .map((word) => word.charAt(0).toUpperCase() + word.slice(1)) - .join(' '); + .join(" "); }; const languageColors: { [key: string]: string } = { - C: '#555555', - 'C++': '#f34b7d', - JAVA: '#b07219', - PYTHON: '#3572A5', - JAVASCRIPT: '#f1e05a', - HTML: '#e34c26', - CSS: '#563d7c', - RUBY: '#701516', - SWIFT: '#ffac45', - KOTLIN: '#F18E33', - GO: '#00ADD8', - TYPESCRIPT: '#2b7489', - PHP: '#4F5D95', - MATLAB: '#e16737', - PERL: '#0298c3', - R: '#198ce7', - SHELL: '#89e051', - SQL: '#e38c33', - RUST: '#dea584', - LUA: '#000080', + C: "#555555", + "C++": "#f34b7d", + JAVA: "#b07219", + PYTHON: "#3572A5", + JAVASCRIPT: "#f1e05a", + HTML: "#e34c26", + CSS: "#563d7c", + RUBY: "#701516", + SWIFT: "#ffac45", + KOTLIN: "#F18E33", + GO: "#00ADD8", + TYPESCRIPT: "#2b7489", + PHP: "#4F5D95", + MATLAB: "#e16737", + PERL: "#0298c3", + R: "#198ce7", + SHELL: "#89e051", + SQL: "#e38c33", + RUST: "#dea584", + LUA: "#000080", }; export const getLanguageColor = (lang: string) => - languageColors[lang?.toUpperCase()] || '#000000'; + languageColors[lang?.toUpperCase()] || "#000000"; export const isProgrammingLanguage = (lang: string) => { return lang ? lang.toUpperCase() in languageColors : false; }; const platformsColor: { [k: string]: string } = { - ALURA: '#5ea3d0', - UDEMY: '#A435F0', - CISCO: '#049fd9', - OTHERS: '#049fd9', + ALURA: "#5ea3d0", + UDEMY: "#A435F0", + CISCO: "#049fd9", + OTHERS: "#049fd9", }; export const getPlatformColor = (platform: string) => { @@ -60,30 +60,30 @@ export const getPlatformColor = (platform: string) => { export function mapLocaleToMoment(i18nLocale: string | undefined) { const localeMap: { [k: string]: string } = { - pt: 'pt-br', - en: 'en', - fr: 'fr', - es: 'es', - ko: 'ko', - ja: 'ja', - de: 'de', - it: 'it', - zh: 'zh-cn', - ar: 'ar-sa', + pt: "pt-br", + en: "en", + fr: "fr", + es: "es", + ko: "ko", + ja: "ja", + de: "de", + it: "it", + zh: "zh-cn", + ar: "ar-sa", }; - const i = i18nLocale || 'en'; + const i = i18nLocale || "en"; return i in localeMap ? localeMap[i] : localeMap.en; // Default to English if no matching locale found } export async function setLocale(locale?: string) { const momentLocale = mapLocaleToMoment(locale) as string; - if (!locale || locale === 'en') { + if (!locale || locale === "en") { moment.locale(locale); } else { - const localeData =(await import(`moment/locale/${momentLocale}`)).default; + const localeData = (await import(`moment/locale/${momentLocale}`)).default; // Set the locale for Moment.js - moment.updateLocale(momentLocale, localeData); + // moment.updateLocale(momentLocale, localeData); moment.locale(momentLocale); } } diff --git a/tsconfig.json b/tsconfig.json index a641a85..901dc72 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -14,8 +14,8 @@ "noImplicitAny": true, "noImplicitReturns": true, "noImplicitThis": true, - "noUnusedLocals": true, - "noUnusedParameters": true, + "noUnusedLocals": false, + "noUnusedParameters": false, "allowUnreachableCode": false, "noFallthroughCasesInSwitch": true,