update AGENTS.md

This commit is contained in:
2026-02-14 13:27:04 +01:00
parent 2468b31462
commit b0b5d0972a

View File

@ -39,16 +39,35 @@ It describes what the project is, what is already implemented, and what still ne
- state management: `frontend/src/stores/ui.ts`
- mounted globally in `frontend/src/App.vue`
- card-level loading/error states are wired in `TodayView`, `MealsView`, `MealDetailView`, `IngredientsView`
- expired-session handling is global:
- token error detector in `frontend/src/utils/error.ts` emits `auth:session-expired`
- listener in `frontend/src/main.ts` clears session, shows info toast, and redirects to auth route
- Frontend i18n is wired and used across new UI:
- setup in `frontend/src/i18n/index.ts`
- locale files in `frontend/src/locales/{sk,cs,en,es,de}.json`
- language switcher updates locale dynamically.
- app UI keys include (`nav`, `pageTitles`, `mealTypes`, `common`, `nutrition`, `today`, `meals`, `ingredients`, `stats`, `settings`, `ux`)
- `nutrition.short.fiber` exists in all locales and is used in macro badges
- `ux.toast.sessionExpired` exists in all locales for auto-logout flow
- Frontend theme system is implemented:
- centralized theme store: `frontend/src/stores/theme.ts`
- shared toggle component: `frontend/src/components/common/ThemeToggle.vue`
- toggle available in auth, app topbar, and settings
- design tokens in `frontend/src/assets/css/style.css` (`:root` variables).
- Frontend macro-badge visual system is implemented:
- shared component: `frontend/src/components/common/MacroBadge.vue`
- shared colors/tokens/styles in `frontend/src/assets/css/style.css`
- used in `IngredientsView`, `MealsView`, `DayTotalsCard`, and `DayMealCard`
- `Today` day totals card layout: kcal block on the left, macros on the right in one row
- macro colors:
- protein `#3B82F6`
- carbs `#F59E0B`
- fat `#EF4444`
- fiber `#10B981`
- style uses subtle tinted background + full-color text, pill shape (no saturated full backgrounds)
- Frontend typography is local (no remote font CDN):
- `frontend/src/assets/css/style.css` uses local `@font-face` for `DM Sans` and `Space Grotesk`
- font files are stored in `frontend/src/assets/fonts/*.woff2`
- App logo is served from `frontend/public/Nutrio.png` (copied from `doc/Nutrio.png`).
- Font Awesome is installed and registered globally in `frontend/src/main.ts`.
- Pinia is installed and configured in `frontend/src/main.ts` via `frontend/src/stores/index.ts`.
@ -58,7 +77,7 @@ It describes what the project is, what is already implemented, and what still ne
- `frontend/src/utils/{nutrition,api,date,error}.ts`
- Ingredients form UX detail:
- create/edit form in `IngredientsView` is hidden by default
- shows only after `Nová surovina` or `Upraviť`
- shows only after `Nova surovina` or `Upravit`
- hides again after successful save (form remount resets fields)
- `frontend/src/BackendAPI.ts` is generated via `backend/scripts/buildTypeScript.php` and should not be edited manually.
- `backend/data.json` contains sample meal data (not currently wired into DB/API flow).
@ -168,6 +187,8 @@ All actions are invoked through `backend/public/API.php` with `?action=<method_n
- raw API response is wrapped as `{ status, data }`
- generated `BackendAPI.ts` currently resolves `response.data` in `callPromise` for non-`__HELP__` actions
- frontend stores use `frontend/src/utils/api.ts` (`unwrapApiData`) to normalize both envelope and unwrapped runtime shapes
- Auto-logout on expired token currently depends on the shared error mapper:
- if a view/store handles API errors without `toErrorMessage(...)`, global `auth:session-expired` event is not emitted there
- `frontend/src/BackendAPI.ts` is generated output; regenerate when backend API changes, do not patch manually.
- In vue-i18n locale strings, `@` must be escaped as `{'@'}` to avoid "Invalid linked format" errors.
@ -206,3 +227,4 @@ Frontend:
- When changing schema, always bump DB version in `Maintenance.php` with forward-only migration steps.
- Keep API action names stable unless frontend is updated at the same time.
- In source files, use tab characters for indentation (do not add space-based indentation).