# Front-end Guidelines This is 3dealer.gr, a boboko shop: Laravel 12 + Lunar, on top of the shared `boboko/core` package. These guidelines apply to all front-end work. > **These rules are moving into the `boboko` Claude Code plugin** (re-skills marketplace), so every boboko shop shares them. Once it's enabled here, this file keeps only 3dealer's own facts (Greek register, fonts, brand). Until then, this file is the reference. > > **Direction of the work in progress:** read [CACHING-TRANSITION.md](CACHING-TRANSITION.md) before touching catalogue pages, the header, the layout or any form. --- ## Project Language Settings - **Greek register:** `singular` — use the informal second person (εσύ/σου/σε). e.g. "Η κριτική σου", "Το όνομά σου", "Το email σου" All UI text written for this project must follow the register above. --- ## Localization **Locales** come from Lunar's languages table (the admin's **Languages** resource), not from config: Greek (`el`) is the default, English (`en`) is secondary. How it works: `vendor/boboko/core/docs/localization.md`. **URL structure:** every storefront route is prefixed with `{locale}`, including the default: `3dealer.gr/el/...` and `3dealer.gr/en/...`. A URL without a valid locale (including bare `/`) is redirected by core's `locale` middleware to the visitor's best `Accept-Language` match, else the default language. That redirect varies per visitor, so it must never be cached. Prefixing every locale keeps hreflang symmetrical and scales cleanly to a third language. **URL slugs are the same across both locales, permanently**: `/el/products/{x}` and `/en/products/{x}`, not `/el/proionta/{x}` vs `/en/products/{x}`. This is a deliberate, standing decision, not a placeholder to revisit later. Only the visible content is translated, not the slug. Do not introduce per-locale translated slugs unless the user explicitly asks for that to change. (Catalogue URLs are moving to id + ASCII slug, `/el/products/123-blue-vase`, once core supports it; until then they use bare ids.) **How it's wired:** - Storefront routes live inside `Route::prefix('{locale}')->middleware('locale')` in `routes/web.php`. `locale` is core's `Modules\Core\Localization\Middleware\LocaleMiddleware`. - The middleware sets the app locale and shares `$currentLocale` (e.g. `el`) and `$altLocales` (a collection of every *other* language: `code`, `name`, `url` of the same page) with every view. That's what powers the header's language switcher and the `
` hreflang tags in `resources/views/layouts/app.blade.php`. Don't recompute this; read those shared variables. - When adding a new route, put it inside that `{locale}` group and give it a `name()`: the alternate-language URLs are generated from the current route's name (an unnamed route falls back to the other language's home page). - When linking in Blade, use `route('name', [...])`, never hand-built paths. Inside the group the locale is filled in automatically. - **Every controller action for a route inside the `{locale}` group must declare `$locale` as its first parameter, even if unused**, e.g. `show(string $locale, Product $product)`. Laravel's `ControllerDispatcher` calls the controller with `...array_values($parameters)`, i.e. **positionally**. If a route-bound model parameter (like `$product`) isn't preceded by a matching `$locale` parameter, the values shift and the locale string lands where the model was expected: a `TypeError` that's easy to misread as a binding failure. Closures with zero declared parameters are unaffected, so this only bites real controller methods. **Where translatable strings go:** - Page copy the client edits (home sections, FAQ, legal pages) comes from **Stoic** (the headless CMS). Don't hardcode it. - UI labels (nav, buttons, aria-labels, tab labels, pluralized counts) are **`__('storefront.key')`** keys stored in the database as **Language Lines** (`spatie/laravel-translation-loader` through boboko/core), editable in the admin (Settings → Language Lines). Use `trans_choice('storefront.key', $count, [...])` for plurals. **Never add `lang/` files** for storefront strings. - The defaults ship with core (`StorefrontTranslationsSeeder`). A key you add in the admin must also get into core's seeder (`php artisan boboko:translations:pull` in local mode; `bin/deploy` checks this), or other environments show the raw key. --- ## Tech Stack - **Laravel 12** (moving to 13) + **Lunar 1.5** through `boboko/core` (exact versions: core's `composer.json`) - **Postgres**, **Meilisearch** (catalogue and search), **Docker**, **Caddy** in front of PHP-FPM - **Blade** for templating (`@extends`, `@section`, `@yield`, components) - **Tailwind CSS v4** via `@tailwindcss/vite` — zero config, `@import 'tailwindcss'` only - **Stimulus JS** for interactivity — controllers registered in `resources/js/stimulus/index.js`; core's controllers come from `@boboko/core` (`registerCheckout`, `registerWishlist` in `app.js`), never copied - **No Turbo.** Normal page navigation, plus Speculation Rules and View Transitions. Turbo is still installed and used in places (listing/search Frames, review Streams); don't add to it, and replace it when you rework that code (see CACHING-TRANSITION.md) - **Popover API** (native browser) for overlays — no JS overlay libraries - Local dev runs in Docker (`bin/dc`, or `bin/dc-core.sh` with a local boboko-core checkout: see `bin/core-mode`) --- ## Key File Locations | What | Where | |---|---| | CSS entry point | `resources/css/app.css` | | Font definitions | `resources/css/fonts.css` | | JS entry point | `resources/js/app.js` | | Stimulus controllers | `resources/js/stimulus/` | | JS utilities | `resources/js/utils/` | | Layout | `resources/views/layouts/app.blade.php` | | UI components (atomic) | `resources/views/components/ui/` | | Section components | `resources/views/components/` | | Page views | `resources/views/{page}/` | | Public assets | `public/images/` | --- ## Tailwind vs. Custom CSS **Prefer Tailwind utilities by default.** Write custom CSS only when something genuinely cannot be expressed as a utility: - Pseudo-elements (`::before`, `::after`) with dynamic transforms or transitions - Complex descendant/sibling selectors (e.g. `.group:hover .nav-dropdown`) - Keyframe animations - The underline-slide animation on nav links (background-size trick) **Never** write inline CSS (`style="..."`). **Never** write custom CSS for something Tailwind already covers. When a component requires a CSS class (e.g. as a hook for a pseudo-element), still put all properties that can be Tailwind utilities as classes on the element in the component file. The CSS rule should contain only what genuinely cannot be a utility — pseudo-elements, complex selectors, keyframes. Do not default to putting all styles in the CSS class just because the class exists. When custom CSS is needed, add it to `resources/css/app.css` inside `@layer components`. Keep the rule minimal — only what can't be a utility. --- ## Design Tokens Defined in `@theme {}` in `app.css`: - `--font-sans`: Manrope (body text) - `--font-display`: Manrope (headings, nav, buttons) — kept separate from `--font-sans` in case they diverge later Reuse existing colors (`neutral-200`, `black`), font sizes, spacing, and border styles as components are built. Do not invent new values — check what's already in use first. --- ## Component Structure ### `resources/views/components/ui/`: atomic, reusable UI elements Single-purpose, stateless or minimally stateful elements used across many contexts: button, input, field, icon, badge, tabs, dropdown, pagination… ### `resources/views/components/`: section-level or composite components Larger reusable blocks made of several elements, often with real content: header, footer, product card, review form… **Check before you create.** Look in `components/ui/` and in core's views (`vendor/boboko/core/resources/views`) first, and extend an existing component with a prop rather than duplicating it. --- ## Interactivity ### Popover API for overlays For **tooltips, modals, dropdowns, and any overlay**: use the native [Popover API](https://developer.mozilla.org/en-US/docs/Web/API/Popover_API) with CSS — no JS, no libraries. ```html