From 3f89eca58611e266a975f2676460c9dabbe44a4b Mon Sep 17 00:00:00 2001 From: Ricardo Campos Date: Thu, 12 Feb 2026 18:48:18 -0300 Subject: [PATCH] chore: fix project errors --- src/Utils.ts | 20 ++++++++++---------- src/index.ts | 11 ++++------- vite-env.d.ts => src/vite-env.d.ts | 0 tsconfig.json | 13 +++++++++++++ 4 files changed, 27 insertions(+), 17 deletions(-) rename vite-env.d.ts => src/vite-env.d.ts (100%) create mode 100644 tsconfig.json diff --git a/src/Utils.ts b/src/Utils.ts index 1d86de2..f46cf5f 100644 --- a/src/Utils.ts +++ b/src/Utils.ts @@ -95,16 +95,16 @@ export function delay(seconds: number) { return new Promise(resolve => setTimeout(resolve, seconds)); } -export function getIcon(category: string) { - const icons = { - 'fats': '🥑 🍳 🍟', - 'proteins': '🫘 🥩 🥚', - 'carbs': '🍞 🥔 🍠', - 'leaves': '🥬 🥗 🌿', - 'fruits': '🍊 🍇 🍎', - 'low carb': '🥦 🍅 🍓', - 'dairy': '🧀 🧈 🥛' - }; +const icons = { + 'fats': '🥑 🍳 🍟', + 'proteins': '🫘 🥩 🥚', + 'carbs': '🍞 🥔 🍠', + 'leaves': '🥬 🥗 🌿', + 'fruits': '🍊 🍇 🍎', + 'low carb': '🥦 🍅 🍓', + 'dairy': '🧀 🧈 🥛' +}; +export function getIcon(category: keyof typeof icons) { return icons[category]; } diff --git a/src/index.ts b/src/index.ts index 0caf7bc..74b3faf 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,10 +1,10 @@ import { foodDatabase } from './foodDatabase.js'; -import { getButtonById, getButtonListByClassName, getDivById, getInputById, showFoodPreview } from './DomUtils.ts'; +import { getButtonById, getButtonListByClassName, getDivById, getInputById, showFoodPreview } from './DomUtils'; import { DailyTotalCalories, FoodItem, FoodStorage, MealGroup, MealPeriod } from './types.js'; import { AppwriteAuth, AppwriteDB } from './appwrite.js'; import swal from 'sweetalert'; -import { closeMobileMenu, delay, getCleanName, getIcon, handleMobileCalendarClick, hideLoading, hideSearchResults, navigateResultsKeyboard, QUICK_DELAY, scrollToCalendarView, showLoading, toggleCardHandler, toggleMobileMenu } from './Utils.ts'; -import { showAuthForms, toggleAuthForms, showRegisterForm, showLoginForm, hideAuthForms, closeAuthModal } from './auth.ts'; +import { closeMobileMenu, delay, getCleanName, getIcon, handleMobileCalendarClick, hideLoading, hideSearchResults, navigateResultsKeyboard, QUICK_DELAY, scrollToCalendarView, showLoading, toggleCardHandler, toggleMobileMenu } from './Utils'; +import { showAuthForms, toggleAuthForms, showRegisterForm, showLoginForm, hideAuthForms, closeAuthModal } from './auth'; import { appState } from "./state"; import { getNutritionInfo, NutritionInfo, clearNutritionCache, getCacheStats } from './claudeService'; @@ -17,10 +17,7 @@ const updateSW = registerSW({ title: 'Update Available', text: 'New content is available. Reload to update?', icon: 'info', - buttons: { - cancel: 'Later', - confirm: 'Update Now' - } + buttons: ['Later', 'Update Now'] }).then((willUpdate) => { if (willUpdate) { updateSW(true) diff --git a/vite-env.d.ts b/src/vite-env.d.ts similarity index 100% rename from vite-env.d.ts rename to src/vite-env.d.ts diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 0000000..e024a0c --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,13 @@ +{ + "compilerOptions": { + "target": "ES2020", + "module": "ESNext", + "moduleResolution": "bundler", + "strict": true, + "noEmit": true, + "skipLibCheck": true, + "lib": ["ES2020", "DOM", "DOM.Iterable"], + "types": ["vite/client"] + }, + "include": ["src"] +}