From f50ad504ff02310d5a6727092b0f0d9b7ed1f053 Mon Sep 17 00:00:00 2001 From: lexx Date: Fri, 6 Nov 2026 18:58:40 +0200 Subject: [PATCH] Chore: enable the boboko plugin and slim CLAUDE.md to 3dealer's own facts The general front-end, localization and performance rules now live in the boboko plugin's skills (re-skills marketplace). CLAUDE.md keeps the Greek register, the design tokens, 3dealer specifics, and a map of which skill covers what. Co-Authored-By: Claude Opus 5.5 --- .claude/settings.json | 8 +- CLAUDE.md | 220 ++++++++---------------------------------- 2 files changed, 46 insertions(+), 182 deletions(-) diff --git a/.claude/settings.json b/.claude/settings.json index 6e61004..aee1d10 100644 --- a/.claude/settings.json +++ b/.claude/settings.json @@ -1,7 +1,10 @@ { "extraKnownMarketplaces": { "re-skills": { - "source": { "source": "git", "url": "git@code.radical-elements.com:radical/re-skills.git" }, + "source": { + "source": "git", + "url": "git@code.radical-elements.com:radical/re-skills.git" + }, "autoUpdate": true } }, @@ -9,6 +12,7 @@ "design@re-skills": true, "seo@re-skills": true, "studio@re-skills": true, - "engineering@re-skills": true + "engineering@re-skills": true, + "boboko@re-skills": true } } diff --git a/CLAUDE.md b/CLAUDE.md index a4122a4..67133e2 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -1,196 +1,56 @@ -# Front-end Guidelines +# 3dealer -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. +The storefront for 3dealer.gr: a boboko shop (Laravel + Lunar, on top of the shared +`boboko/core` package). It's also the **reference shop**: boboko's standard storefront is being +worked out here. -> **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. +## Shared rules: the `boboko` plugin ---- +The rules for every boboko shop are in the **`boboko` Claude Code plugin** (re-skills +marketplace, enabled in `.claude/settings.json`). Its skills load when the work calls for them: -## 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 | +| Skill | For | |---|---| -| 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/` | +| `boboko-platform` | How core, starter and the shops fit together; where new code goes; approved third-party scripts | +| `cacheable-pages` | Catalogue pages identical for every visitor; islands; JSON writes. **Read before touching catalogue pages, the header, the layout or any form** | +| `storefront-frontend` | Tailwind, tokens, components, Popover, Stimulus, ARIA, Greek capitals, forms | +| `storefront-performance` | Core Web Vitals: bundling, fonts, LCP images, CLS, Speculation Rules, bfcache | +| `locale-routes` | `{locale}` routes, `$locale` first in controllers, same slugs, hreflang | +| `storefront-translations` | `storefront.*` labels as Language Lines; getting keys into core | +| `core-local-dev`, `releasing-core` | Working on core alongside this shop; releasing and `bin/deploy` | ---- +If something below conflicts with a skill, this file wins for 3dealer. Say so, so the skill or +this file gets fixed. -## Tailwind vs. Custom CSS +**Work in progress:** [CACHING-TRANSITION.md](CACHING-TRANSITION.md) has the current transition's +decisions, task status and rules. Known problems: [README.md](README.md), "Known issues". -**Prefer Tailwind utilities by default.** Write custom CSS only when something genuinely cannot be expressed as a utility: +## Greek register -- 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) +- **Greek register:** `singular`. Use the informal second person (εσύ/σου/σε), e.g. + "Η κριτική σου", "Το όνομά σου", "Το email σου". -**Never** write inline CSS (`style="..."`). **Never** write custom CSS for something Tailwind already covers. +All UI text written for this project follows it, including labels added in the admin. -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. +## Design tokens -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. +In `@theme {}` in `resources/css/app.css`: ---- +- `--font-sans`: **Manrope** (body text). +- `--font-display`: **Manrope** (headings, nav, buttons). Kept separate from `--font-sans` in + case they diverge later. +- `--color-brand` / `--color-brand-light`: the brand greens. +- `--text-h1` … `--text-h4`: the heading sizes. -## Design Tokens +Reuse these and the colours already in use (`neutral-200`, `black`) before adding anything. +The Manrope weights used above the fold are preloaded in `layouts/app.blade.php`; a new heavy +weight in a hero needs its own preload there. -Defined in `@theme {}` in `app.css`: +## 3dealer specifics -- `--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 - -
...
-``` - -Style open/closed states with `[popover]` and `:popover-open` selectors in CSS. - -### Stimulus JS for behavior - -Use Stimulus when JS is genuinely needed (form handling, cart updates, dynamic state, etc.). - -- Keep controllers lean: manage state and coordinate the DOM, don't build UI inside them -- Use Stimulus values, targets, and outlets — avoid reading from the DOM imperatively -- **Never inject HTML strings or classes from inside a controller.** Instead, drive appearance via data attributes or CSS classes toggled on existing elements, and let CSS handle the visual result -- Never write inline JS (`onclick="..."`, etc.) - -### Pure CSS for simple interactions - -Hover dropdowns, focus states, active states — handle with CSS (`:hover`, `:focus-within`, `.group:hover`) before reaching for Stimulus. - ---- - -## Accessibility (ARIA) - -Always add ARIA attributes. This is not optional: - -- Interactive elements: `aria-label`, `aria-expanded`, `aria-controls`, `aria-haspopup` as appropriate -- Images: meaningful `alt` text, or `alt=""` + `aria-hidden="true"` for decorative images -- Icons used as buttons: `aria-label` on the button, `aria-hidden="true"` on the SVG -- Form fields: always associated `