Seite läuft wieder, menü bringt keine fehler mehr
This commit is contained in:
@@ -1 +0,0 @@
|
|||||||
{"mcpServers":{}}
|
|
||||||
@@ -32,10 +32,20 @@ class Handler extends ExceptionHandler
|
|||||||
|
|
||||||
public function render($request, Throwable $e)
|
public function render($request, Throwable $e)
|
||||||
{
|
{
|
||||||
\Illuminate\Support\Facades\Log::info('Handler render called', ['inertia' => $request->inertia(), 'exception' => get_class($e)]);
|
\Illuminate\Support\Facades\Log::info('Handler render called', ['inertia' => $request->inertia(), 'exception' => get_class($e), 'url' => $request->url()]);
|
||||||
|
|
||||||
|
if ($e instanceof \Symfony\Component\HttpKernel\Exception\NotFoundHttpException) {
|
||||||
|
\Illuminate\Support\Facades\Log::error('Route not found (404)', [
|
||||||
|
'url' => $request->url(),
|
||||||
|
'method' => $request->method(),
|
||||||
|
'referer' => $request->header('referer'),
|
||||||
|
'user_agent' => $request->header('user-agent')
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
if ($request->inertia()) {
|
if ($request->inertia()) {
|
||||||
if ($e instanceof ValidationException) {
|
if ($e instanceof ValidationException) {
|
||||||
\Illuminate\Support\Facades\Log::info('ValidationException in Inertia', ['errors' => $e->errors()]);
|
\Illuminate\Support\Facades\Log::info('ValidationException in Inertia', ['errors' => $e->errors(), 'url' => $request->url()]);
|
||||||
return response()->json([
|
return response()->json([
|
||||||
'message' => 'The given data was invalid.',
|
'message' => 'The given data was invalid.',
|
||||||
'errors' => $e->errors(),
|
'errors' => $e->errors(),
|
||||||
@@ -43,7 +53,7 @@ class Handler extends ExceptionHandler
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($e instanceof \Exception) {
|
if ($e instanceof \Exception) {
|
||||||
\Illuminate\Support\Facades\Log::info('Exception in Inertia', ['message' => $e->getMessage()]);
|
\Illuminate\Support\Facades\Log::info('Exception in Inertia', ['message' => $e->getMessage(), 'url' => $request->url()]);
|
||||||
return response()->json([
|
return response()->json([
|
||||||
'message' => 'Registrierung fehlgeschlagen.',
|
'message' => 'Registrierung fehlgeschlagen.',
|
||||||
'errors' => ['general' => $e->getMessage()],
|
'errors' => ['general' => $e->getMessage()],
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ class CheckoutController extends Controller
|
|||||||
/**
|
/**
|
||||||
* Render the checkout wizard using the legacy marketing controller for now.
|
* Render the checkout wizard using the legacy marketing controller for now.
|
||||||
*/
|
*/
|
||||||
public function show(Request $request, Package $package): JsonResponse
|
public function show(Request $request, Package $package): Response
|
||||||
{
|
{
|
||||||
$marketingController = app(MarketingController::class);
|
$marketingController = app(MarketingController::class);
|
||||||
|
|
||||||
|
|||||||
@@ -37,12 +37,6 @@ class MarketingController extends Controller
|
|||||||
return $p->append(['features', 'limits']);
|
return $p->append(['features', 'limits']);
|
||||||
});
|
});
|
||||||
|
|
||||||
Log::info('Inertia render called for index', [
|
|
||||||
'url' => request()->url(),
|
|
||||||
'inertia_header' => request()->header('X-Inertia'),
|
|
||||||
'packages_count' => $packages->count()
|
|
||||||
]);
|
|
||||||
|
|
||||||
return Inertia::render('marketing/Home', compact('packages'));
|
return Inertia::render('marketing/Home', compact('packages'));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -64,7 +58,7 @@ class MarketingController extends Controller
|
|||||||
|
|
||||||
public function contactView()
|
public function contactView()
|
||||||
{
|
{
|
||||||
return Inertia::render('marketing/Kontakt');
|
return Inertia::render('legal.kontakt');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -462,12 +456,6 @@ class MarketingController extends Controller
|
|||||||
abort(404, 'Invalid occasion type');
|
abort(404, 'Invalid occasion type');
|
||||||
}
|
}
|
||||||
|
|
||||||
Log::info('Inertia render called for occasionsType', [
|
|
||||||
'url' => request()->url(),
|
|
||||||
'inertia_header' => request()->header('X-Inertia'),
|
|
||||||
'type' => $type
|
|
||||||
]);
|
|
||||||
|
|
||||||
return Inertia::render('marketing/Occasions', ['type' => $type]);
|
return Inertia::render('marketing/Occasions', ['type' => $type]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace App\Models;
|
namespace App\Models;
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace App\Services\Checkout;
|
namespace App\Services\Checkout;
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace App\Services\Checkout;
|
namespace App\Services\Checkout;
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace App\Services\Checkout;
|
namespace App\Services\Checkout;
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'session_ttl_minutes' => env('CHECKOUT_SESSION_TTL', 30),
|
'session_ttl_minutes' => env('CHECKOUT_SESSION_TTL', 30),
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ return [
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
'ssr' => [
|
'ssr' => [
|
||||||
'enabled' => true,
|
'enabled' => false,
|
||||||
'url' => 'http://127.0.0.1:13714',
|
'url' => 'http://127.0.0.1:13714',
|
||||||
// 'bundle' => base_path('bootstrap/ssr/ssr.mjs'),
|
// 'bundle' => base_path('bootstrap/ssr/ssr.mjs'),
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
use App\Models\Package;
|
use App\Models\Package;
|
||||||
use App\Models\Tenant;
|
use App\Models\Tenant;
|
||||||
|
|||||||
2488
package-lock.json
generated
2488
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -73,4 +73,4 @@ Error generating stack: `+u.message+`
|
|||||||
<div id='root'></div>
|
<div id='root'></div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
<script id="playwrightReportBase64" type="application/zip">data:application/zip;base64,UEsDBBQAAAgIAEBrRluKTJ2DMAMAAOgIAAALAAAAcmVwb3J0Lmpzb269VUuP4zYM/iuEUGBnCo8bO5lJ46KLXnroYRcFOpdiNF0oNm1roocr0Zs10vz3Qs5L2UmzCxStD4Ykkh8/UqS4YRpJVIIEKzbbhHkSjh6lRlZk8/vFfLZYPEzy6SxhVe8ESWtYkS2m6f0sXxy/hNVSoWfF03PCOmdfsKT3Qh9OPAnyrNgwsiQUKyYJw08dloTVuOnN2bZWYjWMK7+SXbc/tStWkOtxmzB0zrqAzX4OqwJ+VWJYO9m0BI/oCSpZgbEEO1gg9HRzC2RhiVAKpbCCFh2m3LyznqC0WlsDDoW3xoM0peorLLi5g99tD8LtrKRpDlDSgIDSmlo2+6xAyED6JZOgBNQKAulB6s46wgqWA1CL1/Ba8RGB1hYqWdfo0BB8ROdloGtr+Kk7JuC74C6Fx1Z66H0vlBqgFV2HxnMDsG7RgDUYrILPCjs0FZpSYggcBts76ES5Eg2mL96avYYHa1674YYb3k8m2fJpMdEAIAj2++lCK2lWd6Pe7ueLaWQw0RCZZvDXyfCI8aB3OYpEmzGfh4OpTiLZ/rq3kX3trL4AnOs3nwfz5qR2Qv8hOjQx3zzme4xpmh1sM/12v8pz/Qo5IEzPIh6LJGI3lrFQCkISx+S3VmMnGrzIM7mYPOEHU0aSmw0EBNjewsn0x7dxds+jhIu3EgX5x8UgzzBmZxgQ0Sut8fHV7tr6xKyIZJ6cNM3Tc0w8Ej89f8Wd3X81k7C3Ct+h96LBf6C0ARo6vEb3Iicg/ETXrGD778J8OCvNQ7MdazQPoYdGDSX2OHT4i+5U+qHsXXhWfuslIdyUBefr9dpZS5zXlqzvJKo70XWcG1vhB22rXqHnPGojzsfW/Ewhliu55Hz32u6Ug//0xRfzWZFNb6Ni+hJbh4JwbJL/nev38yKfXeVK/zkvcsL42jodLQO3fH5fZPlVctdoBd+ec8wx+Hn1ehfZCZglh+H73o4Be6htb6owU8UKwfduP+mEa3qNhvw4FR02vRIuvNUO/W6CaUFlexiV4+DzKTdh7mkxgEGswuxGX4oOwQ96aZUHJVcInH3DGVgHnH3LGQhTwZ+9JRxn29Fxyp63fwNQSwECPwMUAAAICABAa0ZbikydgzADAADoCAAACwAAAAAAAAAAAAAAtIEAAAAAcmVwb3J0Lmpzb25QSwUGAAAAAAEAAQA5AAAAWQMAAAAA</script>
|
<script id="playwrightReportBase64" type="application/zip">data:application/zip;base64,UEsDBBQAAAgIAJx1RltXyxE/WgYAAMUoAAALAAAAcmVwb3J0Lmpzb27tWuty00YUfpUz+lGSqWVbthMTMWEIDIECgQwEaItoZi0dSRvvRd1LjCfN3z5An6f/+iZ9ks7KdiwndhwCpNDav6S9nD3n07l8u+sTj6MhCTHEC09Oa542RJkDytELg+7GVnejs7m1GbQ7NS+xihgqhRd2Njbqze5Gc/Lr1ryUMtRe+O59zSuUPMLYPCd80qINMdoLTzwjDWFe2Kx5+KHA2GBSvlgx85oy0h+WT7pPi2LcKvteaJTF05qHSknlZHsP3VMI+4wMB4pmuYED1AYSmoCQBkZiwaA29QR1rGgP19bBSOghxIQxTCBHhfVI7EltIJacSwEKiZZCAxUxswmGkfDhJ2mBqNEsKrILMqkAArEUKc3GOIHDpH7luW40mJwYoBooL6QymEBvCCbHywTn5BjBDCQkNE1RoTBwjEpTZ4BM4V5xhk2jXBcOcqrBaksYG0JOigKFjgTAIEcBUqCb5dZMsECRoIgpOihgKK2CgsR9kmH9SEsxHqFBiovLRCISkW02g967rSYHAGJg/N7e4plFbfxCSWeKnzI5qJezjA7blZlNDhUZAfw2lXAmbJOPwKp0nZQITxravFbpG7vEaWV+qiSfI7jFb5236tZ02FT6nUqjqOrbqup7ZlM7mMwN+N3xU6vFL0h2EtozFs8aVZ/2nLlSRfVHDmHYHyEMu0wO5ipfhWZtHaYd23ergM4aBjNqlb85xv0y17gZQZ1zgpyFVSN0Li1LQOGvlioEQTiCRmMLKKNAaQN47Dz+SLoYEgkUzvW1ATr/W9XmfOdNTvRQxFUgTqAgGcLpVQHZuADItLPRgB2tLUd4Q42LqmPQqI5RuThXVgiXEaQAJmPCcqlNuBF024sQ21y0kjNjQGg1DJwNc/0lk0ZWYc6NKcJGY1aDRgXA9fnePgnSM99ulSqRURY+GBb4Ay9Y/TC2yuWlV9YBsBaHUTQYDJSUJopSaaQuKDKfFEUUCZngIZeJZaijqBJ+UVR6/7kB1X5Ge1E0SuCjwW79+pEOu50waK9XnHGJtpNounlNg6ATtjqXqrprRexqQP1mtDSKCJ1KxSuPTtNWdyMMWpdqeplabm0dRdjCKLqsFISb0xW82qraf6PVPpccXTLyGRV9var0n7fSPx6jC88cumVIfIOl/gGjcR8IY1A6ifOyiduUhT3OMe5DKhWM2P9XVN6fUW1QlLqlhLos4wiLS3GwhvWsXoNOs6PXFyFzWUmPpdBVfx/JfzkWP9U+nIkJq9j8Lm0UFdlchwa3SbMLRArLe6jg9N37KmKVAe/erxjCiiF8IYawqHys2MF/gh1wovpoqMj8scBZEthZyBJaV2cJ+AHjV0MRX5ENxDllyWGhZIx6fqW5c3HiqBjs/vWnAqIM1USARkwWpf32J3OGzvU5w94Ec9gfYV6eEISwY/WA5Az+/v0PeIkZdQUDlRVZ2fKU2BTWdhUifAf7hCbrXyHROF+sF+LSw1Qq3GHsDJg5VOGq6i8s4iOveIWYlOnIP0BBhIE1pIITRrOFtKB7QeLEiasfssiLM28zpeiQJImfWM6H4PvICWXbDoJ7+IHwgmE9lhx8vyBaD6RKticPQasNvl+eqRy6c5btMnn6PiOThtcaFfg+SRKFWm9HnhuhjapDEHlOZC4Fbkfe952toNWOvNX5wYod3AA7WFY+rs0SPiM5uAYn+F9SAUmsyVfXAVc/JKiWghc71uRlHS+3oqNq4JOEU+Gi5iY3zDD303zagcHiTXHsclCcuygVGS7YoVaASu4fpeYJ/tx58Gbf5/e3Wk9bXZv3Xj95HRSBOhy8DbLdt7svHh792P+4L3yeeixR+RgVTSmq5Ro/3NpDlkvSejE43lUP9w6eZPbBYyLxaWBuv375tmcfPXmlzcCP9z5O4/O0ZbHGChOqMDaHVtHlCl+4UbjdbDYbLrobLsn1SLwc2v8mO4gVEoNlzblxXW93l9ED88X1ugFGMK+KhME1WcDqrOBrIghf7oQgzpXk1PIrUoGp2h+XcP/VXX91r+++zI7jBrD/ducb2cbP3BeUeXR8/T+gJp+4WHlbUJbWITDKqbnRq4Il5wDjfwIwmWWYlPGrx0QNSqJWA0GOaeYsM3JknJ65x19+SlAx5rr/B2iUujRGy6+28att/A0U7Y/ZvD+XZTrQkEorEu/96T9QSwECPwMUAAAICACcdUZbV8sRP1oGAADFKAAACwAAAAAAAAAAAAAAtIEAAAAAcmVwb3J0Lmpzb25QSwUGAAAAAAEAAQA5AAAAgwYAAAAA</script>
|
||||||
@@ -1,23 +1,46 @@
|
|||||||
{
|
{
|
||||||
|
"header": {
|
||||||
|
"home": "Startseite",
|
||||||
|
"packages": "Pakete",
|
||||||
|
"blog": "Blog",
|
||||||
|
"occasions": {
|
||||||
|
"wedding": "Hochzeit",
|
||||||
|
"birthday": "Geburtstag",
|
||||||
|
"corporate": "Firmenevent"
|
||||||
|
},
|
||||||
|
"contact": "Kontakt",
|
||||||
|
"login": "Anmelden",
|
||||||
|
"register": "Registrieren"
|
||||||
|
},
|
||||||
"login_failed": "Ungültige E-Mail oder Passwort.",
|
"login_failed": "Ungültige E-Mail oder Passwort.",
|
||||||
"login_success": "Sie sind nun eingeloggt.",
|
"login_success": "Sie sind nun eingeloggt.",
|
||||||
"registration_failed": "Registrierung fehlgeschlagen.",
|
"registration_failed": "Registrierung fehlgeschlagen.",
|
||||||
"registration_success": "Registrierung erfolgreich – fortfahren mit Kauf.",
|
"registration_success": "Registrierung erfolgreich – fortfahren mit Kauf.",
|
||||||
"already_logged_in": "Sie sind bereits eingeloggt.",
|
"already_logged_in": "Sie sind bereits eingeloggt.",
|
||||||
"failed_credentials": "Falsche Anmeldedaten.",
|
"failed_credentials": "Falsche Anmeldedaten.",
|
||||||
"header.login": "Anmelden",
|
"login": {
|
||||||
"header.register": "Registrieren",
|
"title": "Anmelden",
|
||||||
"header": {
|
"username_or_email": "Username oder E-Mail",
|
||||||
"home": "Home",
|
"password": "Passwort",
|
||||||
"packages": "Pakete",
|
"remember": "Angemeldet bleiben",
|
||||||
"blog": "Blog",
|
"submit": "Anmelden"
|
||||||
"contact": "Kontakt",
|
},
|
||||||
"login": "Anmelden",
|
"register": {
|
||||||
"register": "Registrieren",
|
"title": "Registrieren",
|
||||||
"occasions": {
|
"name": "Vollständiger Name",
|
||||||
"wedding": "Hochzeit",
|
"username": "Username",
|
||||||
"birthday": "Geburtstag",
|
"email": "E-Mail-Adresse",
|
||||||
"corporate": "Firmenevent"
|
"password": "Passwort",
|
||||||
}
|
"password_confirmation": "Passwort bestätigen",
|
||||||
|
"first_name": "Vorname",
|
||||||
|
"last_name": "Nachname",
|
||||||
|
"address": "Adresse",
|
||||||
|
"phone": "Telefonnummer",
|
||||||
|
"privacy_consent": "Ich stimme der Datenschutzerklärung zu und akzeptiere die Verarbeitung meiner persönlichen Daten.",
|
||||||
|
"submit": "Registrieren"
|
||||||
|
},
|
||||||
|
"verification": {
|
||||||
|
"notice": "Bitte bestätigen Sie Ihre E-Mail-Adresse.",
|
||||||
|
"resend": "E-Mail erneut senden"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -27,7 +27,11 @@ createInertiaApp({
|
|||||||
const root = createRoot(el);
|
const root = createRoot(el);
|
||||||
|
|
||||||
// Sync i18n with initial locale from props
|
// Sync i18n with initial locale from props
|
||||||
if (props.initialPage && props.initialPage.props && props.initialPage.props.locale) {
|
if (
|
||||||
|
props.initialPage &&
|
||||||
|
props.initialPage.props &&
|
||||||
|
typeof props.initialPage.props.locale === 'string'
|
||||||
|
) {
|
||||||
i18n.changeLanguage(props.initialPage.props.locale);
|
i18n.changeLanguage(props.initialPage.props.locale);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,26 +1,22 @@
|
|||||||
import React, { useEffect } from 'react';
|
import React from 'react';
|
||||||
import { usePage } from '@inertiajs/react';
|
import { usePage } from '@inertiajs/react';
|
||||||
import { Link, router } from '@inertiajs/react';
|
import { Link, router } from '@inertiajs/react';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import i18n from '@/i18n';
|
import i18n from '@/i18n';
|
||||||
import { useAppearance } from '@/hooks/use-appearance';
|
import { useAppearance } from '@/hooks/use-appearance';
|
||||||
|
import { useLocalizedRoutes } from '@/hooks/useLocalizedRoutes';
|
||||||
import { Button } from '@/components/ui/button';
|
import { Button } from '@/components/ui/button';
|
||||||
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@/components/ui/select';
|
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@/components/ui/select';
|
||||||
import { Avatar, AvatarFallback, AvatarImage } from '@/components/ui/avatar';
|
import { Avatar, AvatarFallback, AvatarImage } from '@/components/ui/avatar';
|
||||||
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuTrigger } from '@/components/ui/dropdown-menu';
|
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuTrigger } from '@/components/ui/dropdown-menu';
|
||||||
import { NavigationMenu, NavigationMenuItem, NavigationMenuLink, NavigationMenuList, navigationMenuTriggerStyle } from '@/components/ui/navigation-menu';
|
|
||||||
import { Sun, Moon } from 'lucide-react';
|
import { Sun, Moon } from 'lucide-react';
|
||||||
import { cn } from '@/lib/utils';
|
import { cn } from '@/lib/utils';
|
||||||
import { marketing as marketingRoute, packages as packagesRoute, blog as blogRoute, kontakt as kontaktRoute, login as loginRoute, register as registerRoute, anlaesseType } from '@/routes';
|
|
||||||
|
|
||||||
const Header: React.FC = () => {
|
const Header: React.FC = () => {
|
||||||
useEffect(() => {
|
|
||||||
console.log('Header mounted - Inertia initialized?', typeof window.Inertia !== 'undefined' ? 'Yes' : 'No');
|
|
||||||
console.log('Inertia links on page:', document.querySelectorAll('a[data-inertia]').length);
|
|
||||||
}, []);
|
|
||||||
const { auth, locale } = usePage().props as any;
|
const { auth, locale } = usePage().props as any;
|
||||||
const { t } = useTranslation('auth');
|
const { t } = useTranslation('auth');
|
||||||
const { appearance, updateAppearance } = useAppearance();
|
const { appearance, updateAppearance } = useAppearance();
|
||||||
|
const { localizedPath } = useLocalizedRoutes();
|
||||||
|
|
||||||
const toggleTheme = () => {
|
const toggleTheme = () => {
|
||||||
const newAppearance = appearance === 'dark' ? 'light' : 'dark';
|
const newAppearance = appearance === 'dark' ? 'light' : 'dark';
|
||||||
@@ -28,114 +24,80 @@ const Header: React.FC = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const handleLanguageChange = (value: string) => {
|
const handleLanguageChange = (value: string) => {
|
||||||
router.post(
|
router.post('/set-locale', { locale: value }, {
|
||||||
'/set-locale',
|
|
||||||
{ locale: value },
|
|
||||||
{
|
|
||||||
preserveState: true,
|
preserveState: true,
|
||||||
replace: true,
|
replace: true,
|
||||||
onSuccess: () => {
|
onSuccess: () => {
|
||||||
i18n.changeLanguage(value);
|
i18n.changeLanguage(value);
|
||||||
},
|
},
|
||||||
},
|
});
|
||||||
);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleLogout = () => {
|
const handleLogout = () => {
|
||||||
router.post('/logout');
|
router.post('/logout');
|
||||||
};
|
};
|
||||||
|
|
||||||
const occasionUrl = (typeKey: 'hochzeit' | 'geburtstag' | 'firmenevent') =>
|
|
||||||
`/anlaesse/${typeKey}`;
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<header className="fixed top-0 z-50 w-full bg-white/95 dark:bg-gray-900/95 backdrop-blur-md shadow-lg border-b border-gray-200/50 dark:border-gray-700/50">
|
<header className="fixed top-0 z-50 w-full bg-white dark:bg-gray-900 shadow-lg border-b-2 border-gray-200 dark:border-gray-700">
|
||||||
<div className="container mx-auto px-4 py-3">
|
<div className="container mx-auto px-4 py-4">
|
||||||
<div className="flex justify-between items-center">
|
<div className="flex justify-between items-center">
|
||||||
<Link
|
<Link href="{localizedPath('/')}" className="text-2xl font-bold text-gray-800 dark:text-gray-200">
|
||||||
href={marketingRoute().url}
|
|
||||||
className="text-2xl font-bold text-gray-800 dark:text-gray-200 hover:text-pink-500 dark:hover:text-pink-400 transition-colors duration-200"
|
|
||||||
>
|
|
||||||
Fotospiel
|
Fotospiel
|
||||||
</Link>
|
</Link>
|
||||||
<NavigationMenu className="hidden md:flex">
|
<nav className="flex space-x-8">
|
||||||
<NavigationMenuList className="space-x-1">
|
<Link href={localizedPath('/')} className="text-gray-600 hover:text-gray-900 dark:text-gray-300 dark:hover:text-white font-sans-marketing text-lg">
|
||||||
<NavigationMenuItem>
|
|
||||||
<NavigationMenuLink href={marketingRoute().url} className={cn(
|
|
||||||
navigationMenuTriggerStyle(),
|
|
||||||
"text-gray-600 hover:text-gray-900 dark:text-gray-300 dark:hover:text-white font-sans-marketing text-lg bg-transparent hover:bg-pink-50 dark:hover:bg-pink-900/20 rounded-md px-3 py-2 transition-all duration-200"
|
|
||||||
)}>
|
|
||||||
{t('header.home', 'Home')}
|
{t('header.home', 'Home')}
|
||||||
</NavigationMenuLink>
|
</Link>
|
||||||
</NavigationMenuItem>
|
<Link href={localizedPath('/packages')} className="text-gray-600 hover:text-gray-900 dark:text-gray-300 dark:hover:text-white font-sans-marketing text-lg">
|
||||||
<NavigationMenuItem>
|
|
||||||
<NavigationMenuLink href={packagesRoute().url} className={cn(
|
|
||||||
navigationMenuTriggerStyle(),
|
|
||||||
"text-gray-600 hover:text-gray-900 dark:text-gray-300 dark:hover:text-white font-sans-marketing text-lg bg-transparent hover:bg-pink-50 dark:hover:bg-pink-900/20 rounded-md px-3 py-2 transition-all duration-200"
|
|
||||||
)}>
|
|
||||||
{t('header.packages', 'Pakete')}
|
{t('header.packages', 'Pakete')}
|
||||||
</NavigationMenuLink>
|
</Link>
|
||||||
</NavigationMenuItem>
|
<Link href={localizedPath('/blog')} className="text-gray-600 hover:text-gray-900 dark:text-gray-300 dark:hover:text-white font-sans-marketing text-lg">
|
||||||
<NavigationMenuItem>
|
|
||||||
<NavigationMenuLink href={blogRoute().url} className={cn(
|
|
||||||
navigationMenuTriggerStyle(),
|
|
||||||
"text-gray-600 hover:text-gray-900 dark:text-gray-300 dark:hover:text-white font-sans-marketing text-lg bg-transparent hover:bg-pink-50 dark:hover:bg-pink-900/20 rounded-md px-3 py-2 transition-all duration-200"
|
|
||||||
)}>
|
|
||||||
{t('header.blog', 'Blog')}
|
{t('header.blog', 'Blog')}
|
||||||
</NavigationMenuLink>
|
</Link>
|
||||||
</NavigationMenuItem>
|
|
||||||
<NavigationMenuItem>
|
|
||||||
<DropdownMenu>
|
<DropdownMenu>
|
||||||
<DropdownMenuTrigger asChild>
|
<DropdownMenuTrigger asChild>
|
||||||
<Button variant="ghost" className="text-gray-600 hover:text-gray-900 dark:text-gray-300 dark:hover:text-white font-sans-marketing text-lg bg-transparent hover:bg-pink-50 dark:hover:bg-pink-900/20 rounded-md px-3 py-2 transition-all duration-200">
|
<Button variant="ghost" className="text-gray-600 hover:text-gray-900 dark:text-gray-300 dark:hover:text-white font-sans-marketing text-lg">
|
||||||
Anlässe
|
Anlässe
|
||||||
</Button>
|
</Button>
|
||||||
</DropdownMenuTrigger>
|
</DropdownMenuTrigger>
|
||||||
<DropdownMenuContent className="w-56 bg-white dark:bg-gray-800 border-gray-200 dark:border-gray-700 shadow-lg rounded-xl">
|
<DropdownMenuContent>
|
||||||
<DropdownMenuItem asChild>
|
<DropdownMenuItem asChild>
|
||||||
<Link href={occasionUrl('hochzeit')} className="w-full hover:bg-pink-50 dark:hover:bg-pink-900/20 transition-colors duration-200">
|
<Link href={localizedPath('/anlaesse/hochzeit')} className="w-full flex items-center">
|
||||||
{t('header.occasions.wedding', 'Hochzeit')}
|
{t('header.occasions.wedding', 'Hochzeit')}
|
||||||
</Link>
|
</Link>
|
||||||
</DropdownMenuItem>
|
</DropdownMenuItem>
|
||||||
<DropdownMenuItem asChild>
|
<DropdownMenuItem asChild>
|
||||||
<Link href={occasionUrl('geburtstag')} className="w-full hover:bg-pink-50 dark:hover:bg-pink-900/20 transition-colors duration-200">
|
<Link href={localizedPath('/anlaesse/geburtstag')} className="w-full flex items-center">
|
||||||
{t('header.occasions.birthday', 'Geburtstag')}
|
{t('header.occasions.birthday', 'Geburtstag')}
|
||||||
</Link>
|
</Link>
|
||||||
</DropdownMenuItem>
|
</DropdownMenuItem>
|
||||||
<DropdownMenuItem asChild>
|
<DropdownMenuItem asChild>
|
||||||
<Link href={occasionUrl('firmenevent')} className="w-full hover:bg-pink-50 dark:hover:bg-pink-900/20 transition-colors duration-200">
|
<Link href={localizedPath('/anlaesse/firmenevent')} className="w-full flex items-center">
|
||||||
{t('header.occasions.corporate', 'Firmenevent')}
|
{t('header.occasions.corporate', 'Firmenevent')}
|
||||||
</Link>
|
</Link>
|
||||||
</DropdownMenuItem>
|
</DropdownMenuItem>
|
||||||
</DropdownMenuContent>
|
</DropdownMenuContent>
|
||||||
</DropdownMenu>
|
</DropdownMenu>
|
||||||
</NavigationMenuItem>
|
<Link href={localizedPath('/kontakt')} className="text-gray-600 hover:text-gray-900 dark:text-gray-300 dark:hover:text-white font-sans-marketing text-lg">
|
||||||
<NavigationMenuItem>
|
|
||||||
<NavigationMenuLink href={kontaktRoute().url} className={cn(
|
|
||||||
navigationMenuTriggerStyle(),
|
|
||||||
"text-gray-600 hover:text-gray-900 dark:text-gray-300 dark:hover:text-white font-sans-marketing text-lg bg-transparent hover:bg-pink-50 dark:hover:bg-pink-900/20 rounded-md px-3 py-2 transition-all duration-200"
|
|
||||||
)}>
|
|
||||||
{t('header.contact', 'Kontakt')}
|
{t('header.contact', 'Kontakt')}
|
||||||
</NavigationMenuLink>
|
</Link>
|
||||||
</NavigationMenuItem>
|
</nav>
|
||||||
</NavigationMenuList>
|
|
||||||
</NavigationMenu>
|
|
||||||
<div className="flex items-center space-x-4">
|
<div className="flex items-center space-x-4">
|
||||||
<Button
|
<Button
|
||||||
variant="ghost"
|
variant="ghost"
|
||||||
size="icon"
|
size="icon"
|
||||||
onClick={toggleTheme}
|
onClick={toggleTheme}
|
||||||
className="h-8 w-8 hover:bg-pink-50 dark:hover:bg-pink-900/20 transition-colors duration-200"
|
className="h-8 w-8"
|
||||||
>
|
>
|
||||||
<Sun className={cn("h-4 w-4", appearance === "dark" && "hidden")} />
|
<Sun className={cn("h-4 w-4", appearance === "dark" && "hidden")} />
|
||||||
<Moon className={cn("h-4 w-4", appearance !== "dark" && "hidden")} />
|
<Moon className={cn("h-4 w-4", appearance !== "dark" && "hidden")} />
|
||||||
<span className="sr-only">Theme Toggle</span>
|
<span className="sr-only">Theme Toggle</span>
|
||||||
</Button>
|
</Button>
|
||||||
<Select value={locale} onValueChange={handleLanguageChange}>
|
<Select value={locale} onValueChange={handleLanguageChange}>
|
||||||
<SelectTrigger className="w-[70px] h-8 border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-800 hover:bg-pink-50 dark:hover:bg-pink-900/20">
|
<SelectTrigger className="w-[70px] h-8">
|
||||||
<SelectValue placeholder="DE" />
|
<SelectValue placeholder="DE" />
|
||||||
</SelectTrigger>
|
</SelectTrigger>
|
||||||
<SelectContent className="bg-white dark:bg-gray-800 border-gray-200 dark:border-gray-700">
|
<SelectContent>
|
||||||
<SelectItem value="de">DE</SelectItem>
|
<SelectItem value="de">DE</SelectItem>
|
||||||
<SelectItem value="en">EN</SelectItem>
|
<SelectItem value="en">EN</SelectItem>
|
||||||
</SelectContent>
|
</SelectContent>
|
||||||
@@ -143,33 +105,33 @@ const Header: React.FC = () => {
|
|||||||
{auth.user ? (
|
{auth.user ? (
|
||||||
<DropdownMenu>
|
<DropdownMenu>
|
||||||
<DropdownMenuTrigger asChild>
|
<DropdownMenuTrigger asChild>
|
||||||
<Button variant="ghost" className="relative h-8 w-8 rounded-full hover:bg-pink-50 dark:hover:bg-pink-900/20 transition-colors duration-200">
|
<Button variant="ghost" className="relative h-8 w-8 rounded-full">
|
||||||
<Avatar className="h-8 w-8">
|
<Avatar className="h-8 w-8">
|
||||||
<AvatarImage src={auth.user?.avatar} alt={auth.user?.name || 'User'} />
|
<AvatarImage src={auth.user?.avatar} alt={auth.user?.name || 'User'} />
|
||||||
<AvatarFallback className="bg-pink-100 dark:bg-pink-900 text-pink-600 dark:text-pink-400">{(auth.user?.name || auth.user?.email || 'U').charAt(0)}</AvatarFallback>
|
<AvatarFallback>{(auth.user?.name || auth.user?.email || 'U').charAt(0)}</AvatarFallback>
|
||||||
</Avatar>
|
</Avatar>
|
||||||
</Button>
|
</Button>
|
||||||
</DropdownMenuTrigger>
|
</DropdownMenuTrigger>
|
||||||
<DropdownMenuContent className="w-56 bg-white dark:bg-gray-800 border-gray-200 dark:border-gray-700 shadow-lg rounded-xl" align="end" forceMount>
|
<DropdownMenuContent className="w-56" align="end" forceMount>
|
||||||
<DropdownMenuLabel className="font-normal">
|
<DropdownMenuLabel className="font-normal">
|
||||||
<div className="flex flex-col space-y-1">
|
<div className="flex flex-col space-y-1">
|
||||||
<p className="text-sm font-medium leading-none text-gray-900 dark:text-gray-100">{auth.user?.name || auth.user?.email || 'User'}</p>
|
<p className="text-sm font-medium leading-none">{auth.user?.name || auth.user?.email || 'User'}</p>
|
||||||
<p className="text-xs leading-none text-gray-500 dark:text-gray-400">{auth.user?.email || ''}</p>
|
<p className="text-xs leading-none text-muted-foreground">{auth.user?.email || ''}</p>
|
||||||
</div>
|
</div>
|
||||||
</DropdownMenuLabel>
|
</DropdownMenuLabel>
|
||||||
<DropdownMenuSeparator className="bg-gray-200 dark:bg-gray-700" />
|
<DropdownMenuSeparator />
|
||||||
<DropdownMenuItem asChild>
|
<DropdownMenuItem asChild>
|
||||||
<Link href="/profile" className="hover:bg-pink-50 dark:hover:bg-pink-900/20 transition-colors duration-200">
|
<Link href={localizedPath('/profile')}>
|
||||||
Profil
|
Profil
|
||||||
</Link>
|
</Link>
|
||||||
</DropdownMenuItem>
|
</DropdownMenuItem>
|
||||||
<DropdownMenuItem asChild>
|
<DropdownMenuItem asChild>
|
||||||
<Link href="/profile/orders" className="hover:bg-pink-50 dark:hover:bg-pink-900/20 transition-colors duration-200">
|
<Link href={localizedPath('/profile/orders')}>
|
||||||
Bestellungen
|
Bestellungen
|
||||||
</Link>
|
</Link>
|
||||||
</DropdownMenuItem>
|
</DropdownMenuItem>
|
||||||
<DropdownMenuSeparator className="bg-gray-200 dark:bg-gray-700" />
|
<DropdownMenuSeparator />
|
||||||
<DropdownMenuItem onClick={handleLogout} className="hover:bg-pink-50 dark:hover:bg-pink-900/20 transition-colors duration-200">
|
<DropdownMenuItem onClick={handleLogout}>
|
||||||
Abmelden
|
Abmelden
|
||||||
</DropdownMenuItem>
|
</DropdownMenuItem>
|
||||||
</DropdownMenuContent>
|
</DropdownMenuContent>
|
||||||
@@ -177,14 +139,14 @@ const Header: React.FC = () => {
|
|||||||
) : (
|
) : (
|
||||||
<>
|
<>
|
||||||
<Link
|
<Link
|
||||||
href={loginRoute().url}
|
href={localizedPath('/login')}
|
||||||
className="text-gray-600 hover:text-gray-900 dark:text-gray-300 dark:hover:text-white hover:bg-pink-50 dark:hover:bg-pink-900/20 px-3 py-2 rounded-md transition-all duration-200"
|
className="text-gray-600 hover:text-gray-900 dark:text-gray-300 dark:hover:text-white"
|
||||||
>
|
>
|
||||||
{t('header.login')}
|
{t('header.login')}
|
||||||
</Link>
|
</Link>
|
||||||
<Link
|
<Link
|
||||||
href={registerRoute().url}
|
href={localizedPath('/register')}
|
||||||
className="bg-pink-500 hover:bg-pink-600 dark:bg-pink-600 dark:hover:bg-pink-700 text-white px-4 py-2 rounded-md transition-all duration-200 shadow-md hover:shadow-lg"
|
className="bg-pink-500 text-white px-4 py-2 rounded hover:bg-pink-600 dark:bg-pink-600 dark:hover:bg-pink-700"
|
||||||
>
|
>
|
||||||
{t('header.register')}
|
{t('header.register')}
|
||||||
</Link>
|
</Link>
|
||||||
|
|||||||
@@ -1,17 +1,21 @@
|
|||||||
import React, { useState } from 'react';
|
import React, { useMemo, useState } from 'react';
|
||||||
import { Link } from '@inertiajs/react';
|
import { Link } from '@inertiajs/react';
|
||||||
import { usePage } from '@inertiajs/react';
|
import { usePage } from '@inertiajs/react';
|
||||||
|
import { useLocalizedRoutes } from '@/hooks/useLocalizedRoutes';
|
||||||
|
|
||||||
const MarketingHeader: React.FC = () => {
|
const MarketingHeader: React.FC = () => {
|
||||||
const [isOpen, setIsOpen] = useState(false);
|
const [isOpen, setIsOpen] = useState(false);
|
||||||
const { url } = usePage();
|
usePage();
|
||||||
|
const { localizedPath } = useLocalizedRoutes();
|
||||||
|
|
||||||
const occasions = [
|
const occasions = useMemo(
|
||||||
{ href: '/de/occasions/weddings', label: 'Hochzeiten' },
|
() => [
|
||||||
{ href: '/de/occasions/birthdays', label: 'Geburtstage' },
|
{ href: localizedPath('/anlaesse/hochzeit'), label: 'Hochzeiten' },
|
||||||
{ href: '/de/occasions/corporate-events', label: 'Firmenevents' },
|
{ href: localizedPath('/anlaesse/geburtstag'), label: 'Geburtstage' },
|
||||||
{ href: '/de/occasions/family-celebrations', label: 'Familienfeiern' },
|
{ href: localizedPath('/anlaesse/firmenevent'), label: 'Firmenevents' },
|
||||||
];
|
],
|
||||||
|
[localizedPath]
|
||||||
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<header className="bg-white shadow-md sticky top-0 z-50">
|
<header className="bg-white shadow-md sticky top-0 z-50">
|
||||||
|
|||||||
@@ -1,11 +1,30 @@
|
|||||||
import { useLocale } from './useLocale';
|
import { useLocale } from './useLocale';
|
||||||
|
|
||||||
|
type LocalizedPathInput = string | null | undefined;
|
||||||
|
|
||||||
export const useLocalizedRoutes = () => {
|
export const useLocalizedRoutes = () => {
|
||||||
const locale = useLocale();
|
const locale = useLocale();
|
||||||
|
|
||||||
const localizedPath = (path: string) => {
|
const localizedPath = (path: LocalizedPathInput) => {
|
||||||
|
if (typeof path !== 'string' || path.trim().length === 0) {
|
||||||
|
// Diagnose cases where components pass falsy / non-string hrefs (e.g. legacy localized routes, pagination links)
|
||||||
|
// This log allows us to correlate console errors from Inertia with offending components.
|
||||||
|
console.error('[useLocalizedRoutes] Invalid path input detected', {
|
||||||
|
path,
|
||||||
|
locale,
|
||||||
|
stack: new Error().stack,
|
||||||
|
});
|
||||||
|
|
||||||
|
return '/';
|
||||||
|
}
|
||||||
|
|
||||||
|
const trimmed = path.trim();
|
||||||
|
const normalized = trimmed.startsWith('/') ? trimmed : `/${trimmed}`;
|
||||||
|
|
||||||
|
console.debug('[useLocalizedRoutes] Resolved path', { input: path, normalized, locale });
|
||||||
|
|
||||||
// Since prefix-free, return plain path. Locale is handled via session.
|
// Since prefix-free, return plain path. Locale is handled via session.
|
||||||
return path.startsWith('/') ? path : `/${path}`;
|
return normalized;
|
||||||
};
|
};
|
||||||
|
|
||||||
return { localizedPath };
|
return { localizedPath };
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { Head, Link } from '@inertiajs/react';
|
import { Head, Link, usePage } from '@inertiajs/react';
|
||||||
import MarketingLayout from '@/layouts/MarketingLayout';
|
import MarketingLayout from '@/layouts/MarketingLayout';
|
||||||
import { usePage } from '@inertiajs/react';
|
import { useLocalizedRoutes } from '@/hooks/useLocalizedRoutes';
|
||||||
|
|
||||||
const Datenschutz: React.FC = () => {
|
const Datenschutz: React.FC = () => {
|
||||||
const { props } = usePage();
|
const { props } = usePage();
|
||||||
const { __ } = props as any; // Für i18n
|
const { __ } = props as any; // Für i18n
|
||||||
|
const { localizedPath } = useLocalizedRoutes();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<MarketingLayout title={__('legal.datenschutz_title')}>
|
<MarketingLayout title={__('legal.datenschutz_title')}>
|
||||||
@@ -21,7 +22,7 @@ const Datenschutz: React.FC = () => {
|
|||||||
</p>
|
</p>
|
||||||
<p className="mb-4 font-sans-marketing">{__('legal.data_retention')}</p>
|
<p className="mb-4 font-sans-marketing">{__('legal.data_retention')}</p>
|
||||||
<p className="mb-4 font-sans-marketing">
|
<p className="mb-4 font-sans-marketing">
|
||||||
{__('legal.rights')} <Link href="/de/kontakt">{__('legal.contact')}</Link>.
|
{__('legal.rights')} <Link href={localizedPath('/kontakt')}>{__('legal.contact')}</Link>.
|
||||||
</p>
|
</p>
|
||||||
<p className="mb-4 font-sans-marketing">{__('legal.cookies')}</p>
|
<p className="mb-4 font-sans-marketing">{__('legal.cookies')}</p>
|
||||||
|
|
||||||
|
|||||||
@@ -14,27 +14,65 @@ interface Props {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const Blog: React.FC<Props> = ({ posts }) => {
|
const Blog: React.FC<Props> = ({ posts }) => {
|
||||||
|
|
||||||
const { localizedPath } = useLocalizedRoutes();
|
const { localizedPath } = useLocalizedRoutes();
|
||||||
const { t } = useTranslation('marketing');
|
const { t } = useTranslation('marketing');
|
||||||
|
|
||||||
|
const resolvePaginationHref = React.useCallback(
|
||||||
|
(raw?: string | null) => {
|
||||||
|
if (!raw) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
const parsed = new URL(
|
||||||
|
raw,
|
||||||
|
typeof window !== 'undefined' ? window.location.origin : 'http://localhost'
|
||||||
|
);
|
||||||
|
|
||||||
|
const normalized = `${parsed.pathname}${parsed.search}`;
|
||||||
|
return localizedPath(normalized);
|
||||||
|
} catch (error) {
|
||||||
|
console.warn('[Marketing Blog] Fallback resolving pagination link', { raw, error });
|
||||||
|
return localizedPath(raw);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
[localizedPath]
|
||||||
|
);
|
||||||
|
|
||||||
const renderPagination = () => {
|
const renderPagination = () => {
|
||||||
if (!posts.links || posts.links.length <= 3) return null;
|
if (!posts.links || posts.links.length <= 3) return null;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="mt-12 text-center">
|
<div className="mt-12 text-center">
|
||||||
<div className="flex justify-center space-x-2">
|
<div className="flex justify-center space-x-2">
|
||||||
{posts.links.map((link, index) => (
|
{posts.links.map((link, index) => {
|
||||||
<Link
|
const href = resolvePaginationHref(link.url);
|
||||||
key={index}
|
|
||||||
href={link.url || '#'}
|
const baseClasses = `px-3 py-2 rounded ${
|
||||||
className={`px-3 py-2 rounded ${
|
|
||||||
link.active
|
link.active
|
||||||
? 'bg-[#FFB6C1] text-white'
|
? 'bg-[#FFB6C1] text-white'
|
||||||
: 'bg-gray-200 text-gray-700 hover:bg-gray-300'
|
: 'bg-gray-200 text-gray-700 hover:bg-gray-300'
|
||||||
}`}
|
}`;
|
||||||
|
|
||||||
|
if (!href) {
|
||||||
|
return (
|
||||||
|
<span
|
||||||
|
key={index}
|
||||||
|
className={`${baseClasses} cursor-default`}
|
||||||
dangerouslySetInnerHTML={{ __html: link.label }}
|
dangerouslySetInnerHTML={{ __html: link.label }}
|
||||||
/>
|
/>
|
||||||
))}
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Link
|
||||||
|
key={index}
|
||||||
|
href={href}
|
||||||
|
className={baseClasses}
|
||||||
|
dangerouslySetInnerHTML={{ __html: link.label }}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
})}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ const Home: React.FC<Props> = ({ packages }) => {
|
|||||||
</div>
|
</div>
|
||||||
<div className="md:w-1/2">
|
<div className="md:w-1/2">
|
||||||
<img
|
<img
|
||||||
src="/images/hero-image.jpg"
|
src="https://via.placeholder.com/600x400/FFB6C1/FFFFFF?text=Fotospiel+Hero"
|
||||||
alt={t('home.hero_image_alt')}
|
alt={t('home.hero_image_alt')}
|
||||||
className="w-full h-auto rounded-lg shadow-lg"
|
className="w-full h-auto rounded-lg shadow-lg"
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -3,8 +3,8 @@ import { usePage } from "@inertiajs/react";
|
|||||||
import { Button } from "@/components/ui/button";
|
import { Button } from "@/components/ui/button";
|
||||||
import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert";
|
import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert";
|
||||||
import { useCheckoutWizard } from "../WizardContext";
|
import { useCheckoutWizard } from "../WizardContext";
|
||||||
import LoginForm, { AuthUserPayload } from "../../../auth/LoginForm";
|
import LoginForm, { AuthUserPayload } from "../../auth/LoginForm";
|
||||||
import RegisterForm, { RegisterSuccessPayload } from "../../../auth/RegisterForm";
|
import RegisterForm, { RegisterSuccessPayload } from "../../auth/RegisterForm";
|
||||||
|
|
||||||
interface AuthStepProps {
|
interface AuthStepProps {
|
||||||
privacyHtml: string;
|
privacyHtml: string;
|
||||||
|
|||||||
@@ -15,12 +15,12 @@ export const ConfirmationStep: React.FC<ConfirmationStepProps> = ({ onViewProfil
|
|||||||
<Alert>
|
<Alert>
|
||||||
<AlertTitle>Willkommen bei FotoSpiel</AlertTitle>
|
<AlertTitle>Willkommen bei FotoSpiel</AlertTitle>
|
||||||
<AlertDescription>
|
<AlertDescription>
|
||||||
Ihr Paket wurde aktiviert. Wir haben Ihnen eine Bestätigung per E-Mail gesendet.
|
{Ihr Paket "" ist aktiviert. Wir haben Ihnen eine Bestaetigung per E-Mail gesendet.}
|
||||||
</AlertDescription>
|
</AlertDescription>
|
||||||
</Alert>
|
</Alert>
|
||||||
<div className="flex flex-wrap gap-3 justify-end">
|
<div className="flex flex-wrap gap-3 justify-end">
|
||||||
<Button variant="outline" onClick={onViewProfile}>
|
<Button variant="outline" onClick={onViewProfile}>
|
||||||
Profil öffnen
|
Profil oeffnen
|
||||||
</Button>
|
</Button>
|
||||||
<Button>Zum Admin-Bereich</Button>
|
<Button>Zum Admin-Bereich</Button>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
46
resources/lang/de/auth.json
Normal file
46
resources/lang/de/auth.json
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
{
|
||||||
|
"login_failed": "Ungültige E-Mail oder Passwort.",
|
||||||
|
"login_success": "Sie sind nun eingeloggt.",
|
||||||
|
"registration_failed": "Registrierung fehlgeschlagen.",
|
||||||
|
"registration_success": "Registrierung erfolgreich – fortfahren mit Kauf.",
|
||||||
|
"already_logged_in": "Sie sind bereits eingeloggt.",
|
||||||
|
"failed_credentials": "Falsche Anmeldedaten.",
|
||||||
|
"header": {
|
||||||
|
"login": "Anmelden",
|
||||||
|
"register": "Registrieren",
|
||||||
|
"home": "Startseite",
|
||||||
|
"packages": "Pakete",
|
||||||
|
"blog": "Blog",
|
||||||
|
"occasions": {
|
||||||
|
"wedding": "Hochzeit",
|
||||||
|
"birthday": "Geburtstag",
|
||||||
|
"corporate": "Firmenevent"
|
||||||
|
},
|
||||||
|
"contact": "Kontakt"
|
||||||
|
},
|
||||||
|
"login": {
|
||||||
|
"title": "Anmelden",
|
||||||
|
"username_or_email": "Username oder E-Mail",
|
||||||
|
"password": "Passwort",
|
||||||
|
"remember": "Angemeldet bleiben",
|
||||||
|
"submit": "Anmelden"
|
||||||
|
},
|
||||||
|
"register": {
|
||||||
|
"title": "Registrieren",
|
||||||
|
"name": "Vollständiger Name",
|
||||||
|
"username": "Username",
|
||||||
|
"email": "E-Mail-Adresse",
|
||||||
|
"password": "Passwort",
|
||||||
|
"password_confirmation": "Passwort bestätigen",
|
||||||
|
"first_name": "Vorname",
|
||||||
|
"last_name": "Nachname",
|
||||||
|
"address": "Adresse",
|
||||||
|
"phone": "Telefonnummer",
|
||||||
|
"privacy_consent": "Ich stimme der Datenschutzerklärung zu und akzeptiere die Verarbeitung meiner persönlichen Daten.",
|
||||||
|
"submit": "Registrieren"
|
||||||
|
},
|
||||||
|
"verification": {
|
||||||
|
"notice": "Bitte bestätigen Sie Ihre E-Mail-Adresse.",
|
||||||
|
"resend": "E-Mail erneut senden"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -33,16 +33,14 @@ return [
|
|||||||
'resend' => 'E-Mail erneut senden',
|
'resend' => 'E-Mail erneut senden',
|
||||||
],
|
],
|
||||||
'header' => [
|
'header' => [
|
||||||
'home' => 'Home',
|
'home' => 'Startseite',
|
||||||
'packages' => 'Pakete',
|
'packages' => 'Pakete',
|
||||||
'blog' => 'Blog',
|
'blog' => 'Blog',
|
||||||
'contact' => 'Kontakt',
|
|
||||||
'login' => 'Anmelden',
|
|
||||||
'register' => 'Registrieren',
|
|
||||||
'occasions' => [
|
'occasions' => [
|
||||||
'wedding' => 'Hochzeit',
|
'wedding' => 'Hochzeit',
|
||||||
'birthday' => 'Geburtstag',
|
'birthday' => 'Geburtstag',
|
||||||
'corporate' => 'Firmenevent',
|
'corporate' => 'Firmenevent',
|
||||||
],
|
],
|
||||||
|
'contact' => 'Kontakt',
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
@@ -237,7 +237,12 @@
|
|||||||
"register": {
|
"register": {
|
||||||
"free": "Kostenlos"
|
"free": "Kostenlos"
|
||||||
},
|
},
|
||||||
|
"currency": {
|
||||||
|
"euro": "€"
|
||||||
|
},
|
||||||
|
"common": {
|
||||||
"currency": {
|
"currency": {
|
||||||
"euro": "€"
|
"euro": "€"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
@@ -1,45 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
return [
|
|
||||||
'failed' => 'These credentials do not match our records.',
|
|
||||||
'password' => 'The provided password is incorrect.',
|
|
||||||
'throttle' => 'Too many login attempts. Please try again in :seconds seconds.',
|
|
||||||
'login' => [
|
|
||||||
'title' => 'Log In',
|
|
||||||
'username_or_email' => 'Username or Email',
|
|
||||||
'password' => 'Password',
|
|
||||||
'remember' => 'Remember Me',
|
|
||||||
'submit' => 'Log In',
|
|
||||||
],
|
|
||||||
'register' => [
|
|
||||||
'title' => 'Register',
|
|
||||||
'name' => 'Full Name',
|
|
||||||
'username' => 'Username',
|
|
||||||
'email' => 'Email Address',
|
|
||||||
'password' => 'Password',
|
|
||||||
'password_confirmation' => 'Confirm Password',
|
|
||||||
'first_name' => 'First Name',
|
|
||||||
'last_name' => 'Last Name',
|
|
||||||
'address' => 'Address',
|
|
||||||
'phone' => 'Phone Number',
|
|
||||||
'privacy_consent' => 'I agree to the privacy policy and accept the processing of my personal data.',
|
|
||||||
'submit' => 'Register',
|
|
||||||
],
|
|
||||||
'verification' => [
|
|
||||||
'notice' => 'Please confirm your email address.',
|
|
||||||
'resend' => 'Resend Email',
|
|
||||||
],
|
|
||||||
'header' => [
|
|
||||||
'home' => 'Home',
|
|
||||||
'packages' => 'Packages',
|
|
||||||
'blog' => 'Blog',
|
|
||||||
'contact' => 'Contact',
|
|
||||||
'login' => 'Login',
|
|
||||||
'register' => 'Register',
|
|
||||||
'occasions' => [
|
|
||||||
'wedding' => 'Wedding',
|
|
||||||
'birthday' => 'Birthday',
|
|
||||||
'corporate' => 'Corporate Event',
|
|
||||||
],
|
|
||||||
],
|
|
||||||
];
|
|
||||||
@@ -1,22 +1,21 @@
|
|||||||
<header class="bg-white shadow-md sticky top-0 z-50">
|
<header class="bg-white shadow-md sticky top-0 z-50">
|
||||||
<div class="container mx-auto px-4 py-4 flex items-center justify-between">
|
<div class="container mx-auto px-4 py-4 flex items-center justify-between">
|
||||||
<div class="flex items-center space-x-2">
|
<div class="flex items-center space-x-2">
|
||||||
<a href="/" class="text-2xl font-bold text-gray-900">Die Fotospiel.App</a>
|
<a href="{{ route('marketing') }}" class="text-2xl font-bold text-gray-900">Die Fotospiel.App</a>
|
||||||
<svg class="w-6 h-6 text-gray-600" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
|
<svg class="w-6 h-6 text-gray-600" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
|
||||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3 9a2 2 0 012-2h.93a2 2 0 001.664-.89l.812-1.22A2 2 0 0110.07 4h3.86a2 2 0 011.664.89l.812 1.22A2 2 0 0018.07 7H19a2 2 0 012 2v9a2 2 0 01-2 2H5a2 2 0 01-2-2V9z"></path>
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3 9a2 2 0 012-2h.93a2 2 0 001.664-.89l.812-1.22A2 2 0 0110.07 4h3.86a2 2 0 011.664.89l.812 1.22A2 2 0 0018.07 7H19a2 2 0 012 2v9a2 2 0 01-2 2H5a2 2 0 01-2-2V9z"></path>
|
||||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 13a3 3 0 11-6 0 3 3 0 016 0z"></path>
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 13a3 3 0 11-6 0 3 3 0 016 0z"></path>
|
||||||
</svg>
|
</svg>
|
||||||
</div>
|
</div>
|
||||||
<nav class="hidden md:flex space-x-6 items-center">
|
<nav class="hidden md:flex space-x-6 items-center">
|
||||||
<a href="/#how-it-works" class="text-gray-600 hover:text-gray-900">{{ __('marketing.nav.how_it_works') }}</a>
|
<a href="{{ route('marketing') }}#how-it-works" class="text-gray-600 hover:text-gray-900">{{ __('marketing.nav.how_it_works') }}</a>
|
||||||
<a href="/#features" class="text-gray-600 hover:text-gray-900">{{ __('marketing.nav.features') }}</a>
|
<a href="{{ route('marketing') }}#features" class="text-gray-600 hover:text-gray-900">{{ __('marketing.nav.features') }}</a>
|
||||||
<div x-data="{ open: false }" @mouseenter="open = true" @mouseleave="open = false" @click.away="open = false" class="relative">
|
<div x-data="{ open: false }" @mouseenter="open = true" @mouseleave="open = false" @click.away="open = false" class="relative">
|
||||||
<button class="text-gray-600 hover:text-gray-900" @click.stop="open = !open">{{ __('marketing.nav.occasions') }}</button>
|
<button class="text-gray-600 hover:text-gray-900" @click.stop="open = !open">{{ __('marketing.nav.occasions') }}</button>
|
||||||
<div x-show="open" x-transition:enter="transition ease-out duration-200" x-transition:enter-start="opacity-0 transform scale-95" x-transition:enter-end="opacity-100 transform scale-100" x-transition:leave="transition ease-in duration-150" x-transition:leave-start="opacity-100 transform scale-100" x-transition:leave-end="opacity-0 transform scale-95" class="absolute top-full left-0 mt-2 bg-white border rounded shadow-lg z-10">
|
<div x-show="open" x-transition:enter="transition ease-out duration-200" x-transition:enter-start="opacity-0 transform scale-95" x-transition:enter-end="opacity-100 transform scale-100" x-transition:leave="transition ease-in duration-150" x-transition:leave-start="opacity-100 transform scale-100" x-transition:leave-end="opacity-0 transform scale-95" class="absolute top-full left-0 mt-2 bg-white border rounded shadow-lg z-10">
|
||||||
<a href="{{ route('occasions.type', ['locale' => app()->getLocale(), 'type' => 'weddings']) }}" class="block px-4 py-2 text-gray-600 hover:text-gray-900 hover:bg-gray-50 transition">{{ __('marketing.nav.occasions_types.weddings') }}</a>
|
<a href="{{ route('anlaesse.type', ['type' => 'hochzeit']) }}" class="block px-4 py-2 text-gray-600 hover:text-gray-900 hover:bg-gray-50 transition">{{ __('marketing.nav.occasions_types.weddings') }}</a>
|
||||||
<a href="{{ route('occasions.type', ['locale' => app()->getLocale(), 'type' => 'birthdays']) }}" class="block px-4 py-2 text-gray-600 hover:text-gray-900 hover:bg-gray-50 transition">{{ __('marketing.nav.occasions_types.birthdays') }}</a>
|
<a href="{{ route('anlaesse.type', ['type' => 'geburtstag']) }}" class="block px-4 py-2 text-gray-600 hover:text-gray-900 hover:bg-gray-50 transition">{{ __('marketing.nav.occasions_types.birthdays') }}</a>
|
||||||
<a href="{{ route('occasions.type', ['locale' => app()->getLocale(), 'type' => 'corporate-events']) }}" class="block px-4 py-2 text-gray-600 hover:text-gray-900 hover:bg-gray-50 transition">{{ __('marketing.nav.occasions_types.corporate') }}</a>
|
<a href="{{ route('anlaesse.type', ['type' => 'firmenevent']) }}" class="block px-4 py-2 text-gray-600 hover:text-gray-900 hover:bg-gray-50 transition">{{ __('marketing.nav.occasions_types.corporate') }}</a>
|
||||||
<a href="{{ route('occasions.type', ['locale' => app()->getLocale(), 'type' => 'family-celebrations']) }}" class="block px-4 py-2 text-gray-600 hover:text-gray-900 hover:bg-gray-50 transition">{{ __('marketing.nav.occasions_types.family') }}</a>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<a href="{{ route('blog') }}" class="text-gray-600 hover:text-gray-900">{{ __('marketing.nav.blog') }}</a>
|
<a href="{{ route('blog') }}" class="text-gray-600 hover:text-gray-900">{{ __('marketing.nav.blog') }}</a>
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
use App\Http\Controllers\Api\EventPublicController;
|
use App\Http\Controllers\Api\EventPublicController;
|
||||||
use App\Http\Controllers\Api\Tenant\EventController;
|
use App\Http\Controllers\Api\Tenant\EventController;
|
||||||
|
|||||||
@@ -55,7 +55,9 @@ Route::middleware('locale')->group(function () {
|
|||||||
Route::get('/datenschutz', function () {
|
Route::get('/datenschutz', function () {
|
||||||
return view('legal.datenschutz');
|
return view('legal.datenschutz');
|
||||||
})->name('datenschutz');
|
})->name('datenschutz');
|
||||||
Route::get('/kontakt', [\App\Http\Controllers\MarketingController::class, 'contactView'])->name('kontakt');
|
Route::get('/kontakt', function () {
|
||||||
|
return view('legal.kontakt');
|
||||||
|
})->name('kontakt');
|
||||||
Route::post('/kontakt', [\App\Http\Controllers\MarketingController::class, 'contact'])->name('kontakt.submit');
|
Route::post('/kontakt', [\App\Http\Controllers\MarketingController::class, 'contact'])->name('kontakt.submit');
|
||||||
|
|
||||||
// Anlässe routes
|
// Anlässe routes
|
||||||
|
|||||||
106
tests/e2e/homepage-links.test.ts
Normal file
106
tests/e2e/homepage-links.test.ts
Normal file
@@ -0,0 +1,106 @@
|
|||||||
|
import { test, expect } from '@playwright/test';
|
||||||
|
|
||||||
|
test.describe('Homepage Links Test', () => {
|
||||||
|
test('Click all links on homepage and check for errors', async ({ page }) => {
|
||||||
|
// Listen for failed requests (e.g., 404s)
|
||||||
|
const failedRequests: { url: string; status: number }[] = [];
|
||||||
|
page.on('response', response => {
|
||||||
|
if (response.status() >= 400) {
|
||||||
|
failedRequests.push({
|
||||||
|
url: response.url(),
|
||||||
|
status: response.status()
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// Listen for console errors
|
||||||
|
const consoleErrors: string[] = [];
|
||||||
|
page.on('console', msg => {
|
||||||
|
if (msg.type() === 'error') {
|
||||||
|
consoleErrors.push(msg.text());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// Navigate to homepage
|
||||||
|
await page.goto('/');
|
||||||
|
|
||||||
|
// Wait for page to load
|
||||||
|
await page.waitForLoadState('networkidle');
|
||||||
|
|
||||||
|
// Get all links
|
||||||
|
const links = page.locator('a');
|
||||||
|
const linkCount = await links.count();
|
||||||
|
console.log(`Found ${linkCount} links on homepage.`);
|
||||||
|
|
||||||
|
for (let i = 0; i < linkCount; i++) {
|
||||||
|
const link = links.nth(i);
|
||||||
|
const href = await link.getAttribute('href');
|
||||||
|
const text = await link.textContent() || '';
|
||||||
|
|
||||||
|
if (!href || href.startsWith('#') || href.startsWith('mailto:') || href.startsWith('tel:')) {
|
||||||
|
console.log(`Skipping non-navigational link: ${text} (${href})`);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log(`Clicking link ${i + 1}/${linkCount}: "${text}" -> ${href}`);
|
||||||
|
|
||||||
|
// For each link, create temporary listeners
|
||||||
|
const linkFailedRequests: { url: string; status: number }[] = [];
|
||||||
|
const linkConsoleErrors: string[] = [];
|
||||||
|
const linkResponseHandler = (response: any) => {
|
||||||
|
if (response.status() >= 400) {
|
||||||
|
linkFailedRequests.push({
|
||||||
|
url: response.url(),
|
||||||
|
status: response.status()
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
const linkConsoleHandler = (msg: any) => {
|
||||||
|
if (msg.type() === 'error') {
|
||||||
|
linkConsoleErrors.push(msg.text());
|
||||||
|
}
|
||||||
|
};
|
||||||
|
page.on('response', linkResponseHandler);
|
||||||
|
page.on('console', linkConsoleHandler);
|
||||||
|
|
||||||
|
let currentUrl = page.url();
|
||||||
|
try {
|
||||||
|
// Hover and click
|
||||||
|
await link.hover();
|
||||||
|
await link.click({ force: true });
|
||||||
|
|
||||||
|
// Wait for navigation or load
|
||||||
|
await page.waitForTimeout(2000);
|
||||||
|
|
||||||
|
currentUrl = page.url();
|
||||||
|
|
||||||
|
// Remove temporary handlers
|
||||||
|
page.removeListener('response', linkResponseHandler);
|
||||||
|
page.removeListener('console', linkConsoleHandler);
|
||||||
|
|
||||||
|
// Check for errors during this click
|
||||||
|
expect(linkFailedRequests.length).toBe(0);
|
||||||
|
expect(linkConsoleErrors.length).toBe(0);
|
||||||
|
|
||||||
|
console.log(`✓ Link "${text}" successful: ${currentUrl}`);
|
||||||
|
} catch (error: unknown) {
|
||||||
|
// Remove handlers
|
||||||
|
page.removeListener('response', linkResponseHandler);
|
||||||
|
page.removeListener('console', linkConsoleHandler);
|
||||||
|
|
||||||
|
console.error(`✗ Error clicking link "${text}": ${(error as Error).message}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Go back to homepage if navigated away
|
||||||
|
if (currentUrl !== page.url() && !currentUrl.includes('/')) {
|
||||||
|
await page.goBack({ waitUntil: 'networkidle' });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Final checks
|
||||||
|
expect(failedRequests.length).toBe(0);
|
||||||
|
expect(consoleErrors.length).toBe(0);
|
||||||
|
|
||||||
|
console.log('All links tested successfully.');
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -1,73 +0,0 @@
|
|||||||
import { test, expect } from '@playwright/test';
|
|
||||||
|
|
||||||
test('Test all links on homepage', async ({ page }) => {
|
|
||||||
const errors: string[] = [];
|
|
||||||
const consoleMessages: { type: string; text: string }[] = [];
|
|
||||||
|
|
||||||
page.on('console', msg => {
|
|
||||||
consoleMessages.push({ type: msg.type(), text: msg.text() });
|
|
||||||
if (msg.type() === 'error') {
|
|
||||||
console.log('Console Error:', msg.text());
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
page.on('pageerror', error => {
|
|
||||||
console.log('Page Error:', error.message);
|
|
||||||
errors.push(error.message);
|
|
||||||
});
|
|
||||||
|
|
||||||
await page.goto('http://localhost:8000/');
|
|
||||||
|
|
||||||
// Wait for page to load
|
|
||||||
await page.waitForLoadState('networkidle');
|
|
||||||
|
|
||||||
// Get all links
|
|
||||||
const links = await page.locator('a[href]').all();
|
|
||||||
|
|
||||||
console.log(`Found ${links.length} links`);
|
|
||||||
|
|
||||||
for (let i = 0; i < links.length; i++) {
|
|
||||||
const link = links[i];
|
|
||||||
const text = await link.textContent();
|
|
||||||
const href = await link.getAttribute('href');
|
|
||||||
|
|
||||||
console.log(`Clicking link ${i + 1}: "${text?.trim() || 'No text'}" -> ${href}`);
|
|
||||||
|
|
||||||
try {
|
|
||||||
// Clear previous errors
|
|
||||||
const currentErrors = [...errors];
|
|
||||||
errors.length = 0;
|
|
||||||
|
|
||||||
await link.click({ force: true });
|
|
||||||
|
|
||||||
// Wait a bit for navigation or error
|
|
||||||
await page.waitForTimeout(1000);
|
|
||||||
|
|
||||||
// Check for new errors
|
|
||||||
const newErrors = errors.filter(e => !currentErrors.includes(e));
|
|
||||||
if (newErrors.length > 0) {
|
|
||||||
console.log(`Error on link "${text?.trim() || 'No text'}":`, newErrors);
|
|
||||||
expect(newErrors).toHaveLength(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check console for errors after click
|
|
||||||
const recentConsole = consoleMessages.filter(msg => msg.text.includes('TypeError') || msg.text.includes('href') || msg.type === 'error');
|
|
||||||
if (recentConsole.length > 0) {
|
|
||||||
console.log(`Console error on link "${text?.trim() || 'No text'}":`, recentConsole);
|
|
||||||
expect(recentConsole).toHaveLength(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
// If navigated, go back
|
|
||||||
if (page.url() !== 'http://localhost:8000/') {
|
|
||||||
await page.goBack();
|
|
||||||
await page.waitForLoadState('networkidle');
|
|
||||||
}
|
|
||||||
|
|
||||||
} catch (error: unknown) {
|
|
||||||
console.log(`Error clicking link "${text?.trim() || 'No text'}":`, (error as Error).message);
|
|
||||||
expect(error).toBeUndefined();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
expect(errors).toHaveLength(0);
|
|
||||||
});
|
|
||||||
@@ -1,73 +0,0 @@
|
|||||||
import { test, expect } from '@playwright/test';
|
|
||||||
|
|
||||||
test('Test all links on homepage', async ({ page }) => {
|
|
||||||
const errors = [];
|
|
||||||
const consoleMessages = [];
|
|
||||||
|
|
||||||
page.on('console', msg => {
|
|
||||||
consoleMessages.push({ type: msg.type(), text: msg.text() });
|
|
||||||
if (msg.type() === 'error') {
|
|
||||||
console.log('Console Error:', msg.text());
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
page.on('pageerror', error => {
|
|
||||||
console.log('Page Error:', error.message);
|
|
||||||
errors.push(error.message);
|
|
||||||
});
|
|
||||||
|
|
||||||
await page.goto('http://localhost:8000/');
|
|
||||||
|
|
||||||
// Wait for page to load
|
|
||||||
await page.waitForLoadState('networkidle');
|
|
||||||
|
|
||||||
// Get all links
|
|
||||||
const links = await page.locator('a[href]').all();
|
|
||||||
|
|
||||||
console.log(`Found ${links.length} links`);
|
|
||||||
|
|
||||||
for (let i = 0; i < links.length; i++) {
|
|
||||||
const link = links[i];
|
|
||||||
const text = await link.textContent();
|
|
||||||
const href = await link.getAttribute('href');
|
|
||||||
|
|
||||||
console.log(`Clicking link ${i + 1}: "${text?.trim() || 'No text'}" -> ${href}`);
|
|
||||||
|
|
||||||
try {
|
|
||||||
// Clear previous errors
|
|
||||||
const currentErrors = [...errors];
|
|
||||||
errors.length = 0;
|
|
||||||
|
|
||||||
await link.click({ force: true });
|
|
||||||
|
|
||||||
// Wait a bit for navigation or error
|
|
||||||
await page.waitForTimeout(1000);
|
|
||||||
|
|
||||||
// Check for new errors
|
|
||||||
const newErrors = errors.filter(e => !currentErrors.includes(e));
|
|
||||||
if (newErrors.length > 0) {
|
|
||||||
console.log(`Error on link "${text?.trim() || 'No text'}":`, newErrors);
|
|
||||||
expect(newErrors).toHaveLength(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check console for errors after click
|
|
||||||
const recentConsole = consoleMessages.filter(msg => msg.text.includes('TypeError') || msg.text.includes('href') || msg.type() === 'error');
|
|
||||||
if (recentConsole.length > 0) {
|
|
||||||
console.log(`Console error on link "${text?.trim() || 'No text'}":`, recentConsole);
|
|
||||||
expect(recentConsole).toHaveLength(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
// If navigated, go back
|
|
||||||
if (page.url() !== 'http://localhost:8000/') {
|
|
||||||
await page.goBack();
|
|
||||||
await page.waitForLoadState('networkidle');
|
|
||||||
}
|
|
||||||
|
|
||||||
} catch (error) {
|
|
||||||
console.log(`Error clicking link "${text?.trim() || 'No text'}":`, error);
|
|
||||||
expect(error).toBeUndefined();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
expect(errors).toHaveLength(0);
|
|
||||||
});
|
|
||||||
Reference in New Issue
Block a user