# Strava Frontend Developer Instructions You must strictly follow these architectural, coding, and formatting rules for this project (Vue 3 SPA "cycle-rider"). All generated code and modifications must fully comply with the guidelines below. ### 🧠 Agent Behavior - **Reasoning Language**: All thoughts, analysis, and reasoning MUST be written in English to minimize token usage. - **Communication**: Communicate with the user in Russian unless asked otherwise. - **Task Progress**: Always track implementation progress with a todo list. ### 🏗 Project Structure (src/) The SPA is organized as follows — keep the dependency direction `pages -> components / stores / services`: - **`src/main.ts`** — app bootstrap: axios instances, Pinia, router, i18n, Vuestic UI, Yandex Maps, optional GTM. Do NOT relocate providers; components rely on `app.provide` keys. - **`src/router/index.ts`** — single router config. All pages MUST be lazy-loaded via `() => import(...)`. Routes are nested under `AppLayout` (authenticated shell) or `AuthLayout` (auth pages); catch-all redirects to `dashboard`. - **`src/pages/`** — route-level components and page-private logic. One folder per domain area (`workouts/`, `routes/`, `auth/`, `preferences/`, `admin/`). Page-private helper modules live in a `components/` subfolder of the page (e.g., `pages/workouts/components/GetWorkout.ts`). - **`src/components/`** — reusable presentational components (`navbar/`, `sidebar/`, `icons/`, `app-layout-navigation/`). No direct API calls here; receive data via props. - **`src/stores/`** — Pinia stores (options style via `defineStore`). `useUserStore` (user/profile data hydrated from `localStorage`), `useGlobalStore` (sidebar/UI state). - **`src/i18n/`** — vue-i18n setup; locale files auto-discovered from `src/i18n/locales/*.json` (locale name = file name). - **`src/services/`** — cross-cutting helpers: `utils.ts` (validators, sleep), `vuestic-ui/` (global config, themes, icon registry). - **`src/scss/`** — global styles; do not duplicate Vuestic theme tokens — use `--va-*` CSS variables. ### 🌐 API Access Pattern - Two Axios instances are created in `src/main.ts` and injected app-wide: - `axiosAuth` — request interceptor attaches `Authorization: Bearer `; - `axiosPublic` — no auth header. - Consume them with `inject('axiosAuth') as AxiosInstance` / `inject('axiosPublic') as AxiosInstance`. Do NOT create new axios instances in components. - All backend endpoints are under `/api/v0` (base URL = `HOST` constant in `main.ts`). - A shared response interceptor handles 401 (clears `localStorage`, redirects to `login`). Do not add per-component 401 handling. - Auth data lives in `localStorage` keys: `token`, `user`, `profile`, `attachments`. Keep key names stable — `useUserStore` and `main.ts` depend on them. ### 📊 Charts & Maps - **Charts**: Chart.js 4 via `vue-chartjs`; adapters/plugins already installed (`chartjs-adapter-moment`, `chartjs-plugin-zoom`, `chartjs-chart-geo` for elevation). Chart-data building logic belongs in page-level `.ts` helper modules (e.g., `pages/workouts/components/*`), not in `.vue` templates. - **Maps**: Yandex Maps via `vue-yandex-maps` (registered in `main.ts`). Route polylines are built from workout `results` coordinates `[longitude, latitude]`. - Workout detail API response shape: `{ workout, results: [{ timestamp, longitude, latitude, elevation, power, heart_rate, speed }, ...] }`. Null-valued metrics (power/heart_rate/elevation) must be detected and their charts hidden, matching the existing pattern in `GetWorkout.ts`. ### 💾 State Management (Pinia) - Use options-style stores (`defineStore("name", { state, actions })`) consistent with existing stores. - Auth/profile state is hydrated from `localStorage` inside `state()` — there is no pinia-persist plugin. Do not add persistence of sensitive data beyond the existing keys. - UI/visual state (sidebar, theme) belongs in `useGlobalStore`. ### 🎨 Styling - Vuestic UI is the component library. Customize through `src/services/vuestic-ui/global-config.ts` and `themes.ts`, never by forking component internals. - Tailwind CSS utilities are available; color tokens MUST reference Vuestic CSS variables (`var(--va-primary)` etc.) as mapped in `tailwind.config.js` (`primary`, `textPrimary`, `backgroundCardPrimary`, ...). Do not hardcode hex colors that bypass the theme. - Font-size tokens: `text-tag`, `text-regularSmall`, `text-regularMedium`, `text-regularLarge` (defined in `tailwind.config.js`). - Global styles live in `src/scss/main.scss`; page-specific overrides go in the page's `