Merge branch 'karl' into 'ovoteam-2026'

feat: ✨ add :

See merge request ldc-web/projets/ovoteam!8
This commit is contained in:
karl.muller 2026-04-07 14:22:07 +00:00
commit 6a82a59bc5
143 changed files with 9139 additions and 751 deletions

View file

@ -1,19 +0,0 @@
<?php
namespace App\Http\Controllers\Front;
use Inertia\Inertia;
use Uwil\LaravelCommon\Controllers\Controller;
class HomeController extends Controller
{
/**
* Show home page.
*
* @return \Inertia\Response
*/
public function homepage(): \Inertia\Response
{
return Inertia::render('front/Pages/Home');
}
}

View file

@ -6,6 +6,8 @@ use Illuminate\Http\Request;
use Inertia\Middleware;
use Uwil\LaravelCommon\Helpers\InertiaHelper;
use Uwil\LaravelCommon\Support\InertiaSharedRegistry;
use Uwil\LaravelDynamicPages\Enums\PageStatusEnum;
use Uwil\LaravelDynamicPages\Models\DynamicPage;
class HandleInertiaRequests extends Middleware
{
@ -17,8 +19,24 @@ class HandleInertiaRequests extends Middleware
*/
public function share(Request $request): array
{
// Load all published dynamic pages with each parent page relationship.
$dynamicPageModels = DynamicPage::getModelsCached()
->where('status', PageStatusEnum::published);
$dynamicPages = [];
foreach ($dynamicPageModels as $dynamicPageModel) {
$pascalCase = str_replace(' ', '', ucwords(str_replace('-', ' ', $dynamicPageModel->id_key)));
$dynamicPages["page{$pascalCase}"] = $dynamicPageModel;
}
$props = [
...InertiaHelper::errorProps(parent::share($request)),
'recaptchaKey' => config('services.google.recaptcha.public'),
'dynamicPages' => $dynamicPages,
// More props here.
];

View file

@ -18,6 +18,7 @@
"laravel/tinker": "^2.10.1",
"monolog/monolog": "^3.0",
"psr/log": "^3.0",
"sentry/sentry-laravel": "^4.25",
"tightenco/ziggy": "^2.5",
"uwil/laravel-backend": "^4.0",
"uwil/laravel-common": "^5.1",

22
composer.lock generated
View file

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "e466df5c08b26c991f1c808c0cf2d231",
"content-hash": "f41d07cc1caa32fe50011628872b6e76",
"packages": [
{
"name": "24slides/laravel-saml2",
@ -4252,16 +4252,16 @@
},
{
"name": "sentry/sentry-laravel",
"version": "4.24.0",
"version": "4.25.0",
"source": {
"type": "git",
"url": "https://github.com/getsentry/sentry-laravel.git",
"reference": "f823bd85e38e06cb4f1b7a82d48a2fc95320b31d"
"reference": "6699c9465df6bee07d82279f7a209db941913456"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/getsentry/sentry-laravel/zipball/f823bd85e38e06cb4f1b7a82d48a2fc95320b31d",
"reference": "f823bd85e38e06cb4f1b7a82d48a2fc95320b31d",
"url": "https://api.github.com/repos/getsentry/sentry-laravel/zipball/6699c9465df6bee07d82279f7a209db941913456",
"reference": "6699c9465df6bee07d82279f7a209db941913456",
"shasum": ""
},
"require": {
@ -4327,7 +4327,7 @@
],
"support": {
"issues": "https://github.com/getsentry/sentry-laravel/issues",
"source": "https://github.com/getsentry/sentry-laravel/tree/4.24.0"
"source": "https://github.com/getsentry/sentry-laravel/tree/4.25.0"
},
"funding": [
{
@ -4339,7 +4339,7 @@
"type": "custom"
}
],
"time": "2026-03-24T10:33:54+00:00"
"time": "2026-04-07T12:55:27+00:00"
},
{
"name": "spatie/laravel-package-tools",
@ -7471,16 +7471,16 @@
},
{
"name": "uwil/laravel-dynamic-pages",
"version": "1.0.1",
"version": "1.0.2",
"source": {
"type": "git",
"url": "git@lab.s-web.fr:ldc-web/projets/laravel-dynamic-pages.git",
"reference": "24b681456ca8f7bef0a8d4d35aaafdf1fdc4072d"
"reference": "299e024107fcc0649da2d9d6653e789842cc0d45"
},
"dist": {
"type": "zip",
"url": "https://lab.s-web.fr/api/v4/projects/250/packages/composer/archives/uwil/laravel-dynamic-pages.zip?sha=24b681456ca8f7bef0a8d4d35aaafdf1fdc4072d",
"reference": "24b681456ca8f7bef0a8d4d35aaafdf1fdc4072d",
"url": "https://lab.s-web.fr/api/v4/projects/250/packages/composer/archives/uwil/laravel-dynamic-pages.zip?sha=299e024107fcc0649da2d9d6653e789842cc0d45",
"reference": "299e024107fcc0649da2d9d6653e789842cc0d45",
"shasum": ""
},
"require": {

View file

@ -37,7 +37,7 @@ return [
//'cy' => ['name' => 'Welsh', 'script' => 'Latn', 'native' => 'Cymraeg', 'regional' => 'cy_GB'],
//'da' => ['name' => 'Danish', 'script' => 'Latn', 'native' => 'dansk', 'regional' => 'da_DK'],
//'se' => ['name' => 'Northern Sami', 'script' => 'Latn', 'native' => 'davvisámegiella', 'regional' => 'se_NO'],
'de' => ['name' => 'German', 'script' => 'Latn', 'native' => 'Deutsch', 'regional' => 'de_DE'],
//'de' => ['name' => 'German', 'script' => 'Latn', 'native' => 'Deutsch', 'regional' => 'de_DE'],
//'luo' => ['name' => 'Luo', 'script' => 'Latn', 'native' => 'Dholuo', 'regional' => ''],
//'nv' => ['name' => 'Navajo', 'script' => 'Latn', 'native' => 'Diné bizaad', 'regional' => ''],
//'dua' => ['name' => 'Duala', 'script' => 'Latn', 'native' => 'duálá', 'regional' => ''],
@ -49,7 +49,7 @@ return [
//'en-GB' => ['name' => 'British English', 'script' => 'Latn', 'native' => 'British English', 'regional' => 'en_GB'],
//'en-CA' => ['name' => 'Canadian English', 'script' => 'Latn', 'native' => 'Canadian English', 'regional' => 'en_CA'],
//'en-US' => ['name' => 'U.S. English', 'script' => 'Latn', 'native' => 'U.S. English', 'regional' => 'en_US'],
'es' => ['name' => 'Spanish', 'script' => 'Latn', 'native' => 'español', 'regional' => 'es_ES'],
//'es' => ['name' => 'Spanish', 'script' => 'Latn', 'native' => 'español', 'regional' => 'es_ES'],
//'eo' => ['name' => 'Esperanto', 'script' => 'Latn', 'native' => 'esperanto', 'regional' => ''],
//'eu' => ['name' => 'Basque', 'script' => 'Latn', 'native' => 'euskara', 'regional' => 'eu_ES'],
//'ewo' => ['name' => 'Ewondo', 'script' => 'Latn', 'native' => 'ewondo', 'regional' => ''],
@ -133,7 +133,7 @@ return [
//'mtr' => ['name' => 'Mewari', 'script' => 'Latn', 'native' => 'Mewari', 'regional' => ''],
//'mua' => ['name' => 'Mundang', 'script' => 'Latn', 'native' => 'Mundang', 'regional' => ''],
//'mi' => ['name' => 'Māori', 'script' => 'Latn', 'native' => 'Māori', 'regional' => 'mi_NZ'],
'nl' => ['name' => 'Dutch', 'script' => 'Latn', 'native' => 'Nederlands', 'regional' => 'nl_NL'],
//'nl' => ['name' => 'Dutch', 'script' => 'Latn', 'native' => 'Nederlands', 'regional' => 'nl_NL'],
//'nmg' => ['name' => 'Kwasio', 'script' => 'Latn', 'native' => 'ngumba', 'regional' => ''],
//'yav' => ['name' => 'Yangben', 'script' => 'Latn', 'native' => 'nuasue', 'regional' => ''],
//'nn' => ['name' => 'Norwegian Nynorsk', 'script' => 'Latn', 'native' => 'nynorsk', 'regional' => 'nn_NO'],
@ -145,7 +145,7 @@ return [
//'hz' => ['name' => 'Herero', 'script' => 'Latn', 'native' => 'Otjiherero', 'regional' => ''],
//'uz-Latn' => ['name' => 'Uzbek (Latin)', 'script' => 'Latn', 'native' => 'oʼzbekcha', 'regional' => 'uz_UZ'],
//'nds' => ['name' => 'Low German', 'script' => 'Latn', 'native' => 'Plattdüütsch', 'regional' => 'nds_DE'],
'pl' => ['name' => 'Polish', 'script' => 'Latn', 'native' => 'polski', 'regional' => 'pl_PL'],
//'pl' => ['name' => 'Polish', 'script' => 'Latn', 'native' => 'polski', 'regional' => 'pl_PL'],
//'pt' => ['name' => 'Portuguese', 'script' => 'Latn', 'native' => 'português', 'regional' => 'pt_PT'],
//'pt-BR' => ['name' => 'Brazilian Portuguese', 'script' => 'Latn', 'native' => 'português do Brasil', 'regional' => 'pt_BR'],
//'ff' => ['name' => 'Fulah', 'script' => 'Latn', 'native' => 'Pulaar', 'regional' => 'ff_SN'],

61
config/sentry.php Normal file
View file

@ -0,0 +1,61 @@
<?php
return [
'dsn' => env('SENTRY_LARAVEL_DSN', env('SENTRY_DSN')),
// The release version of your application.
// Example with dynamic git hash: trim(exec('git --git-dir ' . base_path('.git') . ' log --pretty="%h" -n1 HEAD')).
'release' => env('SENTRY_RELEASE'),
// When left empty or `null` the Laravel environment will be used.
'environment' => env('SENTRY_ENVIRONMENT'),
'breadcrumbs' => [
// Capture Laravel logs in breadcrumbs.
'logs' => true,
// Capture SQL queries in breadcrumbs.
'sql_queries' => true,
// Capture bindings on SQL queries logged in breadcrumbs.
'sql_bindings' => false,
// Capture queue job information in breadcrumbs.
'queue_info' => true,
// Capture command information in breadcrumbs.
'command_info' => true,
],
'tracing' => [
// Trace queue jobs as their own transactions.
'queue_job_transactions' => env('SENTRY_TRACE_QUEUE_ENABLED', false),
// Capture queue jobs as spans when executed on the sync driver.
'queue_jobs' => true,
// Capture SQL queries as spans.
'sql_queries' => true,
// Try to find out where the SQL query originated from and add it to the query spans.
'sql_origin' => true,
// Capture views as spans.
'views' => true,
// Indicates if the tracing integrations supplied by Sentry should be loaded.
'default_integrations' => true,
// Indicates that requests without a matching route should be traced.
'missing_routes' => false,
],
// See: https://docs.sentry.io/platforms/php/guides/laravel/configuration/options/#send-default-pii.
'send_default_pii' => env('SENTRY_SEND_DEFAULT_PII', false),
// See: https://docs.sentry.io/platforms/php/guides/laravel/configuration/options/#traces-sample-rate.
'traces_sample_rate' => env('SENTRY_TRACES_SAMPLE_RATE') === null ? null : (float) env('SENTRY_TRACES_SAMPLE_RATE'),
'before_send' => [\Uwil\LaravelCommon\Helpers\ExceptionsHelper::class, 'sentryEventHandler'],
];

View file

@ -35,4 +35,11 @@ return [
],
],
'google' => [
'recaptcha' => [
'public' => env('GOOGLE_RECAPTCHA_PUBLIC'),
'private' => env('GOOGLE_RECAPTCHA_PRIVATE'),
'version' => env('GOOGLE_RECAPTCHA_VERSION', "3") === "3" ? true : false
]
],
];

View file

@ -0,0 +1,56 @@
# Guide d'utilisation du système ReCaptcha Provider
Ce guide explique comment utiliser notre système ReCaptcha basé sur un **Provider** et un hook React, pour simplifier l'intégration de Google reCAPTCHA avec gestion des cookies.
---
## 1. Structure du système
Le système se compose de trois éléments principaux :
1. **`RecaptchaProvider`**
- Encapsule votre formulaire et active le reCAPTCHA automatiquement selon le statut des cookies.
- Fournit un contexte React (`useRecaptcha`) pour accéder au token et au `formRef`.
2. **`useRecaptcha`**
- Hook React pour accéder au contexte du Provider.
- Fournit :
- `enabled` : booléen indiquant si le reCAPTCHA est actif (cookie accepté).
- `getToken()` : fonction pour récupérer le token reCAPTCHA actuel.
- `formRef` : référence au formulaire pour manipulation ou focus.
3. **`RecaptchaForm`**
- Wrapper autour du `<form>` standard.
- S'occupe de :
- Injecter le conteneur reCAPTCHA `.r_captcha` si actif.
- Ajouter l’attribut `inert` sur le formulaire si le reCAPTCHA n’est pas encore activé.
- Appeler la fonction `getToken()` au submit si nécessaire.
---
## 2. Utilisation dans un formulaire
```tsx
import { useForm } from "@inertiajs/react";
import { RecaptchaProvider } from "@/front/providers/RecaptchaProvider";
import RecaptchaForm from "@/front/Components/Base/RecaptchaForm";
export default function ContactForm() {
const { data, setData, post, processing } = useForm({
name: "",
email: "",
message: "",
});
const handleSubmit = (token: string) => {
post("/contact");
};
return (
<RecaptchaProvider>
<RecaptchaForm onSubmit={handleSubmit} data={data}>
...input + boutton submit (pas besoin de balise form)
</RecaptchaForm>
</RecaptchaProvider>
);
}

View file

@ -0,0 +1,48 @@
## Fonctionnement du composant `RecaptchaForm`
Le composant `RecaptchaForm` est un wrapper autour d’un `<form>` classique qui gère automatiquement :
1. L’injection du conteneur ReCaptcha (`.r_captcha`)
2. L’état actif ou inactif du formulaire via l’attribut `inert`
3. La récupération et l’injection du token reCAPTCHA dans les données du formulaire
4. L’affichage d’un bandeau d’alerte si les cookies reCAPTCHA ne sont pas encore acceptés
---
### 1. Props principales
| Prop | Type | Description |
|------|------|-------------|
| `onSubmit` | `(e: FormEvent<HTMLFormElement>) => void` | Callback appelé au submit avec le token déjà injecté dans `data["g-recaptcha-response"]`. |
| `data` | `TFormData & { "g-recaptcha-response"?: string }` | Objet représentant les données du formulaire. Le token reCAPTCHA y est ajouté automatiquement. |
| `children` | `React.ReactNode` | Champs et éléments du formulaire. |
| `banner` | `BannerClassName` | Optionnel. Permet de personnaliser le bandeau d’alerte affiché si le reCAPTCHA n’est pas activé. |
| `classNames` | `{ wrapperClassName?: string; formClassName?: string; }` | Optionnel. Permet de passer des classes CSS personnalisées pour le wrapper et le `<form>`. |
---
### 2. Comportement
- **Désactivation automatique du formulaire** :
Le formulaire est rendu `inert` si le reCAPTCHA n’est pas actif (cookie non accepté), empêchant l’interaction avec les champs et les boutons.
```ts
<form inert={!enabled} ... >
```
### Injection du token reCAPTCHA :
Au submit, si le reCAPTCHA est activé, le hook useRecaptcha récupère le token et l’injecte dans data["g-recaptcha-response"] avant d’appeler le callback onSubmit.
```tsx
const handleSubmit = (e: FormEvent<HTMLFormElement>) => {
...
data["g-recaptcha-response"] = token;
...
};
```
### Bandeau d’information (RecaptchaNotice) :
S’affiche uniquement si le reCAPTCHA n’est pas actif.
Invite l’utilisateur à accepter les cookies pour activer le formulaire.
Un bouton Accepter déclenche window.WebCookieNotice?.acceptCookie("recaptcha").

View file

@ -0,0 +1,127 @@
# Documentation du `RecaptchaProvider`
Le `RecaptchaProvider` est un composant React qui encapsule la logique d’intégration de Google reCAPTCHA avec gestion des cookies et état du formulaire. Il fonctionne avec **Inertia.js** et **React**, et simplifie l’activation du reCAPTCHA dans n’importe quel formulaire.
---
## 1. Installation et import
```tsx
import { RecaptchaProvider, useRecaptcha } from "@/front/providers/RecaptchaProvider";
// Ensuite, enveloppe ton formulaire avec le provider :
<RecaptchaProvider>
<MonFormulaire />
</RecaptchaProvider>
// Tu peux être plus propre et entourer tout ton Applayout, ce qui évite d'encapsuler chaque formulaire
<RecaptchaProvider>
{children}
</RecaptchaProvider>
```
## 2. Fonctionnement général
Le provider expose :
- `enabled` : `boolean` indiquant si le reCAPTCHA est activé (cookie accepté).
- `getToken()` : fonction pour récupérer le token généré par Google reCAPTCHA.
- `formRef` : référence vers le `<form>` HTML, utilisée pour injecter le conteneur reCAPTCHA et désactiver le formulaire si nécessaire.
### 2.1 Gestion automatique des cookies
Le provider utilise le hook `useCookieNotice` pour vérifier si l’utilisateur a accepté le service RECAPTCHA.
- Si accepté → le reCAPTCHA est initialisé sur le formulaire.
- Si non accepté → le formulaire reste inert, empêchant toute interaction jusqu’à ce que l’utilisateur donne son consentement.
### 2.2 Injection du formulaire
Le provider utilise `InitRecaptcha([formRef.current])` pour :
- Créer un `<div class="g-recaptcha">` dans le formulaire.
- Charger le script Google reCAPTCHA de manière asynchrone.
- Gérer le reset du reCAPTCHA si nécessaire.
### 2.3 Désactivation du formulaire
Le formulaire est automatiquement rendu `inert` tant que le reCAPTCHA n’est pas actif. Cela empêche les utilisateurs d’envoyer le formulaire avant d’avoir accepté les cookies.
## 3. Utilisation du hook useRecaptcha
Dans un composant enfant du provider, tu peux accéder au contexte avec :
```tsx
const { enabled, getToken, formRef } = useRecaptcha();
```
Exemples :
- Vérifier si le reCAPTCHA est activé :
```tsx
if (!enabled) {
console.log("Le reCAPTCHA n'est pas actif");
}
```
- Récupérer le token au moment du submit :
```tsx
const token = getToken();
data["g-recaptcha-response"] = token;
post(route('contact.submit'), { data });
```
- Associer formRef à un `<form>` :
```tsx
<form ref={formRef} data-recaptcha-key={recaptchaKey}>
...
</form>
```
## 4. Exemple complet avec Inertia
```tsx
<RecaptchaProvider>
<RecaptchaForm
data={formData}
onSubmit={(e) => post(route("contact.submit"), { data: formData })}
>
<input name="email" value={formData.email} onChange={e => setFormData("email", e.target.value)} />
<textarea name="message" value={formData.message} onChange={e => setFormData("message", e.target.value)} />
<button type="submit">Envoyer</button>
</RecaptchaForm>
</RecaptchaProvider>
```
- Le formulaire est désactivé automatiquement si l’utilisateur n’a pas accepté le reCAPTCHA.
- Le token reCAPTCHA est injecté automatiquement au moment du submit.
- La logique de cookie consent est gérée sans code supplémentaire.
## 5. RecaptchaForm : comment ça fonctionne
Le composant `RecaptchaForm` est un wrapper de formulaire qui gère le reCAPTCHA et l’état inert.
- `onSubmit` : callback déclenché lorsque le formulaire est soumis et que le reCAPTCHA est actif.
- `data` : objet contenant les données du formulaire, incluant `g-recaptcha-response`.
- `children` : champs du formulaire.
- `banner` : optionnel, permet d’afficher un message si le reCAPTCHA n’est pas encore activé.
#### Fonctionnalités clés
- Inert automatiquement : le formulaire est bloqué tant que le consentement n’est pas donné.
- Token automatique : le token reCAPTCHA est récupéré et injecté dans `data["g-recaptcha-response"]`.
- Notification de cookie : un banner s’affiche pour informer l’utilisateur et lui permettre d’accepter le service.
## 6. Avantages du `RecaptchaProvider`
- Séparation claire des responsabilités : le provider gère uniquement l’état du reCAPTCHA et des cookies.
- Réutilisable : peut encapsuler plusieurs formulaires ou pages sans dupliquer le code.
- Sécurité : empêche toute soumission tant que le consentement n’est pas donné.
- Intégration simple avec Inertia.js : compatible avec `useForm()` et `usePage()`.
- Flexible : expose `formRef` pour un contrôle direct du `<form>`.
## 7. Bonnes pratiques
- Toujours placer les formulaires à l’intérieur du `RecaptchaProvider`.
- Ne pas appeler `getToken()` en dehors du submit pour éviter des tokens invalides.
- Utiliser le champ `data-recaptcha-key` sur le `<form>` pour que InitRecaptcha puisse initialiser correctement le reCAPTCHA.

View file

@ -1,7 +0,0 @@
<?php
declare(strict_types=1);
return [
// "dashboard" => "Tableau de bord",
];

View file

@ -1,11 +0,0 @@
<?php
declare(strict_types=1);
return [
// "user-role" => [
// "conceptor" => "Concepteur",
// "admin" => "Administrateur",
// "visitor" => "Visiteur",
// ],
];

View file

@ -1,56 +0,0 @@
<?php
return [
"400" => [
"title" => "Ungültige Anfrage",
"description" => "Der Server konnte Ihre Anfrage nicht verstehen. Bitte überprüfen Sie sie und versuchen Sie es erneut.",
],
"401" => [
"title" => "Nicht autorisiert",
"description" => "Sie müssen angemeldet sein, um auf diese Seite zuzugreifen.",
],
"403" => [
"title" => "Zugriff verweigert",
"description" => "Entschuldigung, Sie haben keine Berechtigung, auf diese Seite zuzugreifen.",
],
"404" => [
"title" => "Seite nicht gefunden",
"description" => "Entschuldigung, die von Ihnen gesuchte Seite konnte nicht gefunden werden.",
],
"405" => [
"title" => "Methode nicht erlaubt",
"description" => "Die für diese Anfrage verwendete Methode ist nicht erlaubt.",
],
"408" => [
"title" => "Zeitüberschreitung",
"description" => "Der Server hat zu lange gebraucht, um zu antworten. Bitte versuchen Sie es erneut.",
],
"419" => [
"title" => "Seite abgelaufen",
"description" => "Ihre Sitzung ist abgelaufen. Bitte aktualisieren Sie die Seite und versuchen Sie es erneut.",
],
"422" => [
"title" => "Nicht verarbeitbare Entität",
"description" => "Die bereitgestellten Daten sind ungültig. Bitte überprüfen Sie sie und versuchen Sie es erneut.",
],
"429" => [
"title" => "Zu viele Anfragen",
"description" => "Sie haben zu viele Anfragen in kurzer Zeit gesendet. Bitte warten Sie einen Moment und versuchen Sie es erneut.",
],
"500" => [
"title" => "Serverfehler",
"description" => "Ups, es ist ein Fehler auf unseren Servern aufgetreten.",
],
"502" => [
"title" => "Fehlerhafte Gateway-Antwort",
"description" => "Der Server hat eine ungültige Antwort erhalten. Bitte versuchen Sie es später erneut.",
],
"503" => [
"title" => "Dienst nicht verfügbar",
"description" => "Entschuldigung, wir führen gerade Wartungsarbeiten durch. Bitte versuchen Sie es später erneut.",
],
"504" => [
"title" => "Gateway-Zeitüberschreitung",
"description" => "Der Server hat zu lange gebraucht, um zu antworten. Bitte versuchen Sie es später erneut.",
],
];

View file

@ -1,6 +0,0 @@
<?php
return [
"homepage" => "Hallo Welt",
"back_to_your_website" => "Zurück zur Startseite",
];

View file

@ -1,9 +0,0 @@
<?php
declare(strict_types=1);
return [
"classes" => [
// "users" => "utilisateur|utilisateurs",
],
];

View file

@ -1,9 +0,0 @@
<?php
declare(strict_types=1);
return [
"custom" => [
// "published" => "publié",
],
];

47
lang/en/cookie-notice.php Normal file
View file

@ -0,0 +1,47 @@
<?php
return [
'button_customize_cookies' => 'Customize cookies',
'button_close_cookies' => 'Close cookie window',
'button_toggle_cookie' => 'Accept or refuse',
'button_forbid_all' => 'Refuse all',
'button_allow_all' => 'Accept all',
'button_forbid_all_title' => 'Refuse all cookies and close the cookies panel',
'button_allow_all_title' => 'Accept all cookies and close the cookies panel',
'button_customize' => 'Customize',
'button_validate_and_close' => 'Confirm and close',
'button_title_open_new_tab' => 'Open link in new tab',
'banner_title' => 'The :site_name website uses cookies!',
'banner_text' => 'We use cookies to ensure the proper functioning of our site and for analytical purposes.
You can change your mind at any time by clicking on the icon on any page of our site.
By authorizing these third-party services, you agree to the deposit and reading of cookies and the use of tracking technologies necessary for their proper operation.',
'modal_title' => 'Cookie management window',
'panel_content' => 'Cookie management panel content',
'picture_cookie_title' => 'Image of a nice big cookie',
'navigation_title' => 'Cookies panel navigation',
'custom' => [
'analytics' => [
'title' => 'Google Analytics',
'description' => 'Audience measurement services make it possible to generate attendance statistics useful for improving the site.',
],
'youtube' => [
'title' => 'Youtube',
'description' => 'Cookies placed via video sharing services are intended to allow the user to view multimedia content directly on the site.',
'labelLink' => 'Learn more',
'warning' => 'You must accept cookies to view this video',
'accept' => 'Accept'
],
'matomo' => [
'title' => 'Matomo',
'description' => 'Audience measurement services are used to generate traffic statistics, which are useful for improving the site.',
'labelLink' => 'Learn more',
],
'recaptcha' => [
'title' => 'reCAPTCHA',
'description' => 'The purpose of the cookies placed on forms via the recaptcha is to prevent them from being submitted by robots.',
'labelLink' => 'Learn more',
'warning' => 'You must accept reCAPTCHA cookies to send the form',
'accept' => 'Accept reCAPTCHA'
]
]
];

View file

@ -4,6 +4,41 @@ declare(strict_types=1);
return [
"custom" => [
// "published" => "publié",
"contact_form" => [
"last_name" => [
"label" => "last name",
"placeholder" => "your last name"
],
"first_name" => [
"label" => "first name",
"placeholder" => "your first name"
],
"phone" => [
"label" => "phone number",
"placeholder" => "06.**.**.**.**"
],
"mail" => [
"label" => "email address",
"placeholder" => "example@gmail.com"
],
"entreprise_name" => [
"label" => "company name",
"placeholder" => "your company name"
],
"activity_sector" => [
"label" => "your business sector",
"placeholder" => "choose an activity"
],
"object" => [
"label" => "message subject",
"placeholder" => "choose a subject"
],
"message" => [
"label" => "your message",
"placeholder" => "what is your message?"
],
"terms" => "The information collected through this form is processed by the Data Controller to respond to your contact request. To learn about your rights, you can consult the",
"optin" => "I would like to subscribe to the newsletter"
]
],
];
];

View file

@ -1,7 +0,0 @@
<?php
declare(strict_types=1);
return [
// "dashboard" => "Tableau de bord",
];

View file

@ -1,11 +0,0 @@
<?php
declare(strict_types=1);
return [
// "user-role" => [
// "conceptor" => "Concepteur",
// "admin" => "Administrateur",
// "visitor" => "Visiteur",
// ],
];

View file

@ -1,56 +0,0 @@
<?php
return [
"400" => [
"title" => "Solicitud incorrecta",
"description" => "El servidor no pudo entender su solicitud. Por favor, verifique e intente nuevamente.",
],
"401" => [
"title" => "No autorizado",
"description" => "Debe iniciar sesión para acceder a esta página.",
],
"403" => [
"title" => "Acceso prohibido",
"description" => "Lo sentimos, no está autorizado para acceder a esta página.",
],
"404" => [
"title" => "Página no encontrada",
"description" => "Lo sentimos, la página que busca no se encuentra.",
],
"405" => [
"title" => "Método no permitido",
"description" => "El método utilizado para esta solicitud no está permitido.",
],
"408" => [
"title" => "Tiempo de espera agotado",
"description" => "El servidor tardó demasiado en responder. Por favor, intente nuevamente.",
],
"419" => [
"title" => "Página expirada",
"description" => "Su sesión ha expirado. Por favor, actualice y vuelva a intentarlo.",
],
"422" => [
"title" => "Entidad no procesable",
"description" => "Los datos proporcionados no son válidos. Por favor, verifique e intente nuevamente.",
],
"429" => [
"title" => "Demasiadas solicitudes",
"description" => "Ha realizado demasiadas solicitudes en poco tiempo. Por favor, espere antes de intentar nuevamente.",
],
"500" => [
"title" => "Error del servidor",
"description" => "Ups, ocurrió un error en nuestros servidores.",
],
"502" => [
"title" => "Puerta de enlace incorrecta",
"description" => "El servidor recibió una respuesta inválida. Por favor, intente nuevamente más tarde.",
],
"503" => [
"title" => "Servicio no disponible",
"description" => "Lo sentimos, estamos realizando mantenimiento. Por favor, vuelva más tarde.",
],
"504" => [
"title" => "Tiempo de espera de la puerta de enlace agotado",
"description" => "El servidor tardó demasiado en responder. Por favor, intente nuevamente más tarde.",
],
];

View file

@ -1,6 +0,0 @@
<?php
return [
"homepage" => "Hola Mundo",
"back_to_your_website" => "Volver a la página de inicio",
];

View file

@ -1,9 +0,0 @@
<?php
declare(strict_types=1);
return [
"classes" => [
// "users" => "utilisateur|utilisateurs",
],
];

View file

@ -1,9 +0,0 @@
<?php
declare(strict_types=1);
return [
"custom" => [
// "published" => "publié",
],
];

47
lang/fr/cookie-notice.php Normal file
View file

@ -0,0 +1,47 @@
<?php
return [
'button_customize_cookies' => 'Personnaliser les cookies',
'button_close_cookies' => 'Fermer la fenêtre des cookies',
'button_toggle_cookie' => 'Autoriser ou refuser',
'button_forbid_all' => 'Tout refuser',
'button_allow_all' => 'Tout accepter',
'button_forbid_all_title' => 'Refuser tous les cookies et fermer le panneau des cookies',
'button_allow_all_title' => 'Accepter tous les cookies et fermer le panneau des cookies',
'button_customize' => 'Personnaliser',
'button_validate_and_close' => 'Valider et fermer',
'button_title_open_new_tab' => 'Ouvrir le lien dans un nouvel onglet',
'banner_title' => 'Le site internet :site_name utilise des cookies !',
'banner_text' => 'Nous utilisons des cookies pour nous assurer du bon fonctionnement de notre site et à des fins analytiques.
Vous pouvez changer d’avis à tout moment en cliquant sur l’icône présente sur chaque page de notre site.
En autorisant ces services tiers, vous acceptez le dépôt et la lecture de cookies et l’utilisation de technologies de suivi nécessaires à leur bon fonctionnement.',
'modal_title' => 'Fenêtre de gestion de cookies',
'panel_content' => 'Contenu du panneau des cookies',
'picture_cookie_title' => 'Image d’un bon gros cookie',
'navigation_title' => 'Navigation du panneau des cookies',
'custom' => [
'analytics' => [
'title' => 'Google Analytics',
'description' => 'Les services de mesure d’audience permettent de générer des statistiques de fréquentation utiles à l’amélioration du site.',
],
'youtube' => [
'name' => 'Youtube',
'description' => 'Les cookies placés via les services de partage de vidéos sont destinés à permettre à l’utilisateur de visionner des contenus multimédias directement sur le site.',
'labelLink' => 'En apprendre plus',
'warning' => 'Vous devez accepter les cookies pour visionner cette vidéo',
'accept' => 'Autoriser'
],
'matomo' => [
'title' => 'Matomo',
'description' => 'Les services de mesure d’audience permettent de générer des statistiques de fréquentation utiles à l’amélioration du site.',
'labelLink' => 'En apprendre plus',
],
'recaptcha' => [
'title' => 'reCAPTCHA',
'description' => 'Les cookies qui sont déposés via le recaptcha sur les formulaires ont pour finalité d’empêcher que ceux-ci ne soient soumis par des robots.',
'labelLink' => 'En apprendre plus',
'warning' => 'Vous devez accepter les cookies reCAPTCHA pour envoyer le formulaire',
'accept' => 'Accepter reCAPTCHA'
]
]
];

View file

@ -2,5 +2,59 @@
return [
"homepage" => "Bonjour Monde",
"back_to_your_website" => "Revenir à la page d'accueil",
"back_to_your_website" => "Retour à la page d'accueil",
"ovoteam_product" => "produits ovoteam",
"see" => [
"all_products" => "voir tous les produits",
"product" => "voir le produit",
"recipe" => "voir la recette",
"all_recipes" => "voir toutes les recettes"
],
"know_more" => "en savoir plus",
"ovoteam_commit" => "ovoteam s'engage",
"discover_our_commit" => "découvrez nos engagements",
"ovoteam_recipe" => "recettes ovoteam",
"image" => [
"state_file_uploaded" => "un fichier à bien été chargé",
"modale_title" => "Modification de l'image",
"modale_description" => "Personnalisez le rendu selon vos besoins",
"action_the_crop" => ":action le cadrage",
"select_file_zone" => "Glisser-déposer un fichier ou cliquez pour en sélectionner un",
"select_img_zone" => "Glisser-déposer une image ou cliquez pour en sélectionner une",
"preview_image" => "Prévisualisation de l'image",
"refresh_original" => "remettre à l'état d'origine",
"toast" => [
"too_big" => "taille maximale autorisée : :maxSize. Le fichier est trop volumineux",
"no_file" => "aucun fichier sélectionné !",
"forbidden_file" => "fichier non autorisé.",
"too_many" => "le nombre de fichier autorisé est dépassé (1)",
"defaultError" => "une erreur est survenue !"
],
"validation" => [
"rules_between" => "le média doit faire :width px de large et :height px de haut.",
"rules_weight" => "taille max: :size",
"allowed_formats" => "formats autorisés: :formats",
"all_formats" => "tous"
],
"filters" => [
'zoomIn' => "zoom avant",
"zoomOut" => "zoom arrière",
"zoom" => "zoom",
"rotation_forward" => "rotation avant",
"rotation_back" => "rotation arrière",
"rotation" => "rotation",
"grayscale" => "noir & blanc",
"sepia" => "sépia",
"saturation" => "saturation",
"contrast" => "contraste",
"brightness" => "luminosité",
"reset" => "réinitialiser",
"vertical_flip" => "inverser verticalement",
"horizontal_flip" => "inverser horizontalement",
],
],
"gamme" => "Large gamme plein air",
"expertise" => "Expertise depuis 1963",
"made-in-france" => "Fabriqué en France",
"engage" => "Ovoteam s'engage"
];

View file

@ -4,6 +4,41 @@ declare(strict_types=1);
return [
"custom" => [
// "published" => "publié",
"contact_form" => [
"last_name" => [
"label" => "nom",
"placeholder" => "votre nom"
],
"first_name" => [
"label" => "prénom",
"placeholder" => "votre prénom"
],
"phone" => [
"label" => "numéro de téléphone",
"placeholder" => "06.**.**.**.**"
],
"mail" => [
"label" => "adresse mail",
"placeholder" => "exemple@gmail.com"
],
"entreprise_name" => [
"label" => "nom de l'entreprise",
"placeholder" => "le nom de votre entreprise"
],
"activity_sector" => [
"label" => "votre secteur d'activité",
"placeholder" => "choisir une activité"
],
"object" => [
"label" => "object du message",
"placeholder" => "choisir un objet"
],
"message" => [
"label" => "votre message",
"placeholder" => "quel est votre message ?"
],
"terms" => "Les informations recueillies à partir de ce formulaire sont traitées par le Responsable de Traitement pour donner suite à votre demande de contact. Pour connaître vos droits, vous pouvez consulter la",
"optin" => "je souhaite m'inscrire à la newsletter"
]
],
];
];

View file

@ -1,7 +0,0 @@
<?php
declare(strict_types=1);
return [
// "dashboard" => "Tableau de bord",
];

View file

@ -1,11 +0,0 @@
<?php
declare(strict_types=1);
return [
// "user-role" => [
// "conceptor" => "Concepteur",
// "admin" => "Administrateur",
// "visitor" => "Visiteur",
// ],
];

View file

@ -1,56 +0,0 @@
<?php
return [
"400" => [
"title" => "Ongeldig verzoek",
"description" => "De server kon je verzoek niet begrijpen. Controleer het en probeer het opnieuw.",
],
"401" => [
"title" => "Niet geautoriseerd",
"description" => "Je moet ingelogd zijn om deze pagina te bekijken.",
],
"403" => [
"title" => "Toegang geweigerd",
"description" => "Sorry, je hebt geen toestemming om deze pagina te bekijken.",
],
"404" => [
"title" => "Pagina niet gevonden",
"description" => "Sorry, de door jou gezochte pagina bestaat niet.",
],
"405" => [
"title" => "Methode niet toegestaan",
"description" => "De gebruikte methode voor dit verzoek is niet toegestaan.",
],
"408" => [
"title" => "Time-out",
"description" => "De server deed er te lang over om te reageren. Probeer het opnieuw.",
],
"419" => [
"title" => "Pagina verlopen",
"description" => "Je sessie is verlopen. Vernieuw de pagina en probeer het opnieuw.",
],
"422" => [
"title" => "Niet verwerkbare entiteit",
"description" => "De opgegeven gegevens zijn ongeldig. Controleer ze en probeer het opnieuw.",
],
"429" => [
"title" => "Te veel verzoeken",
"description" => "Je hebt te veel verzoeken in korte tijd gedaan. Wacht even en probeer het opnieuw.",
],
"500" => [
"title" => "Serverfout",
"description" => "Oeps, er is een fout op onze servers opgetreden.",
],
"502" => [
"title" => "Ongeldige gateway",
"description" => "De server heeft een ongeldig antwoord ontvangen. Probeer het later opnieuw.",
],
"503" => [
"title" => "Dienst niet beschikbaar",
"description" => "Sorry, we voeren onderhoud uit. Probeer het later opnieuw.",
],
"504" => [
"title" => "Gateway Time-out",
"description" => "De server deed er te lang over om te reageren. Probeer het later opnieuw.",
],
];

View file

@ -1,6 +0,0 @@
<?php
return [
"homepage" => "Hallo wereld",
"back_to_your_website" => "Terug naar de startpagina",
];

View file

@ -1,9 +0,0 @@
<?php
declare(strict_types=1);
return [
"classes" => [
// "users" => "utilisateur|utilisateurs",
],
];

View file

@ -1,9 +0,0 @@
<?php
declare(strict_types=1);
return [
"custom" => [
// "published" => "publié",
],
];

View file

@ -1,7 +0,0 @@
<?php
declare(strict_types=1);
return [
// "dashboard" => "Tableau de bord",
];

View file

@ -1,11 +0,0 @@
<?php
declare(strict_types=1);
return [
// "user-role" => [
// "conceptor" => "Concepteur",
// "admin" => "Administrateur",
// "visitor" => "Visiteur",
// ],
];

View file

@ -1,56 +0,0 @@
<?php
return [
"400" => [
"title" => "Nieprawidłowe żądanie",
"description" => "Serwer nie mógł zrozumieć Twojego żądania. Sprawdź je i spróbuj ponownie.",
],
"401" => [
"title" => "Nieautoryzowany",
"description" => "Musisz być zalogowany, aby uzyskać dostęp do tej strony.",
],
"403" => [
"title" => "Dostęp zabroniony",
"description" => "Przepraszamy, nie masz uprawnień do tej strony.",
],
"404" => [
"title" => "Strona nie znaleziona",
"description" => "Przepraszamy, strona, której szukasz, nie istnieje.",
],
"405" => [
"title" => "Metoda niedozwolona",
"description" => "Użyta metoda żądania nie jest dozwolona.",
],
"408" => [
"title" => "Przekroczono czas oczekiwania",
"description" => "Serwer potrzebował zbyt dużo czasu, aby odpowiedzieć. Spróbuj ponownie.",
],
"419" => [
"title" => "Strona wygasła",
"description" => "Twoja sesja wygasła. Odśwież stronę i spróbuj ponownie.",
],
"422" => [
"title" => "Nieprzetwarzalna jednostka",
"description" => "Dostarczone dane są nieprawidłowe. Sprawdź je i spróbuj ponownie.",
],
"429" => [
"title" => "Za dużo żądań",
"description" => "Wysłano zbyt wiele żądań w krótkim czasie. Poczekaj chwilę i spróbuj ponownie.",
],
"500" => [
"title" => "Błąd serwera",
"description" => "Ups, wystąpił błąd po stronie serwera.",
],
"502" => [
"title" => "Zła brama",
"description" => "Serwer otrzymał nieprawidłową odpowiedź. Spróbuj ponownie później.",
],
"503" => [
"title" => "Usługa niedostępna",
"description" => "Przepraszamy, trwa konserwacja. Spróbuj ponownie później.",
],
"504" => [
"title" => "Przekroczono czas oczekiwania bramy",
"description" => "Serwer potrzebował zbyt dużo czasu, aby odpowiedzieć. Spróbuj ponownie później.",
],
];

View file

@ -1,6 +0,0 @@
<?php
return [
"homepage" => "Witaj świecie",
"back_to_your_website" => "Powrót do strony głównej",
];

View file

@ -1,9 +0,0 @@
<?php
declare(strict_types=1);
return [
"classes" => [
// "users" => "utilisateur|utilisateurs",
],
];

View file

@ -1,9 +0,0 @@
<?php
declare(strict_types=1);
return [
"custom" => [
// "published" => "publié",
],
];

View file

@ -21,18 +21,8 @@ data:
MAIL_USERNAME: "${APP_MAIL_USERNAME}"
MAIL_PASSWORD: "${APP_MAIL_PASSWORD}"
MAIL_ENCRYPTION: "${APP_MAIL_ENCRYPTION}"
MAIL_FROM_ADDRESS: "${APP_MAIL_FROM_ADDRESS}"
MAIL_FROM_NAME: "${APP_APP_NAME}"
SENTRY_LARAVEL_DSN: "${APP_SENTRY_LARAVEL_DSN}"
TELESCOPE_ENABLED: "${APP_TELESCOPE_ENABLED}"
CRM_ENDPOINT: "${APP_CRM_ENDPOINT}"
CRM_TOKEN: "${APP_CRM_TOKEN}"
CRM_PASSWORD: "${APP_CRM_PASSWORD}"
MATOMO_SITE_ID: "${APP_MATOMO_SITE_ID}"
GOOGLE_RECAPTCHA_PRIVATE: "${APP_GOOGLE_RECAPTCHA_PRIVATE}"
GOOGLE_RECAPTCHA_PUBLIC: "${APP_GOOGLE_RECAPTCHA_PUBLIC}"
GOOGLE_RECAPTCHA_VERSION: "${APP_GOOGLE_RECAPTCHA_VERSION}"
GOOGLE_MAPS_KEY: "${APP_GOOGLE_MAPS_KEY}"
SCOUT_PREFIX: "${APP_SCOUT_PREFIX}"
SCOUT_QUEUE: "${APP_SCOUT_QUEUE}"
MEILISEARCH_HOST: "meilisearch.common-services:7700"
@ -42,7 +32,13 @@ data:
SAML2_CONTACT_TECHNICAL_EMAIL: "${APP_SAML2_CONTACT_TECHNICAL_EMAIL}"
SAML2_CONTACT_SUPPORT_EMAIL: "${APP_SAML2_CONTACT_SUPPORT_EMAIL}"
SAML2_DEFAULT_TENANT_UUID: "${APP_SAML2_DEFAULT_TENANT_UUID}"
MATOMO_SITE_ID: "${APP_MATOMO_SITE_ID}"
UWIL_ADMIN_SECURE_CIDR_LIST: "${APP_GLOBAL_UWIL_ADMIN_SECURE_CIDR_LIST}"
GOOGLE_RECAPTCHA_PRIVATE: "${APP_GOOGLE_RECAPTCHA_PRIVATE}"
GOOGLE_RECAPTCHA_PUBLIC: "${APP_GOOGLE_RECAPTCHA_PUBLIC}"
GOOGLE_RECAPTCHA_VERSION: "${APP_GOOGLE_RECAPTCHA_VERSION}"
SENTRY_LARAVEL_DSN: "${APP_SENTRY_LARAVEL_DSN}"
---
apiVersion: v1
kind: PersistentVolumeClaim

1498
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -15,6 +15,7 @@
},
"devDependencies": {
"@headlessui/react": "^2.2.9",
"@ldc-web/cookie-notice": "^6.1.1",
"@radix-ui/react-accordion": "^1.2.12",
"@radix-ui/react-checkbox": "^1.3.3",
"@radix-ui/react-collapsible": "^1.1.12",
@ -75,6 +76,7 @@
"@dnd-kit/utilities": "^3.2.2",
"@inertiajs/core": "^2.1.5",
"@inertiajs/react": "^2.3.18",
"@radix-ui/react-slot": "^1.2.4",
"@tanstack/react-table": "^8.21.3",
"@tiptap/core": "^3.21.0",
"@tiptap/extension-blockquote": "^3.21.0",
@ -115,11 +117,14 @@
"lucide-react": "^0.503.0",
"motion": "^12.38.0",
"prosemirror-state": "^1.4.4",
"radix-ui": "^1.4.3",
"react-color": "^2.19.3",
"react-dropzone": "^14.4.1",
"react-image-crop": "^11.0.10",
"slugify": "^1.6.8",
"swiper": "^12.1.3",
"tailwind-merge": "^3.5.0",
"vaul": "^1.1.2",
"ziggy-js": "^2.6.2",
"zod": "^4.3.6",
"zustand": "^5.0.12"

View file

@ -1,56 +1,56 @@
apiVersion: cert-manager.io/v1
kind: Certificate
metadata:
name: $APP_DOMAIN
spec:
dnsNames:
- $APP_DOMAIN
secretName: $APP_DOMAIN
issuerRef:
name: $APP_CERT_ISSUER
kind: ClusterIssuer
---
# Redirect with domain replacement
apiVersion: traefik.io/v1alpha1
kind: Middleware
metadata:
name: redirect-multi-to-ldcfr
spec:
redirectRegex:
regex: ^https://(.*)(corico|volaillesdeblancafort).fr(.*)
replacement: https://${REDIRECT}${APP_DOMAIN}
permanent: true
---
apiVersion: traefik.io/v1alpha1
kind: IngressRoute
metadata:
name: redirect-multi-to-ldcfr
spec:
entryPoints:
- websecure
routes:
- match: (Host(`corico.fr`) || Host(`www.corico.fr`) || Host(`volaillesdeblancafort.fr`) || Host(`www.volaillesdeblancafort.fr`)) && !PathPrefix(`/.well-known/acme-challenge/`)
kind: Rule
services:
- name: api@internal
kind: TraefikService
middlewares:
- name: redirect-multi-to-ldcfr
tls:
secretName: redirect-multi-to-ldcfr
---
apiVersion: cert-manager.io/v1
kind: Certificate
metadata:
name: redirect-multi-to-ldcfr
spec:
dnsNames:
- corico.fr
- www.corico.fr
- volaillesdeblancafort.fr
- www.volaillesdeblancafort.fr
secretName: redirect-multi-to-ldcfr
issuerRef:
name: $APP_CERT_ISSUER
kind: ClusterIssuer
# apiVersion: cert-manager.io/v1
# kind: Certificate
# metadata:
# name: $APP_DOMAIN
# spec:
# dnsNames:
# - $APP_DOMAIN
# secretName: $APP_DOMAIN
# issuerRef:
# name: $APP_CERT_ISSUER
# kind: ClusterIssuer
# ---
# # Redirect with domain replacement
# apiVersion: traefik.io/v1alpha1
# kind: Middleware
# metadata:
# name: redirect-multi-to-ldcfr
# spec:
# redirectRegex:
# regex: ^https://(.*)(corico|volaillesdeblancafort).fr(.*)
# replacement: https://${REDIRECT}${APP_DOMAIN}
# permanent: true
# ---
# apiVersion: traefik.io/v1alpha1
# kind: IngressRoute
# metadata:
# name: redirect-multi-to-ldcfr
# spec:
# entryPoints:
# - websecure
# routes:
# - match: (Host(`corico.fr`) || Host(`www.corico.fr`) || Host(`volaillesdeblancafort.fr`) || Host(`www.volaillesdeblancafort.fr`)) && !PathPrefix(`/.well-known/acme-challenge/`)
# kind: Rule
# services:
# - name: api@internal
# kind: TraefikService
# middlewares:
# - name: redirect-multi-to-ldcfr
# tls:
# secretName: redirect-multi-to-ldcfr
# ---
# apiVersion: cert-manager.io/v1
# kind: Certificate
# metadata:
# name: redirect-multi-to-ldcfr
# spec:
# dnsNames:
# - corico.fr
# - www.corico.fr
# - volaillesdeblancafort.fr
# - www.volaillesdeblancafort.fr
# secretName: redirect-multi-to-ldcfr
# issuerRef:
# name: $APP_CERT_ISSUER
# kind: ClusterIssuer

BIN
public/assets/img/Logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 448 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 167 KiB

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -1,3 +1,6 @@
@use "./common/wysiwyg";
@tailwind base;
@tailwind components;
@tailwind utilities;

View file

@ -0,0 +1,21 @@
$primaryForegroundFront: hsl(227 65% 19%);
.tiptap {
color: $primaryForegroundFront;
h2 {
@apply text-4xl font-bold uppercase mb-3;
}
h3 {
@apply text-3xl font-bold mb-3;
}
ul {
@apply list-disc pl-6;
}
a {
@apply underline text-blue-500 cursor-pointer;
}
}

View file

@ -0,0 +1,163 @@
/* Gotham - Black */
@font-face {
font-display: swap;
font-family: "Gotham";
font-style: normal;
font-weight: 900;
src: url("&/fonts/Gotham/Gotham-Black.ttf") format("truetype");
}
/* Gotham - BlackItalic */
@font-face {
font-display: swap;
font-family: "Gotham";
font-style: italic;
font-weight: 900;
src: url("&/fonts/Gotham/Gotham-BlackItalic.ttf") format("truetype");
}
/* Gotham - Bold */
@font-face {
font-display: swap;
font-family: "Gotham";
font-style: normal;
font-weight: 700;
src: url("&/fonts/Gotham/Gotham-Bold.ttf") format("truetype");
}
/* Gotham - BoldItalic */
@font-face {
font-display: swap;
font-family: "Gotham";
font-style: italic;
font-weight: 700;
src: url("&/fonts/Gotham/Gotham-BoldItalic.ttf") format("truetype");
}
/* Gotham - Book */
@font-face {
font-display: swap;
font-family: "Gotham";
font-style: normal;
font-weight: 400;
src: url("&/fonts/Gotham/Gotham-Book.ttf") format("truetype");
}
/* Gotham - BookItalic */
@font-face {
font-display: swap;
font-family: "Gotham";
font-style: italic;
font-weight: 400;
src: url("&/fonts/Gotham/Gotham-BookItalic.ttf") format("truetype");
}
/* Gotham - Light */
@font-face {
font-display: swap;
font-family: "Gotham";
font-style: normal;
font-weight: 300;
src: url("&/fonts/Gotham/Gotham-Light.ttf") format("truetype");
}
/* Gotham - LightItalic */
@font-face {
font-display: swap;
font-family: "Gotham";
font-style: italic;
font-weight: 300;
src: url("&/fonts/Gotham/Gotham-LightItalic.ttf") format("truetype");
}
/* Gotham - Medium */
@font-face {
font-display: swap;
font-family: "Gotham";
font-style: normal;
font-weight: 500;
src: url("&/fonts/Gotham/Gotham-Medium.ttf") format("truetype");
}
/* Gotham - MediumItalic */
@font-face {
font-display: swap;
font-family: "Gotham";
font-style: italic;
font-weight: 500;
src: url("&/fonts/Gotham/Gotham-MediumItalic.ttf") format("truetype");
}
/* Gotham - Thin */
@font-face {
font-display: swap;
font-family: "Gotham";
font-style: normal;
font-weight: 100;
src: url("&/fonts/Gotham/Gotham-Thin.ttf") format("truetype");
}
/* Gotham - ThinItalic */
@font-face {
font-display: swap;
font-family: "Gotham";
font-style: italic;
font-weight: 100;
src: url("&/fonts/Gotham/Gotham-ThinItalic.ttf") format("truetype");
}
/* Gotham - Ultra */
@font-face {
font-display: swap;
font-family: "Gotham";
font-style: normal;
font-weight: 950;
src: url("&/fonts/Gotham/Gotham-Ultra.ttf") format("truetype");
}
/* Gotham - UltraItalic */
@font-face {
font-display: swap;
font-family: "Gotham";
font-style: italic;
font-weight: 950;
src: url("&/fonts/Gotham/Gotham-UltraItalic.ttf") format("truetype");
}
/* Gotham - Xlight */
@font-face {
font-display: swap;
font-family: "Gotham";
font-style: normal;
font-weight: 200;
src: url("/fonts/Gotham/Gotham-XLight.ttf") format("truetype");
}
/* Gotham - XLightItalic */
@font-face {
font-display: swap;
font-family: "Gotham";
font-style: italic;
font-weight: 200;
src: url("&/fonts/Gotham/Gotham-XLightItalic.ttf") format("truetype");
}
// DELIUS
/* Delius - Regular */
@font-face {
font-display: swap;
font-family: "Delius";
font-style: normal;
font-weight: 400;
src: url("&/fonts/Delius/Delius-Regular.ttf") format("truetype");
}
/* Delius - SwashCaps */
@font-face {
font-display: swap;
font-family: "Delius Swash Caps";
font-style: normal;
font-weight: 400;
src: url("&/fonts/Delius/DeliusSwashCaps-Regular.ttf") format("truetype");
}

View file

@ -1,20 +1,58 @@
// * COMMON CSS.
@use './../common';
@use './fonts';
@use './vendor/_cookie-notice';
body {
height: 100vh;
padding: 1.5rem;
margin: 0;
background-color: #f3f4f6;
> div {
display: flex;
height: 100%;
flex-direction: column;
align-items: center;
justify-content: center;
border-radius: 0.5rem;
background-color: #fff;
box-shadow: 0 1px 2px 0 #0000000d;
@layer base {
* {
--primary: 40 100% 64%;
--primary-foreground: 227 65% 19%;
--background: 0 0% 100%;
--secondary: 210 40% 96.1%;
--secondary-foreground: 222.2 47.4% 11.2%;
--accent: 220 14% 96%;
--accent-foreground: 227 51% 23%;
--foreground: 227 65% 19%;
--muted: 210 40% 96.1%;
--muted-foreground: 215.4 16.3% 46.9%;
--popover: 0 0% 100%;
--popover-foreground: 222.2 84% 4.9%;
--card: 0 0% 100%;
--card-foreground: 222.2 84% 4.9%;
--border: 214.3 31.8% 91.4%;
--input: 214.3 31.8% 91.4%;
--destructive: 0 84.2% 60.2%;
--destructive-foreground: 210 40% 98%;
--successive: 113 100% 38%;
--successive-foreground: 210 40% 98%;
--informative: 207 69% 48%;
--informative-foreground: 210 40% 98%;
--preventive: 46 100% 50%;
--preventive-foreground: 210 40% 98%;
--ring: 222.2 84% 4.9%;
--radius: 0.5rem;
}
* {
@apply border-border font-gotham;
}
body {
@apply bg-background text-foreground;
}
}
html {
scroll-behavior: smooth;
}
.swiper-pagination {
@apply w-full flex justify-center items-center;
}

View file

@ -0,0 +1,36 @@
@use "@ldc-web/cookie-notice/src/scss/variables" with (
$ck-primary-color: hsl(227 65% 19%),
$ck-secondary-color: hsl(227 65% 19%),
$cn-button-bg-color: hsl(40 100% 64%),
$ck-title-font: "Gotham",
$ck-text-font: "Gotham",
$ck-btn-background-color: hsl(40 100% 64%),
);
@use "@ldc-web/cookie-notice/src/scss/themes/standard";
.cn-banner-img {
width: 150px !important;
height: auto;
}
.cn-cookie-wrapper {
background-color: hsl(40 100% 64%);
}
.cn-banner-btn {
font-weight: bold;
}
.cn-content {
width: inherit;
}
#cn-cookie-btn svg {
path {
fill: hsl(227 65% 19%);
}
circle {
fill: hsl(227 65% 19%);
}
}

View file

@ -2,6 +2,9 @@ import { createInertiaApp } from "@inertiajs/react";
import { resolvePageComponent } from "laravel-vite-plugin/inertia-helpers";
import { createRoot } from "react-dom/client";
import axios from "axios";
import CookieNotice from "@ldc-web/cookie-notice";
import recaptcha from "./hooks/use-recaptcha";
// @ts-expect-error Env is always present.
const appName = import.meta.env.VITE_APP_NAME || "Laravel";
@ -27,3 +30,6 @@ createInertiaApp({
window.axios = axios;
window.axios.defaults.headers.common["X-Requested-With"] = "XMLHttpRequest";
window.CookieNotice = CookieNotice;
window.Recaptcha = recaptcha;

View file

@ -642,7 +642,14 @@ export const ModelSelect = forwardRef<ModelSelectRef, ModelSelectProps>(
if (onValueChange) {
onValueChange(defaultValues);
}
setData(name, multiple ? defaultValues : defaultValues[0]);
const singleDefaultValue = defaultValues.length > 0 ? defaultValues[0] : null;
setData(
name,
multiple
? defaultValues
: singleDefaultValue
);
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [defaultValues, onValueChange]);
@ -658,7 +665,13 @@ export const ModelSelect = forwardRef<ModelSelectRef, ModelSelectProps>(
if (onValueChange) {
onValueChange(values);
}
setData(name, multiple ? values : values[0]);
const singleDefaultValue = values.length > 0 ? values[0] : null;
setData(
name,
multiple
? values
: singleDefaultValue
);
},
clear: () => {
setSelectedValues([]);
@ -863,7 +876,13 @@ export const ModelSelect = forwardRef<ModelSelectRef, ModelSelectProps>(
if (onModelChange) {
onModelChange(newSelectedModels);
}
setData(name, multiple ? newSelectedValues : newSelectedValues[0]);
const singleDefaultValue = newSelectedValues.length > 0 ? newSelectedValues[0] : null;
setData(
name,
multiple
? newSelectedValues
: singleDefaultValue
);
}
};
@ -885,7 +904,13 @@ export const ModelSelect = forwardRef<ModelSelectRef, ModelSelectProps>(
if (onModelChange) {
onModelChange(newSelectedModels);
}
setData(name, multiple ? newSelectedValues : newSelectedValues[0]);
const singleDefaultValue = newSelectedValues.length > 0 ? newSelectedValues[0] : null;
setData(
name,
multiple
? newSelectedValues
: singleDefaultValue
);
if (closeOnSelect) {
setIsPopoverOpen(false);
}
@ -918,7 +943,13 @@ export const ModelSelect = forwardRef<ModelSelectRef, ModelSelectProps>(
}
setSelectedModels(newSelectedModels);
setData(name, multiple ? newSelectedValues : newSelectedValues[0]);
const singleDefaultValue = newSelectedValues.length > 0 ? newSelectedValues[0] : null;
setData(
name,
multiple
? newSelectedValues
: singleDefaultValue
);
} else {
if (maxSelection && selectedValues.length >= maxSelection) {
announce(`Maximum ${maxSelection} selection(s) allowed`, "assertive");
@ -935,7 +966,13 @@ export const ModelSelect = forwardRef<ModelSelectRef, ModelSelectProps>(
onModelChange(newSelectedModels);
}
setSelectedModels(newSelectedModels);
setData(name, multiple ? newSelectedValues : newSelectedValues[0]);
const singleDefaultValue = newSelectedValues.length > 0 ? newSelectedValues[0] : null;
setData(
name,
multiple
? newSelectedValues
: singleDefaultValue
);
}
if (closeOnSelect) {
setIsPopoverOpen(false);
@ -983,7 +1020,13 @@ export const ModelSelect = forwardRef<ModelSelectRef, ModelSelectProps>(
if (onModelChange) {
onModelChange(newSelectedModels);
}
setData(name, multiple ? newSelectedValues : newSelectedValues[0]);
const singleDefaultValue = newSelectedValues.length > 0 ? newSelectedValues[0] : null;
setData(
name,
multiple
? newSelectedValues
: singleDefaultValue
);
};
const toggleAll = () => {
@ -1013,7 +1056,13 @@ export const ModelSelect = forwardRef<ModelSelectRef, ModelSelectProps>(
if (onModelChange) {
onModelChange(allOptions);
}
setData(name, multiple ? allValues : allValues[0]);
const singleDefaultValue = allValues.length > 0 ? allValues[0] : null;
setData(
name,
multiple
? allValues
: singleDefaultValue
);
}
if (closeOnSelect) {
@ -1519,8 +1568,7 @@ export const ModelSelect = forwardRef<ModelSelectRef, ModelSelectProps>(
aria-selected={isSelected}
aria-label={`${getModelField(option)}${
isSelected ? ", selected" : ", not selected"
}
`}
}`}
className={cn(
"cursor-pointer gap-1.5 px-4 py-2 w-full h-auto min-h-10",
)}

View file

@ -1,30 +0,0 @@
// * Packages
import { createInertiaApp } from "@inertiajs/react";
import { resolvePageComponent } from "laravel-vite-plugin/inertia-helpers";
import { createRoot } from "react-dom/client";
import axios from "axios";
// @ts-expect-error Env is always present.
const appName = import.meta.env.VITE_APP_NAME || "Laravel";
createInertiaApp({
title: (title) => `${title} - ${appName}`,
resolve: (name) =>
resolvePageComponent(
`./Pages/${name}.tsx`,
// @ts-expect-error Glob error.
import.meta.glob("./Pages/**/*.tsx"),
),
setup({ el, App, props }) {
const root = createRoot(el);
// eslint-disable-next-line react/jsx-filename-extension, react/jsx-props-no-spreading
root.render(<App {...props} />);
},
progress: {
color: "#4B5563",
},
});
window.axios = axios;
window.axios.defaults.headers.common["X-Requested-With"] = "XMLHttpRequest";

View file

@ -0,0 +1,132 @@
import * as React from "react"
import { Drawer as DrawerPrimitive } from "vaul"
import { cn } from "@/lib/utils"
function Drawer({
...props
}: React.ComponentProps<typeof DrawerPrimitive.Root>) {
return <DrawerPrimitive.Root data-slot="drawer" {...props} />
}
function DrawerTrigger({
...props
}: React.ComponentProps<typeof DrawerPrimitive.Trigger>) {
return <DrawerPrimitive.Trigger data-slot="drawer-trigger" {...props} />
}
function DrawerPortal({
...props
}: React.ComponentProps<typeof DrawerPrimitive.Portal>) {
return <DrawerPrimitive.Portal data-slot="drawer-portal" {...props} />
}
function DrawerClose({
...props
}: React.ComponentProps<typeof DrawerPrimitive.Close>) {
return <DrawerPrimitive.Close data-slot="drawer-close" {...props} />
}
function DrawerOverlay({
className,
...props
}: React.ComponentProps<typeof DrawerPrimitive.Overlay>) {
return (
<DrawerPrimitive.Overlay
data-slot="drawer-overlay"
className={cn(
"fixed inset-0 z-50 bg-black/10 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0",
className
)}
{...props}
/>
)
}
function DrawerContent({
className,
children,
...props
}: React.ComponentProps<typeof DrawerPrimitive.Content>) {
return (
<DrawerPortal data-slot="drawer-portal">
<DrawerOverlay />
<DrawerPrimitive.Content
data-slot="drawer-content"
className={cn(
"group/drawer-content fixed z-50 flex h-auto flex-col bg-popover text-sm text-popover-foreground data-[vaul-drawer-direction=bottom]:inset-x-0 data-[vaul-drawer-direction=bottom]:bottom-0 data-[vaul-drawer-direction=bottom]:mt-24 data-[vaul-drawer-direction=bottom]:max-h-[80vh] data-[vaul-drawer-direction=bottom]:rounded-t-xl data-[vaul-drawer-direction=bottom]:border-t data-[vaul-drawer-direction=left]:inset-y-0 data-[vaul-drawer-direction=left]:left-0 data-[vaul-drawer-direction=left]:w-3/4 data-[vaul-drawer-direction=left]:rounded-r-xl data-[vaul-drawer-direction=left]:border-r data-[vaul-drawer-direction=right]:inset-y-0 data-[vaul-drawer-direction=right]:right-0 data-[vaul-drawer-direction=right]:w-3/4 data-[vaul-drawer-direction=right]:rounded-l-xl data-[vaul-drawer-direction=right]:border-l data-[vaul-drawer-direction=top]:inset-x-0 data-[vaul-drawer-direction=top]:top-0 data-[vaul-drawer-direction=top]:mb-24 data-[vaul-drawer-direction=top]:max-h-[80vh] data-[vaul-drawer-direction=top]:rounded-b-xl data-[vaul-drawer-direction=top]:border-b data-[vaul-drawer-direction=left]:sm:max-w-sm data-[vaul-drawer-direction=right]:sm:max-w-sm",
className
)}
{...props}
>
<div className="mx-auto mt-4 hidden h-1 w-[100px] shrink-0 rounded-full bg-muted group-data-[vaul-drawer-direction=bottom]/drawer-content:block" />
{children}
</DrawerPrimitive.Content>
</DrawerPortal>
)
}
function DrawerHeader({ className, ...props }: React.ComponentProps<"div">) {
return (
<div
data-slot="drawer-header"
className={cn(
"flex flex-col gap-0.5 p-4 group-data-[vaul-drawer-direction=bottom]/drawer-content:text-center group-data-[vaul-drawer-direction=top]/drawer-content:text-center md:gap-0.5 md:text-left",
className
)}
{...props}
/>
)
}
function DrawerFooter({ className, ...props }: React.ComponentProps<"div">) {
return (
<div
data-slot="drawer-footer"
className={cn("mt-auto flex flex-col gap-2 p-4", className)}
{...props}
/>
)
}
function DrawerTitle({
className,
...props
}: React.ComponentProps<typeof DrawerPrimitive.Title>) {
return (
<DrawerPrimitive.Title
data-slot="drawer-title"
className={cn(
"cn-font-heading text-base font-medium text-foreground",
className
)}
{...props}
/>
)
}
function DrawerDescription({
className,
...props
}: React.ComponentProps<typeof DrawerPrimitive.Description>) {
return (
<DrawerPrimitive.Description
data-slot="drawer-description"
className={cn("text-sm text-muted-foreground", className)}
{...props}
/>
)
}
export {
Drawer,
DrawerPortal,
DrawerOverlay,
DrawerTrigger,
DrawerClose,
DrawerContent,
DrawerHeader,
DrawerFooter,
DrawerTitle,
DrawerDescription,
}

View file

@ -0,0 +1,154 @@
import * as React from "react"
import { cva, type VariantProps } from "class-variance-authority"
import { cn } from "@/lib/utils"
import { Button } from "@/components/ui/button"
import { Input } from "@/components/ui/input"
import { Textarea } from "@/components/ui/textarea"
function InputGroup({ className, ...props }: React.ComponentProps<"div">) {
return (
<div
data-slot="input-group"
role="group"
className={cn(
"group/input-group relative flex h-8 w-full min-w-0 items-center rounded-lg border border-input transition-colors outline-none in-data-[slot=combobox-content]:focus-within:border-inherit in-data-[slot=combobox-content]:focus-within:ring-0 has-disabled:bg-input/50 has-disabled:opacity-50 has-[[data-slot=input-group-control]:focus-visible]:border-ring has-[[data-slot=input-group-control]:focus-visible]:ring-3 has-[[data-slot=input-group-control]:focus-visible]:ring-ring/50 has-[[data-slot][aria-invalid=true]]:border-destructive has-[[data-slot][aria-invalid=true]]:ring-3 has-[[data-slot][aria-invalid=true]]:ring-destructive/20 has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>textarea]:h-auto dark:bg-input/30 dark:has-disabled:bg-input/80 dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40 has-[>[data-align=block-end]]:[&>input]:pt-3 has-[>[data-align=block-start]]:[&>input]:pb-3 has-[>[data-align=inline-end]]:[&>input]:pr-1.5 has-[>[data-align=inline-start]]:[&>input]:pl-1.5",
className
)}
{...props}
/>
)
}
const inputGroupAddonVariants = cva(
"flex h-auto cursor-text items-center justify-center gap-2 py-1.5 text-sm font-medium text-muted-foreground select-none group-data-[disabled=true]/input-group:opacity-50 [&>kbd]:rounded-[calc(var(--radius)-5px)] [&>svg:not([class*='size-'])]:size-4",
{
variants: {
align: {
"inline-start":
"order-first pl-2 has-[>button]:ml-[-0.3rem] has-[>kbd]:ml-[-0.15rem]",
"inline-end":
"order-last pr-2 has-[>button]:mr-[-0.3rem] has-[>kbd]:mr-[-0.15rem]",
"block-start":
"order-first w-full justify-start px-2.5 pt-2 group-has-[>input]/input-group:pt-2 [.border-b]:pb-2",
"block-end":
"order-last w-full justify-start px-2.5 pb-2 group-has-[>input]/input-group:pb-2 [.border-t]:pt-2",
},
},
defaultVariants: {
align: "inline-start",
},
}
)
function InputGroupAddon({
className,
align = "inline-start",
...props
}: React.ComponentProps<"div"> & VariantProps<typeof inputGroupAddonVariants>) {
return (
<div
role="group"
data-slot="input-group-addon"
data-align={align}
className={cn(inputGroupAddonVariants({ align }), className)}
onClick={(e) => {
if ((e.target as HTMLElement).closest("button")) {
return
}
e.currentTarget.parentElement?.querySelector("input")?.focus()
}}
{...props}
/>
)
}
const inputGroupButtonVariants = cva(
"flex items-center gap-2 text-sm shadow-none",
{
variants: {
size: {
xs: "h-6 gap-1 rounded-[calc(var(--radius)-3px)] px-1.5 [&>svg:not([class*='size-'])]:size-3.5",
sm: "",
"icon-xs":
"size-6 rounded-[calc(var(--radius)-3px)] p-0 has-[>svg]:p-0",
"icon-sm": "size-8 p-0 has-[>svg]:p-0",
},
},
defaultVariants: {
size: "xs",
},
}
)
function InputGroupButton({
className,
type = "button",
variant = "ghost",
size = "xs",
...props
}: Omit<React.ComponentProps<typeof Button>, "size"> &
VariantProps<typeof inputGroupButtonVariants>) {
return (
<Button
type={type}
data-size={size}
variant={variant}
className={cn(inputGroupButtonVariants({ size }), className)}
{...props}
/>
)
}
function InputGroupText({ className, ...props }: React.ComponentProps<"span">) {
return (
<span
className={cn(
"flex items-center gap-2 text-sm text-muted-foreground [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4",
className
)}
{...props}
/>
)
}
function InputGroupInput({
className,
...props
}: React.ComponentProps<"input">) {
return (
<Input
data-slot="input-group-control"
className={cn(
"flex-1 rounded-none border-0 bg-transparent shadow-none ring-0 focus-visible:ring-0 disabled:bg-transparent aria-invalid:ring-0 dark:bg-transparent dark:disabled:bg-transparent",
className
)}
{...props}
/>
)
}
function InputGroupTextarea({
className,
...props
}: React.ComponentProps<"textarea">) {
return (
<Textarea
data-slot="input-group-control"
className={cn(
"flex-1 resize-none rounded-none border-0 bg-transparent py-2 shadow-none ring-0 focus-visible:ring-0 disabled:bg-transparent aria-invalid:ring-0 dark:bg-transparent dark:disabled:bg-transparent",
className
)}
{...props}
/>
)
}
export {
InputGroup,
InputGroupAddon,
InputGroupButton,
InputGroupText,
InputGroupInput,
InputGroupTextarea,
}

View file

@ -0,0 +1,168 @@
import * as React from "react"
import { cva } from "class-variance-authority"
import { ChevronDownIcon } from "lucide-react"
import { NavigationMenu as NavigationMenuPrimitive } from "radix-ui"
import { cn } from "@/lib/utils"
function NavigationMenu({
className,
children,
viewport = true,
...props
}: React.ComponentProps<typeof NavigationMenuPrimitive.Root> & {
viewport?: boolean
}) {
return (
<NavigationMenuPrimitive.Root
data-slot="navigation-menu"
data-viewport={viewport}
className={cn(
"group/navigation-menu relative flex max-w-max flex-1 items-center justify-center",
className
)}
{...props}
>
{children}
{viewport && <NavigationMenuViewport />}
</NavigationMenuPrimitive.Root>
)
}
function NavigationMenuList({
className,
...props
}: React.ComponentProps<typeof NavigationMenuPrimitive.List>) {
return (
<NavigationMenuPrimitive.List
data-slot="navigation-menu-list"
className={cn(
"group flex flex-1 list-none items-center justify-center gap-1",
className
)}
{...props}
/>
)
}
function NavigationMenuItem({
className,
...props
}: React.ComponentProps<typeof NavigationMenuPrimitive.Item>) {
return (
<NavigationMenuPrimitive.Item
data-slot="navigation-menu-item"
className={cn("relative", className)}
{...props}
/>
)
}
const navigationMenuTriggerStyle = cva(
"group inline-flex h-9 w-max items-center justify-center rounded-md bg-background px-4 py-2 text-sm font-medium transition-[color,box-shadow] outline-none hover:bg-accent hover:text-accent-foreground focus:bg-accent focus:text-accent-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1 disabled:pointer-events-none disabled:opacity-50 data-[state=open]:bg-accent/50 data-[state=open]:text-accent-foreground data-[state=open]:hover:bg-accent data-[state=open]:focus:bg-accent"
)
function NavigationMenuTrigger({
className,
children,
...props
}: React.ComponentProps<typeof NavigationMenuPrimitive.Trigger>) {
return (
<NavigationMenuPrimitive.Trigger
data-slot="navigation-menu-trigger"
className={cn(navigationMenuTriggerStyle(), "group", className)}
{...props}
>
{children}{" "}
<ChevronDownIcon
className="relative top-[1px] ml-1 size-3 transition duration-300 group-data-[state=open]:rotate-180"
aria-hidden="true"
/>
</NavigationMenuPrimitive.Trigger>
)
}
function NavigationMenuContent({
className,
...props
}: React.ComponentProps<typeof NavigationMenuPrimitive.Content>) {
return (
<NavigationMenuPrimitive.Content
data-slot="navigation-menu-content"
className={cn(
"top-0 left-0 w-full p-2 pr-2.5 data-[motion=from-end]:slide-in-from-right-52 data-[motion=from-start]:slide-in-from-left-52 data-[motion=to-end]:slide-out-to-right-52 data-[motion=to-start]:slide-out-to-left-52 data-[motion^=from-]:animate-in data-[motion^=from-]:fade-in data-[motion^=to-]:animate-out data-[motion^=to-]:fade-out md:absolute md:w-auto",
"group-data-[viewport=false]/navigation-menu:top-full group-data-[viewport=false]/navigation-menu:mt-1.5 group-data-[viewport=false]/navigation-menu:overflow-hidden group-data-[viewport=false]/navigation-menu:rounded-md group-data-[viewport=false]/navigation-menu:border group-data-[viewport=false]/navigation-menu:bg-popover group-data-[viewport=false]/navigation-menu:text-popover-foreground group-data-[viewport=false]/navigation-menu:shadow group-data-[viewport=false]/navigation-menu:duration-200 **:data-[slot=navigation-menu-link]:focus:ring-0 **:data-[slot=navigation-menu-link]:focus:outline-none group-data-[viewport=false]/navigation-menu:data-[state=closed]:animate-out group-data-[viewport=false]/navigation-menu:data-[state=closed]:fade-out-0 group-data-[viewport=false]/navigation-menu:data-[state=closed]:zoom-out-95 group-data-[viewport=false]/navigation-menu:data-[state=open]:animate-in group-data-[viewport=false]/navigation-menu:data-[state=open]:fade-in-0 group-data-[viewport=false]/navigation-menu:data-[state=open]:zoom-in-95",
className
)}
{...props}
/>
)
}
function NavigationMenuViewport({
className,
...props
}: React.ComponentProps<typeof NavigationMenuPrimitive.Viewport>) {
return (
<div
className={cn(
"absolute top-full left-0 isolate z-50 flex justify-center"
)}
>
<NavigationMenuPrimitive.Viewport
data-slot="navigation-menu-viewport"
className={cn(
"origin-top-center relative mt-1.5 h-[var(--radix-navigation-menu-viewport-height)] w-full overflow-hidden rounded-md border bg-popover text-popover-foreground shadow data-[state=closed]:animate-out data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:zoom-in-90 md:w-[var(--radix-navigation-menu-viewport-width)]",
className
)}
{...props}
/>
</div>
)
}
function NavigationMenuLink({
className,
...props
}: React.ComponentProps<typeof NavigationMenuPrimitive.Link>) {
return (
<NavigationMenuPrimitive.Link
data-slot="navigation-menu-link"
className={cn(
"flex flex-col gap-1 rounded-sm p-2 text-sm transition-all outline-none hover:bg-accent hover:text-accent-foreground focus:bg-accent focus:text-accent-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1 data-[active=true]:bg-accent/50 data-[active=true]:text-accent-foreground data-[active=true]:hover:bg-accent data-[active=true]:focus:bg-accent [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground",
className
)}
{...props}
/>
)
}
function NavigationMenuIndicator({
className,
...props
}: React.ComponentProps<typeof NavigationMenuPrimitive.Indicator>) {
return (
<NavigationMenuPrimitive.Indicator
data-slot="navigation-menu-indicator"
className={cn(
"top-full z-[1] flex h-1.5 items-end justify-center overflow-hidden data-[state=hidden]:animate-out data-[state=hidden]:fade-out data-[state=visible]:animate-in data-[state=visible]:fade-in",
className
)}
{...props}
>
<div className="relative top-[60%] h-2 w-2 rotate-45 rounded-tl-sm bg-border shadow-md" />
</NavigationMenuPrimitive.Indicator>
)
}
export {
NavigationMenu,
NavigationMenuList,
NavigationMenuItem,
NavigationMenuContent,
NavigationMenuTrigger,
NavigationMenuLink,
NavigationMenuIndicator,
NavigationMenuViewport,
navigationMenuTriggerStyle,
}

View file

@ -0,0 +1,47 @@
//* PACKAGES
import {
Breadcrumb,
BreadcrumbItem,
BreadcrumbList,
BreadcrumbSeparator,
} from "@/components/ui/breadcrumb";
import { Link } from "@inertiajs/react";
//* THEME
import { cn } from "@/lib/utils";
const BreadcrumbsBase = ({ className, breadcrumbs }: { className?: string, breadcrumbs?: Array<{
title: string;
url: string;
}> }) => {
return (
breadcrumbs && (
<Breadcrumb className={cn(className)}>
<BreadcrumbList>
{breadcrumbs.map((breadcrumb, breadcrumbIndex) => (
<ul
key={breadcrumb.url}
className="flex flex-wrap items-center gap-1 break-words sm:gap-2.5"
>
{breadcrumbIndex >= 1 && <BreadcrumbSeparator />}
<BreadcrumbItem className="text-primary-foreground/70">
{breadcrumbIndex !== breadcrumbs.length - 1 &&
breadcrumb.url ? (
<Link
href={breadcrumb.url}
className="rounded-md text-primary-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2"
>
{breadcrumb.title}
</Link>
) : (
breadcrumb.title
)}
</BreadcrumbItem>
</ul>
))}
</BreadcrumbList>
</Breadcrumb>
)
)
}
export default BreadcrumbsBase;

View file

@ -0,0 +1,87 @@
// * Packages
import { Link } from "@inertiajs/react";
import {
ButtonHTMLAttributes,
CSSProperties,
MouseEventHandler,
ReactNode,
} from "react";
import { VariantProps } from "class-variance-authority";
// * Components shadcn
import { Button, buttonVariants } from "@/components/ui/button";
import {
Tooltip,
TooltipContent,
TooltipTrigger,
} from "@/components/ui/tooltip";
type ButtonVariant = VariantProps<typeof buttonVariants>["variant"];
type ButtonSize = VariantProps<typeof buttonVariants>["size"];
type ButtonType = ButtonHTMLAttributes<HTMLButtonElement>["type"];
type BtnOptionnalLinkWithTooltipProps = {
link?: string | null;
content: ReactNode;
tooltipContent: ReactNode;
className?: string;
type?: ButtonType;
size?: ButtonSize;
variant?: ButtonVariant;
externalLink?: boolean;
disabled?: boolean;
style?: CSSProperties;
onClick?: MouseEventHandler<HTMLButtonElement>;
};
export default function BtnOptionnalLinkWithTooltip({
link = null,
content,
tooltipContent,
className = "",
type = "button",
size = "icon",
variant = "default",
externalLink = false,
disabled = false,
style,
onClick,
...props
}: BtnOptionnalLinkWithTooltipProps) {
let innerContent: ReactNode = content;
if (link !== null) {
if (externalLink) {
innerContent = disabled ? (
<Button disabled>{content}</Button>
) : (
<a href={link} target="_blank" rel="noreferrer">
{content}
</a>
);
} else {
innerContent = <Link href={link}>{content}</Link>;
}
}
return (
<Tooltip>
<TooltipTrigger asChild>
<Button
variant={variant}
size={size}
className={className}
type={type}
asChild={link !== null}
disabled={disabled}
onClick={onClick}
style={style}
// eslint-disable-next-line react/jsx-props-no-spreading
{...props}
>
{innerContent}
</Button>
</TooltipTrigger>
<TooltipContent>{tooltipContent}</TooltipContent>
</Tooltip>
);
}

View file

@ -0,0 +1,18 @@
import useInView from "@/hooks/use-in-view";
import CarouselContent from "./CarouselContent";
import { CarouselPropsWithNavigation } from "@/types/front";
type Props = CarouselPropsWithNavigation & {
className?: string;
}
const Carousel = (props: Props) => {
const { className, ...carouselProps } = props;
const { ref, isVisible } = useInView();
return (
<div ref={ref} className={className}>
{isVisible && <CarouselContent {...carouselProps} />}
</div>
)
}
export default Carousel;

View file

@ -0,0 +1,145 @@
/** REACT */
import { ReactNode, useMemo, useRef, useState } from "react";
/** SWIPER PACKAGE */
import { Swiper as SwiperType } from "swiper";
import { PaginationOptions } from "swiper/types";
import { Swiper, SwiperClass, SwiperSlide } from "swiper/react";
import { Pagination } from "swiper/modules";
import 'swiper/css';
import 'swiper/css/navigation';
import 'swiper/css/pagination';
/** THEME */
import ItemCard from "$/uwil/ItemCard";
import { CarouselBreakpointsProps, CarouselPropsWithNavigation, SwiperButtonProps } from "@/types/front";
import { bgColors } from "@/front/lib/constants";
import { cn } from "@/lib/utils";
const CarouselContent = (props: CarouselPropsWithNavigation) => {
const { items, carousel, variant = bgColors.PRIMARY, prevBtn, nextBtn } = props;
const [isBeginning, setIsBeginning] = useState(true);
const [isEnd, setIsEnd] = useState(false);
const swiperRef = useRef<SwiperType | null>(null);
const paginationDefaultVariant = variant === bgColors.PRIMARY ? "bg-background" : "bg-primary"
const spaceBetween = carousel?.spaceBetween ?? 50;
const slidesPerView = carousel?.slidesPerView ?? 1;
const defaultPagination: PaginationOptions = {
clickable: true,
bulletClass: `inline-block w-3 h-3 rounded-full ${paginationDefaultVariant} mx-1`,
bulletActiveClass: 'bg-primary-foreground w-5 h-5',
};
const defaultSlidesPerView: Record<number, number> = {
768: 2,
1024: 3,
1248: 4
};
const breakpoints = useMemo(() => {
return Object.keys({
...defaultSlidesPerView,
...carousel?.breakpoints,
}).reduce((acc, key) => {
const numKey = Number(key);
acc[numKey] = {
...carousel?.breakpoints?.[numKey],
slidesPerView:
carousel?.breakpoints?.[numKey]?.slidesPerView ??
defaultSlidesPerView[numKey],
};
return acc;
}, {} as CarouselBreakpointsProps);
}, [carousel?.breakpoints]);
const pagination = useMemo(() => {
if (carousel?.pagination === false) return false;
return {
...defaultPagination,
...(typeof carousel?.pagination === 'object'
? carousel.pagination
: {}),
};
}, [carousel?.pagination, variant]);
const handleSwiper = (swiper: SwiperClass) => {
swiperRef.current = swiper;
carousel?.onSwiper?.(swiper);
};
return (
<div className="relative flex justify-center items-center w-full ">
<PrevButton icon={prevBtn} swiperRef={swiperRef} disabled={isBeginning} />
<Swiper
modules={[Pagination]}
centeredSlides={carousel?.centeredSlides}
spaceBetween={spaceBetween}
slidesPerView={slidesPerView}
onSlideChange={(swiper) => {
carousel?.onSlideChange?.(swiper);
setIsBeginning(swiper.isBeginning);
setIsEnd(swiper.isEnd || swiper.isLocked);
}}
onAfterInit={(swiper) => {
setIsBeginning(swiper.isBeginning);
setIsEnd(swiper.isEnd || swiper.isLocked);
}}
watchOverflow={carousel?.watchOverflow}
onSwiper={handleSwiper}
autoplay={carousel?.autoplay}
pagination={pagination}
navigation={carousel?.navigation}
breakpoints={breakpoints}
wrapperClass={cn("pb-20", carousel?.wrapperClass)}
className="w-full"
>
{items.map((item, index) => {
return (
<SwiperSlide
key={index}
className="justify-center !flex"
>
<ItemCard
image={{lazyload: true, ...item.image}}
title={item.title}
subtitle={item.subtitle}
description={item.description}
button={item.button}
variant={variant}
/>
</SwiperSlide>
)
})}
</Swiper>
<NextButton icon={nextBtn} swiperRef={swiperRef} disabled={isEnd} />
</div>
)
}
export default CarouselContent;
const NextButton = ({ swiperRef, disabled, icon }: SwiperButtonProps) => {
return (
<button
onClick={() => swiperRef.current?.slideNext()}
disabled={disabled}
className="hidden md:block disabled:opacity-0"
>
{icon}
</button>
);
};
const PrevButton = ({ swiperRef, disabled, icon }: SwiperButtonProps) => {
return (
<button
onClick={() => swiperRef.current?.slidePrev()}
disabled={disabled}
className="hidden md:block disabled:opacity-0"
>
{icon}
</button>
);
};

View file

@ -0,0 +1,49 @@
import { cn } from "@/lib/utils";
import { ReactNode, useEffect, useState } from "react";
type Props = {
threshold?: number;
behavior?: ScrollBehavior;
children: ReactNode;
classes?: {
onVisibleClasses?: string;
onHiddenClasses?: string;
generalClasses?: string
}
}
const GoToTopBase = (props: Props) => {
const { threshold = 300, behavior = "smooth", children, classes } = props;
const [visible, setVisible] = useState<boolean>(false);
useEffect(() => {
const handleScroll = () => {
setVisible(window.scrollY > threshold);
};
window.addEventListener("scroll", handleScroll);
return () => {
window.removeEventListener("scroll", handleScroll);
};
}, []);
const scrollToTop = () => {
window.scrollTo({
top: 0,
behavior,
});
};
return (
<button
onClick={scrollToTop}
className={cn(classes?.generalClasses, "z-10 p-0 fixed bottom-4 md:bottom-32 right-2 md:right-16 transition-all duration-300",
visible ? `opacity-100 translate-y-0 ${classes?.onVisibleClasses}` : `opacity-0 translate-y-4 pointer-events-none ${classes?.onHiddenClasses}`)}>
{children}
</button>
)
}
export default GoToTopBase;

View file

@ -0,0 +1,41 @@
// * Packages
import { AlertCircleIcon } from "lucide-react";
import { usePage } from "@inertiajs/react";
// * Components shadcn
import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert";
// * Other
import useTrans from "@/hooks/use-translations";
import { cn } from "@/lib/utils";
export default function InputError({
all,
message,
}: {
all?: boolean;
message?: string;
}) {
const { errors } = usePage().props;
const errorsTrans = useTrans("uwil-backend::back.errors");
let messages = {} as Array<string>;
if (message) {
messages = Object.values([message]);
} else if (Object.values(errors).length && all) {
messages = Object.values(errors);
}
if (messages.length) {
return (
<Alert
variant="destructive"
className={cn("text-left ", { "mb-4": all })}
>
<AlertCircleIcon className="h-4 w-4" />
{all && <AlertTitle>{errorsTrans}</AlertTitle>}
<AlertDescription>
{messages.map((errorMessage) => {
return <p key={errorMessage}>{errorMessage}</p>;
})}
</AlertDescription>
</Alert>
);
}
}

View file

@ -0,0 +1,245 @@
// * Packages
import { usePage } from "@inertiajs/react";
import { useEffect, useState } from "react";
import { CheckIcon, ChevronsUpDownIcon, SearchIcon, XIcon } from "lucide-react";
// * Components shadcn
import { Label } from "@/components/ui/label";
import {
Popover,
PopoverContent,
PopoverTrigger,
} from "@/components/ui/popover";
import { Input } from "@/components/ui/input";
import { Button } from "@/components/ui/button";
// * Other
import BtnOptionnalLinkWithTooltip from "@/front/Components/Base/BtnOptionnalLinkWithTooltip";
import InputError from "@/front/Components/Base/InputError";
import { AppEnv } from "@/types/global";
import { cn } from "@/lib/utils";
import useTrans from "@/hooks/use-translations";
import str from "@/hooks/use-string";
type EnumSelectProps = {
name: string;
label: string;
options?: Record<string, { label: string; name: string; value: number }>;
placeholder?: string;
exclude?: number[];
selected?: number | null;
required?: boolean;
disabled?: boolean;
className?: string;
parentErrors?: Record<string, string> | null;
// eslint-disable-next-line no-unused-vars
setData: (name: string, value: number | null) => void;
// eslint-disable-next-line no-unused-vars
onSelectValue?: (value: number | null) => void;
};
export default function EnumSelect({
name,
label,
options = {},
placeholder = "ex: John Doe",
exclude = [],
selected = null,
required = true,
disabled = false,
parentErrors = null,
className,
setData,
onSelectValue,
}: EnumSelectProps) {
const { locale } = usePage().props.appEnv as AppEnv;
const { errors } = usePage().props;
const localErrors = parentErrors ?? errors;
// List of options.
const initalOptions = Object.fromEntries(
Object.entries(options).filter(([, item]) => !exclude.includes(item.value)),
);
const [currentOptions, setCurrentOptions] =
useState<Record<string, { label: string; name: string; value: number }>>(
initalOptions,
);
// Model key selected.
const initial =
selected === 0 || selected === null || selected === undefined
? null
: Number(selected);
const [selectedEnum, setSelectedEnum] = useState<number | null>(initial);
// String research in models collection.
const [search, setSearch] = useState<string>("");
// Component states.
const [open, setOpen] = useState<boolean>(false);
const transNoResults = useTrans("uwil-backend::back.table_no_results");
const transDelete = useTrans("uwil-backend::crud.actions.delete");
/**
* Get the identification field of specific option.
* @param value number
* @return string
*/
const getEnumLabel = (value: number): string => {
const targetEnum = Object.values(initalOptions).find(
(option) => option.value === value,
);
if (!targetEnum) return String(value);
if (typeof value === "object")
return String(
targetEnum.label[locale as keyof typeof targetEnum.label] ?? "",
);
return targetEnum.label;
};
/**
* Updates when selecting new value.
* @param value number
* @return void
*/
const handleSelect = (value: number) => {
setSelectedEnum(value);
setData(name, value);
onSelectValue?.(value);
setOpen(false);
};
/**
* Updates when clear the selected value.
* @return void
*/
const handleClear = () => {
setSelectedEnum(null);
setData(name, null);
onSelectValue?.(null);
};
/**
* Reset the search.
* @return void
*/
const handleClearSearch = () => {
setSearch("");
};
// Fetch with debounce.
useEffect(() => {
// Reset options list if empty search or null
if (search.length === 0) {
setCurrentOptions(initalOptions);
return;
}
const optionsFiltered = Object.fromEntries(
Object.entries(initalOptions).filter(([, item]) =>
item.label.toLowerCase().includes(search),
),
);
// Get updated options list with search.
setCurrentOptions(optionsFiltered);
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [search, options]);
return (
<div className={cn("flex flex-col w-full gap-1.5", className)}>
<Label htmlFor={name} className="flex items-center gap-1.5">
{label}
{required && " *"}
</Label>
<div className="flex items-center gap-1.5 w-full">
<Popover open={open} onOpenChange={setOpen}>
<PopoverTrigger asChild>
<Button
variant="outline"
role="combobox"
aria-expanded={open}
disabled={disabled}
className={cn(
"w-full h-10 justify-between whitespace-normal text-start rounded-full",
{ "text-muted-foreground": !selectedEnum },
{ "border-destructive/50": localErrors[name] },
)}
>
{selectedEnum
? str(getEnumLabel(selectedEnum)).ucFirst().value()
: placeholder}
<ChevronsUpDownIcon className="opacity-50" />
</Button>
</PopoverTrigger>
<PopoverContent className="w-[var(--radix-popover-trigger-width)] p-0">
<div className="relative">
<div className="absolute top-1/2 left-2 transform -translate-y-1/2 text-muted-foreground">
<SearchIcon className="w-4 h-4" />
</div>
<Input
type="text"
placeholder={placeholder}
value={search}
disabled={disabled}
onChange={(e) => setSearch(e.target.value)}
className="w-[calc(100%-2.5rem-40px)] border-0 mx-9"
/>
<BtnOptionnalLinkWithTooltip
content={<XIcon />}
tooltipContent={
<p>
{str(useTrans("uwil-backend::crud.actions.delete"))
.ucFirst()
.value()}
</p>
}
type="button"
variant="ghost"
size="icon"
className="absolute top-1/2 right-0 transform -translate-y-1/2 text-muted-foreground"
onClick={handleClearSearch}
disabled={search.length < 1 || disabled}
/>
</div>
<div
className={cn(
`overflow-auto border-t flex flex-col justify-between p-1 gap-1 ${Object.values(initalOptions).length > 5 ? "h-[225px]" : "h-auto"}`,
)}
>
{Object.values(currentOptions).length === 0 && (
<p className="text-sm text-muted-foreground text-center py-5">
{transNoResults}
</p>
)}
<div className="flex flex-col justify-between">
{Object.values(currentOptions).map((option) => (
<Button
key={option.value}
className="w-full h-auto min-h-10 justify-between whitespace-normal text-start"
variant="ghost"
disabled={disabled}
onClick={() => handleSelect(option.value)}
>
<span>{str(option.label).ucFirst().value()}</span>
{selectedEnum === option.value && <CheckIcon />}
</Button>
))}
</div>
</div>
</PopoverContent>
</Popover>
{!required && selectedEnum !== null && (
<BtnOptionnalLinkWithTooltip
content={<XIcon />}
tooltipContent={<p>{str(transDelete).ucFirst().value()}</p>}
type="button"
variant="destructive"
size="icon"
onClick={handleClear}
/>
)}
</div>
<InputError message={localErrors[name]} />
</div>
);
}

View file

@ -0,0 +1,199 @@
/** OTHER */
import * as React from "react"
/** SHADCN */
import { Checkbox } from "@/components/ui/checkbox"
import { Popover, PopoverContent, PopoverTrigger } from "@/components/ui/popover"
import { Label } from "@/components/ui/label"
import {
Accordion,
AccordionContent,
AccordionItem,
AccordionTrigger,
} from "@/components/ui/accordion"
/** THEME */
import { cn } from "@/lib/utils"
import Button from "$/uwil/Button"
import { fonts, sidePlacements } from "@/front/lib/constants"
import { Trash, X } from "lucide-react"
export interface FilterOption {
id: string
label: string
checked?: boolean
}
interface FilterDropdownProps {
/** Le texte du bouton */
label?: string
/** Les options de filtre */
options: FilterOption[]
/** Callback quand les filtres changent */
onChange?: (selectedIds: string[]) => void
/** Ouvrir au survol en plus du clic */
openOnHover?: boolean
/** Délai avant fermeture au survol (ms) */
hoverCloseDelay?: number
/** Classes additionnelles pour le bouton */
className?: string
/** Value of the input */
value: string[];
isMobile?: boolean
}
export function FilterDropdown({
label = "Filtres",
options,
onChange,
openOnHover = false,
hoverCloseDelay = 200,
className,
value,
isMobile = false
}: FilterDropdownProps) {
const [open, setOpen] = React.useState(false)
const selected = new Set(value);
const selectedCount = value.length;
const closeTimeoutRef = React.useRef<NodeJS.Timeout | null>(null)
const handleCheckedChange = (id: string, checked: boolean) => {
let next: string[];
if (checked) {
next = [...value, id];
} else {
next = value.filter((v) => v !== id);
}
onChange?.(next);
};
const handleMouseEnter = () => {
if (!openOnHover) return
if (closeTimeoutRef.current) {
clearTimeout(closeTimeoutRef.current)
closeTimeoutRef.current = null
}
setOpen(true)
}
const handleMouseLeave = () => {
if (!openOnHover) return
closeTimeoutRef.current = setTimeout(() => {
setOpen(false)
}, hoverCloseDelay)
}
if (isMobile) {
return (
<div className="flex gap-1 items-start">
<Accordion
type="single"
collapsible
className="w-full"
>
<AccordionItem value={label}>
<AccordionTrigger className="py-2 bg-primary rounded-full px-4 text-primary-foreground">
<div className="flex gap-1 items-center">
{label}
{selectedCount > 0 && (
<span className="bg-primary-foreground text-background ml-1 flex size-5 items-center justify-center rounded-full text-xs font-medium">
{selectedCount}
</span>
)}
</div>
</AccordionTrigger>
<AccordionContent>
<div className="flex flex-wrap gap-1 text-primary-foreground mt-4">
{options.map((option) => (
<label
key={option.id}
className="bg-primary hover:bg-primary/80 flex cursor-pointer items-center gap-3 rounded-full px-2 py-2 transition-colors"
>
<Checkbox
id={option.id}
className="rounded-full bg-background data-[state=checked]:bg-primary-foreground data-[state=checked]:text-primary-foreground"
checked={selected.has(option.id)}
onCheckedChange={(checked) =>
handleCheckedChange(option.id, checked === true)
}
/>
<Label htmlFor={option.id} className={cn("cursor-pointer text-sm font-normal", fonts.DELIUS_SWASH)}>
{option.label}
</Label>
</label>
))}
</div>
</AccordionContent>
</AccordionItem>
</Accordion>
</div>
)
}
return (
<Popover open={open} onOpenChange={setOpen}>
<div
onMouseEnter={handleMouseEnter}
onMouseLeave={handleMouseLeave}
className="inline-block"
>
<PopoverTrigger asChild>
<Button variant={"default"} className={cn("gap-2", className)}
icon={{
icon: "chevron-right",
placement: sidePlacements.RIGHT,
className: cn("transition-transform", open ? "rotate-90" : "")
}}
>
{label}
{selectedCount > 0 && (
<span className="bg-primary-foreground text-background ml-1 flex size-5 items-center justify-center rounded-full text-xs font-medium">
{selectedCount}
</span>
)}
</Button>
</PopoverTrigger>
<PopoverContent
align="start"
className="w-96 p-2"
onMouseEnter={handleMouseEnter}
onMouseLeave={handleMouseLeave}
>
<div className="flex flex-wrap gap-1">
{options.map((option) => (
<label
key={option.id}
className="bg-primary hover:bg-primary/80 flex cursor-pointer items-center gap-3 rounded-full px-2 py-2 transition-colors"
>
<Checkbox
id={option.id}
className="rounded-full bg-background data-[state=checked]:bg-primary-foreground data-[state=checked]:text-primary-foreground"
checked={selected.has(option.id)}
onCheckedChange={(checked) =>
handleCheckedChange(option.id, checked === true)
}
/>
<Label htmlFor={option.id} className={cn("cursor-pointer text-sm font-normal", fonts.DELIUS_SWASH)}>
{option.label}
</Label>
</label>
))}
</div>
{selectedCount > 0 && (
<div className="border-border mt-2 border-t pt-2">
<Button
variant="ghost"
size="sm"
className="text-muted-foreground h-8 w-full text-xs"
onClick={() => onChange?.([])}
>
Effacer les filtres
</Button>
</div>
)}
</PopoverContent>
</div>
</Popover>
)
}

View file

@ -0,0 +1,31 @@
// * Packages
import { SearchIcon } from "lucide-react";
import { useForm } from "@inertiajs/react";
// * Components shadcn
import { Button } from "@/components/ui/button";
// * Other
import InputError from "@/front/Components/Base/InputError";
import { InputGroup, InputGroupAddon, InputGroupInput } from "@/components/ui/input-group";
export default function SearchInput() {
const { data, setData, processing, errors } = useForm({
search: ""
})
const submit = (e) => {
e.preventDefault();
}
return (
<form onSubmit={submit}>
<InputGroup className="rounded-full">
<InputGroupInput value={data.search} onChange={(e) => setData("search", e.target.value)} disabled={processing} placeholder="Rechercher..." />
<InputGroupAddon align={"inline-end"}>
<Button variant={"ghost"} className="rounded-full w-7 py-0 h-7">
<SearchIcon />
</Button>
</InputGroupAddon>
</InputGroup>
<InputError message={errors["search"]} />
</form>
);
}

View file

@ -0,0 +1,51 @@
import { Checkbox } from "@/components/ui/checkbox";
import { usePage } from "@inertiajs/react";
import { ReactNode } from "react";
import InputError from "$/base/InputError";
import { Label } from "@/components/ui/label";
import { cn } from "@/lib/utils";
type SimpleCheckboxProps = {
className?: string;
name: string;
label: ReactNode | string;
value?: boolean;
id?: string;
disabled?: boolean;
parentErrors?: Record<string, string> | null;
// eslint-disable-next-line no-unused-vars
setData: (name: string, value: boolean) => void;
};
export default function SimpleCheckbox({
className,
value = false,
name,
label,
id = name,
disabled = false,
parentErrors = null,
setData,
}: SimpleCheckboxProps) {
const { errors } = usePage().props;
const localErrors = parentErrors ?? errors;
return (
<div className={cn(className)}>
<div className="flex items-start gap-4">
<Checkbox
id={id}
disabled={disabled}
className="rounded-full border-primary-foreground data-[state=checked]:bg-primary-foreground data-[state=checked]:text-primary"
checked={value}
onCheckedChange={(value) => {
setData(name, Boolean(value))
}}
/>
<Label htmlFor={id} className="text-start font-normal">
{label}
</Label>
</div>
<InputError message={localErrors[name]} />
</div>
)
}

View file

@ -0,0 +1,294 @@
import { Button as ShadcnButton } from "@/components/ui/button";
import str from "@/hooks/use-string";
import { useToast } from "@/hooks/use-toast";
import useTrans from "@/hooks/use-translations";
import { cn, GetTranslation } from "@/lib/utils";
import { FileCheck, Image, Trash, UploadIcon } from "lucide-react";
import { ReactNode, useCallback, useEffect, useState } from "react";
import { ErrorCode, FileWithPath, useDropzone } from "react-dropzone";
import BtnOptionnalLinkWithTooltip from "../BtnOptionnalLinkWithTooltip";
type FileWithPreview = FileWithPath & {
preview: string;
};
type FileValidation = {
validationRules?: {
width: string | null;
height: string | null;
} | null;
maxFileSize: string | null;
allowedFormats: string | null;
};
type SimpleImageProps = FileValidation & {
name: string;
value?: string | File | null;
/** Original data is the data directly from the model, not in the form state */
originalData?: string | undefined;
/** Add custom event when refresh to the originalData */
onRefreshFile?: () => void;
label?: ReactNode | string;
required?: boolean;
fileName?: string;
hasRefreshBtn?: boolean;
parentErrors?: Record<string, string> | null;
setData: (name: string, value: File | string | null) => void;
reset: (name?: string) => void;
hasFile?: (hasFile: boolean) => void;
}
export default function SimpleImage({
value,
setData,
originalData,
name = "defaultName",
onRefreshFile,
label = "defaultLabel",
required = false,
maxFileSize,
validationRules,
allowedFormats,
reset,
fileName = "image",
hasRefreshBtn = true,
hasFile,
parentErrors,
}: SimpleImageProps) {
const { toast } = useToast();
const [selectedFile, setSelectedFile] = useState<FileWithPreview | null>(null);
const [accept, setAccept] = useState<Record<string, Array<string>>>({
"image/*": [],
});
const [extensions, setExtensions] = useState<string>();
const localMaxFileSize = maxFileSize
? parseInt(maxFileSize, 10) * 1024
: 50000;
// Fonction utilitaire pour formater la taille de fichier
const formatFileSize = (bytes: number): string => {
if (bytes === 0) return "0 Bytes";
const k = 1024;
const sizes = ["Bytes", "KB", "MB", "GB"];
const i = Math.floor(Math.log(bytes) / Math.log(k));
const currentSize = sizes[i];
const currentBytes = parseFloat((bytes / k ** i).toFixed(2));
return `${currentBytes} ${currentSize}`;
};
const dropErrorMessages = {
noFile: str(useTrans("front.image.toast.no_file"))
.ucFirst()
.value(),
tooLarge: str(
useTrans("front.image.toast.too_big", {
params: {
maxSize: formatFileSize(localMaxFileSize),
},
}),
)
.ucFirst()
.value(),
forbidden: str(
useTrans("front.image.toast.forbidden_file"),
)
.ucFirst()
.value(),
tooMany: str(useTrans("front.image.toast.too_many"))
.ucFirst()
.value(),
default: str(
useTrans("front.image.toast.defaultError"),
)
.ucFirst()
.value(),
};
const onDrop = useCallback(
(acceptedFiles: FileWithPath[]) => {
const file = acceptedFiles[0];
if (!file) {
toast({
title: "Oups !",
description: dropErrorMessages.noFile,
});
return;
}
const fileWithPreview = Object.assign(file, {
preview: URL.createObjectURL(file),
});
setSelectedFile(fileWithPreview);
setData(name, file);
},
// eslint-disable-next-line react-hooks/exhaustive-deps
[maxFileSize, formatFileSize],
);
const { getRootProps, getInputProps } = useDropzone({
onDrop,
accept,
multiple: false,
maxSize: localMaxFileSize,
onDropRejected: (fileRejections) => {
const rejection = fileRejections[0];
const rejectionCode = rejection?.errors?.[0]?.code;
if (rejectionCode === ErrorCode.FileTooLarge) {
toast({
title: "Oups !",
description: `${dropErrorMessages.tooLarge} (${formatFileSize(rejection.file.size)}).`,
});
} else if (rejectionCode === ErrorCode.FileInvalidType) {
toast({
title: "Oups !",
description: dropErrorMessages.forbidden,
});
} else if (rejectionCode === ErrorCode.TooManyFiles) {
toast({
title: "Oups !",
description: dropErrorMessages.tooMany,
});
} else {
toast({
title: "Oups !",
description: dropErrorMessages.default,
});
}
},
});
// Translations
const transSelectImgZone = GetTranslation(
"front.image.select_file_zone"
);
const transValidationAllFormats = str(
useTrans("front.image.validation.all_formats"),
)
.ucFirst()
.value();
const transCropperFileUploaded = useTrans(
"front.image.state_file_uploaded",
);
const transCancel = useTrans("uwil-backend::back.cancel");
const getTransValidationAllowedFormats = (targetExtensions: string) => {
return str(
GetTranslation(
"front.image.validation.allowed_formats",
{
params: {
formats: targetExtensions,
},
},
),
)
.ucFirst()
.value();
};
const transRulesWeight = GetTranslation(
"front.image.validation.rules_weight",
{
params: {
size: formatFileSize(localMaxFileSize).toString(),
},
},
);
const buildDropzoneAccept = (): Record<string, string[]> => {
if (!allowedFormats) return {};
const currentExtensions = allowedFormats.split(",");
setExtensions(allowedFormats);
const mimeMap: Record<string, string> = {
jpg: "image/jpeg",
jpeg: "image/jpeg",
png: "image/png",
gif: "image/gif",
pdf: "application/pdf",
svg: "image/svg+xml",
webp: "image/webp",
};
const result: Record<string, Set<string>> = {};
currentExtensions.forEach((ext) => {
const cleanExt = ext.trim().toLowerCase();
const mime = mimeMap[cleanExt];
if (mime) {
if (!result[mime]) {
result[mime] = new Set();
}
result[mime].add(`.${cleanExt}`);
}
});
// Convert Set to Array for React Dropzone
const currentAccept: Record<string, string[]> = {};
Object.entries(result).forEach(([mime, extSet]) => {
currentAccept[mime] = Array.from(extSet);
});
setAccept(currentAccept);
return currentAccept;
};
useEffect(() => {
buildDropzoneAccept();
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);
return (
<div className="w-full">
{selectedFile ? (
<div className="relative">
<div
className={cn(
"text-sm flex justify-center border border-dashed overflow-hidden whitespace-normal [&_svg]:!size-auto [&_svg]:!shrink text-muted-foreground w-full h-36",
)}
>
<div className="flex flex-col justify-center items-center">
<FileCheck />
<p className="text-center break-normal w-full mt-2">
{str(transCropperFileUploaded).ucFirst().value()}
</p>
<small>{selectedFile.name}</small>
</div>
</div>
<BtnOptionnalLinkWithTooltip
className="absolute top-2 right-2"
variant="destructive"
content={<Trash className="w-4 h-4 m-auto" />}
onClick={() => {
setSelectedFile(null);
setData(name, null);
}}
tooltipContent={str(transCancel).ucFirst().value()}
/>
</div>
) : (
<ShadcnButton
variant="ghost"
type="button"
className={cn(
"relative rounded-full bg-muted w-[450px] h-[450px] flex border border-dashed overflow-hidden whitespace-normal [&_svg]:!pointer-events-auto [&_svg]:size-36 [&_svg]:!shrink text-muted-foreground",
// { "border-destructive": localErrors[name] },
)}
// eslint-disable-next-line react/jsx-props-no-spreading
{...getRootProps()}
>
{/* eslint-disable-next-line react/jsx-props-no-spreading */}
<input name={"file"} {...getInputProps()} />
<div className="flex flex-col justify-center items-center absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2">
<Image className="text-background stroke-[1.5px]" />
<p className="text-center break-normal w-full mt-2">
{transSelectImgZone}
</p>
<small>
{extensions
? getTransValidationAllowedFormats(extensions)
: transValidationAllFormats}
. {str(transRulesWeight).ucFirst().value()}
</small>
</div>
</ShadcnButton>
)}
</div>
)
}

View file

@ -0,0 +1,108 @@
// * Packages
import { EyeIcon, EyeOffIcon } from "lucide-react";
import { useState, useEffect, useRef, ReactNode } from "react";
import { usePage } from "@inertiajs/react";
// * Components shadcn
import { Input } from "@/components/ui/input";
import { Label } from "@/components/ui/label";
import { Button } from "@/components/ui/button";
// * Other
import { cn } from "@/lib/utils";
import useTrans from "@/hooks/use-translations";
import InputError from "@/front/Components/Base/InputError";
type SimpleStringProps = {
className?: string;
name: string;
label: ReactNode | string;
value?: string;
id?: string;
type?: string;
placeholder?: string;
required?: boolean;
disabled?: boolean;
/** Pattern is regex without antislash */
pattern?: string;
checkVisibility?: boolean;
parentErrors?: Record<string, string> | null;
// eslint-disable-next-line no-unused-vars
setData: (name: string, value: string) => void;
};
export default function SimpleString({
className,
value = "",
name,
label,
id = name,
type = "text",
placeholder = "uwil-backend::back.enter_text_here",
required = true,
disabled = false,
pattern,
checkVisibility = false,
parentErrors = null,
setData,
}: SimpleStringProps) {
const [isVisible, setIsVisible] = useState(checkVisibility);
const inputRef = useRef<HTMLInputElement>(null);
const { errors } = usePage().props;
const localErrors = parentErrors ?? errors;
useEffect(() => {
if (inputRef.current && inputRef.current.value !== value) {
inputRef.current.value = value;
}
}, [value]);
return (
<div
className={cn(
"flex flex-col w-full justify-between items-start gap-1.5",
className,
)}
>
<Label htmlFor={id} className="flex items-center gap-1.5">
{label}
{required && " *"}
</Label>
<div className="flex w-full">
<Input
id={id}
name={name}
type={isVisible ? "text" : type}
placeholder={useTrans(placeholder)}
defaultValue={value}
ref={inputRef}
onChange={(e) => {
setData(name, e.target.value);
}}
required={required}
disabled={disabled}
className={cn(
"rounded-full",
type === "password" || checkVisibility
? "w-[calc(100%-40px-0.25rem)]"
: "w-full",
{ "border-destructive/50": localErrors[name] },
)}
pattern={pattern ?? undefined}
/>
{(type === "password" || checkVisibility) && (
<Button
className="ms-1"
type="button"
size="icon"
onClick={() => {
setIsVisible(!isVisible);
}}
>
<EyeOffIcon className={!isVisible ? "hidden " : ""} />
<EyeIcon className={isVisible ? "hidden" : ""} />
</Button>
)}
</div>
<InputError message={localErrors[name]} />
</div>
);
}

View file

@ -0,0 +1,70 @@
// * Packages
import { usePage } from "@inertiajs/react";
// * Components shadcn
import { Label } from "@/components/ui/label";
import { Textarea } from "@/components/ui/textarea";
// * Other
import InputError from "@/front/Components/Base/InputError";
import useTrans from "@/hooks/use-translations";
import { cn } from "@/lib/utils";
type SimpleTextareaProps = {
className?: string;
name: string;
label: string;
value?: string;
id?: string;
placeholder?: string;
required?: boolean;
disabled?: boolean;
parentErrors?: Record<string, string> | null;
// eslint-disable-next-line no-unused-vars
setData: (name: string, value: string) => void;
};
export default function SimpleTextarea({
className,
name,
label,
value = "",
id = name,
placeholder = "uwil-backend::back.enter_text_here",
required = true,
disabled = false,
parentErrors = null,
setData,
}: SimpleTextareaProps) {
const { errors } = usePage().props;
const localErrors = parentErrors ?? errors;
return (
<div
className={cn(
"flex flex-col w-full justify-between items-start gap-1.5",
className,
)}
>
<Label htmlFor={id} className="flex items-center gap-1.5">
{label}
{required && " *"}
</Label>
<div className="flex w-full">
<Textarea
id={id}
name={name}
placeholder={useTrans(placeholder)}
defaultValue={value}
onChange={(e) => {
setData(name, e.target.value);
}}
required={required}
disabled={disabled}
className={cn("w-full", {
"border-destructive/50": localErrors[name],
})}
/>
</div>
<InputError message={localErrors[name]} />
</div>
);
}

View file

@ -0,0 +1,103 @@
/** REACT / INERTIA */
import React, { FormEvent } from "react";
import { usePage } from "@inertiajs/react";
/** LUCIDE */
import { InfoIcon } from "lucide-react";
/** SHADCN */
import { Button } from "@/components/ui/button";
/** BASE */
import { useRecaptcha } from "@/front/providers/RecaptchaProvider";
import InputError from "$/base/InputError";
import useTrans from "@/hooks/use-translations";
import { cn } from "@/lib/utils";
interface CustomData {
"g-recaptcha-response"?: string;
}
type Props<TFormData> = {
onSubmit: (e: FormEvent<HTMLFormElement>) => void;
data: TFormData & CustomData;
children: React.ReactNode;
footer?: React.ReactNode;
banner?: BannerClassName
classNames?: {
wrapperClassName?: string;
formClassName?: string;
}
};
type BannerClassName = {
classNames?: {
wrapperClassName?: string;
btnClassName?: string;
}
}
export default function RecaptchaForm<TFormData>({ onSubmit, classNames, banner, data, children, footer }: Props<TFormData>) {
const { getToken, formRef, enabled } = useRecaptcha();
const { errors } = usePage().props;
const recaptchaKey = usePage().props.recaptchaKey as string;
const handleSubmit = (e: FormEvent<HTMLFormElement>) => {
e.preventDefault();
if (!enabled) return;
const token = getToken();
data["g-recaptcha-response"] = token;
onSubmit(e);
};
return (
<div className={cn(classNames?.wrapperClassName)}>
<RecaptchaNotice banner={banner} />
<form
className={cn(classNames?.formClassName)}
ref={formRef} onSubmit={handleSubmit} data-recaptcha-key={recaptchaKey} inert={!enabled}>
{children}
{enabled && (
<>
<InputError
message={errors["g-recaptcha-response"]}
/>
<div className="r_captcha flex justify-center mt-8" />
</>
)}
{footer}
</form>
</div>
);
}
function RecaptchaNotice({ banner }: { banner?: BannerClassName }) {
const { enabled } = useRecaptcha();
const title = useTrans("cookie-notice.custom.recaptcha.title");
const warning = useTrans("cookie-notice.custom.recaptcha.warning");
const label = useTrans("cookie-notice.custom.recaptcha.accept");
const handleAccept = () => {
// @ts-expect-error
window.WebCookieNotice?.acceptCookie("recaptcha");
};
if (enabled) return null;
return (
<div
data-cookie-name="recaptcha"
className={cn("cn-cookie-activate flex flex-col rounded-lg border border-destructive/50 bg-card text-card-foreground shadow-sm gap-4 mb-4 p-6", banner?.classNames?.wrapperClassName)}
>
<p className="text-2xl font-semibold leading-none tracking-tight flex flex-row w-full items-start">
<InfoIcon className="mr-1" />
{title}
</p>
<div className="flex flex-row justify-between items-center">
<small className="text-success fw-normal fs-5">{warning}</small>
<Button
className={cn(banner?.classNames?.btnClassName)}
id="recaptcha-accept" type="button" onClick={handleAccept}>
{label}
</Button>
</div>
</div>
);
}

View file

@ -0,0 +1,62 @@
import { Loader } from "lucide-react";
import { cn, GetTranslation } from "@/lib/utils";
import { VideoProviderName } from "@/front/lib/constants";
import { useCookieNotice } from "@/hooks/use-cookie-notice";
type Props = {
service: VideoProviderName;
embedUrl: string;
title: string;
className?: string;
iframeContainerClassName?: string;
};
const VideoEmbedWithConsent = ({
service,
embedUrl,
title,
className = "",
iframeContainerClassName = ""
}: Props) => {
const { status, loading, accept } = useCookieNotice(service);
const warning = GetTranslation(`cookie-notice.custom.${service}.warning`);
const acceptLabel = GetTranslation(`cookie-notice.custom.${service}.accept`);
return (
<div className={`video-inlaid text-center ${className}`}>
{!status ? (
loading ? (
<div className="py-48 flex justify-center">
<Loader className="size-8 text-primary-foreground/40 animate-spin" />
</div>
) : (
<div className="py-48 flex gap-2 justify-center flex-col md:flex-row">
<p>{warning}</p>
<button
className="underline font-bold hover:opacity-80 transition"
type="button"
onClick={accept}
>
{acceptLabel}
</button>
</div>
)
) : (
<div className={cn("h-[81vh]", iframeContainerClassName)}>
<iframe
className="border-none"
width="100%"
height="100%"
src={embedUrl}
title={title}
allow="autoplay; encrypted-media"
allowFullScreen
/>
</div>
)}
</div>
);
};
export default VideoEmbedWithConsent;

View file

@ -0,0 +1,35 @@
import { DynamicPageModel } from "@/back/types/dynamic-pages";
import { AppEnv } from "@/types/global";
import { usePage } from "@inertiajs/react";
import React from "react";
type DynamicPages = Record<string, DynamicPageModel>;
type PascalCase = `${Capitalize<string>}`;
type PageKey = `page${PascalCase}`;
export default function DynamicPageResolver({
pageKey,
children,
}: {
pageKey: PageKey;
children: (data: { href: string; title: string; page: DynamicPageModel }) => React.ReactNode;
}) {
const dynamicPages = usePage().props.dynamicPages as DynamicPages;
const { locale } = usePage().props.appEnv as AppEnv;
const isValidPageKey = (key: string) => /^page([A-Z][a-z0-9]+)+$/.test(key);
if (!isValidPageKey(pageKey)) {
console.warn(`Invalid pageKey format: ${pageKey}`);
return null;
}
const page = dynamicPages[pageKey];
if (!page) return null;
const href = page.slug?.[locale] ?? "#";
const title = page.title?.[locale] ?? "";
return <>{children({ href, title, page })}</>;
}

View file

@ -0,0 +1,116 @@
/** SHADCN */
import { ButtonProps } from "@/components/ui/button";
/** THEME */
import { BgColorName, bgColors, VerticalPlacementName, verticalPlacements } from "@/front/lib/constants";
import Button from "$/uwil/Button"
import { CustomButtonVariant, TextProps } from "@/types/front";
import { cn } from "@/lib/utils";
type Props = {
/** Button configuration */
button: {
/** Button label */
label: string;
/** Link URL */
href: string;
/** Button vertical placement (top or bottom). Default: bottom */
placement?: VerticalPlacementName;
/** Custom button variant (optional) */
variant?: ButtonProps["variant"] | CustomButtonVariant;
};
/** Background color variant. Default: PRIMARY */
variant?: BgColorName;
/** Text content configuration */
text: TextProps;
};
/**
* ActionSection
*
* A reusable section component displaying a call-to-action with text and a button.
* The button can be positioned either above or below the text.
*
* This component is designed to be flexible and theme-aware through background variants
* and button styles.
*
* @component
*
* @param {Object} props - Component props
* @param {Object} props.button - Button configuration
* @param {string} props.button.label - Text displayed inside the button
* @param {string} props.button.href - URL the button links to
* @param {VerticalPlacementName} [props.button.placement="bottom"] - Vertical position of the button relative to the text ("top" or "bottom")
* @param {ButtonProps["variant"] | CustomButtonVariant} [props.button.variant] - Optional custom button variant (overrides default behavior)
*
* @param {BgColorName} [props.variant=bgColors.PRIMARY] - Background color variant of the section
*
* @param {TextProps} props.text - Text content configuration
* @param {string} props.text.text - HTML string displayed as the main text (rendered using dangerouslySetInnerHTML)
* @param {string} props.text.font - CSS class applied to the text for font styling
*
* @return {JSX.Element} A styled section with text and a call-to-action button
*
* @example
* <ActionSection
* variant={bgColors.SECONDARY}
* text={{
* text: "<strong>Start now</strong> and boost your productivity",
* font: "font-semibold"
* }}
* button={{
* label: "Get Started",
* href: "/signup",
* placement: verticalPlacements.BOTTOM
* }}
* />
*/
const ActionSection = (props: Props) => {
const { button, variant = bgColors.PRIMARY, text } = props;
const placement = button.placement ?? verticalPlacements.BOTTOM;
const btnVariant = variant === bgColors.PRIMARY ? "inverted" : "default";
return (
<div className={cn("text-center py-20", variant)}>
<div className="max-w-7xl mx-auto px-4 md:px-0 space-y-6">
{placement === verticalPlacements.TOP && (
<Button
variant={button.variant ?? btnVariant}
icon={{
icon: "chevron-right",
placement: "right"
}}
link={{
label: button.label,
href: button.href
}}
/>
)}
<p className={cn("text-2xl", text.font)} dangerouslySetInnerHTML={{
__html: text.text
}} />
{placement === verticalPlacements.BOTTOM && (
<Button
variant={button.variant ?? btnVariant}
icon={{
icon: "chevron-right",
placement: "right"
}}
link={{
label: button.label,
href: button.href
}}
/>
)}
</div>
</div>
)
}
export default ActionSection;

View file

@ -0,0 +1,20 @@
import Button from "$/uwil/Button";
import { sidePlacements } from "@/front/lib/constants";
import str from "@/hooks/use-string";
import { GetTranslation } from "@/lib/utils";
export default function BackToHome() {
return (
<Button
variant={"tertiary"}
link={{
href: "/",
label: str(GetTranslation('front.back_to_your_website')).ucFirst().value()
}}
icon={{
icon: "chevron-left",
placement: sidePlacements.LEFT
}}
/>
)
}

View file

@ -0,0 +1,25 @@
//* PACKAGES
import { usePage } from "@inertiajs/react";
//* THEME
import BreadcrumbsBase from "../Base/BreadCrumbsBase";
type Props = {
className?: string;
breadcrumbs?: Array<{
title: string;
url: string;
}>
}
const Breadcrumbs = (props: Props) => {
const { breadcrumbs, className } = props;
const pageBreadcrumbs = usePage().props.breadcrumbs as Array<{
title: string;
url: string;
}>;
console.log(usePage().props)
const breadcrumbsLocal = pageBreadcrumbs ?? breadcrumbs;
return (
<BreadcrumbsBase className={className} breadcrumbs={breadcrumbsLocal} />
)
}
export default Breadcrumbs;

View file

@ -0,0 +1,121 @@
import { Button as ShadcnButton, ButtonProps } from "@/components/ui/button"
import { FontName, fonts, iconMap, sidePlacements } from "@/front/lib/constants";
import { cn } from "@/lib/utils";
import { CustomButtonVariant, IconConfig } from "@/types/front";
import { Link } from "@inertiajs/react";
type ThemeButtonProps = Omit<ButtonProps, "variant" | "size"> & {
variant?: ButtonProps["variant"] | CustomButtonVariant;
size?: ButtonProps['size'] | CustomSize;
icon?: IconConfig
isBold?: boolean
font?: FontName;
link?: {
href: string,
label: string
}
}
type CustomSize = "xs";
const customVariantSizes: Record<CustomSize, string> = {
xs: "h-7 px-3 text-sm",
}
const customVariantStyles: Record<CustomButtonVariant, string> = {
tertiary: "bg-primary-foreground text-background hover:bg-primary-foreground/90",
inverted: "bg-background hover:bg-secondary/90"
}
const Button = ({
icon,
isBold = true,
font = fonts.GOTHAM,
size,
variant,
children,
className,
asChild,
link,
...props
}: ThemeButtonProps) => {
const Icon = icon ? iconMap[icon.icon] : undefined
const customVariant =
variant && variant in customVariantStyles
? customVariantStyles[variant as CustomButtonVariant]
: ""
const getSizeClasses = (size?: ButtonProps['size'] | CustomSize) => {
if (size && size in customVariantSizes) return customVariantSizes[size as CustomSize]
return "h-8 px-5"
}
const iconClassName = icon?.className ?? "";
if (link && link.href && link.label) {
return (
<ShadcnButton
variant={variant as ButtonProps["variant"]}
className={cn(
'rounded-full w-fit',
isBold ? "font-bold" : "font-normal",
font,
className,
getSizeClasses(size),
customVariant
)}
asChild
{...props}
>
<Link href={link.href} className="flex items-center justify-center gap-2">
{icon?.placement !== sidePlacements.RIGHT && Icon && <Icon className={cn(iconClassName)} />}
{link.label}
{icon?.placement === sidePlacements.RIGHT && Icon && <Icon className={cn(iconClassName)} />}
</Link>
</ShadcnButton>
)
}
if (asChild) {
return (
<ShadcnButton
variant={variant as ButtonProps["variant"]}
className={cn(
'rounded-full w-fit',
isBold ? "font-bold" : "font-normal",
font,
className,
getSizeClasses(size),
customVariant
)}
asChild
{...props}
>
<div>
{icon?.placement !== sidePlacements.RIGHT && Icon && <Icon className={cn(iconClassName)} />}
{children}
{icon?.placement === sidePlacements.RIGHT && Icon && <Icon className={cn(iconClassName)} />}
</div>
</ShadcnButton>
);
}
return (
<ShadcnButton
variant={variant as ButtonProps["variant"]}
className={cn('rounded-full w-fit',
isBold ? "font-bold" : "font-normal",
font,
className,
getSizeClasses(size),
customVariant,
)}
{...props}
>
{icon?.placement !== sidePlacements.RIGHT && Icon && <Icon className={cn(iconClassName)} />}
{children}
{icon?.placement === sidePlacements.RIGHT && Icon && <Icon className={cn(iconClassName)} />}
</ShadcnButton>
)
}
export default Button;

View file

@ -0,0 +1,24 @@
import { cn } from "@/lib/utils";
import { ReactNode, forwardRef } from "react";
type Props = {
children: ReactNode;
className?: string;
};
const Container = forwardRef<HTMLDivElement, Props>(
({ children, className }, ref) => {
return (
<div
ref={ref}
className={cn("mx-auto md:px-0 px-4 container", className)}
>
{children}
</div>
);
}
);
Container.displayName = "Container";
export default Container;

View file

@ -0,0 +1,10 @@
import { cn } from "@/lib/utils";
export default function CookieNoticeLink({ className } : { className?: string;}) {
const handleCookieLink = () => {
const cookieButton = document.getElementById('cn-cookie-btn');
cookieButton?.click()
}
return <button type="button" onClick={handleCookieLink} className={cn(className)}>Gestion des cookies</button>
}

View file

@ -0,0 +1,54 @@
import { Link } from "@inertiajs/react";
import Logo from "./Logo";
import SocialNetworks from "./SocialNetworks";
import { cn } from "@/lib/utils";
import ActionSection from "$/uwil/ActionSection";
import { bgColors, verticalPlacements } from "@/front/lib/constants";
import { route } from "ziggy-js";
import DynamicPageResolver from "../DynamicPageResolver";
import CookieNoticeLink from "$/uwil/CookieNoticeLink";
const Footer = () => {
const hoverLink = "hover:text-primary-foreground/80";
return (
<section>
<ActionSection
text={{
text: "<strong>Lorem ipsum dolor sit amet consectetur adipisicing elit</strong>. Sequi placeat harum laboriosam facilis a odit sunt, vero doloribus voluptatum suscipit odio, esse."
}}
button={{
href: route('front.contact-us'),
label: "Nous contacter",
placement: verticalPlacements.BOTTOM,
}} variant={bgColors.PRIMARY}
/>
<div className="flex flex-col gap-8 justify-center items-center py-20">
<Logo className="w-[128px] flex justify-center" />
<SocialNetworks className="gap-8" size="47" />
<footer className="mx-auto container">
<ul className="flex flex-col gap-3 md:gap-0 md:flex-row items-center justify-around font-medium">
<DynamicPageResolver pageKey="pageMentionsLegales">
{({ href, title }) => (
<Link href={href} className={cn(hoverLink)}>{title}</Link>
)}
</DynamicPageResolver>
<DynamicPageResolver pageKey="pageCharteDeConfidentialite">
{({ href, title }) => (
<Link href={href} className={cn(hoverLink)}>{title}</Link>
)}
</DynamicPageResolver>
<li>
<CookieNoticeLink className={hoverLink} />
</li>
<li>
<p>©OVOTEAM {new Date().getFullYear()}</p>
</li>
</ul>
</footer>
</div>
</section>
)
}
export default Footer;

View file

@ -0,0 +1,30 @@
import GoToTopBase from "../Base/GoToTopBase";
const GoToTop = () => {
return (
<GoToTopBase
children={
<svg width="71" height="83" viewBox="0 0 71 83" fill="none" xmlns="http://www.w3.org/2000/svg">
<g filter="url(#filter0_d_113_2)">
<path d="M67 43.5897C67 61.2912 52.897 75 35.5 75C18.103 75 4 61.2912 4 43.5897C4 25.8883 18.103 0 35.5 0C52.897 0 67 25.8883 67 43.5897Z" fill="#FFC647" />
<path d="M48.7901 36.0465L37.3473 24.6647C37.1297 24.4575 36.8731 24.2951 36.5924 24.187C36.0356 23.9597 35.4115 23.9605 34.8553 24.1892C34.5748 24.298 34.3187 24.461 34.1016 24.6687L22.6873 36.079C22.4744 36.2917 22.3057 36.5442 22.1907 36.822C22.0757 37.0998 22.0167 37.3975 22.0171 37.698C22.0179 38.305 22.2604 38.8868 22.6913 39.3154C23.1223 39.7441 23.7063 39.9844 24.315 39.9837C24.9237 39.9829 25.5072 39.7411 25.937 39.3114L33.4476 31.7807L33.4693 49.0798C33.47 49.6843 33.7116 50.2637 34.1408 50.6906C34.5699 51.1175 35.1516 51.3569 35.7578 51.3561C36.364 51.3554 36.9451 51.1145 37.3732 50.6866C37.8014 50.2586 38.0415 49.6786 38.0407 49.0741L38.0191 31.775L45.5485 39.287C45.7612 39.5003 46.0142 39.6696 46.2929 39.7849C46.5716 39.9003 46.8704 39.9595 47.1722 39.9591C47.4739 39.9588 47.7726 39.8988 48.051 39.7828C48.3294 39.6667 48.5819 39.4968 48.7942 39.2829C49.0081 39.0708 49.1779 38.8185 49.2936 38.5406C49.4093 38.2627 49.4686 37.9647 49.4683 37.6639C49.4679 37.363 49.4078 37.0652 49.2914 36.7876C49.175 36.51 49.0046 36.2581 48.7901 36.0465Z" fill="#111F51" />
</g>
<defs>
<filter id="filter0_d_113_2" x="0" y="0" width="71" height="83" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
<feFlood flood-opacity="0" result="BackgroundImageFix" />
<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha" />
<feOffset dy="4" />
<feGaussianBlur stdDeviation="2" />
<feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.25 0" />
<feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_113_2" />
<feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow_113_2" result="shape" />
</filter>
</defs>
</svg>
}
/>
)
}
export default GoToTop;

View file

@ -0,0 +1,86 @@
//* PACKAGES
import {
NavigationMenu,
NavigationMenuContent,
NavigationMenuItem,
NavigationMenuLink,
NavigationMenuList,
NavigationMenuTrigger,
navigationMenuTriggerStyle,
} from "@/components/ui/navigation-menu"
import { Link } from "@inertiajs/react"
//* THEME
import Logo from "$/uwil/Logo"
import SocialNetworks from "$/uwil/SocialNetworks"
import { cn } from "@/lib/utils"
import { FrontNavLinkProps } from "@/types/front"
import SearchInput from "../../Base/Inputs/SearchInput"
const DesktopNav = ({ navLinks } : { navLinks: FrontNavLinkProps[] }) => {
return (
<div className="hidden lg:block">
<div className="flex items-center justify-between my-3 pr-3">
<div>
<SearchInput />
</div>
<SocialNetworks />
</div>
<nav className="flex items-center justify-between">
<Logo className="w-[95px] h-auto" />
<NavigationMenu viewport={false} className="uppercase">
<NavigationMenuList className="gap-4">
{navLinks.map((link) => {
if (link.children) {
return (
<NavigationMenuItem>
<NavigationMenuTrigger className="text-md font-bold uppercase">{link.title}</NavigationMenuTrigger>
<NavigationMenuContent className="z-50">
<ul className="w-96 list-disc pl-5 space-y-0.5">
{link.children.map((child) => {
return (
<ListItem href={child.href ?? ""} title={child.title} />
)
})}
</ul>
</NavigationMenuContent>
</NavigationMenuItem>
)
} else {
return (
<NavigationMenuItem>
<NavigationMenuLink asChild className={cn(navigationMenuTriggerStyle(), "text-md font-bold")}>
<Link href={link.href}>{link.title}</Link>
</NavigationMenuLink>
</NavigationMenuItem>
)
}
})}
</NavigationMenuList>
</NavigationMenu>
</nav>
</div>
)
}
export default DesktopNav;
function ListItem({
title,
href,
...props
}: React.ComponentPropsWithoutRef<"li"> & { href: string }) {
return (
<li {...props}>
<NavigationMenuLink asChild>
<Link href={href}>
<div className="flex flex-col gap-1 text-sm py-1.5">
<div className="leading-none font-medium">{title}</div>
</div>
</Link>
</NavigationMenuLink>
</li>
)
}

Some files were not shown because too many files have changed in this diff Show more