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 <noreply@anthropic.com>
This commit is contained in:
1 parent
81e70de70f
commit
f50ad504ff
2 files changed
+46
-182
No files matched your search
@@ -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
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
|
||||
<!-- CHANGE THESE PER PROJECT -->
|
||||
- **Greek register:** `singular` — use the informal second person (εσύ/σου/σε). e.g. "Η κριτική σου", "Το όνομά σου", "Το email σου"
|
||||
<!-- singular = informal (εσύ) | plural = formal (εσείς) -->
|
||||
|
||||
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 `<head>` 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
|
||||
<button popovertarget="my-popover">Open</button>
|
||||
<div id="my-popover" popover>...</div>
|
||||
```
|
||||
|
||||
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 `<label>`, `aria-describedby` for hints/errors
|
||||
- Dynamic content: `aria-live` regions where content updates without navigation
|
||||
- When refactoring or adding interactivity, review ARIA impact — don't break existing roles
|
||||
|
||||
---
|
||||
|
||||
## Greek Typography
|
||||
|
||||
CSS `text-transform: uppercase` leaves Greek tonos accents in place (e.g. Ά instead of Α), which is incorrect. The utility at `resources/js/utils/strip-accents.js` handles this automatically for any element with the `uppercase` Tailwind class. **Always add the `uppercase` class to elements** rather than applying `text-transform: uppercase` in CSS — this keeps the strip-accents utility working without extra configuration.
|
||||
|
||||
---
|
||||
|
||||
## Performance & Core Web Vitals
|
||||
|
||||
Every frontend change should assume it will be measured by PageSpeed/Lighthouse. These rules exist because we hit each of these mistakes in production and had to fix them after the fact — bake them in up front instead.
|
||||
|
||||
### CSS bundling
|
||||
- Before adding a CSS import to a shared/global entry point (e.g. `app.css`), ask whether every page actually needs it. Page- or component-specific styles (date pickers, legal-page typography, admin-only widgets) should not ship on pages that don't use them.
|
||||
- Scope non-critical CSS to load only where it's used — either a dedicated build entry for that page, or import the `.css` file inside the same JS module that already lazy-loads that component (e.g. a Stimulus/JS controller), so the bundler emits it as a separate chunk fetched only when that component actually mounts.
|
||||
- Exception: never defer CSS for anything the page shows immediately on load (above-the-fold content, or a component that renders as soon as its JS runs — an FAQ accordion, a cookie-consent banner). Even a well-scoped async CSS chunk arrives a beat after the JS that displays the element, causing a visible flash of unstyled/wrong-state content and a layout shift. Keep that CSS in the blocking bundle on purpose.
|
||||
- Never import a full icon-font library (Phosphor, Font Awesome, etc.) — it ships every icon regardless of usage. Use inline SVGs for only the icons actually referenced; check the shared icon component for an existing icon before adding a new one.
|
||||
- Only declare design tokens / CSS custom properties that are actually used somewhere in the codebase (Tailwind v4 already tree-shakes unused `@theme` tokens from output, so this is for keeping the source legible, not for bytes).
|
||||
|
||||
### Fonts
|
||||
- `font-display: swap` means any text using a font weight will visibly reflow once that weight's file finishes downloading, if the fallback font's metrics differ. Preload every font weight used in above-the-fold text, not just the default body-copy weight — bold/black heading weights are usually the most visually prominent element on the page and cause the most visible reflow if not preloaded.
|
||||
- When introducing a new heavy-weight text utility (e.g. a bold/black heading class) in a hero or above-the-fold component, confirm that weight has a matching `<link rel="preload" as="font">` in the layout `<head>`.
|
||||
|
||||
### Images
|
||||
- Any image that could be the Largest Contentful Paint element (hero/banner images) must have: `fetchpriority="high"`, `loading="eager"`, explicit `width`/`height`, a responsive `srcset`/`sizes`, and a `<link rel="preload" as="image">` in `<head>` with matching `imagesrcset`/`imagesizes` — this lets the browser start the fetch as soon as it parses `<head>`, instead of waiting to discover the `<img>` tag in the body.
|
||||
- Every other image: `loading="lazy"` with explicit `width`/`height` to reserve its layout space.
|
||||
|
||||
### Layout shift (CLS)
|
||||
- Never animate `top`/`bottom`/`left`/`right`/`width`/`height`/`margin` on any element that appears or moves without direct user interaction (banners, toasts, slide-in modals, accordions). These are layout-affecting properties — the browser recalculates layout on every animation frame, and each frame's position delta counts toward CLS. Animate `transform` (translate/scale) and `opacity` instead — both are compositor-only and fully excluded from CLS scoring, no matter how far or long the animation runs.
|
||||
- This applies to vendor/third-party CSS too (cookie-consent widgets, modal libraries) — check its default show/hide mechanism before shipping, and override it if it animates a layout property directly.
|
||||
- Any element with a collapsed/expanded default state (accordions, dropdowns) needs its collapsed-state CSS in the blocking stylesheet, never a lazily-loaded chunk — otherwise it renders in its expanded/default state for a frame before the async CSS applies.
|
||||
|
||||
---
|
||||
|
||||
## Forms
|
||||
|
||||
Never add `novalidate` to forms. Always use the browser's default validation.
|
||||
|
||||
---
|
||||
|
||||
## Asking Questions
|
||||
|
||||
When the approach is unclear — layout structure, whether something should be a component, which Tailwind pattern fits — **ask before building**. A short question is cheaper than a refactor.
|
||||
- **Product custom fields** (text answers and photo uploads on the product page): how they work,
|
||||
limits and clean-up are in [README.md](README.md). Products with custom fields can't be
|
||||
quick-added from cards.
|
||||
- **hCaptcha** protects the contact and login forms only.
|
||||
- **Stoic** provides the FAQ, legal pages and other client-edited copy (`App\Services\Stoic`,
|
||||
`App\Models\Stoic*`).
|
||||
Reference in new issue
Block a user