Update admin PWA events, branding, and packages
This commit is contained in:
@@ -1,3 +1,4 @@
|
|||||||
|
{"id":"--stealth-d39","title":"Superadmin control surface spec and access matrix","description":"Define the minimal superadmin control surface, permissions, and mapping to tenant/guest responsibilities. Document scope and non-goals.","status":"tombstone","priority":2,"issue_type":"task","created_at":"2026-01-01T14:16:06.994379577+01:00","updated_at":"2026-01-01T17:23:28.230936323+01:00","close_reason":"Duplicate of fotospiel-app-ihd after beads re-init","deleted_at":"2026-01-01T17:23:28.230936323+01:00","deleted_by":"soeren","delete_reason":"Remove stray stealth issue id","original_type":"task"}
|
||||||
{"id":"fotospiel-app-097","title":"Tenant announcements / release notes","description":"Broadcast announcements to tenants/admins with targeting and scheduling.","status":"closed","priority":3,"issue_type":"feature","created_at":"2026-01-01T14:20:21.68206312+01:00","updated_at":"2026-01-02T14:18:31.676816348+01:00","closed_at":"2026-01-02T14:18:31.676816348+01:00","close_reason":"Closed"}
|
{"id":"fotospiel-app-097","title":"Tenant announcements / release notes","description":"Broadcast announcements to tenants/admins with targeting and scheduling.","status":"closed","priority":3,"issue_type":"feature","created_at":"2026-01-01T14:20:21.68206312+01:00","updated_at":"2026-01-02T14:18:31.676816348+01:00","closed_at":"2026-01-02T14:18:31.676816348+01:00","close_reason":"Closed"}
|
||||||
{"id":"fotospiel-app-0h0","title":"SEC-BILL-02 Signature freshness + retry policies for Paddle webhooks","status":"open","priority":2,"issue_type":"task","created_at":"2026-01-01T15:53:37.618780852+01:00","created_by":"soeren","updated_at":"2026-01-01T15:53:37.618780852+01:00"}
|
{"id":"fotospiel-app-0h0","title":"SEC-BILL-02 Signature freshness + retry policies for Paddle webhooks","status":"open","priority":2,"issue_type":"task","created_at":"2026-01-01T15:53:37.618780852+01:00","created_by":"soeren","updated_at":"2026-01-01T15:53:37.618780852+01:00"}
|
||||||
{"id":"fotospiel-app-0rb","title":"Tenant admin onboarding: inline checkout integration in welcome flow","status":"closed","priority":2,"issue_type":"task","created_at":"2026-01-01T16:08:22.434997456+01:00","created_by":"soeren","updated_at":"2026-01-01T16:08:28.026795975+01:00","closed_at":"2026-01-01T16:08:28.026795975+01:00","close_reason":"Completed in codebase (verified)"}
|
{"id":"fotospiel-app-0rb","title":"Tenant admin onboarding: inline checkout integration in welcome flow","status":"closed","priority":2,"issue_type":"task","created_at":"2026-01-01T16:08:22.434997456+01:00","created_by":"soeren","updated_at":"2026-01-01T16:08:28.026795975+01:00","closed_at":"2026-01-01T16:08:28.026795975+01:00","close_reason":"Completed in codebase (verified)"}
|
||||||
|
|||||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -12,6 +12,7 @@ fotospiel-tenant-app
|
|||||||
/resources/js/wayfinder
|
/resources/js/wayfinder
|
||||||
/storage/*.key
|
/storage/*.key
|
||||||
/storage/pail
|
/storage/pail
|
||||||
|
/C:\\wwwroot\\fotospiel-app\\storage\\app/
|
||||||
/vendor
|
/vendor
|
||||||
/clients/photobooth-uploader/**/bin
|
/clients/photobooth-uploader/**/bin
|
||||||
/clients/photobooth-uploader/**/obj
|
/clients/photobooth-uploader/**/obj
|
||||||
|
|||||||
209
AGENTS.md
209
AGENTS.md
@@ -129,7 +129,7 @@ The Laravel Boost guidelines are specifically curated by Laravel maintainers for
|
|||||||
## Foundational Context
|
## Foundational Context
|
||||||
This application is a Laravel application and its main Laravel ecosystems package & versions are below. You are an expert with them all. Ensure you abide by these specific packages & versions.
|
This application is a Laravel application and its main Laravel ecosystems package & versions are below. You are an expert with them all. Ensure you abide by these specific packages & versions.
|
||||||
|
|
||||||
- php - 8.3.24
|
- php - 8.3.6
|
||||||
- filament/filament (FILAMENT) - v4
|
- filament/filament (FILAMENT) - v4
|
||||||
- inertiajs/inertia-laravel (INERTIA) - v2
|
- inertiajs/inertia-laravel (INERTIA) - v2
|
||||||
- laravel/framework (LARAVEL) - v12
|
- laravel/framework (LARAVEL) - v12
|
||||||
@@ -151,7 +151,7 @@ This application is a Laravel application and its main Laravel ecosystems packag
|
|||||||
- prettier (PRETTIER) - v3
|
- prettier (PRETTIER) - v3
|
||||||
|
|
||||||
## Conventions
|
## Conventions
|
||||||
- You must follow all existing code conventions used in this application. When creating or editing a file, check sibling files for the correct structure, approach, naming.
|
- You must follow all existing code conventions used in this application. When creating or editing a file, check sibling files for the correct structure, approach, and naming.
|
||||||
- Use descriptive names for variables and methods. For example, `isRegisteredForDiscounts`, not `discount()`.
|
- Use descriptive names for variables and methods. For example, `isRegisteredForDiscounts`, not `discount()`.
|
||||||
- Check for existing components to reuse before writing a new one.
|
- Check for existing components to reuse before writing a new one.
|
||||||
|
|
||||||
@@ -159,7 +159,7 @@ This application is a Laravel application and its main Laravel ecosystems packag
|
|||||||
- Do not create verification scripts or tinker when tests cover that functionality and prove it works. Unit and feature tests are more important.
|
- Do not create verification scripts or tinker when tests cover that functionality and prove it works. Unit and feature tests are more important.
|
||||||
|
|
||||||
## Application Structure & Architecture
|
## Application Structure & Architecture
|
||||||
- Stick to existing directory structure - don't create new base folders without approval.
|
- Stick to existing directory structure; don't create new base folders without approval.
|
||||||
- Do not change the application's dependencies without approval.
|
- Do not change the application's dependencies without approval.
|
||||||
|
|
||||||
## Frontend Bundling
|
## Frontend Bundling
|
||||||
@@ -171,17 +171,16 @@ This application is a Laravel application and its main Laravel ecosystems packag
|
|||||||
## Documentation Files
|
## Documentation Files
|
||||||
- You must only create documentation files if explicitly requested by the user.
|
- You must only create documentation files if explicitly requested by the user.
|
||||||
|
|
||||||
|
|
||||||
=== boost rules ===
|
=== boost rules ===
|
||||||
|
|
||||||
## Laravel Boost
|
## Laravel Boost
|
||||||
- Laravel Boost is an MCP server that comes with powerful tools designed specifically for this application. Use them.
|
- Laravel Boost is an MCP server that comes with powerful tools designed specifically for this application. Use them.
|
||||||
|
|
||||||
## Artisan
|
## Artisan
|
||||||
- Use the `list-artisan-commands` tool when you need to call an Artisan command to double check the available parameters.
|
- Use the `list-artisan-commands` tool when you need to call an Artisan command to double-check the available parameters.
|
||||||
|
|
||||||
## URLs
|
## URLs
|
||||||
- Whenever you share a project URL with the user you should use the `get-absolute-url` tool to ensure you're using the correct scheme, domain / IP, and port.
|
- Whenever you share a project URL with the user, you should use the `get-absolute-url` tool to ensure you're using the correct scheme, domain/IP, and port.
|
||||||
|
|
||||||
## Tinker / Debugging
|
## Tinker / Debugging
|
||||||
- You should use the `tinker` tool when you need to execute PHP to debug code or query Eloquent models directly.
|
- You should use the `tinker` tool when you need to execute PHP to debug code or query Eloquent models directly.
|
||||||
@@ -192,22 +191,21 @@ This application is a Laravel application and its main Laravel ecosystems packag
|
|||||||
- Only recent browser logs will be useful - ignore old logs.
|
- Only recent browser logs will be useful - ignore old logs.
|
||||||
|
|
||||||
## Searching Documentation (Critically Important)
|
## Searching Documentation (Critically Important)
|
||||||
- Boost comes with a powerful `search-docs` tool you should use before any other approaches. This tool automatically passes a list of installed packages and their versions to the remote Boost API, so it returns only version-specific documentation specific for the user's circumstance. You should pass an array of packages to filter on if you know you need docs for particular packages.
|
- Boost comes with a powerful `search-docs` tool you should use before any other approaches when dealing with Laravel or Laravel ecosystem packages. This tool automatically passes a list of installed packages and their versions to the remote Boost API, so it returns only version-specific documentation for the user's circumstance. You should pass an array of packages to filter on if you know you need docs for particular packages.
|
||||||
- The 'search-docs' tool is perfect for all Laravel related packages, including Laravel, Inertia, Livewire, Filament, Tailwind, Pest, Nova, Nightwatch, etc.
|
- The `search-docs` tool is perfect for all Laravel-related packages, including Laravel, Inertia, Livewire, Filament, Tailwind, Pest, Nova, Nightwatch, etc.
|
||||||
- You must use this tool to search for Laravel-ecosystem documentation before falling back to other approaches.
|
- You must use this tool to search for Laravel ecosystem documentation before falling back to other approaches.
|
||||||
- Search the documentation before making code changes to ensure we are taking the correct approach.
|
- Search the documentation before making code changes to ensure we are taking the correct approach.
|
||||||
- Use multiple, broad, simple, topic based queries to start. For example: `['rate limiting', 'routing rate limiting', 'routing']`.
|
- Use multiple, broad, simple, topic-based queries to start. For example: `['rate limiting', 'routing rate limiting', 'routing']`.
|
||||||
- Do not add package names to queries - package information is already shared. For example, use `test resource table`, not `filament 4 test resource table`.
|
- Do not add package names to queries; package information is already shared. For example, use `test resource table`, not `filament 4 test resource table`.
|
||||||
|
|
||||||
### Available Search Syntax
|
### Available Search Syntax
|
||||||
- You can and should pass multiple queries at once. The most relevant results will be returned first.
|
- You can and should pass multiple queries at once. The most relevant results will be returned first.
|
||||||
|
|
||||||
1. Simple Word Searches with auto-stemming - query=authentication - finds 'authenticate' and 'auth'
|
1. Simple Word Searches with auto-stemming - query=authentication - finds 'authenticate' and 'auth'.
|
||||||
2. Multiple Words (AND Logic) - query=rate limit - finds knowledge containing both "rate" AND "limit"
|
2. Multiple Words (AND Logic) - query=rate limit - finds knowledge containing both "rate" AND "limit".
|
||||||
3. Quoted Phrases (Exact Position) - query="infinite scroll" - Words must be adjacent and in that order
|
3. Quoted Phrases (Exact Position) - query="infinite scroll" - words must be adjacent and in that order.
|
||||||
4. Mixed Queries - query=middleware "rate limit" - "middleware" AND exact phrase "rate limit"
|
4. Mixed Queries - query=middleware "rate limit" - "middleware" AND exact phrase "rate limit".
|
||||||
5. Multiple Queries - queries=["authentication", "middleware"] - ANY of these terms
|
5. Multiple Queries - queries=["authentication", "middleware"] - ANY of these terms.
|
||||||
|
|
||||||
|
|
||||||
=== php rules ===
|
=== php rules ===
|
||||||
|
|
||||||
@@ -218,7 +216,7 @@ This application is a Laravel application and its main Laravel ecosystems packag
|
|||||||
### Constructors
|
### Constructors
|
||||||
- Use PHP 8 constructor property promotion in `__construct()`.
|
- Use PHP 8 constructor property promotion in `__construct()`.
|
||||||
- <code-snippet>public function __construct(public GitHub $github) { }</code-snippet>
|
- <code-snippet>public function __construct(public GitHub $github) { }</code-snippet>
|
||||||
- Do not allow empty `__construct()` methods with zero parameters.
|
- Do not allow empty `__construct()` methods with zero parameters unless the constructor is private.
|
||||||
|
|
||||||
### Type Declarations
|
### Type Declarations
|
||||||
- Always use explicit return type declarations for methods and functions.
|
- Always use explicit return type declarations for methods and functions.
|
||||||
@@ -232,7 +230,7 @@ protected function isAccessible(User $user, ?string $path = null): bool
|
|||||||
</code-snippet>
|
</code-snippet>
|
||||||
|
|
||||||
## Comments
|
## Comments
|
||||||
- Prefer PHPDoc blocks over comments. Never use comments within the code itself unless there is something _very_ complex going on.
|
- Prefer PHPDoc blocks over inline comments. Never use comments within the code itself unless there is something very complex going on.
|
||||||
|
|
||||||
## PHPDoc Blocks
|
## PHPDoc Blocks
|
||||||
- Add useful array shape type definitions for arrays when appropriate.
|
- Add useful array shape type definitions for arrays when appropriate.
|
||||||
@@ -240,32 +238,22 @@ protected function isAccessible(User $user, ?string $path = null): bool
|
|||||||
## Enums
|
## Enums
|
||||||
- Typically, keys in an Enum should be TitleCase. For example: `FavoritePerson`, `BestLake`, `Monthly`.
|
- Typically, keys in an Enum should be TitleCase. For example: `FavoritePerson`, `BestLake`, `Monthly`.
|
||||||
|
|
||||||
|
|
||||||
=== herd rules ===
|
|
||||||
|
|
||||||
## Laravel Herd
|
|
||||||
|
|
||||||
- The application is served by Laravel Herd and will be available at: https?://[kebab-case-project-dir].test. Use the `get-absolute-url` tool to generate URLs for the user to ensure valid URLs.
|
|
||||||
- You must not run any commands to make the site available via HTTP(s). It is _always_ available through Laravel Herd.
|
|
||||||
|
|
||||||
|
|
||||||
=== tests rules ===
|
=== tests rules ===
|
||||||
|
|
||||||
## Test Enforcement
|
## Test Enforcement
|
||||||
|
|
||||||
- Every change must be programmatically tested. Write a new test or update an existing test, then run the affected tests to make sure they pass.
|
- Every change must be programmatically tested. Write a new test or update an existing test, then run the affected tests to make sure they pass.
|
||||||
- Run the minimum number of tests needed to ensure code quality and speed. Use `php artisan test` with a specific filename or filter.
|
- Run the minimum number of tests needed to ensure code quality and speed. Use `php artisan test --compact` with a specific filename or filter.
|
||||||
|
|
||||||
|
|
||||||
=== inertia-laravel/core rules ===
|
=== inertia-laravel/core rules ===
|
||||||
|
|
||||||
## Inertia Core
|
## Inertia
|
||||||
|
|
||||||
- Inertia.js components should be placed in the `resources/js/pages` directory unless specified differently in the JS bundler (vite.config.js).
|
- Inertia.js components should be placed in the `resources/js/Pages` directory unless specified differently in the JS bundler (`vite.config.js`).
|
||||||
- Use `Inertia::render()` for server-side routing instead of traditional Blade views.
|
- Use `Inertia::render()` for server-side routing instead of traditional Blade views.
|
||||||
- Use `search-docs` for accurate guidance on all things Inertia.
|
- Use the `search-docs` tool for accurate guidance on all things Inertia.
|
||||||
|
|
||||||
<code-snippet lang="php" name="Inertia::render Example">
|
<code-snippet name="Inertia Render Example" lang="php">
|
||||||
// routes/web.php example
|
// routes/web.php example
|
||||||
Route::get('/users', function () {
|
Route::get('/users', function () {
|
||||||
return Inertia::render('Users/Index', [
|
return Inertia::render('Users/Index', [
|
||||||
@@ -274,28 +262,26 @@ Route::get('/users', function () {
|
|||||||
});
|
});
|
||||||
</code-snippet>
|
</code-snippet>
|
||||||
|
|
||||||
|
|
||||||
=== inertia-laravel/v2 rules ===
|
=== inertia-laravel/v2 rules ===
|
||||||
|
|
||||||
## Inertia v2
|
## Inertia v2
|
||||||
|
|
||||||
- Make use of all Inertia features from v1 & v2. Check the documentation before making any changes to ensure we are taking the correct approach.
|
- Make use of all Inertia features from v1 and v2. Check the documentation before making any changes to ensure we are taking the correct approach.
|
||||||
|
|
||||||
### Inertia v2 New Features
|
### Inertia v2 New Features
|
||||||
- Polling
|
- Deferred props.
|
||||||
- Prefetching
|
- Infinite scrolling using merging props and `WhenVisible`.
|
||||||
- Deferred props
|
- Lazy loading data on scroll.
|
||||||
- Infinite scrolling using merging props and `WhenVisible`
|
- Polling.
|
||||||
- Lazy loading data on scroll
|
- Prefetching.
|
||||||
|
|
||||||
### Deferred Props & Empty States
|
### Deferred Props & Empty States
|
||||||
- When using deferred props on the frontend, you should add a nice empty state with pulsing / animated skeleton.
|
- When using deferred props on the frontend, you should add a nice empty state with pulsing/animated skeleton.
|
||||||
|
|
||||||
### Inertia Form General Guidance
|
### Inertia Form General Guidance
|
||||||
- The recommended way to build forms when using Inertia is with the `<Form>` component - a useful example is below. Use `search-docs` with a query of `form component` for guidance.
|
- The recommended way to build forms when using Inertia is with the `<Form>` component - a useful example is below. Use the `search-docs` tool with a query of `form component` for guidance.
|
||||||
- Forms can also be built using the `useForm` helper for more programmatic control, or to follow existing conventions. Use `search-docs` with a query of `useForm helper` for guidance.
|
- Forms can also be built using the `useForm` helper for more programmatic control, or to follow existing conventions. Use the `search-docs` tool with a query of `useForm helper` for guidance.
|
||||||
- `resetOnError`, `resetOnSuccess`, and `setDefaultsOnSuccess` are available on the `<Form>` component. Use `search-docs` with a query of 'form component resetting' for guidance.
|
- `resetOnError`, `resetOnSuccess`, and `setDefaultsOnSuccess` are available on the `<Form>` component. Use the `search-docs` tool with a query of `form component resetting` for guidance.
|
||||||
|
|
||||||
|
|
||||||
=== laravel/core rules ===
|
=== laravel/core rules ===
|
||||||
|
|
||||||
@@ -307,7 +293,7 @@ Route::get('/users', function () {
|
|||||||
|
|
||||||
### Database
|
### Database
|
||||||
- Always use proper Eloquent relationship methods with return type hints. Prefer relationship methods over raw queries or manual joins.
|
- Always use proper Eloquent relationship methods with return type hints. Prefer relationship methods over raw queries or manual joins.
|
||||||
- Use Eloquent models and relationships before suggesting raw database queries
|
- Use Eloquent models and relationships before suggesting raw database queries.
|
||||||
- Avoid `DB::`; prefer `Model::query()`. Generate code that leverages Laravel's ORM capabilities rather than bypassing them.
|
- Avoid `DB::`; prefer `Model::query()`. Generate code that leverages Laravel's ORM capabilities rather than bypassing them.
|
||||||
- Generate code that prevents N+1 query problems by using eager loading.
|
- Generate code that prevents N+1 query problems by using eager loading.
|
||||||
- Use Laravel's query builder for very complex database operations.
|
- Use Laravel's query builder for very complex database operations.
|
||||||
@@ -342,52 +328,56 @@ Route::get('/users', function () {
|
|||||||
### Vite Error
|
### Vite Error
|
||||||
- If you receive an "Illuminate\Foundation\ViteException: Unable to locate file in Vite manifest" error, you can run `npm run build` or ask the user to run `npm run dev` or `composer run dev`.
|
- If you receive an "Illuminate\Foundation\ViteException: Unable to locate file in Vite manifest" error, you can run `npm run build` or ask the user to run `npm run dev` or `composer run dev`.
|
||||||
|
|
||||||
|
|
||||||
=== laravel/v12 rules ===
|
=== laravel/v12 rules ===
|
||||||
|
|
||||||
## Laravel 12
|
## Laravel 12
|
||||||
|
|
||||||
- Use the `search-docs` tool to get version specific documentation.
|
- Use the `search-docs` tool to get version-specific documentation.
|
||||||
- This project upgraded from Laravel 10 without migrating to the new streamlined Laravel file structure.
|
- This project upgraded from Laravel 10 without migrating to the new streamlined Laravel file structure.
|
||||||
- This is **perfectly fine** and recommended by Laravel. Follow the existing structure from Laravel 10. We do not to need migrate to the new Laravel structure unless the user explicitly requests that.
|
- This is **perfectly fine** and recommended by Laravel. Follow the existing structure from Laravel 10. We do not need to migrate to the new Laravel structure unless the user explicitly requests it.
|
||||||
|
|
||||||
|
|
||||||
|
### Laravel 10 Structure
|
||||||
|
- Middleware typically lives in `app/Http/Middleware/` and service providers in `app/Providers/`.
|
||||||
|
- There is no `bootstrap/app.php` application configuration in a Laravel 10 structure:
|
||||||
|
- Middleware registration happens in `app/Http/Kernel.php`
|
||||||
|
- Exception handling is in `app/Exceptions/Handler.php`
|
||||||
|
- Console commands and schedule register in `app/Console/Kernel.php`
|
||||||
|
- Rate limits likely exist in `RouteServiceProvider` or `app/Http/Kernel.php`
|
||||||
|
|
||||||
### Database
|
### Database
|
||||||
- When modifying a column, the migration must include all of the attributes that were previously defined on the column. Otherwise, they will be dropped and lost.
|
- When modifying a column, the migration must include all of the attributes that were previously defined on the column. Otherwise, they will be dropped and lost.
|
||||||
- Laravel 11 allows limiting eagerly loaded records natively, without external packages: `$query->latest()->limit(10);`.
|
- Laravel 12 allows limiting eagerly loaded records natively, without external packages: `$query->latest()->limit(10);`.
|
||||||
|
|
||||||
### Models
|
### Models
|
||||||
- Casts can and likely should be set in a `casts()` method on a model rather than the `$casts` property. Follow existing conventions from other models.
|
- Casts can and likely should be set in a `casts()` method on a model rather than the `$casts` property. Follow existing conventions from other models.
|
||||||
|
|
||||||
|
|
||||||
=== wayfinder/core rules ===
|
=== wayfinder/core rules ===
|
||||||
|
|
||||||
## Laravel Wayfinder
|
## Laravel Wayfinder
|
||||||
|
|
||||||
Wayfinder generates TypeScript functions and types for Laravel controllers and routes which you can import into your client side code. It provides type safety and automatic synchronization between backend routes and frontend code.
|
Wayfinder generates TypeScript functions and types for Laravel controllers and routes which you can import into your client-side code. It provides type safety and automatic synchronization between backend routes and frontend code.
|
||||||
|
|
||||||
### Development Guidelines
|
### Development Guidelines
|
||||||
- Always use `search-docs` to check wayfinder correct usage before implementing any features.
|
- Always use the `search-docs` tool to check Wayfinder correct usage before implementing any features.
|
||||||
- Always Prefer named imports for tree-shaking (e.g., `import { show } from '@/actions/...'`)
|
- Always prefer named imports for tree-shaking (e.g., `import { show } from '@/actions/...'`).
|
||||||
- Avoid default controller imports (prevents tree-shaking)
|
- Avoid default controller imports (prevents tree-shaking).
|
||||||
- Run `php artisan wayfinder:generate` after route changes if Vite plugin isn't installed
|
- Run `php artisan wayfinder:generate` after route changes if Vite plugin isn't installed.
|
||||||
|
|
||||||
### Feature Overview
|
### Feature Overview
|
||||||
- Form Support: Use `.form()` with `--with-form` flag for HTML form attributes — `<form {...store.form()}>` → `action="/posts" method="post"`
|
- Form Support: Use `.form()` with `--with-form` flag for HTML form attributes — `<form {...store.form()}>` → `action="/posts" method="post"`.
|
||||||
- HTTP Methods: Call `.get()`, `.post()`, `.patch()`, `.put()`, `.delete()` for specific methods — `show.head(1)` → `{ url: "/posts/1", method: "head" }`
|
- HTTP Methods: Call `.get()`, `.post()`, `.patch()`, `.put()`, `.delete()` for specific methods — `show.head(1)` → `{ url: "/posts/1", method: "head" }`.
|
||||||
- Invokable Controllers: Import and invoke directly as functions. For example, `import StorePost from '@/actions/.../StorePostController'; StorePost()`
|
- Invokable Controllers: Import and invoke directly as functions. For example, `import StorePost from '@/actions/.../StorePostController'; StorePost()`.
|
||||||
- Named Routes: Import from `@/routes/` for non-controller routes. For example, `import { show } from '@/routes/post'; show(1)` for route name `post.show`
|
- Named Routes: Import from `@/routes/` for non-controller routes. For example, `import { show } from '@/routes/post'; show(1)` for route name `post.show`.
|
||||||
- Parameter Binding: Detects route keys (e.g., `{post:slug}`) and accepts matching object properties — `show("my-post")` or `show({ slug: "my-post" })`
|
- Parameter Binding: Detects route keys (e.g., `{post:slug}`) and accepts matching object properties — `show("my-post")` or `show({ slug: "my-post" })`.
|
||||||
- Query Merging: Use `mergeQuery` to merge with `window.location.search`, set values to `null` to remove — `show(1, { mergeQuery: { page: 2, sort: null } })`
|
- Query Merging: Use `mergeQuery` to merge with `window.location.search`, set values to `null` to remove — `show(1, { mergeQuery: { page: 2, sort: null } })`.
|
||||||
- Query Parameters: Pass `{ query: {...} }` in options to append params — `show(1, { query: { page: 1 } })` → `"/posts/1?page=1"`
|
- Query Parameters: Pass `{ query: {...} }` in options to append params — `show(1, { query: { page: 1 } })` → `"/posts/1?page=1"`.
|
||||||
- Route Objects: Functions return `{ url, method }` shaped objects — `show(1)` → `{ url: "/posts/1", method: "get" }`
|
- Route Objects: Functions return `{ url, method }` shaped objects — `show(1)` → `{ url: "/posts/1", method: "get" }`.
|
||||||
- URL Extraction: Use `.url()` to get URL string — `show.url(1)` → `"/posts/1"`
|
- URL Extraction: Use `.url()` to get URL string — `show.url(1)` → `"/posts/1"`.
|
||||||
|
|
||||||
### Example Usage
|
### Example Usage
|
||||||
|
|
||||||
<code-snippet name="Wayfinder Basic Usage" lang="typescript">
|
<code-snippet name="Wayfinder Basic Usage" lang="typescript">
|
||||||
// Import controller methods (tree-shakable)
|
// Import controller methods (tree-shakable)...
|
||||||
import { show, store, update } from '@/actions/App/Http/Controllers/PostController'
|
import { show, store, update } from '@/actions/App/Http/Controllers/PostController'
|
||||||
|
|
||||||
// Get route object with URL and method...
|
// Get route object with URL and method...
|
||||||
@@ -405,7 +395,6 @@ Wayfinder generates TypeScript functions and types for Laravel controllers and r
|
|||||||
postShow(1) // { url: "/posts/1", method: "get" }
|
postShow(1) // { url: "/posts/1", method: "get" }
|
||||||
</code-snippet>
|
</code-snippet>
|
||||||
|
|
||||||
|
|
||||||
### Wayfinder + Inertia
|
### Wayfinder + Inertia
|
||||||
If your application uses the `<Form>` component from Inertia, you can use Wayfinder to generate form action and method automatically.
|
If your application uses the `<Form>` component from Inertia, you can use Wayfinder to generate form action and method automatically.
|
||||||
<code-snippet name="Wayfinder Form Component (React)" lang="typescript">
|
<code-snippet name="Wayfinder Form Component (React)" lang="typescript">
|
||||||
@@ -414,14 +403,14 @@ If your application uses the `<Form>` component from Inertia, you can use Wayfin
|
|||||||
|
|
||||||
</code-snippet>
|
</code-snippet>
|
||||||
|
|
||||||
|
|
||||||
=== livewire/core rules ===
|
=== livewire/core rules ===
|
||||||
|
|
||||||
## Livewire Core
|
## Livewire
|
||||||
- Use the `search-docs` tool to find exact version specific documentation for how to write Livewire & Livewire tests.
|
|
||||||
- Use the `php artisan make:livewire [Posts\CreatePost]` artisan command to create new components
|
- Use the `search-docs` tool to find exact version-specific documentation for how to write Livewire and Livewire tests.
|
||||||
|
- Use the `php artisan make:livewire [Posts\CreatePost]` Artisan command to create new components.
|
||||||
- State should live on the server, with the UI reflecting it.
|
- State should live on the server, with the UI reflecting it.
|
||||||
- All Livewire requests hit the Laravel backend, they're like regular HTTP requests. Always validate form data, and run authorization checks in Livewire actions.
|
- All Livewire requests hit the Laravel backend; they're like regular HTTP requests. Always validate form data and run authorization checks in Livewire actions.
|
||||||
|
|
||||||
## Livewire Best Practices
|
## Livewire Best Practices
|
||||||
- Livewire components require a single root element.
|
- Livewire components require a single root element.
|
||||||
@@ -438,15 +427,14 @@ If your application uses the `<Form>` component from Inertia, you can use Wayfin
|
|||||||
|
|
||||||
- Prefer lifecycle hooks like `mount()`, `updatedFoo()` for initialization and reactive side effects:
|
- Prefer lifecycle hooks like `mount()`, `updatedFoo()` for initialization and reactive side effects:
|
||||||
|
|
||||||
<code-snippet name="Lifecycle hook examples" lang="php">
|
<code-snippet name="Lifecycle Hook Examples" lang="php">
|
||||||
public function mount(User $user) { $this->user = $user; }
|
public function mount(User $user) { $this->user = $user; }
|
||||||
public function updatedSearch() { $this->resetPage(); }
|
public function updatedSearch() { $this->resetPage(); }
|
||||||
</code-snippet>
|
</code-snippet>
|
||||||
|
|
||||||
|
|
||||||
## Testing Livewire
|
## Testing Livewire
|
||||||
|
|
||||||
<code-snippet name="Example Livewire component test" lang="php">
|
<code-snippet name="Example Livewire Component Test" lang="php">
|
||||||
Livewire::test(Counter::class)
|
Livewire::test(Counter::class)
|
||||||
->assertSet('count', 0)
|
->assertSet('count', 0)
|
||||||
->call('increment')
|
->call('increment')
|
||||||
@@ -455,19 +443,17 @@ If your application uses the `<Form>` component from Inertia, you can use Wayfin
|
|||||||
->assertStatus(200);
|
->assertStatus(200);
|
||||||
</code-snippet>
|
</code-snippet>
|
||||||
|
|
||||||
|
<code-snippet name="Testing Livewire Component Exists on Page" lang="php">
|
||||||
<code-snippet name="Testing a Livewire component exists within a page" lang="php">
|
$this->get('/posts/create')
|
||||||
$this->get('/posts/create')
|
->assertSeeLivewire(CreatePost::class);
|
||||||
->assertSeeLivewire(CreatePost::class);
|
</code-snippet>
|
||||||
</code-snippet>
|
|
||||||
|
|
||||||
|
|
||||||
=== livewire/v3 rules ===
|
=== livewire/v3 rules ===
|
||||||
|
|
||||||
## Livewire 3
|
## Livewire 3
|
||||||
|
|
||||||
### Key Changes From Livewire 2
|
### Key Changes From Livewire 2
|
||||||
- These things changed in Livewire 2, but may not have been updated in this application. Verify this application's setup to ensure you conform with application conventions.
|
- These things changed in Livewire 3, but may not have been updated in this application. Verify this application's setup to ensure you conform with application conventions.
|
||||||
- Use `wire:model.live` for real-time updates, `wire:model` is now deferred by default.
|
- Use `wire:model.live` for real-time updates, `wire:model` is now deferred by default.
|
||||||
- Components now use the `App\Livewire` namespace (not `App\Http\Livewire`).
|
- Components now use the `App\Livewire` namespace (not `App\Http\Livewire`).
|
||||||
- Use `$this->dispatch()` to dispatch events (not `emit` or `dispatchBrowserEvent`).
|
- Use `$this->dispatch()` to dispatch events (not `emit` or `dispatchBrowserEvent`).
|
||||||
@@ -477,13 +463,13 @@ If your application uses the `<Form>` component from Inertia, you can use Wayfin
|
|||||||
- `wire:show`, `wire:transition`, `wire:cloak`, `wire:offline`, `wire:target` are available for use. Use the documentation to find usage examples.
|
- `wire:show`, `wire:transition`, `wire:cloak`, `wire:offline`, `wire:target` are available for use. Use the documentation to find usage examples.
|
||||||
|
|
||||||
### Alpine
|
### Alpine
|
||||||
- Alpine is now included with Livewire, don't manually include Alpine.js.
|
- Alpine is now included with Livewire; don't manually include Alpine.js.
|
||||||
- Plugins included with Alpine: persist, intersect, collapse, and focus.
|
- Plugins included with Alpine: persist, intersect, collapse, and focus.
|
||||||
|
|
||||||
### Lifecycle Hooks
|
### Lifecycle Hooks
|
||||||
- You can listen for `livewire:init` to hook into Livewire initialization, and `fail.status === 419` for the page expiring:
|
- You can listen for `livewire:init` to hook into Livewire initialization, and `fail.status === 419` for the page expiring:
|
||||||
|
|
||||||
<code-snippet name="livewire:load example" lang="js">
|
<code-snippet name="Livewire Init Hook Example" lang="js">
|
||||||
document.addEventListener('livewire:init', function () {
|
document.addEventListener('livewire:init', function () {
|
||||||
Livewire.hook('request', ({ fail }) => {
|
Livewire.hook('request', ({ fail }) => {
|
||||||
if (fail && fail.status === 419) {
|
if (fail && fail.status === 419) {
|
||||||
@@ -497,7 +483,6 @@ document.addEventListener('livewire:init', function () {
|
|||||||
});
|
});
|
||||||
</code-snippet>
|
</code-snippet>
|
||||||
|
|
||||||
|
|
||||||
=== pint/core rules ===
|
=== pint/core rules ===
|
||||||
|
|
||||||
## Laravel Pint Code Formatter
|
## Laravel Pint Code Formatter
|
||||||
@@ -505,24 +490,22 @@ document.addEventListener('livewire:init', function () {
|
|||||||
- You must run `vendor/bin/pint --dirty` before finalizing changes to ensure your code matches the project's expected style.
|
- You must run `vendor/bin/pint --dirty` before finalizing changes to ensure your code matches the project's expected style.
|
||||||
- Do not run `vendor/bin/pint --test`, simply run `vendor/bin/pint` to fix any formatting issues.
|
- Do not run `vendor/bin/pint --test`, simply run `vendor/bin/pint` to fix any formatting issues.
|
||||||
|
|
||||||
|
|
||||||
=== phpunit/core rules ===
|
=== phpunit/core rules ===
|
||||||
|
|
||||||
## PHPUnit Core
|
## PHPUnit
|
||||||
|
|
||||||
- This application uses PHPUnit for testing. All tests must be written as PHPUnit classes. Use `php artisan make:test --phpunit {name}` to create a new test.
|
- This application uses PHPUnit for testing. All tests must be written as PHPUnit classes. Use `php artisan make:test --phpunit {name}` to create a new test.
|
||||||
- If you see a test using "Pest", convert it to PHPUnit.
|
- If you see a test using "Pest", convert it to PHPUnit.
|
||||||
- Every time a test has been updated, run that singular test.
|
- Every time a test has been updated, run that singular test.
|
||||||
- When the tests relating to your feature are passing, ask the user if they would like to also run the entire test suite to make sure everything is still passing.
|
- When the tests relating to your feature are passing, ask the user if they would like to also run the entire test suite to make sure everything is still passing.
|
||||||
- Tests should test all of the happy paths, failure paths, and weird paths.
|
- Tests should test all of the happy paths, failure paths, and weird paths.
|
||||||
- You must not remove any tests or test files from the tests directory without approval. These are not temporary or helper files, these are core to the application.
|
- You must not remove any tests or test files from the tests directory without approval. These are not temporary or helper files; these are core to the application.
|
||||||
|
|
||||||
### Running Tests
|
### Running Tests
|
||||||
- Run the minimal number of tests, using an appropriate filter, before finalizing.
|
- Run the minimal number of tests, using an appropriate filter, before finalizing.
|
||||||
- To run all tests: `php artisan test`.
|
- To run all tests: `php artisan test --compact`.
|
||||||
- To run all tests in a file: `php artisan test tests/Feature/ExampleTest.php`.
|
- To run all tests in a file: `php artisan test --compact tests/Feature/ExampleTest.php`.
|
||||||
- To filter on a particular test name: `php artisan test --filter=testName` (recommended after making a change to a related file).
|
- To filter on a particular test name: `php artisan test --compact --filter=testName` (recommended after making a change to a related file).
|
||||||
|
|
||||||
|
|
||||||
=== inertia-react/core rules ===
|
=== inertia-react/core rules ===
|
||||||
|
|
||||||
@@ -537,10 +520,9 @@ import { Link } from '@inertiajs/react'
|
|||||||
|
|
||||||
</code-snippet>
|
</code-snippet>
|
||||||
|
|
||||||
|
|
||||||
=== inertia-react/v2/forms rules ===
|
=== inertia-react/v2/forms rules ===
|
||||||
|
|
||||||
## Inertia + React Forms
|
## Inertia v2 + React Forms
|
||||||
|
|
||||||
<code-snippet name="`<Form>` Component Example" lang="react">
|
<code-snippet name="`<Form>` Component Example" lang="react">
|
||||||
|
|
||||||
@@ -575,39 +557,37 @@ export default () => (
|
|||||||
|
|
||||||
</code-snippet>
|
</code-snippet>
|
||||||
|
|
||||||
|
|
||||||
=== tailwindcss/core rules ===
|
=== tailwindcss/core rules ===
|
||||||
|
|
||||||
## Tailwind Core
|
## Tailwind CSS
|
||||||
|
|
||||||
- Use Tailwind CSS classes to style HTML, check and use existing tailwind conventions within the project before writing your own.
|
- Use Tailwind CSS classes to style HTML; check and use existing Tailwind conventions within the project before writing your own.
|
||||||
- Offer to extract repeated patterns into components that match the project's conventions (i.e. Blade, JSX, Vue, etc..)
|
- Offer to extract repeated patterns into components that match the project's conventions (i.e. Blade, JSX, Vue, etc.).
|
||||||
- Think through class placement, order, priority, and defaults - remove redundant classes, add classes to parent or child carefully to limit repetition, group elements logically
|
- Think through class placement, order, priority, and defaults. Remove redundant classes, add classes to parent or child carefully to limit repetition, and group elements logically.
|
||||||
- You can use the `search-docs` tool to get exact examples from the official documentation when needed.
|
- You can use the `search-docs` tool to get exact examples from the official documentation when needed.
|
||||||
|
|
||||||
### Spacing
|
### Spacing
|
||||||
- When listing items, use gap utilities for spacing, don't use margins.
|
- When listing items, use gap utilities for spacing; don't use margins.
|
||||||
|
|
||||||
<code-snippet name="Valid Flex Gap Spacing Example" lang="html">
|
|
||||||
<div class="flex gap-8">
|
|
||||||
<div>Superior</div>
|
|
||||||
<div>Michigan</div>
|
|
||||||
<div>Erie</div>
|
|
||||||
</div>
|
|
||||||
</code-snippet>
|
|
||||||
|
|
||||||
|
<code-snippet name="Valid Flex Gap Spacing Example" lang="html">
|
||||||
|
<div class="flex gap-8">
|
||||||
|
<div>Superior</div>
|
||||||
|
<div>Michigan</div>
|
||||||
|
<div>Erie</div>
|
||||||
|
</div>
|
||||||
|
</code-snippet>
|
||||||
|
|
||||||
### Dark Mode
|
### Dark Mode
|
||||||
- If existing pages and components support dark mode, new pages and components must support dark mode in a similar way, typically using `dark:`.
|
- If existing pages and components support dark mode, new pages and components must support dark mode in a similar way, typically using `dark:`.
|
||||||
|
|
||||||
|
|
||||||
=== tailwindcss/v4 rules ===
|
=== tailwindcss/v4 rules ===
|
||||||
|
|
||||||
## Tailwind 4
|
## Tailwind CSS 4
|
||||||
|
|
||||||
- Always use Tailwind CSS v4 - do not use the deprecated utilities.
|
- Always use Tailwind CSS v4; do not use the deprecated utilities.
|
||||||
- `corePlugins` is not supported in Tailwind v4.
|
- `corePlugins` is not supported in Tailwind v4.
|
||||||
- In Tailwind v4, configuration is CSS-first using the `@theme` directive — no separate `tailwind.config.js` file is needed.
|
- In Tailwind v4, configuration is CSS-first using the `@theme` directive — no separate `tailwind.config.js` file is needed.
|
||||||
|
|
||||||
<code-snippet name="Extending Theme in CSS" lang="css">
|
<code-snippet name="Extending Theme in CSS" lang="css">
|
||||||
@theme {
|
@theme {
|
||||||
--color-brand: oklch(0.72 0.11 178);
|
--color-brand: oklch(0.72 0.11 178);
|
||||||
@@ -623,9 +603,8 @@ export default () => (
|
|||||||
+ @import "tailwindcss";
|
+ @import "tailwindcss";
|
||||||
</code-snippet>
|
</code-snippet>
|
||||||
|
|
||||||
|
|
||||||
### Replaced Utilities
|
### Replaced Utilities
|
||||||
- Tailwind v4 removed deprecated utilities. Do not use the deprecated option - use the replacement.
|
- Tailwind v4 removed deprecated utilities. Do not use the deprecated option; use the replacement.
|
||||||
- Opacity values are still numeric.
|
- Opacity values are still numeric.
|
||||||
|
|
||||||
| Deprecated | Replacement |
|
| Deprecated | Replacement |
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ class SeedDemoSwitcherTenants extends Command
|
|||||||
|
|
||||||
DB::transaction(function () use ($packages, $eventTypes) {
|
DB::transaction(function () use ($packages, $eventTypes) {
|
||||||
$this->seedCustomerStandardEmpty($packages, $eventTypes);
|
$this->seedCustomerStandardEmpty($packages, $eventTypes);
|
||||||
$this->seedCustomerStarterWedding($packages, $eventTypes);
|
$this->seedCustomerStandardWedding($packages, $eventTypes);
|
||||||
$this->seedResellerActive($packages, $eventTypes);
|
$this->seedResellerActive($packages, $eventTypes);
|
||||||
$this->seedResellerFull($packages, $eventTypes);
|
$this->seedResellerFull($packages, $eventTypes);
|
||||||
});
|
});
|
||||||
@@ -189,14 +189,14 @@ class SeedDemoSwitcherTenants extends Command
|
|||||||
$this->comment('Seeded Starter tenant without events.');
|
$this->comment('Seeded Starter tenant without events.');
|
||||||
}
|
}
|
||||||
|
|
||||||
private function seedCustomerStarterWedding(array $packages, array $eventTypes): void
|
private function seedCustomerStandardWedding(array $packages, array $eventTypes): void
|
||||||
{
|
{
|
||||||
$tenant = $this->upsertTenant(
|
$tenant = $this->upsertTenant(
|
||||||
slug: 'demo-starter-wedding',
|
slug: 'demo-starter-wedding',
|
||||||
name: 'Demo Starter Wedding',
|
name: 'Demo Standard Wedding',
|
||||||
contactEmail: 'starter-wedding@demo.fotospiel',
|
contactEmail: 'starter-wedding@demo.fotospiel',
|
||||||
attributes: [
|
attributes: [
|
||||||
'subscription_tier' => 'starter',
|
'subscription_tier' => 'standard',
|
||||||
'subscription_status' => 'active',
|
'subscription_status' => 'active',
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
@@ -204,9 +204,9 @@ class SeedDemoSwitcherTenants extends Command
|
|||||||
$this->upsertAdmin($tenant, 'starter-wedding@demo.fotospiel');
|
$this->upsertAdmin($tenant, 'starter-wedding@demo.fotospiel');
|
||||||
|
|
||||||
TenantPackage::updateOrCreate(
|
TenantPackage::updateOrCreate(
|
||||||
['tenant_id' => $tenant->id, 'package_id' => $packages['starter']->id],
|
['tenant_id' => $tenant->id, 'package_id' => $packages['standard']->id],
|
||||||
[
|
[
|
||||||
'price' => $packages['starter']->price,
|
'price' => $packages['standard']->price,
|
||||||
'purchased_at' => Carbon::now()->subDays(1),
|
'purchased_at' => Carbon::now()->subDays(1),
|
||||||
'expires_at' => Carbon::now()->addMonths(12),
|
'expires_at' => Carbon::now()->addMonths(12),
|
||||||
'used_events' => 1,
|
'used_events' => 1,
|
||||||
@@ -216,7 +216,7 @@ class SeedDemoSwitcherTenants extends Command
|
|||||||
|
|
||||||
$event = $this->upsertEvent(
|
$event = $this->upsertEvent(
|
||||||
tenant: $tenant,
|
tenant: $tenant,
|
||||||
package: $packages['starter'],
|
package: $packages['standard'],
|
||||||
eventType: $eventTypes['wedding'] ?? null,
|
eventType: $eventTypes['wedding'] ?? null,
|
||||||
attributes: [
|
attributes: [
|
||||||
'name' => ['de' => 'Hochzeit Mia & Jonas', 'en' => 'Wedding Mia & Jonas'],
|
'name' => ['de' => 'Hochzeit Mia & Jonas', 'en' => 'Wedding Mia & Jonas'],
|
||||||
|
|||||||
@@ -1298,7 +1298,7 @@ class EventPublicController extends BaseController
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
$diskName = config('filesystems.default', 'public');
|
$diskName = 'public';
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$storage = Storage::disk($diskName);
|
$storage = Storage::disk($diskName);
|
||||||
|
|||||||
@@ -453,7 +453,7 @@ class EventController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($assetDataUrl && $mode === 'custom' && $brandingAllowed) {
|
if ($assetDataUrl && $mode === 'custom' && $brandingAllowed) {
|
||||||
if (! preg_match('/^data:image\\/(png|webp|jpe?g);base64,(.+)$/i', $assetDataUrl, $matches)) {
|
if (! preg_match('/^data:image\\/(png|webp|jpe?g|svg\\+xml);base64,(.+)$/i', $assetDataUrl, $matches)) {
|
||||||
throw ValidationException::withMessages([
|
throw ValidationException::withMessages([
|
||||||
'settings.watermark.asset_data_url' => __('Ungültiges Wasserzeichen-Bild.'),
|
'settings.watermark.asset_data_url' => __('Ungültiges Wasserzeichen-Bild.'),
|
||||||
]);
|
]);
|
||||||
@@ -473,7 +473,12 @@ class EventController extends Controller
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
$extension = str_starts_with(strtolower($matches[1]), 'jp') ? 'jpg' : strtolower($matches[1]);
|
$mime = strtolower($matches[1]);
|
||||||
|
$extension = match (true) {
|
||||||
|
str_starts_with($mime, 'jp') => 'jpg',
|
||||||
|
str_starts_with($mime, 'svg') => 'svg',
|
||||||
|
default => $mime,
|
||||||
|
};
|
||||||
$path = sprintf('branding/watermarks/event-%s.%s', $event->id, $extension);
|
$path = sprintf('branding/watermarks/event-%s.%s', $event->id, $extension);
|
||||||
Storage::disk('public')->put($path, $decoded);
|
Storage::disk('public')->put($path, $decoded);
|
||||||
$assetPath = $path;
|
$assetPath = $path;
|
||||||
|
|||||||
@@ -39,7 +39,9 @@ class TenantPackageController extends Controller
|
|||||||
|
|
||||||
$activePackage = $tenant->activeResellerPackage?->load('package');
|
$activePackage = $tenant->activeResellerPackage?->load('package');
|
||||||
|
|
||||||
if ($activePackage instanceof TenantPackage) {
|
if (! ($activePackage instanceof TenantPackage)) {
|
||||||
|
$activePackage = $packages->firstWhere('active', true);
|
||||||
|
} else {
|
||||||
$this->hydratePackageSnapshot($activePackage, $usageEventPackage);
|
$this->hydratePackageSnapshot($activePackage, $usageEventPackage);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -54,6 +54,8 @@ class EventStoreRequest extends FormRequest
|
|||||||
'settings.branding' => ['nullable', 'array'],
|
'settings.branding' => ['nullable', 'array'],
|
||||||
'settings.branding.*' => ['nullable'],
|
'settings.branding.*' => ['nullable'],
|
||||||
'settings.engagement_mode' => ['nullable', Rule::in(['tasks', 'photo_only'])],
|
'settings.engagement_mode' => ['nullable', Rule::in(['tasks', 'photo_only'])],
|
||||||
|
'settings.guest_downloads_enabled' => ['nullable', 'boolean'],
|
||||||
|
'settings.guest_sharing_enabled' => ['nullable', 'boolean'],
|
||||||
'settings.guest_upload_visibility' => ['nullable', Rule::in(['review', 'immediate'])],
|
'settings.guest_upload_visibility' => ['nullable', Rule::in(['review', 'immediate'])],
|
||||||
'settings.live_show' => ['nullable', 'array'],
|
'settings.live_show' => ['nullable', 'array'],
|
||||||
'settings.live_show.moderation_mode' => ['nullable', Rule::in(['off', 'manual', 'trusted_only'])],
|
'settings.live_show.moderation_mode' => ['nullable', Rule::in(['off', 'manual', 'trusted_only'])],
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ use Illuminate\Http\Request;
|
|||||||
use Illuminate\Http\Resources\Json\JsonResource;
|
use Illuminate\Http\Resources\Json\JsonResource;
|
||||||
use Illuminate\Http\Resources\MissingValue;
|
use Illuminate\Http\Resources\MissingValue;
|
||||||
use Illuminate\Support\Arr;
|
use Illuminate\Support\Arr;
|
||||||
|
use Illuminate\Support\Facades\URL;
|
||||||
|
|
||||||
use function app;
|
use function app;
|
||||||
|
|
||||||
@@ -18,6 +19,7 @@ class EventResource extends JsonResource
|
|||||||
$tenantId = $request->attributes->get('tenant_id');
|
$tenantId = $request->attributes->get('tenant_id');
|
||||||
$showSensitive = $this->tenant_id === $tenantId;
|
$showSensitive = $this->tenant_id === $tenantId;
|
||||||
$settings = is_array($this->settings) ? $this->settings : [];
|
$settings = is_array($this->settings) ? $this->settings : [];
|
||||||
|
$settings = $this->attachWatermarkAssetUrl($settings);
|
||||||
$eventPackage = null;
|
$eventPackage = null;
|
||||||
$memberPermissions = null;
|
$memberPermissions = null;
|
||||||
|
|
||||||
@@ -97,6 +99,64 @@ class EventResource extends JsonResource
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param array<string, mixed> $settings
|
||||||
|
* @return array<string, mixed>
|
||||||
|
*/
|
||||||
|
protected function attachWatermarkAssetUrl(array $settings): array
|
||||||
|
{
|
||||||
|
$watermark = Arr::get($settings, 'watermark');
|
||||||
|
$base = config('watermark.base', []);
|
||||||
|
$base = is_array($base) ? $base : [];
|
||||||
|
|
||||||
|
if (! is_array($watermark)) {
|
||||||
|
$watermark = [];
|
||||||
|
}
|
||||||
|
|
||||||
|
$mode = $watermark['mode'] ?? null;
|
||||||
|
if (! is_string($mode) || $mode === '') {
|
||||||
|
$mode = 'base';
|
||||||
|
$watermark['mode'] = $mode;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($mode !== 'off') {
|
||||||
|
foreach (['position', 'opacity', 'scale', 'padding', 'offset_x', 'offset_y'] as $key) {
|
||||||
|
if (! array_key_exists($key, $watermark) && array_key_exists($key, $base)) {
|
||||||
|
$watermark[$key] = $base[$key];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$asset = $watermark['asset'] ?? null;
|
||||||
|
if ((! is_string($asset) || $asset === '') && $mode !== 'off') {
|
||||||
|
$asset = $base['asset'] ?? null;
|
||||||
|
if (is_string($asset) && $asset !== '') {
|
||||||
|
$watermark['asset'] = $asset;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! is_string($asset) || $asset === '') {
|
||||||
|
$settings['watermark'] = $watermark;
|
||||||
|
|
||||||
|
return $settings;
|
||||||
|
}
|
||||||
|
|
||||||
|
$normalized = ltrim($asset, '/');
|
||||||
|
if (str_starts_with($normalized, 'storage/')) {
|
||||||
|
$normalized = substr($normalized, strlen('storage/'));
|
||||||
|
}
|
||||||
|
|
||||||
|
$watermark['asset_url'] = URL::temporarySignedRoute(
|
||||||
|
'api.v1.branding.asset',
|
||||||
|
now()->addSeconds(3600),
|
||||||
|
['path' => $normalized]
|
||||||
|
);
|
||||||
|
|
||||||
|
$settings['watermark'] = $watermark;
|
||||||
|
|
||||||
|
return $settings;
|
||||||
|
}
|
||||||
|
|
||||||
protected function formatAddons(?\App\Models\EventPackage $eventPackage): array
|
protected function formatAddons(?\App\Models\EventPackage $eventPackage): array
|
||||||
{
|
{
|
||||||
if (! $eventPackage) {
|
if (! $eventPackage) {
|
||||||
|
|||||||
760
composer.lock
generated
760
composer.lock
generated
File diff suppressed because it is too large
Load Diff
7612
package-lock.json
generated
7612
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
72
package.json
72
package.json
@@ -22,24 +22,24 @@
|
|||||||
"@eslint/js": "^9.19.0",
|
"@eslint/js": "^9.19.0",
|
||||||
"@laravel/vite-plugin-wayfinder": "^0.1.7",
|
"@laravel/vite-plugin-wayfinder": "^0.1.7",
|
||||||
"@playwright/test": "^1.57.0",
|
"@playwright/test": "^1.57.0",
|
||||||
"@tamagui/cli": "^1.142.0",
|
"@tamagui/cli": "^1.144.2",
|
||||||
"@testing-library/jest-dom": "^6.9.1",
|
"@testing-library/jest-dom": "^6.9.1",
|
||||||
"@testing-library/react": "^16.3.0",
|
"@testing-library/react": "^16.3.1",
|
||||||
"@testing-library/user-event": "^14.6.1",
|
"@testing-library/user-event": "^14.6.1",
|
||||||
"@types/fabric": "^5.3.10",
|
"@types/fabric": "^5.3.11",
|
||||||
"@types/node": "^22.19.2",
|
"@types/node": "^22.19.7",
|
||||||
"baseline-browser-mapping": "^2.9.6",
|
"baseline-browser-mapping": "^2.9.15",
|
||||||
"dotenv": "^16.6.1",
|
"dotenv": "^16.6.1",
|
||||||
"eslint": "^9.39.1",
|
"eslint": "^9.39.2",
|
||||||
"eslint-config-prettier": "^10.1.8",
|
"eslint-config-prettier": "^10.1.8",
|
||||||
"eslint-plugin-react": "^7.37.5",
|
"eslint-plugin-react": "^7.37.5",
|
||||||
"eslint-plugin-react-hooks": "^5.2.0",
|
"eslint-plugin-react-hooks": "^5.2.0",
|
||||||
"i18next-scanner": "^4.6.0",
|
"i18next-scanner": "^4.6.0",
|
||||||
"jsdom": "^25.0.1",
|
"jsdom": "^25.0.1",
|
||||||
"playwright": "^1.55.1",
|
"playwright": "^1.55.1",
|
||||||
"prettier": "^3.7.4",
|
"prettier": "^3.8.0",
|
||||||
"shadcn": "^3.5.2",
|
"shadcn": "^3.7.0",
|
||||||
"typescript-eslint": "^8.49.0",
|
"typescript-eslint": "^8.53.0",
|
||||||
"vite-plugin-pwa": "^1.2.0",
|
"vite-plugin-pwa": "^1.2.0",
|
||||||
"vitest": "^2.1.9"
|
"vitest": "^2.1.9"
|
||||||
},
|
},
|
||||||
@@ -47,7 +47,7 @@
|
|||||||
"@dnd-kit/core": "^6.3.1",
|
"@dnd-kit/core": "^6.3.1",
|
||||||
"@dnd-kit/utilities": "^3.2.2",
|
"@dnd-kit/utilities": "^3.2.2",
|
||||||
"@headlessui/react": "^2.2.9",
|
"@headlessui/react": "^2.2.9",
|
||||||
"@inertiajs/react": "^2.2.21",
|
"@inertiajs/react": "^2.3.10",
|
||||||
"@radix-ui/react-accordion": "^1.2.12",
|
"@radix-ui/react-accordion": "^1.2.12",
|
||||||
"@radix-ui/react-avatar": "^1.1.11",
|
"@radix-ui/react-avatar": "^1.1.11",
|
||||||
"@radix-ui/react-checkbox": "^1.3.3",
|
"@radix-ui/react-checkbox": "^1.3.3",
|
||||||
@@ -66,24 +66,24 @@
|
|||||||
"@radix-ui/react-toggle-group": "^1.1.11",
|
"@radix-ui/react-toggle-group": "^1.1.11",
|
||||||
"@radix-ui/react-tooltip": "^1.2.8",
|
"@radix-ui/react-tooltip": "^1.2.8",
|
||||||
"@react-spring/web": "^10.0.3",
|
"@react-spring/web": "^10.0.3",
|
||||||
"@sentry/react": "^10.32.0",
|
"@sentry/react": "^10.34.0",
|
||||||
"@sentry/tracing": "^7.120.4",
|
"@sentry/tracing": "^7.120.4",
|
||||||
"@sentry/vite-plugin": "^4.6.1",
|
"@sentry/vite-plugin": "^4.6.2",
|
||||||
"@stripe/stripe-js": "^8.5.3",
|
"@stripe/stripe-js": "^8.6.1",
|
||||||
"@tailwindcss/vite": "^4.1.17",
|
"@tailwindcss/vite": "^4.1.18",
|
||||||
"@tamagui/button": "~1.139.2",
|
"@tamagui/button": "~1.144.2",
|
||||||
"@tamagui/config": "~1.139.2",
|
"@tamagui/config": "~1.144.2",
|
||||||
"@tamagui/font": "~1.139.3",
|
"@tamagui/font": "~1.144.2",
|
||||||
"@tamagui/group": "~1.139.2",
|
"@tamagui/group": "~1.144.2",
|
||||||
"@tamagui/list-item": "~1.139.2",
|
"@tamagui/list-item": "~1.144.2",
|
||||||
"@tamagui/radio-group": "~1.139.2",
|
"@tamagui/radio-group": "~1.144.2",
|
||||||
"@tamagui/stacks": "~1.139.2",
|
"@tamagui/stacks": "~1.144.2",
|
||||||
"@tamagui/switch": "~1.139.2",
|
"@tamagui/switch": "~1.144.2",
|
||||||
"@tamagui/text": "~1.139.2",
|
"@tamagui/text": "~1.144.2",
|
||||||
"@tamagui/themes": "~1.139.2",
|
"@tamagui/themes": "~1.144.2",
|
||||||
"@tamagui/vite-plugin": "~1.139.2",
|
"@tamagui/vite-plugin": "~1.144.2",
|
||||||
"@tanstack/react-query": "^5.90.12",
|
"@tanstack/react-query": "^5.90.19",
|
||||||
"@types/react": "^19.2.7",
|
"@types/react": "^19.2.8",
|
||||||
"@types/react-dom": "^19.2.3",
|
"@types/react-dom": "^19.2.3",
|
||||||
"@use-gesture/react": "^10.3.1",
|
"@use-gesture/react": "^10.3.1",
|
||||||
"@vitejs/plugin-react": "^4.7.0",
|
"@vitejs/plugin-react": "^4.7.0",
|
||||||
@@ -94,29 +94,29 @@
|
|||||||
"embla-carousel": "^8.6.0",
|
"embla-carousel": "^8.6.0",
|
||||||
"embla-carousel-autoplay": "^8.6.0",
|
"embla-carousel-autoplay": "^8.6.0",
|
||||||
"embla-carousel-react": "^8.6.0",
|
"embla-carousel-react": "^8.6.0",
|
||||||
"fabric": "^6.9.0",
|
"fabric": "^6.9.1",
|
||||||
"framer-motion": "^12.23.26",
|
"framer-motion": "^12.26.2",
|
||||||
"globals": "^15.15.0",
|
"globals": "^15.15.0",
|
||||||
"html5-qrcode": "^2.3.8",
|
"html5-qrcode": "^2.3.8",
|
||||||
"i18next": "^25.7.2",
|
"i18next": "^25.7.4",
|
||||||
"i18next-browser-languagedetector": "^8.2.0",
|
"i18next-browser-languagedetector": "^8.2.0",
|
||||||
"i18next-http-backend": "^3.0.2",
|
"i18next-http-backend": "^3.0.2",
|
||||||
"laravel-vite-plugin": "^2.0.1",
|
"laravel-vite-plugin": "^2.0.1",
|
||||||
"lucide-react": "^0.475.0",
|
"lucide-react": "^0.475.0",
|
||||||
"pdf-lib": "^1.17.1",
|
"pdf-lib": "^1.17.1",
|
||||||
"react": "^19.2.1",
|
"react": "^19.2.3",
|
||||||
"react-colorful": "^5.6.1",
|
"react-colorful": "^5.6.1",
|
||||||
"react-dom": "^19.2.1",
|
"react-dom": "^19.2.3",
|
||||||
"react-hot-toast": "^2.6.0",
|
"react-hot-toast": "^2.6.0",
|
||||||
"react-i18next": "^16.4.1",
|
"react-i18next": "^16.5.3",
|
||||||
"react-router-dom": "^7.10.1",
|
"react-router-dom": "^7.12.0",
|
||||||
"swiper": "^12.0.3",
|
"swiper": "^12.0.3",
|
||||||
"tailwind-merge": "^3.4.0",
|
"tailwind-merge": "^3.4.0",
|
||||||
"tailwindcss": "^4.0.0",
|
"tailwindcss": "^4.0.0",
|
||||||
"tailwindcss-animate": "^1.0.7",
|
"tailwindcss-animate": "^1.0.7",
|
||||||
"tamagui": "^1.139.3",
|
"tamagui": "^1.144.2",
|
||||||
"typescript": "^5.9.3",
|
"typescript": "^5.9.3",
|
||||||
"vite": "^7.2.7"
|
"vite": "^7.3.1"
|
||||||
},
|
},
|
||||||
"optionalDependencies": {
|
"optionalDependencies": {
|
||||||
"@rollup/rollup-linux-x64-gnu": "4.9.5",
|
"@rollup/rollup-linux-x64-gnu": "4.9.5",
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -1 +1 @@
|
|||||||
function r({initialHeight:i,shouldAutosize:s,state:h}){return{state:h,wrapperEl:null,init(){this.wrapperEl=this.$el.parentNode,this.setInitialHeight(),s?this.$watch("state",()=>{this.resize()}):this.setUpResizeObserver()},setInitialHeight(){this.$el.scrollHeight<=0||(this.wrapperEl.style.height=i+"rem")},resize(){if(this.$el.scrollHeight<=0)return;let e=this.$el.style.height;this.$el.style.height="0px";let t=this.$el.scrollHeight+"px";this.$el.style.height=e,this.wrapperEl.style.height!==t&&(this.wrapperEl.style.height=t)},setUpResizeObserver(){new ResizeObserver(()=>{this.wrapperEl.style.height=this.$el.style.height}).observe(this.$el)}}}export{r as default};
|
function n({initialHeight:e,shouldAutosize:i,state:h}){return{state:h,wrapperEl:null,init(){this.wrapperEl=this.$el.parentNode,this.setInitialHeight(),i?this.$watch("state",()=>{this.resize()}):this.setUpResizeObserver()},setInitialHeight(){this.$el.scrollHeight<=0||(this.wrapperEl.style.height=e+"rem")},resize(){if(this.$el.scrollHeight<=0)return;let t=this.$el.style.height;this.$el.style.height="0px";let r=this.$el.scrollHeight;this.$el.style.height=t;let l=parseFloat(e)*parseFloat(getComputedStyle(document.documentElement).fontSize),s=Math.max(r,l)+"px";this.wrapperEl.style.height!==s&&(this.wrapperEl.style.height=s)},setUpResizeObserver(){new ResizeObserver(()=>{this.wrapperEl.style.height=this.$el.style.height}).observe(this.$el)}}}export{n as default};
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -7,7 +7,7 @@ import { useTheme } from '@tamagui/core';
|
|||||||
|
|
||||||
const DEV_TENANT_KEYS = [
|
const DEV_TENANT_KEYS = [
|
||||||
{ key: 'cust-standard-empty', label: 'Endkunde – Starter (kein Event)' },
|
{ key: 'cust-standard-empty', label: 'Endkunde – Starter (kein Event)' },
|
||||||
{ key: 'cust-starter-wedding', label: 'Endkunde – Starter (Hochzeit)' },
|
{ key: 'cust-starter-wedding', label: 'Endkunde – Standard (Hochzeit)' },
|
||||||
{ key: 'reseller-s-active', label: 'Reseller S – 3 aktive Events' },
|
{ key: 'reseller-s-active', label: 'Reseller S – 3 aktive Events' },
|
||||||
{ key: 'reseller-s-full', label: 'Reseller S – voll belegt (5/5)' },
|
{ key: 'reseller-s-full', label: 'Reseller S – voll belegt (5/5)' },
|
||||||
] as const;
|
] as const;
|
||||||
|
|||||||
@@ -180,6 +180,63 @@ export type EventStats = {
|
|||||||
pending_photos?: number;
|
pending_photos?: number;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export type EventEngagementSummary = {
|
||||||
|
totalPhotos: number;
|
||||||
|
uniqueGuests: number;
|
||||||
|
tasksSolved: number;
|
||||||
|
likesTotal: number;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type EventEngagementLeaderboardEntry = {
|
||||||
|
guest: string;
|
||||||
|
photos: number;
|
||||||
|
likes: number;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type EventEngagementTopPhoto = {
|
||||||
|
photoId: number;
|
||||||
|
guest: string;
|
||||||
|
likes: number;
|
||||||
|
task?: string | null;
|
||||||
|
createdAt: string;
|
||||||
|
thumbnail: string | null;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type EventEngagementTrendingEmotion = {
|
||||||
|
emotionId: number;
|
||||||
|
name: string;
|
||||||
|
count: number;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type EventEngagementTimelinePoint = {
|
||||||
|
date: string;
|
||||||
|
photos: number;
|
||||||
|
guests: number;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type EventEngagementFeedEntry = {
|
||||||
|
photoId: number;
|
||||||
|
guest: string;
|
||||||
|
task?: string | null;
|
||||||
|
likes: number;
|
||||||
|
createdAt: string;
|
||||||
|
thumbnail: string | null;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type EventEngagement = {
|
||||||
|
summary: EventEngagementSummary;
|
||||||
|
leaderboards: {
|
||||||
|
uploads: EventEngagementLeaderboardEntry[];
|
||||||
|
likes: EventEngagementLeaderboardEntry[];
|
||||||
|
};
|
||||||
|
highlights: {
|
||||||
|
topPhoto: EventEngagementTopPhoto | null;
|
||||||
|
trendingEmotion: EventEngagementTrendingEmotion | null;
|
||||||
|
timeline: EventEngagementTimelinePoint[];
|
||||||
|
};
|
||||||
|
feed: EventEngagementFeedEntry[];
|
||||||
|
};
|
||||||
|
|
||||||
export type PhotoboothStatusMetrics = {
|
export type PhotoboothStatusMetrics = {
|
||||||
uploads_last_hour?: number | null;
|
uploads_last_hour?: number | null;
|
||||||
uploads_today?: number | null;
|
uploads_today?: number | null;
|
||||||
@@ -255,6 +312,7 @@ export type TenantFont = {
|
|||||||
export type WatermarkSettings = {
|
export type WatermarkSettings = {
|
||||||
mode?: 'base' | 'custom' | 'off';
|
mode?: 'base' | 'custom' | 'off';
|
||||||
asset?: string | null;
|
asset?: string | null;
|
||||||
|
asset_url?: string | null;
|
||||||
asset_data_url?: string | null;
|
asset_data_url?: string | null;
|
||||||
position?:
|
position?:
|
||||||
| 'top-left'
|
| 'top-left'
|
||||||
@@ -1321,6 +1379,113 @@ function normalizeQrInvite(raw: JsonValue): EventQrInvite {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function toEngagementNumber(value: unknown, fallback = 0): number {
|
||||||
|
if (typeof value === 'number' && Number.isFinite(value)) {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
if (typeof value === 'string' && value !== '') {
|
||||||
|
const parsed = Number(value);
|
||||||
|
return Number.isFinite(parsed) ? parsed : fallback;
|
||||||
|
}
|
||||||
|
return fallback;
|
||||||
|
}
|
||||||
|
|
||||||
|
function toEngagementString(value: unknown): string {
|
||||||
|
return typeof value === 'string' ? value : '';
|
||||||
|
}
|
||||||
|
|
||||||
|
function normalizeEventEngagement(payload: JsonValue): EventEngagement {
|
||||||
|
const record = payload && typeof payload === 'object' ? (payload as Record<string, unknown>) : {};
|
||||||
|
const summary = record.summary && typeof record.summary === 'object' ? (record.summary as Record<string, unknown>) : {};
|
||||||
|
const leaderboards = record.leaderboards && typeof record.leaderboards === 'object'
|
||||||
|
? (record.leaderboards as Record<string, unknown>)
|
||||||
|
: {};
|
||||||
|
const highlights = record.highlights && typeof record.highlights === 'object'
|
||||||
|
? (record.highlights as Record<string, unknown>)
|
||||||
|
: {};
|
||||||
|
const feedRaw = Array.isArray(record.feed) ? record.feed : [];
|
||||||
|
|
||||||
|
const uploadsBoard = Array.isArray(leaderboards.uploads)
|
||||||
|
? (leaderboards.uploads as Record<string, unknown>[]).map((row) => ({
|
||||||
|
guest: toEngagementString(row.guest),
|
||||||
|
photos: toEngagementNumber(row.photos),
|
||||||
|
likes: toEngagementNumber(row.likes),
|
||||||
|
}))
|
||||||
|
: [];
|
||||||
|
|
||||||
|
const likesBoard = Array.isArray(leaderboards.likes)
|
||||||
|
? (leaderboards.likes as Record<string, unknown>[]).map((row) => ({
|
||||||
|
guest: toEngagementString(row.guest),
|
||||||
|
photos: toEngagementNumber(row.photos),
|
||||||
|
likes: toEngagementNumber(row.likes),
|
||||||
|
}))
|
||||||
|
: [];
|
||||||
|
|
||||||
|
const topPhotoRaw = highlights.top_photo && typeof highlights.top_photo === 'object'
|
||||||
|
? (highlights.top_photo as Record<string, unknown>)
|
||||||
|
: null;
|
||||||
|
const topPhoto = topPhotoRaw
|
||||||
|
? {
|
||||||
|
photoId: toEngagementNumber(topPhotoRaw.photo_id),
|
||||||
|
guest: toEngagementString(topPhotoRaw.guest),
|
||||||
|
likes: toEngagementNumber(topPhotoRaw.likes),
|
||||||
|
task: (topPhotoRaw as { task?: string | null }).task ?? null,
|
||||||
|
createdAt: toEngagementString(topPhotoRaw.created_at),
|
||||||
|
thumbnail: topPhotoRaw.thumbnail ? toEngagementString(topPhotoRaw.thumbnail) : null,
|
||||||
|
}
|
||||||
|
: null;
|
||||||
|
|
||||||
|
const trendingRaw = highlights.trending_emotion && typeof highlights.trending_emotion === 'object'
|
||||||
|
? (highlights.trending_emotion as Record<string, unknown>)
|
||||||
|
: null;
|
||||||
|
const trendingEmotion = trendingRaw
|
||||||
|
? {
|
||||||
|
emotionId: toEngagementNumber(trendingRaw.emotion_id),
|
||||||
|
name: toEngagementString(trendingRaw.name),
|
||||||
|
count: toEngagementNumber(trendingRaw.count),
|
||||||
|
}
|
||||||
|
: null;
|
||||||
|
|
||||||
|
const timeline = Array.isArray(highlights.timeline)
|
||||||
|
? (highlights.timeline as Record<string, unknown>[]).map((row) => ({
|
||||||
|
date: toEngagementString(row.date),
|
||||||
|
photos: toEngagementNumber(row.photos),
|
||||||
|
guests: toEngagementNumber(row.guests),
|
||||||
|
}))
|
||||||
|
: [];
|
||||||
|
|
||||||
|
const feed = feedRaw.map((row) => {
|
||||||
|
const entry = row as Record<string, unknown>;
|
||||||
|
return {
|
||||||
|
photoId: toEngagementNumber(entry.photo_id),
|
||||||
|
guest: toEngagementString(entry.guest),
|
||||||
|
task: (entry as { task?: string | null }).task ?? null,
|
||||||
|
likes: toEngagementNumber(entry.likes),
|
||||||
|
createdAt: toEngagementString(entry.created_at),
|
||||||
|
thumbnail: entry.thumbnail ? toEngagementString(entry.thumbnail) : null,
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
return {
|
||||||
|
summary: {
|
||||||
|
totalPhotos: toEngagementNumber(summary.total_photos),
|
||||||
|
uniqueGuests: toEngagementNumber(summary.unique_guests),
|
||||||
|
tasksSolved: toEngagementNumber(summary.tasks_solved),
|
||||||
|
likesTotal: toEngagementNumber(summary.likes_total),
|
||||||
|
},
|
||||||
|
leaderboards: {
|
||||||
|
uploads: uploadsBoard,
|
||||||
|
likes: likesBoard,
|
||||||
|
},
|
||||||
|
highlights: {
|
||||||
|
topPhoto,
|
||||||
|
trendingEmotion,
|
||||||
|
timeline,
|
||||||
|
},
|
||||||
|
feed,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
function normalizeGuestNotification(raw: JsonValue): GuestNotificationSummary | null {
|
function normalizeGuestNotification(raw: JsonValue): GuestNotificationSummary | null {
|
||||||
if (!raw || typeof raw !== 'object') {
|
if (!raw || typeof raw !== 'object') {
|
||||||
return null;
|
return null;
|
||||||
@@ -1818,6 +1983,37 @@ export async function getEventStats(slug: string): Promise<EventStats> {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export async function getEventEngagement(
|
||||||
|
token: string,
|
||||||
|
options: { locale?: string; guestName?: string; signal?: AbortSignal } = {}
|
||||||
|
): Promise<EventEngagement> {
|
||||||
|
const params = new URLSearchParams();
|
||||||
|
if (options.guestName) {
|
||||||
|
params.set('guest_name', options.guestName);
|
||||||
|
}
|
||||||
|
if (options.locale) {
|
||||||
|
params.set('locale', options.locale);
|
||||||
|
}
|
||||||
|
|
||||||
|
const query = params.toString();
|
||||||
|
const response = await fetch(
|
||||||
|
`/api/v1/events/${encodeURIComponent(token)}/achievements${query ? `?${query}` : ''}`,
|
||||||
|
{
|
||||||
|
method: 'GET',
|
||||||
|
headers: {
|
||||||
|
Accept: 'application/json',
|
||||||
|
...(options.locale ? { 'X-Locale': options.locale } : {}),
|
||||||
|
},
|
||||||
|
credentials: 'same-origin',
|
||||||
|
cache: 'no-store',
|
||||||
|
signal: options.signal,
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
const data = await jsonOrThrow<JsonValue>(response, 'Failed to load engagement data', { suppressToast: true });
|
||||||
|
return normalizeEventEngagement(data);
|
||||||
|
}
|
||||||
|
|
||||||
export async function getEventQrInvites(slug: string): Promise<EventQrInvite[]> {
|
export async function getEventQrInvites(slug: string): Promise<EventQrInvite[]> {
|
||||||
const response = await authorizedFetch(`${eventEndpoint(slug)}/join-tokens`);
|
const response = await authorizedFetch(`${eventEndpoint(slug)}/join-tokens`);
|
||||||
const payload = await jsonOrThrow<{ data: JsonValue[] }>(response, 'Failed to load invitations');
|
const payload = await jsonOrThrow<{ data: JsonValue[] }>(response, 'Failed to load invitations');
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -74,6 +74,7 @@ type WatermarkForm = {
|
|||||||
mode: 'base' | 'custom' | 'off';
|
mode: 'base' | 'custom' | 'off';
|
||||||
assetPath: string;
|
assetPath: string;
|
||||||
assetDataUrl: string;
|
assetDataUrl: string;
|
||||||
|
assetPreviewUrl: string;
|
||||||
position: WatermarkPosition;
|
position: WatermarkPosition;
|
||||||
opacity: number;
|
opacity: number;
|
||||||
scale: number;
|
scale: number;
|
||||||
@@ -97,6 +98,7 @@ export default function MobileBrandingPage() {
|
|||||||
mode: 'base',
|
mode: 'base',
|
||||||
assetPath: '',
|
assetPath: '',
|
||||||
assetDataUrl: '',
|
assetDataUrl: '',
|
||||||
|
assetPreviewUrl: '',
|
||||||
position: 'bottom-right',
|
position: 'bottom-right',
|
||||||
opacity: 0.25,
|
opacity: 0.25,
|
||||||
scale: 0.2,
|
scale: 0.2,
|
||||||
@@ -192,13 +194,6 @@ export default function MobileBrandingPage() {
|
|||||||
|
|
||||||
async function handleSave() {
|
async function handleSave() {
|
||||||
if (!event?.slug) return;
|
if (!event?.slug) return;
|
||||||
const eventTypeId = event.event_type_id ?? event.event_type?.id ?? null;
|
|
||||||
if (!eventTypeId) {
|
|
||||||
const msg = t('events.errors.missingType', 'Event type fehlt. Speichere das Event erneut im Admin.');
|
|
||||||
setError(msg);
|
|
||||||
toast.error(msg);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
setSaving(true);
|
setSaving(true);
|
||||||
setError(null);
|
setError(null);
|
||||||
try {
|
try {
|
||||||
@@ -210,14 +205,6 @@ export default function MobileBrandingPage() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const payload = {
|
|
||||||
name: typeof event.name === 'string' ? event.name : renderName(event.name),
|
|
||||||
slug: event.slug,
|
|
||||||
event_type_id: eventTypeId,
|
|
||||||
event_date: event.event_date ?? undefined,
|
|
||||||
status: event.status ?? 'draft',
|
|
||||||
is_active: event.is_active ?? undefined,
|
|
||||||
};
|
|
||||||
const settings = { ...(event.settings ?? {}) };
|
const settings = { ...(event.settings ?? {}) };
|
||||||
const logoUploadValue = form.logoMode === 'upload' ? form.logoDataUrl.trim() : '';
|
const logoUploadValue = form.logoMode === 'upload' ? form.logoDataUrl.trim() : '';
|
||||||
const logoIsDataUrl = logoUploadValue.startsWith('data:image/');
|
const logoIsDataUrl = logoUploadValue.startsWith('data:image/');
|
||||||
@@ -288,11 +275,9 @@ export default function MobileBrandingPage() {
|
|||||||
if (watermarkPayload) {
|
if (watermarkPayload) {
|
||||||
settings.watermark = watermarkPayload;
|
settings.watermark = watermarkPayload;
|
||||||
}
|
}
|
||||||
const updated = await updateEvent(event.slug, {
|
const updated = await updateEvent(event.slug, { settings });
|
||||||
...payload,
|
|
||||||
settings,
|
|
||||||
});
|
|
||||||
setEvent(updated);
|
setEvent(updated);
|
||||||
|
setWatermarkForm(extractWatermark(updated));
|
||||||
void trackOnboarding('branding_configured', { event_id: updated.id });
|
void trackOnboarding('branding_configured', { event_id: updated.id });
|
||||||
toast.success(t('events.branding.saveSuccess', 'Branding gespeichert'));
|
toast.success(t('events.branding.saveSuccess', 'Branding gespeichert'));
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
@@ -340,6 +325,8 @@ export default function MobileBrandingPage() {
|
|||||||
padding={watermarkForm.padding}
|
padding={watermarkForm.padding}
|
||||||
offsetX={watermarkForm.offsetX}
|
offsetX={watermarkForm.offsetX}
|
||||||
offsetY={watermarkForm.offsetY}
|
offsetY={watermarkForm.offsetY}
|
||||||
|
previewUrl={mode === 'off' ? '' : watermarkForm.assetDataUrl || watermarkForm.assetPreviewUrl}
|
||||||
|
previewAlt={t('events.watermark.previewAlt', 'Watermark preview')}
|
||||||
/>
|
/>
|
||||||
</MobileCard>
|
</MobileCard>
|
||||||
|
|
||||||
@@ -404,12 +391,29 @@ export default function MobileBrandingPage() {
|
|||||||
>
|
>
|
||||||
<UploadCloud size={18} color={primary} />
|
<UploadCloud size={18} color={primary} />
|
||||||
<Text fontSize="$sm" color={primary} fontWeight="700">
|
<Text fontSize="$sm" color={primary} fontWeight="700">
|
||||||
{watermarkForm.assetPath
|
{watermarkForm.assetPath || watermarkForm.assetDataUrl
|
||||||
? t('events.watermark.replace', 'Wasserzeichen ersetzen')
|
? t('events.watermark.replace', 'Wasserzeichen ersetzen')
|
||||||
: t('events.watermark.uploadCta', 'PNG/SVG/JPG (max. 3 MB)')}
|
: t('events.watermark.uploadCta', 'PNG/SVG/JPG (max. 3 MB)')}
|
||||||
</Text>
|
</Text>
|
||||||
</XStack>
|
</XStack>
|
||||||
</Pressable>
|
</Pressable>
|
||||||
|
{watermarkForm.assetDataUrl ? (
|
||||||
|
<YStack
|
||||||
|
borderRadius={12}
|
||||||
|
borderWidth={1}
|
||||||
|
borderColor={border}
|
||||||
|
backgroundColor={surfaceMuted}
|
||||||
|
padding="$2"
|
||||||
|
alignItems="center"
|
||||||
|
justifyContent="center"
|
||||||
|
>
|
||||||
|
<img
|
||||||
|
src={watermarkForm.assetDataUrl}
|
||||||
|
alt={t('events.watermark.previewAlt', 'Wasserzeichen Vorschau')}
|
||||||
|
style={{ maxHeight: 120, maxWidth: '100%', objectFit: 'contain' }}
|
||||||
|
/>
|
||||||
|
</YStack>
|
||||||
|
) : null}
|
||||||
<MobileFileInput
|
<MobileFileInput
|
||||||
id="watermark-upload-input"
|
id="watermark-upload-input"
|
||||||
accept="image/png,image/jpeg,image/webp,image/svg+xml"
|
accept="image/png,image/jpeg,image/webp,image/svg+xml"
|
||||||
@@ -423,7 +427,12 @@ export default function MobileBrandingPage() {
|
|||||||
const reader = new FileReader();
|
const reader = new FileReader();
|
||||||
reader.onload = () => {
|
reader.onload = () => {
|
||||||
const result = typeof reader.result === 'string' ? reader.result : '';
|
const result = typeof reader.result === 'string' ? reader.result : '';
|
||||||
setWatermarkForm((prev) => ({ ...prev, assetDataUrl: result, assetPath: '' }));
|
setWatermarkForm((prev) => ({
|
||||||
|
...prev,
|
||||||
|
assetDataUrl: result,
|
||||||
|
assetPreviewUrl: result,
|
||||||
|
assetPath: '',
|
||||||
|
}));
|
||||||
setError(null);
|
setError(null);
|
||||||
};
|
};
|
||||||
reader.readAsDataURL(file);
|
reader.readAsDataURL(file);
|
||||||
@@ -1073,6 +1082,7 @@ function extractWatermark(event: TenantEvent): WatermarkForm {
|
|||||||
mode,
|
mode,
|
||||||
assetPath: readString('asset', ''),
|
assetPath: readString('asset', ''),
|
||||||
assetDataUrl: '',
|
assetDataUrl: '',
|
||||||
|
assetPreviewUrl: readString('asset_url', ''),
|
||||||
position,
|
position,
|
||||||
opacity: readNumber('opacity', 0.25),
|
opacity: readNumber('opacity', 0.25),
|
||||||
scale: readNumber('scale', 0.2),
|
scale: readNumber('scale', 0.2),
|
||||||
@@ -1339,6 +1349,8 @@ function WatermarkPreview({
|
|||||||
padding,
|
padding,
|
||||||
offsetX,
|
offsetX,
|
||||||
offsetY,
|
offsetY,
|
||||||
|
previewUrl,
|
||||||
|
previewAlt,
|
||||||
}: {
|
}: {
|
||||||
position: WatermarkPosition;
|
position: WatermarkPosition;
|
||||||
scale: number;
|
scale: number;
|
||||||
@@ -1346,6 +1358,8 @@ function WatermarkPreview({
|
|||||||
padding: number;
|
padding: number;
|
||||||
offsetX: number;
|
offsetX: number;
|
||||||
offsetY: number;
|
offsetY: number;
|
||||||
|
previewUrl?: string;
|
||||||
|
previewAlt?: string;
|
||||||
}) {
|
}) {
|
||||||
const { border, muted, textStrong, overlay } = useAdminTheme();
|
const { border, muted, textStrong, overlay } = useAdminTheme();
|
||||||
const width = 280;
|
const width = 280;
|
||||||
@@ -1406,7 +1420,7 @@ function WatermarkPreview({
|
|||||||
top: y,
|
top: y,
|
||||||
width: wmWidth,
|
width: wmWidth,
|
||||||
height: wmHeight,
|
height: wmHeight,
|
||||||
background: 'rgba(255,255,255,0.8)',
|
background: previewUrl ? 'transparent' : 'rgba(255,255,255,0.8)',
|
||||||
borderRadius: 10,
|
borderRadius: 10,
|
||||||
display: 'flex',
|
display: 'flex',
|
||||||
alignItems: 'center',
|
alignItems: 'center',
|
||||||
@@ -1415,7 +1429,15 @@ function WatermarkPreview({
|
|||||||
border: `1px dashed ${muted}`,
|
border: `1px dashed ${muted}`,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Droplets size={18} color={textStrong} />
|
{previewUrl ? (
|
||||||
|
<img
|
||||||
|
src={previewUrl}
|
||||||
|
alt={previewAlt ?? 'Watermark'}
|
||||||
|
style={{ width: '100%', height: '100%', objectFit: 'contain' }}
|
||||||
|
/>
|
||||||
|
) : (
|
||||||
|
<Droplets size={18} color={textStrong} />
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -1486,7 +1508,7 @@ function UpgradeCard({
|
|||||||
}
|
}
|
||||||
|
|
||||||
function TabButton({ label, active, onPress }: { label: string; active: boolean; onPress: () => void }) {
|
function TabButton({ label, active, onPress }: { label: string; active: boolean; onPress: () => void }) {
|
||||||
const { backdrop, surfaceMuted, border, surface } = useAdminTheme();
|
const { primary, surfaceMuted, border, surface, textStrong } = useAdminTheme();
|
||||||
return (
|
return (
|
||||||
<Pressable onPress={onPress} style={{ flex: 1 }}>
|
<Pressable onPress={onPress} style={{ flex: 1 }}>
|
||||||
<XStack
|
<XStack
|
||||||
@@ -1494,11 +1516,11 @@ function TabButton({ label, active, onPress }: { label: string; active: boolean;
|
|||||||
justifyContent="center"
|
justifyContent="center"
|
||||||
paddingVertical="$2.5"
|
paddingVertical="$2.5"
|
||||||
borderRadius={12}
|
borderRadius={12}
|
||||||
backgroundColor={active ? backdrop : surfaceMuted}
|
backgroundColor={active ? primary : surfaceMuted}
|
||||||
borderWidth={1}
|
borderWidth={1}
|
||||||
borderColor={active ? backdrop : border}
|
borderColor={active ? primary : border}
|
||||||
>
|
>
|
||||||
<Text fontSize="$sm" color={active ? surface : backdrop} fontWeight="700">
|
<Text fontSize="$sm" color={active ? surface : textStrong} fontWeight="700">
|
||||||
{label}
|
{label}
|
||||||
</Text>
|
</Text>
|
||||||
</XStack>
|
</XStack>
|
||||||
@@ -1517,7 +1539,7 @@ function ModeButton({
|
|||||||
onPress: () => void;
|
onPress: () => void;
|
||||||
disabled?: boolean;
|
disabled?: boolean;
|
||||||
}) {
|
}) {
|
||||||
const { backdrop, surfaceMuted, border, surface } = useAdminTheme();
|
const { primary, surfaceMuted, border, surface, textStrong } = useAdminTheme();
|
||||||
return (
|
return (
|
||||||
<Pressable onPress={onPress} disabled={disabled} style={{ flex: 1, opacity: disabled ? 0.6 : 1 }}>
|
<Pressable onPress={onPress} disabled={disabled} style={{ flex: 1, opacity: disabled ? 0.6 : 1 }}>
|
||||||
<XStack
|
<XStack
|
||||||
@@ -1525,11 +1547,11 @@ function ModeButton({
|
|||||||
justifyContent="center"
|
justifyContent="center"
|
||||||
paddingVertical="$2"
|
paddingVertical="$2"
|
||||||
borderRadius={10}
|
borderRadius={10}
|
||||||
backgroundColor={active ? backdrop : surfaceMuted}
|
backgroundColor={active ? primary : surfaceMuted}
|
||||||
borderWidth={1}
|
borderWidth={1}
|
||||||
borderColor={active ? backdrop : border}
|
borderColor={active ? primary : border}
|
||||||
>
|
>
|
||||||
<Text fontSize="$xs" color={active ? surface : backdrop} fontWeight="700">
|
<Text fontSize="$xs" color={active ? surface : textStrong} fontWeight="700">
|
||||||
{label}
|
{label}
|
||||||
</Text>
|
</Text>
|
||||||
</XStack>
|
</XStack>
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import { Image } from '@tamagui/image';
|
|||||||
import { isSameDay, isPast, isFuture, parseISO, differenceInDays, startOfDay } from 'date-fns';
|
import { isSameDay, isPast, isFuture, parseISO, differenceInDays, startOfDay } from 'date-fns';
|
||||||
|
|
||||||
import { MobileShell } from './components/MobileShell';
|
import { MobileShell } from './components/MobileShell';
|
||||||
import { adminPath } from '../constants';
|
import { ADMIN_EVENTS_PATH, adminPath } from '../constants';
|
||||||
import { useEventContext } from '../context/EventContext';
|
import { useEventContext } from '../context/EventContext';
|
||||||
import { getEventStats, EventStats, TenantEvent, getEventPhotos, TenantPhoto } from '../api';
|
import { getEventStats, EventStats, TenantEvent, getEventPhotos, TenantPhoto } from '../api';
|
||||||
import { formatEventDate, resolveEventDisplayName } from '../lib/events';
|
import { formatEventDate, resolveEventDisplayName } from '../lib/events';
|
||||||
@@ -165,10 +165,21 @@ export default function MobileDashboardPage() {
|
|||||||
selectEvent(slugParam);
|
selectEvent(slugParam);
|
||||||
}, [activeEvent?.slug, selectEvent, slugParam]);
|
}, [activeEvent?.slug, selectEvent, slugParam]);
|
||||||
|
|
||||||
|
const shouldRedirectToSelector = !isLoading && !activeEvent && !slugParam;
|
||||||
|
|
||||||
|
React.useEffect(() => {
|
||||||
|
if (!shouldRedirectToSelector) return;
|
||||||
|
navigate(ADMIN_EVENTS_PATH, { replace: true });
|
||||||
|
}, [navigate, shouldRedirectToSelector]);
|
||||||
|
|
||||||
const [eventSwitcherOpen, setEventSwitcherOpen] = React.useState(false);
|
const [eventSwitcherOpen, setEventSwitcherOpen] = React.useState(false);
|
||||||
|
|
||||||
// --- RENDER ---
|
// --- RENDER ---
|
||||||
|
|
||||||
|
if (shouldRedirectToSelector) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
if (isLoading) {
|
if (isLoading) {
|
||||||
return (
|
return (
|
||||||
<MobileShell activeTab="home" title={t('mobileDashboard.title', 'Dashboard')}>
|
<MobileShell activeTab="home" title={t('mobileDashboard.title', 'Dashboard')}>
|
||||||
@@ -188,6 +199,7 @@ export default function MobileDashboardPage() {
|
|||||||
// Calculate Readiness
|
// Calculate Readiness
|
||||||
const readiness = useEventReadiness(activeEvent, t as any);
|
const readiness = useEventReadiness(activeEvent, t as any);
|
||||||
const phase = activeEvent ? getEventPhase(activeEvent) : 'setup';
|
const phase = activeEvent ? getEventPhase(activeEvent) : 'setup';
|
||||||
|
const isCompleted = phase === 'post';
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<MobileShell activeTab="home" title={t('mobileDashboard.title', 'Dashboard')}>
|
<MobileShell activeTab="home" title={t('mobileDashboard.title', 'Dashboard')}>
|
||||||
@@ -223,6 +235,7 @@ export default function MobileDashboardPage() {
|
|||||||
navigate={navigate}
|
navigate={navigate}
|
||||||
permissions={memberPermissions}
|
permissions={memberPermissions}
|
||||||
isMember={isMember}
|
isMember={isMember}
|
||||||
|
isCompleted={isCompleted}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
{/* 5. RECENT PHOTOS */}
|
{/* 5. RECENT PHOTOS */}
|
||||||
@@ -241,6 +254,7 @@ export default function MobileDashboardPage() {
|
|||||||
type EventPhase = 'setup' | 'live' | 'post';
|
type EventPhase = 'setup' | 'live' | 'post';
|
||||||
|
|
||||||
function getEventPhase(event: TenantEvent): EventPhase {
|
function getEventPhase(event: TenantEvent): EventPhase {
|
||||||
|
if (event.status === 'archived') return 'post';
|
||||||
if (!event.event_date) return 'setup';
|
if (!event.event_date) return 'setup';
|
||||||
const today = startOfDay(new Date());
|
const today = startOfDay(new Date());
|
||||||
const eventDate = parseISO(event.event_date);
|
const eventDate = parseISO(event.event_date);
|
||||||
@@ -318,17 +332,23 @@ function LifecycleHero({ event, stats, locale, navigate, onSwitch, canSwitch, re
|
|||||||
</YStack>
|
</YStack>
|
||||||
<YStack>
|
<YStack>
|
||||||
<Text fontSize="$md" fontWeight="800" color={theme.textStrong}>
|
<Text fontSize="$md" fontWeight="800" color={theme.textStrong}>
|
||||||
{t('management:status.archived', 'Event Completed')}
|
{t('events.recap.completedTitle', 'Event completed')}
|
||||||
</Text>
|
</Text>
|
||||||
<Text fontSize="$xs" color={theme.muted}>{t('management:recap.galleryOpen', 'Gallery online')}</Text>
|
<Text fontSize="$xs" color={theme.muted}>{t('events.recap.galleryOpen', 'Gallery online')}</Text>
|
||||||
</YStack>
|
</YStack>
|
||||||
</XStack>
|
</XStack>
|
||||||
<ModernButton
|
<ModernButton
|
||||||
label={t('management:recap.downloadAll', 'Download Photos')}
|
label={t('events.recap.downloadAll', 'Download photos')}
|
||||||
tone="primary"
|
tone="primary"
|
||||||
icon={<Download size={16} color="white" />}
|
icon={<Download size={16} color="white" />}
|
||||||
onPress={() => navigate(adminPath(`/mobile/exports`))}
|
onPress={() => navigate(adminPath(`/mobile/exports`))}
|
||||||
/>
|
/>
|
||||||
|
<ModernButton
|
||||||
|
label={t('events.recap.openRecap', 'Open recap')}
|
||||||
|
tone="ghost"
|
||||||
|
icon={<ArrowRight size={16} color={theme.text} />}
|
||||||
|
onPress={() => navigate(adminPath(`/mobile/events/${event.slug}/recap`))}
|
||||||
|
/>
|
||||||
</ModernCard>
|
</ModernCard>
|
||||||
</YStack>
|
</YStack>
|
||||||
);
|
);
|
||||||
@@ -413,40 +433,46 @@ function PulseStrip({ event, stats }: any) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function UnifiedToolGrid({ event, navigate, permissions, isMember }: any) {
|
function UnifiedToolGrid({ event, navigate, permissions, isMember, isCompleted }: any) {
|
||||||
const theme = useAdminTheme();
|
const theme = useAdminTheme();
|
||||||
const { t } = useTranslation(['management', 'dashboard']);
|
const { t } = useTranslation(['management', 'dashboard']);
|
||||||
const slug = event?.slug;
|
const slug = event?.slug;
|
||||||
if (!slug) return null;
|
if (!slug) return null;
|
||||||
|
|
||||||
|
const experienceItems = [
|
||||||
|
{ label: t('management:photos.gallery.title', 'Photos'), icon: ImageIcon, path: `/mobile/events/${slug}/control-room`, color: theme.primary },
|
||||||
|
!isCompleted ? { label: t('management:events.quick.liveShowSettings', 'Slide Show'), icon: Tv, path: `/mobile/events/${slug}/live-show/settings`, color: '#F59E0B' } : null,
|
||||||
|
!isCompleted ? { label: t('events.tasks.badge', 'Tasks'), icon: ListTodo, path: `/mobile/events/${slug}/tasks`, color: theme.accent } : null,
|
||||||
|
!isCompleted ? { label: t('management:events.quick.photobooth', 'Photobooth'), icon: Camera, path: `/mobile/events/${slug}/photobooth`, color: '#8B5CF6' } : null,
|
||||||
|
].filter((item): item is { label: string; icon: any; path: string; color?: string } => Boolean(item));
|
||||||
|
|
||||||
|
const operationsItems = [
|
||||||
|
!isCompleted ? { label: t('management:invites.badge', 'QR Codes'), icon: QrCode, path: `/mobile/events/${slug}/qr`, color: '#10B981' } : null,
|
||||||
|
{ label: t('management:events.quick.guests', 'Guests'), icon: Users, path: `/mobile/events/${slug}/members`, color: theme.text },
|
||||||
|
!isCompleted ? { label: t('management:events.quick.guestMessages', 'Messages'), icon: Megaphone, path: `/mobile/events/${slug}/guest-notifications`, color: theme.text } : null,
|
||||||
|
!isCompleted ? { label: t('events.branding.titleShort', 'Branding'), icon: Layout, path: `/mobile/events/${slug}/branding`, color: theme.text } : null,
|
||||||
|
].filter((item): item is { label: string; icon: any; path: string; color?: string } => Boolean(item));
|
||||||
|
|
||||||
|
const adminItems = [
|
||||||
|
{ label: t('management:mobileDashboard.shortcutAnalytics', 'Analytics'), icon: TrendingUp, path: `/mobile/events/${slug}/analytics` },
|
||||||
|
!isCompleted ? { label: t('events.recap.exportTitleShort', 'Exports'), icon: Download, path: `/mobile/exports` } : null,
|
||||||
|
{ label: t('management:mobileProfile.settings', 'Settings'), icon: Settings, path: `/mobile/events/${slug}/edit` },
|
||||||
|
].filter((item): item is { label: string; icon: any; path: string; color?: string } => Boolean(item));
|
||||||
|
|
||||||
const sections = [
|
const sections = [
|
||||||
{
|
{
|
||||||
title: t('management:branding.badge', 'Experience'),
|
title: t('management:branding.badge', 'Experience'),
|
||||||
items: [
|
items: experienceItems,
|
||||||
{ label: t('management:photos.gallery.title', 'Photos'), icon: ImageIcon, path: `/mobile/events/${slug}/control-room`, color: theme.primary },
|
|
||||||
{ label: t('management:events.quick.liveShowSettings', 'Slide Show'), icon: Tv, path: `/mobile/events/${slug}/live-show/settings`, color: '#F59E0B' },
|
|
||||||
{ label: t('management:tasks.badge', 'Tasks'), icon: ListTodo, path: `/mobile/events/${slug}/tasks`, color: theme.accent },
|
|
||||||
{ label: t('management:events.quick.photobooth', 'Photobooth'), icon: Camera, path: `/mobile/events/${slug}/photobooth`, color: '#8B5CF6' },
|
|
||||||
]
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: t('management:workspace.hero.badge', 'Operations'),
|
title: t('management:workspace.hero.badge', 'Operations'),
|
||||||
items: [
|
items: operationsItems,
|
||||||
{ label: t('management:invites.badge', 'QR Codes'), icon: QrCode, path: `/mobile/events/${slug}/qr`, color: '#10B981' },
|
|
||||||
{ label: t('management:events.quick.guests', 'Guests'), icon: Users, path: `/mobile/events/${slug}/members`, color: theme.text },
|
|
||||||
{ label: t('management:events.quick.guestMessages', 'Messages'), icon: Megaphone, path: `/mobile/events/${slug}/guest-notifications`, color: theme.text },
|
|
||||||
{ label: t('management:branding.titleShort', 'Branding'), icon: Layout, path: `/mobile/events/${slug}/branding`, color: theme.text },
|
|
||||||
]
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: t('management:settings.hero.badge', 'Admin'),
|
title: t('management:settings.hero.badge', 'Admin'),
|
||||||
items: [
|
items: adminItems,
|
||||||
{ label: t('management:mobileDashboard.shortcutAnalytics', 'Analytics'), icon: TrendingUp, path: `/mobile/events/${slug}/analytics` },
|
|
||||||
{ label: t('management:recap.exportTitle', 'Exports'), icon: Download, path: `/mobile/exports` },
|
|
||||||
{ label: t('management:mobileProfile.settings', 'Settings'), icon: Settings, path: `/mobile/events/${slug}/edit` },
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
];
|
].filter((section) => section.items.length > 0);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<YStack space="$4">
|
<YStack space="$4">
|
||||||
|
|||||||
@@ -56,35 +56,69 @@ function formatEventName(event: TenantEvent | DataExportSummary['event'] | null)
|
|||||||
return event.slug ?? '';
|
return event.slug ?? '';
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function MobileDataExportsPage() {
|
type DataExportsPanelProps = {
|
||||||
|
variant?: 'page' | 'recap';
|
||||||
|
event?: TenantEvent | null;
|
||||||
|
onRefreshReady?: (refresh: () => void) => void;
|
||||||
|
};
|
||||||
|
|
||||||
|
export function DataExportsPanel({
|
||||||
|
variant = 'page',
|
||||||
|
event,
|
||||||
|
onRefreshReady,
|
||||||
|
}: DataExportsPanelProps) {
|
||||||
const { t } = useTranslation('management');
|
const { t } = useTranslation('management');
|
||||||
const { textStrong, text, muted, danger } = useAdminTheme();
|
const { textStrong, text, muted, danger } = useAdminTheme();
|
||||||
const [exports, setExports] = React.useState<DataExportSummary[]>([]);
|
const [exports, setExports] = React.useState<DataExportSummary[]>([]);
|
||||||
const [events, setEvents] = React.useState<TenantEvent[]>([]);
|
const [events, setEvents] = React.useState<TenantEvent[]>([]);
|
||||||
const [scope, setScope] = React.useState<'tenant' | 'event'>('tenant');
|
const isRecap = variant === 'recap';
|
||||||
const [eventId, setEventId] = React.useState<number | null>(null);
|
const [scope, setScope] = React.useState<'tenant' | 'event'>(isRecap ? 'event' : 'tenant');
|
||||||
|
const [eventId, setEventId] = React.useState<number | null>(isRecap ? event?.id ?? null : null);
|
||||||
const [includeMedia, setIncludeMedia] = React.useState(false);
|
const [includeMedia, setIncludeMedia] = React.useState(false);
|
||||||
const [loading, setLoading] = React.useState(true);
|
const [loading, setLoading] = React.useState(true);
|
||||||
const [requesting, setRequesting] = React.useState(false);
|
const [requesting, setRequesting] = React.useState(false);
|
||||||
const [error, setError] = React.useState<string | null>(null);
|
const [error, setError] = React.useState<string | null>(null);
|
||||||
const back = useBackNavigation(adminPath('/mobile/profile'));
|
|
||||||
|
React.useEffect(() => {
|
||||||
|
if (!isRecap) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (event?.id && eventId !== event.id) {
|
||||||
|
setEventId(event.id);
|
||||||
|
}
|
||||||
|
if (event) {
|
||||||
|
setEvents([event]);
|
||||||
|
}
|
||||||
|
}, [event, eventId, isRecap]);
|
||||||
|
|
||||||
const load = React.useCallback(async () => {
|
const load = React.useCallback(async () => {
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
try {
|
try {
|
||||||
const [exportRows, eventRows] = await Promise.all([
|
const [exportRows, eventRows] = await Promise.all([
|
||||||
listTenantDataExports(),
|
listTenantDataExports(),
|
||||||
getEvents({ force: true }),
|
isRecap ? Promise.resolve(event ? [event] : []) : getEvents({ force: true }),
|
||||||
]);
|
]);
|
||||||
setExports(exportRows);
|
setExports(exportRows);
|
||||||
setEvents(eventRows);
|
if (!isRecap) {
|
||||||
|
setEvents(eventRows);
|
||||||
|
} else if (eventRows.length > 0) {
|
||||||
|
setEvents(eventRows);
|
||||||
|
}
|
||||||
setError(null);
|
setError(null);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
setError(getApiErrorMessage(err, t('dataExports.errors.load', 'Exports konnten nicht geladen werden.')));
|
setError(getApiErrorMessage(err, t('dataExports.errors.load', 'Exports konnten nicht geladen werden.')));
|
||||||
} finally {
|
} finally {
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
}
|
}
|
||||||
}, [t]);
|
}, [event, isRecap, t]);
|
||||||
|
|
||||||
|
const refresh = React.useCallback(() => {
|
||||||
|
void load();
|
||||||
|
}, [load]);
|
||||||
|
|
||||||
|
React.useEffect(() => {
|
||||||
|
onRefreshReady?.(refresh);
|
||||||
|
}, [onRefreshReady, refresh]);
|
||||||
|
|
||||||
React.useEffect(() => {
|
React.useEffect(() => {
|
||||||
void load();
|
void load();
|
||||||
@@ -111,7 +145,10 @@ export default function MobileDataExportsPage() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (scope === 'event' && !eventId) {
|
const requestScope = isRecap ? 'event' : scope;
|
||||||
|
const requestEventId = isRecap ? eventId : eventId;
|
||||||
|
|
||||||
|
if (requestScope === 'event' && !requestEventId) {
|
||||||
setError(t('dataExports.errors.eventRequired', 'Bitte wähle ein Event aus.'));
|
setError(t('dataExports.errors.eventRequired', 'Bitte wähle ein Event aus.'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -119,8 +156,8 @@ export default function MobileDataExportsPage() {
|
|||||||
setRequesting(true);
|
setRequesting(true);
|
||||||
try {
|
try {
|
||||||
await requestTenantDataExport({
|
await requestTenantDataExport({
|
||||||
scope,
|
scope: requestScope,
|
||||||
eventId: scope === 'event' ? eventId ?? undefined : undefined,
|
eventId: requestScope === 'event' ? requestEventId ?? undefined : undefined,
|
||||||
includeMedia,
|
includeMedia,
|
||||||
});
|
});
|
||||||
toast.success(t('dataExports.actions.requested', 'Export wird vorbereitet.'));
|
toast.success(t('dataExports.actions.requested', 'Export wird vorbereitet.'));
|
||||||
@@ -133,23 +170,24 @@ export default function MobileDataExportsPage() {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const visibleExports = React.useMemo(() => {
|
||||||
|
if (!isRecap) {
|
||||||
|
return exports;
|
||||||
|
}
|
||||||
|
if (!event?.id) {
|
||||||
|
return exports.filter((entry) => entry.scope === 'event');
|
||||||
|
}
|
||||||
|
return exports.filter((entry) => entry.scope === 'event' && entry.event?.id === event.id);
|
||||||
|
}, [event?.id, exports, isRecap]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<MobileShell
|
<>
|
||||||
activeTab="profile"
|
|
||||||
title={t('dataExports.title', 'Data exports')}
|
|
||||||
onBack={back}
|
|
||||||
headerActions={
|
|
||||||
<HeaderActionButton onPress={() => load()} ariaLabel={t('common.refresh', 'Refresh')}>
|
|
||||||
<RefreshCcw size={18} color={textStrong} />
|
|
||||||
</HeaderActionButton>
|
|
||||||
}
|
|
||||||
>
|
|
||||||
{error ? (
|
{error ? (
|
||||||
<MobileCard>
|
<MobileCard>
|
||||||
<Text fontWeight="700" color={danger}>
|
<Text fontWeight="700" color={danger}>
|
||||||
{error}
|
{error}
|
||||||
</Text>
|
</Text>
|
||||||
<CTAButton label={t('dataExports.actions.refresh', 'Refresh')} tone="ghost" onPress={load} />
|
<CTAButton label={t('dataExports.actions.refresh', 'Refresh')} tone="ghost" onPress={refresh} />
|
||||||
</MobileCard>
|
</MobileCard>
|
||||||
) : null}
|
) : null}
|
||||||
|
|
||||||
@@ -161,21 +199,32 @@ export default function MobileDataExportsPage() {
|
|||||||
{t('dataExports.request.hint', 'Export tenant data or a specific event archive.')}
|
{t('dataExports.request.hint', 'Export tenant data or a specific event archive.')}
|
||||||
</Text>
|
</Text>
|
||||||
<YStack space="$2">
|
<YStack space="$2">
|
||||||
<XStack alignItems="center" justifyContent="space-between">
|
{!isRecap ? (
|
||||||
<Text fontSize="$sm" color={text}>
|
<XStack alignItems="center" justifyContent="space-between">
|
||||||
{t('dataExports.fields.scope', 'Scope')}
|
<Text fontSize="$sm" color={text}>
|
||||||
</Text>
|
{t('dataExports.fields.scope', 'Scope')}
|
||||||
<MobileSelect
|
</Text>
|
||||||
value={scope}
|
<MobileSelect
|
||||||
onChange={(event) => setScope(event.target.value as 'tenant' | 'event')}
|
value={scope}
|
||||||
compact
|
onChange={(event) => setScope(event.target.value as 'tenant' | 'event')}
|
||||||
style={{ minWidth: 140, maxWidth: 180 }}
|
compact
|
||||||
>
|
style={{ minWidth: 140, maxWidth: 180 }}
|
||||||
<option value="tenant">{t('dataExports.scopes.tenant', 'Tenant')}</option>
|
>
|
||||||
<option value="event">{t('dataExports.scopes.event', 'Event')}</option>
|
<option value="tenant">{t('dataExports.scopes.tenant', 'Tenant')}</option>
|
||||||
</MobileSelect>
|
<option value="event">{t('dataExports.scopes.event', 'Event')}</option>
|
||||||
</XStack>
|
</MobileSelect>
|
||||||
{scope === 'event' ? (
|
</XStack>
|
||||||
|
) : (
|
||||||
|
<XStack alignItems="center" justifyContent="space-between">
|
||||||
|
<Text fontSize="$sm" color={text}>
|
||||||
|
{t('dataExports.fields.event', 'Event')}
|
||||||
|
</Text>
|
||||||
|
<Text fontSize="$sm" color={textStrong}>
|
||||||
|
{formatEventName(event) || event?.slug || t('dataExports.fields.eventPlaceholder', 'Choose event')}
|
||||||
|
</Text>
|
||||||
|
</XStack>
|
||||||
|
)}
|
||||||
|
{!isRecap && scope === 'event' ? (
|
||||||
<XStack alignItems="center" justifyContent="space-between">
|
<XStack alignItems="center" justifyContent="space-between">
|
||||||
<Text fontSize="$sm" color={text}>
|
<Text fontSize="$sm" color={text}>
|
||||||
{t('dataExports.fields.event', 'Event')}
|
{t('dataExports.fields.event', 'Event')}
|
||||||
@@ -238,13 +287,13 @@ export default function MobileDataExportsPage() {
|
|||||||
<SkeletonCard height={72} />
|
<SkeletonCard height={72} />
|
||||||
<SkeletonCard height={72} />
|
<SkeletonCard height={72} />
|
||||||
</YStack>
|
</YStack>
|
||||||
) : exports.length === 0 ? (
|
) : visibleExports.length === 0 ? (
|
||||||
<Text fontSize="$sm" color={muted}>
|
<Text fontSize="$sm" color={muted}>
|
||||||
{t('dataExports.history.empty', 'No exports yet.')}
|
{t('dataExports.history.empty', 'No exports yet.')}
|
||||||
</Text>
|
</Text>
|
||||||
) : (
|
) : (
|
||||||
<YStack space="$2">
|
<YStack space="$2">
|
||||||
{exports.map((entry) => (
|
{visibleExports.map((entry) => (
|
||||||
<MobileCard key={entry.id} space="$2">
|
<MobileCard key={entry.id} space="$2">
|
||||||
<XStack alignItems="center" justifyContent="space-between">
|
<XStack alignItems="center" justifyContent="space-between">
|
||||||
<YStack>
|
<YStack>
|
||||||
@@ -301,6 +350,28 @@ export default function MobileDataExportsPage() {
|
|||||||
</YStack>
|
</YStack>
|
||||||
)}
|
)}
|
||||||
</MobileCard>
|
</MobileCard>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default function MobileDataExportsPage() {
|
||||||
|
const { t } = useTranslation('management');
|
||||||
|
const { textStrong } = useAdminTheme();
|
||||||
|
const back = useBackNavigation(adminPath('/mobile/profile'));
|
||||||
|
const [refresh, setRefresh] = React.useState<null | (() => void)>(null);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<MobileShell
|
||||||
|
activeTab="profile"
|
||||||
|
title={t('dataExports.title', 'Data exports')}
|
||||||
|
onBack={back}
|
||||||
|
headerActions={
|
||||||
|
<HeaderActionButton onPress={() => refresh?.()} ariaLabel={t('common.refresh', 'Refresh')}>
|
||||||
|
<RefreshCcw size={18} color={textStrong} />
|
||||||
|
</HeaderActionButton>
|
||||||
|
}
|
||||||
|
>
|
||||||
|
<DataExportsPanel onRefreshReady={setRefresh} />
|
||||||
</MobileShell>
|
</MobileShell>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import { useNavigate, useParams } from 'react-router-dom';
|
|||||||
import { useQueryClient } from '@tanstack/react-query';
|
import { useQueryClient } from '@tanstack/react-query';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import { CalendarDays, ChevronDown, MapPin, Save, Check } from 'lucide-react';
|
import { CalendarDays, ChevronDown, MapPin, Save, Check } from 'lucide-react';
|
||||||
|
import { isPast, isSameDay, parseISO, startOfDay } from 'date-fns';
|
||||||
import { YStack, XStack } from '@tamagui/stacks';
|
import { YStack, XStack } from '@tamagui/stacks';
|
||||||
import { SizableText as Text } from '@tamagui/text';
|
import { SizableText as Text } from '@tamagui/text';
|
||||||
import { Switch } from '@tamagui/switch';
|
import { Switch } from '@tamagui/switch';
|
||||||
@@ -71,6 +72,9 @@ export default function MobileEventFormPage() {
|
|||||||
packageId: null,
|
packageId: null,
|
||||||
servicePackageSlug: null,
|
servicePackageSlug: null,
|
||||||
});
|
});
|
||||||
|
const [eventMeta, setEventMeta] = React.useState<{ status: TenantEvent['status']; eventDate: string | null } | null>(
|
||||||
|
null,
|
||||||
|
);
|
||||||
const [eventTypes, setEventTypes] = React.useState<TenantEventType[]>([]);
|
const [eventTypes, setEventTypes] = React.useState<TenantEventType[]>([]);
|
||||||
const [typesLoading, setTypesLoading] = React.useState(false);
|
const [typesLoading, setTypesLoading] = React.useState(false);
|
||||||
const [packages, setPackages] = React.useState<Package[]>([]);
|
const [packages, setPackages] = React.useState<Package[]>([]);
|
||||||
@@ -86,11 +90,15 @@ export default function MobileEventFormPage() {
|
|||||||
const back = useBackNavigation(slug ? adminPath(`/mobile/events/${slug}`) : adminPath('/mobile/events'));
|
const back = useBackNavigation(slug ? adminPath(`/mobile/events/${slug}`) : adminPath('/mobile/events'));
|
||||||
|
|
||||||
React.useEffect(() => {
|
React.useEffect(() => {
|
||||||
if (!slug) return;
|
if (!slug) {
|
||||||
|
setEventMeta(null);
|
||||||
|
return;
|
||||||
|
}
|
||||||
(async () => {
|
(async () => {
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
try {
|
try {
|
||||||
const data = await getEvent(slug);
|
const data = await getEvent(slug);
|
||||||
|
setEventMeta({ status: data.status, eventDate: data.event_date });
|
||||||
setForm({
|
setForm({
|
||||||
name: renderName(data.name),
|
name: renderName(data.name),
|
||||||
date: toDateTimeLocal(data.event_date),
|
date: toDateTimeLocal(data.event_date),
|
||||||
@@ -117,6 +125,24 @@ export default function MobileEventFormPage() {
|
|||||||
})();
|
})();
|
||||||
}, [slug, t, isEdit]);
|
}, [slug, t, isEdit]);
|
||||||
|
|
||||||
|
const isEventCompleted = React.useMemo(() => {
|
||||||
|
if (!eventMeta) return false;
|
||||||
|
if (eventMeta.status === 'archived') return true;
|
||||||
|
if (!eventMeta.eventDate) return false;
|
||||||
|
const eventDate = parseISO(eventMeta.eventDate);
|
||||||
|
const today = startOfDay(new Date());
|
||||||
|
if (isSameDay(today, eventDate)) return false;
|
||||||
|
return isPast(eventDate);
|
||||||
|
}, [eventMeta]);
|
||||||
|
|
||||||
|
const handleDateChange = React.useCallback(
|
||||||
|
(event: React.ChangeEvent<HTMLInputElement>) => {
|
||||||
|
if (isEventCompleted) return;
|
||||||
|
setForm((prev) => ({ ...prev, date: event.target.value }));
|
||||||
|
},
|
||||||
|
[isEventCompleted],
|
||||||
|
);
|
||||||
|
|
||||||
React.useEffect(() => {
|
React.useEffect(() => {
|
||||||
(async () => {
|
(async () => {
|
||||||
setTypesLoading(true);
|
setTypesLoading(true);
|
||||||
@@ -429,8 +455,9 @@ export default function MobileEventFormPage() {
|
|||||||
<XStack alignItems="center" space="$2">
|
<XStack alignItems="center" space="$2">
|
||||||
<MobileDateTimeInput
|
<MobileDateTimeInput
|
||||||
value={form.date}
|
value={form.date}
|
||||||
onChange={(event) => setForm((prev) => ({ ...prev, date: event.target.value }))}
|
onChange={handleDateChange}
|
||||||
style={{ flex: 1 }}
|
style={{ flex: 1 }}
|
||||||
|
disabled={isEventCompleted}
|
||||||
/>
|
/>
|
||||||
<CalendarDays size={16} color={subtle} />
|
<CalendarDays size={16} color={subtle} />
|
||||||
</XStack>
|
</XStack>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { useNavigate, useParams } from 'react-router-dom';
|
import { useNavigate, useParams } from 'react-router-dom';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import { Check, Copy, Download, Share2, Sparkles, Trophy, Users } from 'lucide-react';
|
import { Share2, Sparkles, Trophy, Users, TrendingUp, Heart, Image as ImageIcon } from 'lucide-react';
|
||||||
import { YStack, XStack } from '@tamagui/stacks';
|
import { YStack, XStack } from '@tamagui/stacks';
|
||||||
import { SizableText as Text } from '@tamagui/text';
|
import { SizableText as Text } from '@tamagui/text';
|
||||||
import { Pressable } from '@tamagui/react-native-web-lite';
|
import { Pressable } from '@tamagui/react-native-web-lite';
|
||||||
@@ -9,20 +9,23 @@ import { Switch } from '@tamagui/switch';
|
|||||||
import { MobileShell } from './components/MobileShell';
|
import { MobileShell } from './components/MobileShell';
|
||||||
import { MobileCard, CTAButton, PillBadge, SkeletonCard } from './components/Primitives';
|
import { MobileCard, CTAButton, PillBadge, SkeletonCard } from './components/Primitives';
|
||||||
import { LegalConsentSheet } from './components/LegalConsentSheet';
|
import { LegalConsentSheet } from './components/LegalConsentSheet';
|
||||||
|
import { DataExportsPanel } from './DataExportsPage';
|
||||||
import {
|
import {
|
||||||
getEvent,
|
getEvent,
|
||||||
getEventStats,
|
getEventStats,
|
||||||
getEventQrInvites,
|
getEventQrInvites,
|
||||||
|
getEventEngagement,
|
||||||
updateEvent,
|
updateEvent,
|
||||||
TenantEvent,
|
TenantEvent,
|
||||||
EventStats,
|
EventStats,
|
||||||
EventQrInvite,
|
EventQrInvite,
|
||||||
|
EventEngagement,
|
||||||
EventAddonCatalogItem,
|
EventAddonCatalogItem,
|
||||||
getAddonCatalog,
|
getAddonCatalog,
|
||||||
createEventAddonCheckout,
|
createEventAddonCheckout,
|
||||||
} from '../api';
|
} from '../api';
|
||||||
import { isAuthError } from '../auth/tokens';
|
import { isAuthError } from '../auth/tokens';
|
||||||
import { getApiErrorMessage } from '../lib/apiError';
|
import { getApiErrorMessage, isApiError } from '../lib/apiError';
|
||||||
import { adminPath } from '../constants';
|
import { adminPath } from '../constants';
|
||||||
import toast from 'react-hot-toast';
|
import toast from 'react-hot-toast';
|
||||||
import { useBackNavigation } from './hooks/useBackNavigation';
|
import { useBackNavigation } from './hooks/useBackNavigation';
|
||||||
@@ -37,13 +40,18 @@ type GalleryCounts = {
|
|||||||
export default function MobileEventRecapPage() {
|
export default function MobileEventRecapPage() {
|
||||||
const { slug } = useParams<{ slug: string }>();
|
const { slug } = useParams<{ slug: string }>();
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const { t } = useTranslation('management');
|
const { t, i18n } = useTranslation('management');
|
||||||
const { textStrong, text, muted, border, primary, successText, danger } = useAdminTheme();
|
const { textStrong, text, muted, border, primary, danger } = useAdminTheme();
|
||||||
|
const locale = i18n.language;
|
||||||
|
|
||||||
|
const [activeTab, setActiveTab] = React.useState<'overview' | 'engagement' | 'compliance'>('overview');
|
||||||
const [event, setEvent] = React.useState<TenantEvent | null>(null);
|
const [event, setEvent] = React.useState<TenantEvent | null>(null);
|
||||||
const [stats, setEventStats] = React.useState<EventStats | null>(null);
|
const [stats, setEventStats] = React.useState<EventStats | null>(null);
|
||||||
const [invites, setInvites] = React.useState<EventQrInvite[]>([]);
|
const [invites, setInvites] = React.useState<EventQrInvite[]>([]);
|
||||||
const [addons, setAddons] = React.useState<EventAddonCatalogItem[]>([]);
|
const [addons, setAddons] = React.useState<EventAddonCatalogItem[]>([]);
|
||||||
|
const [engagement, setEngagement] = React.useState<EventEngagement | null>(null);
|
||||||
|
const [engagementLoading, setEngagementLoading] = React.useState(false);
|
||||||
|
const [engagementError, setEngagementError] = React.useState<string | null>(null);
|
||||||
const [loading, setLoading] = React.useState(true);
|
const [loading, setLoading] = React.useState(true);
|
||||||
const [error, setError] = React.useState<string | null>(null);
|
const [error, setError] = React.useState<string | null>(null);
|
||||||
const [consentOpen, setConsentOpen] = React.useState(false);
|
const [consentOpen, setConsentOpen] = React.useState(false);
|
||||||
@@ -78,6 +86,50 @@ export default function MobileEventRecapPage() {
|
|||||||
void load();
|
void load();
|
||||||
}, [load]);
|
}, [load]);
|
||||||
|
|
||||||
|
React.useEffect(() => {
|
||||||
|
if (event?.status && event.status !== 'published') {
|
||||||
|
setEngagement(null);
|
||||||
|
setEngagementError(null);
|
||||||
|
setEngagementLoading(false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const token = invites.find((invite) => invite.is_active)?.token ?? invites[0]?.token ?? '';
|
||||||
|
if (!token) {
|
||||||
|
setEngagement(null);
|
||||||
|
setEngagementError(null);
|
||||||
|
setEngagementLoading(false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const controller = new AbortController();
|
||||||
|
setEngagementLoading(true);
|
||||||
|
setEngagementError(null);
|
||||||
|
getEventEngagement(token, { locale: i18n.language, signal: controller.signal })
|
||||||
|
.then((payload) => {
|
||||||
|
setEngagement(payload);
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
if (err?.name === 'AbortError') {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (isApiError(err) && (err.status === 403 || err.status === 404)) {
|
||||||
|
setEngagement(null);
|
||||||
|
setEngagementError(null);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
setEngagement(null);
|
||||||
|
setEngagementError(getApiErrorMessage(err, t('events.recap.engagementError', 'Engagement konnte nicht geladen werden.')));
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
setEngagementLoading(false);
|
||||||
|
});
|
||||||
|
|
||||||
|
return () => {
|
||||||
|
controller.abort();
|
||||||
|
};
|
||||||
|
}, [event?.status, i18n.language, invites, t]);
|
||||||
|
|
||||||
const handleCheckout = async (addonKey: string) => {
|
const handleCheckout = async (addonKey: string) => {
|
||||||
if (!slug || busyScope) return;
|
if (!slug || busyScope) return;
|
||||||
setBusyScope(addonKey);
|
setBusyScope(addonKey);
|
||||||
@@ -156,121 +208,355 @@ export default function MobileEventRecapPage() {
|
|||||||
onBack={back}
|
onBack={back}
|
||||||
>
|
>
|
||||||
<YStack space="$4">
|
<YStack space="$4">
|
||||||
{/* Status & Summary */}
|
<XStack space="$2">
|
||||||
<MobileCard space="$3">
|
<TabButton
|
||||||
<XStack alignItems="center" justifyContent="space-between">
|
label={t('events.recap.tabs.overview', 'Overview')}
|
||||||
<YStack space="$1">
|
active={activeTab === 'overview'}
|
||||||
<Text fontSize="$xl" fontWeight="800" color={textStrong}>
|
onPress={() => setActiveTab('overview')}
|
||||||
{t('events.recap.done', 'Event beendet')}
|
/>
|
||||||
|
<TabButton
|
||||||
|
label={t('events.recap.tabs.engagement', 'Engagement')}
|
||||||
|
active={activeTab === 'engagement'}
|
||||||
|
onPress={() => setActiveTab('engagement')}
|
||||||
|
/>
|
||||||
|
<TabButton
|
||||||
|
label={t('events.recap.tabs.compliance', 'Compliance')}
|
||||||
|
active={activeTab === 'compliance'}
|
||||||
|
onPress={() => setActiveTab('compliance')}
|
||||||
|
/>
|
||||||
|
</XStack>
|
||||||
|
|
||||||
|
{activeTab === 'overview' ? (
|
||||||
|
<YStack space="$4">
|
||||||
|
<MobileCard space="$3">
|
||||||
|
<XStack alignItems="center" justifyContent="space-between">
|
||||||
|
<YStack space="$1">
|
||||||
|
<Text fontSize="$xl" fontWeight="800" color={textStrong}>
|
||||||
|
{t('events.recap.completedTitle', 'Event abgeschlossen')}
|
||||||
|
</Text>
|
||||||
|
<Text fontSize="$sm" color={muted}>
|
||||||
|
{formatDate(event.event_date, locale)}
|
||||||
|
</Text>
|
||||||
|
</YStack>
|
||||||
|
<PillBadge tone="success">{t('events.recap.statusClosed', 'Archiviert')}</PillBadge>
|
||||||
|
</XStack>
|
||||||
|
|
||||||
|
<XStack flexWrap="wrap" gap="$2" marginTop="$1">
|
||||||
|
<Stat label={t('events.stats.uploads', 'Uploads')} value={formatCount(galleryCounts.photos, locale)} />
|
||||||
|
<Stat label={t('events.stats.pending', 'Offen')} value={formatCount(galleryCounts.pending, locale)} />
|
||||||
|
<Stat label={t('events.stats.likes', 'Likes')} value={formatCount(galleryCounts.likes, locale)} />
|
||||||
|
</XStack>
|
||||||
|
</MobileCard>
|
||||||
|
|
||||||
|
<MobileCard space="$3">
|
||||||
|
<XStack alignItems="center" space="$2">
|
||||||
|
<Share2 size={18} color={primary} />
|
||||||
|
<Text fontSize="$md" fontWeight="800" color={textStrong}>
|
||||||
|
{t('events.recap.shareGuests', 'Gäste-Galerie teilen')}
|
||||||
|
</Text>
|
||||||
|
</XStack>
|
||||||
|
<Text fontSize="$sm" color={text}>
|
||||||
|
{t('events.recap.shareBody', 'Deine Gäste können die Galerie auch nach dem Event weiterhin ansehen.')}
|
||||||
</Text>
|
</Text>
|
||||||
<Text fontSize="$sm" color={muted}>
|
|
||||||
{formatDate(event.event_date)}
|
|
||||||
</Text>
|
|
||||||
</YStack>
|
|
||||||
<PillBadge tone="success">{t('events.recap.statusClosed', 'Archiviert')}</PillBadge>
|
|
||||||
</XStack>
|
|
||||||
|
|
||||||
<XStack flexWrap="wrap" gap="$2" marginTop="$1">
|
{guestLink ? (
|
||||||
<Stat label={t('events.stats.uploads', 'Uploads')} value={String(galleryCounts.photos)} />
|
<YStack space="$2" marginTop="$1">
|
||||||
<Stat label={t('events.stats.pending', 'Offen')} value={String(galleryCounts.pending)} />
|
<XStack
|
||||||
<Stat label={t('events.stats.likes', 'Likes')} value={String(galleryCounts.likes)} />
|
backgroundColor={border}
|
||||||
</XStack>
|
padding="$3"
|
||||||
</MobileCard>
|
borderRadius={12}
|
||||||
|
alignItems="center"
|
||||||
|
justifyContent="space-between"
|
||||||
|
>
|
||||||
|
<Text fontSize="$xs" color={muted} numberOfLines={1} flex={1}>
|
||||||
|
{guestLink}
|
||||||
|
</Text>
|
||||||
|
<CTAButton
|
||||||
|
label={t('events.recap.copyLink', 'Link kopieren')}
|
||||||
|
tone="ghost"
|
||||||
|
onPress={() => copyToClipboard(guestLink, t)}
|
||||||
|
/>
|
||||||
|
</XStack>
|
||||||
|
{typeof navigator !== 'undefined' && !!navigator.share && (
|
||||||
|
<CTAButton
|
||||||
|
label={t('events.recap.qrShare', 'Link/QR teilen')}
|
||||||
|
tone="ghost"
|
||||||
|
onPress={() => shareLink(guestLink, event, t)}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
</YStack>
|
||||||
|
) : (
|
||||||
|
<Text fontSize="$sm" color={muted} marginTop="$1">
|
||||||
|
{t('events.recap.noPublicUrl', 'Kein Gäste-Link gesetzt. Lege den öffentlichen Link im Event-Setup fest.')}
|
||||||
|
</Text>
|
||||||
|
)}
|
||||||
|
|
||||||
{/* Share Section */}
|
{guestLink && activeInvite?.qr_code_data_url ? (
|
||||||
<MobileCard space="$3">
|
<YStack alignItems="center" space="$2" marginTop="$2">
|
||||||
<XStack alignItems="center" space="$2">
|
<YStack
|
||||||
<Share2 size={18} color={primary} />
|
|
||||||
<Text fontSize="$md" fontWeight="800" color={textStrong}>
|
|
||||||
{t('events.recap.shareGallery', 'Galerie teilen')}
|
|
||||||
</Text>
|
|
||||||
</XStack>
|
|
||||||
<Text fontSize="$sm" color={text}>
|
|
||||||
{t('events.recap.shareBody', 'Deine Gäste können die Galerie auch nach dem Event weiterhin ansehen.')}
|
|
||||||
</Text>
|
|
||||||
|
|
||||||
<YStack space="$2" marginTop="$1">
|
|
||||||
<XStack
|
|
||||||
backgroundColor={border}
|
|
||||||
padding="$3"
|
|
||||||
borderRadius={12}
|
|
||||||
alignItems="center"
|
|
||||||
justifyContent="space-between"
|
|
||||||
>
|
|
||||||
<Text fontSize="$xs" color={muted} numberOfLines={1} flex={1}>
|
|
||||||
{guestLink}
|
|
||||||
</Text>
|
|
||||||
<CTAButton label={t('events.recap.copy', 'Kopieren')} tone="ghost" onPress={() => guestLink && copyToClipboard(guestLink, t)} />
|
|
||||||
</XStack>
|
|
||||||
{typeof navigator !== 'undefined' && !!navigator.share && (
|
|
||||||
<CTAButton label={t('events.recap.share', 'Teilen')} tone="ghost" onPress={() => shareLink(guestLink, event, t)} />
|
|
||||||
)}
|
|
||||||
</YStack>
|
|
||||||
|
|
||||||
{activeInvite?.qr_code_data_url ? (
|
|
||||||
<YStack alignItems="center" space="$2" marginTop="$2">
|
|
||||||
<YStack
|
|
||||||
padding="$2"
|
padding="$2"
|
||||||
backgroundColor="white"
|
backgroundColor="white"
|
||||||
borderRadius={12}
|
borderRadius={12}
|
||||||
borderWidth={1}
|
borderWidth={1}
|
||||||
borderColor={border}
|
borderColor={border}
|
||||||
>
|
>
|
||||||
<img src={activeInvite.qr_code_data_url} alt="QR" style={{ width: 120, height: 120 }} />
|
<img
|
||||||
|
src={activeInvite.qr_code_data_url}
|
||||||
|
alt={t('events.recap.qrAlt', 'QR-Code zur Gäste-Galerie')}
|
||||||
|
style={{ width: 120, height: 120 }}
|
||||||
|
/>
|
||||||
|
</YStack>
|
||||||
|
<CTAButton
|
||||||
|
label={t('events.recap.qrDownload', 'QR-Code herunterladen')}
|
||||||
|
tone="ghost"
|
||||||
|
onPress={() => downloadQr(activeInvite.qr_code_data_url!)}
|
||||||
|
/>
|
||||||
</YStack>
|
</YStack>
|
||||||
<CTAButton label={t('events.recap.downloadQr', 'QR herunterladen')} tone="ghost" onPress={() => downloadQr(activeInvite.qr_code_data_url!)} />
|
) : null}
|
||||||
</YStack>
|
</MobileCard>
|
||||||
) : null}
|
|
||||||
</MobileCard>
|
|
||||||
|
|
||||||
{/* Settings */}
|
<MobileCard space="$3">
|
||||||
<MobileCard space="$3">
|
<XStack alignItems="center" space="$2">
|
||||||
<XStack alignItems="center" space="$2">
|
<Users size={18} color={primary} />
|
||||||
<Users size={18} color={primary} />
|
<Text fontSize="$md" fontWeight="800" color={textStrong}>
|
||||||
<Text fontSize="$md" fontWeight="800" color={textStrong}>
|
{t('events.recap.settings', 'Nachlauf-Optionen')}
|
||||||
{t('events.recap.settings', 'Nachlauf-Optionen')}
|
</Text>
|
||||||
</Text>
|
</XStack>
|
||||||
</XStack>
|
|
||||||
|
|
||||||
<YStack space="$1.5">
|
<YStack space="$1.5">
|
||||||
<ToggleOption
|
<ToggleOption
|
||||||
label={t('events.recap.allowDownloads', 'Gäste dürfen Fotos laden')}
|
label={t('events.recap.allowDownloads', 'Gäste dürfen Fotos laden')}
|
||||||
value={Boolean(event.settings?.guest_downloads_enabled)}
|
value={Boolean(event.settings?.guest_downloads_enabled)}
|
||||||
onToggle={(value) => updateSetting(event, setEvent, slug, 'guest_downloads_enabled', value, setError, t as any)}
|
onToggle={(value) => updateSetting(event, setEvent, slug, 'guest_downloads_enabled', value, setError, t as any)}
|
||||||
/>
|
|
||||||
<ToggleOption
|
|
||||||
label={t('events.recap.allowSharing', 'Gäste dürfen Fotos teilen')}
|
|
||||||
value={Boolean(event.settings?.guest_sharing_enabled)}
|
|
||||||
onToggle={(value) => updateSetting(event, setEvent, slug, 'guest_sharing_enabled', value, setError, t as any)}
|
|
||||||
/>
|
|
||||||
</YStack>
|
|
||||||
</MobileCard>
|
|
||||||
|
|
||||||
{/* Extensions */}
|
|
||||||
<MobileCard space="$3">
|
|
||||||
<XStack alignItems="center" space="$2">
|
|
||||||
<Sparkles size={18} color={primary} />
|
|
||||||
<Text fontSize="$md" fontWeight="800" color={textStrong}>
|
|
||||||
{t('events.recap.addons', 'Galerie verlängern')}
|
|
||||||
</Text>
|
|
||||||
</XStack>
|
|
||||||
<Text fontSize="$sm" color={text}>
|
|
||||||
{t('events.recap.addonBody', 'Die Online-Zeit deiner Galerie neigt sich dem Ende? Hier kannst du sie verlängern.')}
|
|
||||||
</Text>
|
|
||||||
|
|
||||||
<YStack space="$2">
|
|
||||||
{addons
|
|
||||||
.filter((a) => a.key === 'gallery_extension')
|
|
||||||
.map((addon) => (
|
|
||||||
<CTAButton
|
|
||||||
key={addon.key}
|
|
||||||
label={t('events.recap.buyExtension', 'Galerie um 30 Tage verlängern')}
|
|
||||||
onPress={() => handleCheckout(addon.key)}
|
|
||||||
loading={busyScope === addon.key}
|
|
||||||
/>
|
/>
|
||||||
))}
|
<ToggleOption
|
||||||
|
label={t('events.recap.allowSharing', 'Gäste dürfen Fotos teilen')}
|
||||||
|
value={Boolean(event.settings?.guest_sharing_enabled)}
|
||||||
|
onToggle={(value) => updateSetting(event, setEvent, slug, 'guest_sharing_enabled', value, setError, t as any)}
|
||||||
|
/>
|
||||||
|
</YStack>
|
||||||
|
</MobileCard>
|
||||||
|
|
||||||
|
<MobileCard space="$3">
|
||||||
|
<XStack alignItems="center" space="$2">
|
||||||
|
<Sparkles size={18} color={primary} />
|
||||||
|
<Text fontSize="$md" fontWeight="800" color={textStrong}>
|
||||||
|
{t('events.recap.addons', 'Galerie verlängern')}
|
||||||
|
</Text>
|
||||||
|
</XStack>
|
||||||
|
<Text fontSize="$sm" color={text}>
|
||||||
|
{t('events.recap.addonBody', 'Die Online-Zeit deiner Galerie neigt sich dem Ende? Hier kannst du sie verlängern.')}
|
||||||
|
</Text>
|
||||||
|
|
||||||
|
<YStack space="$2">
|
||||||
|
{addons
|
||||||
|
.filter((a) => a.key === 'gallery_extension')
|
||||||
|
.map((addon) => (
|
||||||
|
<CTAButton
|
||||||
|
key={addon.key}
|
||||||
|
label={t('events.recap.buyExtension', 'Galerie um 30 Tage verlängern')}
|
||||||
|
onPress={() => handleCheckout(addon.key)}
|
||||||
|
loading={busyScope === addon.key}
|
||||||
|
/>
|
||||||
|
))}
|
||||||
|
</YStack>
|
||||||
|
</MobileCard>
|
||||||
</YStack>
|
</YStack>
|
||||||
</MobileCard>
|
) : null}
|
||||||
|
|
||||||
|
{activeTab === 'engagement' ? (
|
||||||
|
<YStack space="$4">
|
||||||
|
{engagementLoading ? (
|
||||||
|
<YStack space="$2">
|
||||||
|
<SkeletonCard height={140} />
|
||||||
|
<SkeletonCard height={180} />
|
||||||
|
<SkeletonCard height={180} />
|
||||||
|
</YStack>
|
||||||
|
) : engagementError ? (
|
||||||
|
<MobileCard>
|
||||||
|
<Text fontWeight="700" color={danger}>
|
||||||
|
{engagementError}
|
||||||
|
</Text>
|
||||||
|
</MobileCard>
|
||||||
|
) : !engagement ? (
|
||||||
|
<MobileCard>
|
||||||
|
<Text fontWeight="700" color={muted}>
|
||||||
|
{activeInvite
|
||||||
|
? t('events.recap.engagement.empty', 'No engagement data yet.')
|
||||||
|
: t('events.recap.engagement.noInvite', 'No active guest link available yet.')}
|
||||||
|
</Text>
|
||||||
|
</MobileCard>
|
||||||
|
) : (
|
||||||
|
<YStack space="$4">
|
||||||
|
<MobileCard space="$3">
|
||||||
|
<XStack alignItems="center" space="$2">
|
||||||
|
<TrendingUp size={18} color={primary} />
|
||||||
|
<Text fontSize="$md" fontWeight="800" color={textStrong}>
|
||||||
|
{t('events.recap.engagement.title', 'Guest engagement')}
|
||||||
|
</Text>
|
||||||
|
</XStack>
|
||||||
|
<Text fontSize="$sm" color={text}>
|
||||||
|
{t('events.recap.engagement.subtitle', 'Highlights, leaderboards, and milestones from your guests.')}
|
||||||
|
</Text>
|
||||||
|
<XStack flexWrap="wrap" gap="$2" marginTop="$1">
|
||||||
|
<Stat
|
||||||
|
label={t('events.recap.engagement.summary.photos', 'Photos')}
|
||||||
|
value={formatCount(engagement.summary.totalPhotos, locale)}
|
||||||
|
/>
|
||||||
|
<Stat
|
||||||
|
label={t('events.recap.engagement.summary.guests', 'Guests')}
|
||||||
|
value={formatCount(engagement.summary.uniqueGuests, locale)}
|
||||||
|
/>
|
||||||
|
<Stat
|
||||||
|
label={t('events.recap.engagement.summary.tasks', 'Tasks solved')}
|
||||||
|
value={formatCount(engagement.summary.tasksSolved, locale)}
|
||||||
|
/>
|
||||||
|
<Stat
|
||||||
|
label={t('events.recap.engagement.summary.likes', 'Likes')}
|
||||||
|
value={formatCount(engagement.summary.likesTotal, locale)}
|
||||||
|
/>
|
||||||
|
</XStack>
|
||||||
|
</MobileCard>
|
||||||
|
|
||||||
|
<MobileCard space="$3">
|
||||||
|
<XStack alignItems="center" space="$2">
|
||||||
|
<Trophy size={18} color={primary} />
|
||||||
|
<Text fontSize="$md" fontWeight="800" color={textStrong}>
|
||||||
|
{t('events.recap.engagement.leaderboards.uploadsTitle', 'Top contributors')}
|
||||||
|
</Text>
|
||||||
|
</XStack>
|
||||||
|
{engagement.leaderboards.uploads.length === 0 ? (
|
||||||
|
<Text fontSize="$sm" color={muted}>
|
||||||
|
{t('events.recap.engagement.leaderboards.uploadsEmpty', 'No uploads yet.')}
|
||||||
|
</Text>
|
||||||
|
) : (
|
||||||
|
<YStack space="$1.5" marginTop="$1">
|
||||||
|
{engagement.leaderboards.uploads.slice(0, 5).map((entry, index) => (
|
||||||
|
<LeaderboardRow
|
||||||
|
key={`${entry.guest}-${entry.photos}-${index}`}
|
||||||
|
rank={index + 1}
|
||||||
|
name={entry.guest || t('events.recap.engagement.guestFallback', 'Guest')}
|
||||||
|
value={`${formatCount(entry.photos, locale)} · ${formatCount(entry.likes, locale)} ${t('events.recap.engagement.likesLabel', 'Likes')}`}
|
||||||
|
/>
|
||||||
|
))}
|
||||||
|
</YStack>
|
||||||
|
)}
|
||||||
|
</MobileCard>
|
||||||
|
|
||||||
|
<MobileCard space="$3">
|
||||||
|
<XStack alignItems="center" space="$2">
|
||||||
|
<Heart size={18} color={primary} />
|
||||||
|
<Text fontSize="$md" fontWeight="800" color={textStrong}>
|
||||||
|
{t('events.recap.engagement.leaderboards.likesTitle', 'Most liked')}
|
||||||
|
</Text>
|
||||||
|
</XStack>
|
||||||
|
{engagement.leaderboards.likes.length === 0 ? (
|
||||||
|
<Text fontSize="$sm" color={muted}>
|
||||||
|
{t('events.recap.engagement.leaderboards.likesEmpty', 'No likes yet.')}
|
||||||
|
</Text>
|
||||||
|
) : (
|
||||||
|
<YStack space="$1.5" marginTop="$1">
|
||||||
|
{engagement.leaderboards.likes.slice(0, 5).map((entry, index) => (
|
||||||
|
<LeaderboardRow
|
||||||
|
key={`${entry.guest}-${entry.likes}-${index}`}
|
||||||
|
rank={index + 1}
|
||||||
|
name={entry.guest || t('events.recap.engagement.guestFallback', 'Guest')}
|
||||||
|
value={`${formatCount(entry.likes, locale)} ${t('events.recap.engagement.likesLabel', 'Likes')}`}
|
||||||
|
/>
|
||||||
|
))}
|
||||||
|
</YStack>
|
||||||
|
)}
|
||||||
|
</MobileCard>
|
||||||
|
|
||||||
|
<MobileCard space="$3">
|
||||||
|
<XStack alignItems="center" space="$2">
|
||||||
|
<Sparkles size={18} color={primary} />
|
||||||
|
<Text fontSize="$md" fontWeight="800" color={textStrong}>
|
||||||
|
{t('events.recap.engagement.highlightsTitle', 'Highlights')}
|
||||||
|
</Text>
|
||||||
|
</XStack>
|
||||||
|
<YStack space="$2" marginTop="$1">
|
||||||
|
<XStack space="$2" alignItems="center">
|
||||||
|
<YStack
|
||||||
|
width={72}
|
||||||
|
height={72}
|
||||||
|
borderRadius={12}
|
||||||
|
backgroundColor={border}
|
||||||
|
alignItems="center"
|
||||||
|
justifyContent="center"
|
||||||
|
overflow="hidden"
|
||||||
|
>
|
||||||
|
{engagement.highlights.topPhoto?.thumbnail ? (
|
||||||
|
<img
|
||||||
|
src={engagement.highlights.topPhoto.thumbnail}
|
||||||
|
alt={t('events.recap.engagement.topPhoto', 'Top photo')}
|
||||||
|
style={{ width: '100%', height: '100%', objectFit: 'cover' }}
|
||||||
|
/>
|
||||||
|
) : (
|
||||||
|
<ImageIcon size={24} color={muted} />
|
||||||
|
)}
|
||||||
|
</YStack>
|
||||||
|
<YStack flex={1}>
|
||||||
|
<Text fontSize="$sm" fontWeight="700" color={textStrong}>
|
||||||
|
{t('events.recap.engagement.topPhoto', 'Top photo')}
|
||||||
|
</Text>
|
||||||
|
<Text fontSize="$xs" color={muted}>
|
||||||
|
{engagement.highlights.topPhoto
|
||||||
|
? `${engagement.highlights.topPhoto.guest || t('events.recap.engagement.guestFallback', 'Guest')} · ${formatCount(engagement.highlights.topPhoto.likes, locale)} ${t('events.recap.engagement.likesLabel', 'Likes')}`
|
||||||
|
: t('events.recap.engagement.topPhotoEmpty', 'No photo highlights yet.')}
|
||||||
|
</Text>
|
||||||
|
</YStack>
|
||||||
|
</XStack>
|
||||||
|
|
||||||
|
<XStack alignItems="center" justifyContent="space-between">
|
||||||
|
<Text fontSize="$sm" fontWeight="600" color={textStrong}>
|
||||||
|
{t('events.recap.engagement.trendingEmotion', 'Trending emotion')}
|
||||||
|
</Text>
|
||||||
|
<Text fontSize="$sm" color={muted}>
|
||||||
|
{engagement.highlights.trendingEmotion
|
||||||
|
? `${engagement.highlights.trendingEmotion.name} · ${formatCount(engagement.highlights.trendingEmotion.count, locale)}`
|
||||||
|
: t('events.recap.engagement.trendingEmpty', 'No trends yet.')}
|
||||||
|
</Text>
|
||||||
|
</XStack>
|
||||||
|
|
||||||
|
<YStack space="$1">
|
||||||
|
<Text fontSize="$sm" fontWeight="600" color={textStrong}>
|
||||||
|
{t('events.recap.engagement.timeline', 'Uploads over time')}
|
||||||
|
</Text>
|
||||||
|
{engagement.highlights.timeline.length === 0 ? (
|
||||||
|
<Text fontSize="$xs" color={muted}>
|
||||||
|
{t('events.recap.engagement.timelineEmpty', 'No timeline data yet.')}
|
||||||
|
</Text>
|
||||||
|
) : (
|
||||||
|
<YStack space="$1">
|
||||||
|
{engagement.highlights.timeline.slice(-5).map((point) => (
|
||||||
|
<XStack key={point.date} alignItems="center" justifyContent="space-between">
|
||||||
|
<Text fontSize="$xs" color={muted}>
|
||||||
|
{formatShortDate(point.date, locale)}
|
||||||
|
</Text>
|
||||||
|
<Text fontSize="$xs" color={muted}>
|
||||||
|
{t('events.recap.engagement.timelineRow', '{{photos}} photos · {{guests}} guests', {
|
||||||
|
photos: formatCount(point.photos, locale),
|
||||||
|
guests: formatCount(point.guests, locale),
|
||||||
|
})}
|
||||||
|
</Text>
|
||||||
|
</XStack>
|
||||||
|
))}
|
||||||
|
</YStack>
|
||||||
|
)}
|
||||||
|
</YStack>
|
||||||
|
</YStack>
|
||||||
|
</MobileCard>
|
||||||
|
</YStack>
|
||||||
|
)}
|
||||||
|
</YStack>
|
||||||
|
) : null}
|
||||||
|
|
||||||
|
{activeTab === 'compliance' ? (
|
||||||
|
<YStack space="$4">
|
||||||
|
<DataExportsPanel variant="recap" event={event} />
|
||||||
|
</YStack>
|
||||||
|
) : null}
|
||||||
</YStack>
|
</YStack>
|
||||||
|
|
||||||
<LegalConsentSheet
|
<LegalConsentSheet
|
||||||
@@ -323,6 +609,67 @@ function ToggleOption({ label, value, onToggle }: { label: string; value: boolea
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function TabButton({ label, active, onPress }: { label: string; active: boolean; onPress: () => void }) {
|
||||||
|
const { primary, surfaceMuted, border, surface, textStrong } = useAdminTheme();
|
||||||
|
return (
|
||||||
|
<Pressable onPress={onPress} style={{ flex: 1 }}>
|
||||||
|
<XStack
|
||||||
|
alignItems="center"
|
||||||
|
justifyContent="center"
|
||||||
|
paddingVertical="$2.5"
|
||||||
|
borderRadius={12}
|
||||||
|
backgroundColor={active ? primary : surfaceMuted}
|
||||||
|
borderWidth={1}
|
||||||
|
borderColor={active ? primary : border}
|
||||||
|
>
|
||||||
|
<Text fontSize="$sm" color={active ? surface : textStrong} fontWeight="700">
|
||||||
|
{label}
|
||||||
|
</Text>
|
||||||
|
</XStack>
|
||||||
|
</Pressable>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function LeaderboardRow({ rank, name, value }: { rank: number; name: string; value: string }) {
|
||||||
|
const { textStrong, muted, border, surfaceMuted } = useAdminTheme();
|
||||||
|
return (
|
||||||
|
<XStack
|
||||||
|
alignItems="center"
|
||||||
|
justifyContent="space-between"
|
||||||
|
paddingHorizontal="$2.5"
|
||||||
|
paddingVertical="$2"
|
||||||
|
borderRadius={12}
|
||||||
|
borderWidth={1}
|
||||||
|
borderColor={border}
|
||||||
|
backgroundColor={surfaceMuted}
|
||||||
|
>
|
||||||
|
<XStack alignItems="center" space="$2">
|
||||||
|
<Text fontSize="$xs" color={muted} fontWeight="700">
|
||||||
|
#{rank}
|
||||||
|
</Text>
|
||||||
|
<Text fontSize="$sm" color={textStrong} fontWeight="600">
|
||||||
|
{name}
|
||||||
|
</Text>
|
||||||
|
</XStack>
|
||||||
|
<Text fontSize="$xs" color={muted}>
|
||||||
|
{value}
|
||||||
|
</Text>
|
||||||
|
</XStack>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function formatCount(value: number, locale?: string): string {
|
||||||
|
const normalized = Number.isFinite(value) ? value : 0;
|
||||||
|
return new Intl.NumberFormat(locale, { maximumFractionDigits: 0 }).format(normalized);
|
||||||
|
}
|
||||||
|
|
||||||
|
function formatShortDate(iso: string, locale?: string): string {
|
||||||
|
if (!iso) return '';
|
||||||
|
const date = new Date(iso);
|
||||||
|
if (Number.isNaN(date.getTime())) return '';
|
||||||
|
return new Intl.DateTimeFormat(locale, { month: 'short', day: 'numeric' }).format(date);
|
||||||
|
}
|
||||||
|
|
||||||
async function updateSetting(
|
async function updateSetting(
|
||||||
event: TenantEvent,
|
event: TenantEvent,
|
||||||
setEvent: (event: TenantEvent) => void,
|
setEvent: (event: TenantEvent) => void,
|
||||||
@@ -384,9 +731,9 @@ function resolveName(name: TenantEvent['name']): string {
|
|||||||
return 'Event';
|
return 'Event';
|
||||||
}
|
}
|
||||||
|
|
||||||
function formatDate(iso?: string | null): string {
|
function formatDate(iso?: string | null, locale?: string): string {
|
||||||
if (!iso) return '';
|
if (!iso) return '';
|
||||||
const date = new Date(iso);
|
const date = new Date(iso);
|
||||||
if (Number.isNaN(date.getTime())) return '';
|
if (Number.isNaN(date.getTime())) return '';
|
||||||
return date.toLocaleDateString(undefined, { day: '2-digit', month: 'short', year: 'numeric' });
|
return date.toLocaleDateString(locale, { day: '2-digit', month: 'short', year: 'numeric' });
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ export default function MobileEventsPage() {
|
|||||||
setEvents(await getEvents());
|
setEvents(await getEvents());
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
if (!isAuthError(err)) {
|
if (!isAuthError(err)) {
|
||||||
setError(getApiErrorMessage(err, t('events.errors.loadFailed', 'Event konnte nicht geladen werden.')));
|
setError(getApiErrorMessage(err, t('events.errors.loadFailed')));
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
@@ -52,10 +52,13 @@ export default function MobileEventsPage() {
|
|||||||
return (
|
return (
|
||||||
<MobileShell
|
<MobileShell
|
||||||
activeTab="home"
|
activeTab="home"
|
||||||
title={t('events.list.dashboardTitle', 'All Events Dashboard')}
|
title={t('events.list.title')}
|
||||||
onBack={back}
|
onBack={back}
|
||||||
headerActions={
|
headerActions={
|
||||||
<HeaderActionButton onPress={() => searchRef.current?.focus()} ariaLabel={t('events.list.search', 'Search events')}>
|
<HeaderActionButton
|
||||||
|
onPress={() => searchRef.current?.focus()}
|
||||||
|
ariaLabel={t('events.detail.pickEvent')}
|
||||||
|
>
|
||||||
<Search size={18} color={text} />
|
<Search size={18} color={text} />
|
||||||
</HeaderActionButton>
|
</HeaderActionButton>
|
||||||
}
|
}
|
||||||
@@ -100,7 +103,7 @@ export default function MobileEventsPage() {
|
|||||||
backgroundColor={surfaceMuted}
|
backgroundColor={surfaceMuted}
|
||||||
>
|
>
|
||||||
<Text fontSize="$xs" fontWeight="800" color={text}>
|
<Text fontSize="$xs" fontWeight="800" color={text}>
|
||||||
{t('events.list.filters.title', 'Filters & Search')}
|
{t('events.list.overview.title')}
|
||||||
</Text>
|
</Text>
|
||||||
</XStack>
|
</XStack>
|
||||||
<MobileInput
|
<MobileInput
|
||||||
@@ -108,11 +111,11 @@ export default function MobileEventsPage() {
|
|||||||
type="search"
|
type="search"
|
||||||
value={query}
|
value={query}
|
||||||
onChange={(e) => setQuery(e.target.value)}
|
onChange={(e) => setQuery(e.target.value)}
|
||||||
placeholder={t('events.list.search', 'Search events')}
|
placeholder={t('events.detail.pickEvent')}
|
||||||
compact
|
compact
|
||||||
/>
|
/>
|
||||||
<Text fontSize="$xs" color={muted}>
|
<Text fontSize="$xs" color={muted}>
|
||||||
{t('events.list.filters.hint', 'Filter your events by status or search by name.')}
|
{t('events.list.subtitle')}
|
||||||
</Text>
|
</Text>
|
||||||
</YStack>
|
</YStack>
|
||||||
</Card>
|
</Card>
|
||||||
@@ -137,13 +140,16 @@ export default function MobileEventsPage() {
|
|||||||
>
|
>
|
||||||
<YStack space="$2" alignItems="center">
|
<YStack space="$2" alignItems="center">
|
||||||
<Text fontSize="$md" fontWeight="700">
|
<Text fontSize="$md" fontWeight="700">
|
||||||
{t('events.list.empty.title', 'Noch kein Event angelegt')}
|
{t('events.list.title')}
|
||||||
</Text>
|
</Text>
|
||||||
<Text fontSize="$sm" color={muted} textAlign="center">
|
<Text fontSize="$sm" color={muted} textAlign="center">
|
||||||
{t('events.list.empty.description', 'Starte jetzt mit deinem ersten Event.')}
|
{t('events.list.overview.empty')}
|
||||||
</Text>
|
</Text>
|
||||||
{!isMember ? (
|
{!isMember ? (
|
||||||
<CTAButton label={t('events.actions.create', 'Create New Event')} onPress={() => navigate(adminPath('/events/new'))} />
|
<CTAButton
|
||||||
|
label={t('events.list.actions.create')}
|
||||||
|
onPress={() => navigate(adminPath('/events/new'))}
|
||||||
|
/>
|
||||||
) : null}
|
) : null}
|
||||||
</YStack>
|
</YStack>
|
||||||
</Card>
|
</Card>
|
||||||
@@ -160,7 +166,7 @@ export default function MobileEventsPage() {
|
|||||||
|
|
||||||
{!isMember ? (
|
{!isMember ? (
|
||||||
<FloatingActionButton
|
<FloatingActionButton
|
||||||
label={t('events.actions.create', 'Create New Event')}
|
label={t('events.list.actions.create')}
|
||||||
icon={Plus}
|
icon={Plus}
|
||||||
onPress={() => navigate(adminPath('/mobile/events/new'))}
|
onPress={() => navigate(adminPath('/mobile/events/new'))}
|
||||||
/>
|
/>
|
||||||
@@ -204,10 +210,10 @@ function EventsList({
|
|||||||
}, [filteredByStatus, query]);
|
}, [filteredByStatus, query]);
|
||||||
|
|
||||||
const filters: Array<{ key: EventStatusKey; label: string; count: number }> = [
|
const filters: Array<{ key: EventStatusKey; label: string; count: number }> = [
|
||||||
{ key: 'all', label: t('events.list.filters.all', 'All'), count: statusCounts.all },
|
{ key: 'all', label: t('events.list.filters.all'), count: statusCounts.all },
|
||||||
{ key: 'upcoming', label: t('events.list.filters.upcoming', 'Upcoming'), count: statusCounts.upcoming },
|
{ key: 'upcoming', label: t('events.list.filters.upcoming'), count: statusCounts.upcoming },
|
||||||
{ key: 'draft', label: t('events.list.filters.draft', 'Draft'), count: statusCounts.draft },
|
{ key: 'draft', label: t('events.list.filters.draft'), count: statusCounts.draft },
|
||||||
{ key: 'past', label: t('events.list.filters.past', 'Past'), count: statusCounts.past },
|
{ key: 'past', label: t('events.list.filters.past'), count: statusCounts.past },
|
||||||
];
|
];
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -234,7 +240,7 @@ function EventsList({
|
|||||||
backgroundColor={surfaceMuted}
|
backgroundColor={surfaceMuted}
|
||||||
>
|
>
|
||||||
<Text fontSize="$xs" fontWeight="800" color={text}>
|
<Text fontSize="$xs" fontWeight="800" color={text}>
|
||||||
{t('events.list.filters.status', 'Status')}
|
{t('events.workspace.fields.status')}
|
||||||
</Text>
|
</Text>
|
||||||
</XStack>
|
</XStack>
|
||||||
<ScrollView horizontal showsHorizontalScrollIndicator={false}>
|
<ScrollView horizontal showsHorizontalScrollIndicator={false}>
|
||||||
@@ -286,13 +292,13 @@ function EventsList({
|
|||||||
>
|
>
|
||||||
<YStack space="$2" alignItems="center">
|
<YStack space="$2" alignItems="center">
|
||||||
<Text fontSize="$sm" fontWeight="700" color={text}>
|
<Text fontSize="$sm" fontWeight="700" color={text}>
|
||||||
{t('events.list.empty.filtered', 'No events match this filter.')}
|
{t('events.list.empty.filtered')}
|
||||||
</Text>
|
</Text>
|
||||||
<Text fontSize="$xs" color={muted} textAlign="center">
|
<Text fontSize="$xs" color={muted} textAlign="center">
|
||||||
{t('events.list.empty.filteredHint', 'Try a different status or clear your search.')}
|
{t('events.list.empty.filteredHint')}
|
||||||
</Text>
|
</Text>
|
||||||
<CTAButton
|
<CTAButton
|
||||||
label={t('events.list.filters.all', 'All')}
|
label={t('events.list.filters.all')}
|
||||||
tone="ghost"
|
tone="ghost"
|
||||||
fullWidth={false}
|
fullWidth={false}
|
||||||
onPress={() => onStatusChange('all')}
|
onPress={() => onStatusChange('all')}
|
||||||
@@ -304,10 +310,10 @@ function EventsList({
|
|||||||
const statusKey = resolveEventStatusKey(event);
|
const statusKey = resolveEventStatusKey(event);
|
||||||
const statusLabel =
|
const statusLabel =
|
||||||
statusKey === 'draft'
|
statusKey === 'draft'
|
||||||
? t('events.list.filters.draft', 'Draft')
|
? t('events.list.filters.draft')
|
||||||
: statusKey === 'past'
|
: statusKey === 'past'
|
||||||
? t('events.list.filters.past', 'Past')
|
? t('events.list.filters.past')
|
||||||
: t('events.list.filters.upcoming', 'Upcoming');
|
: t('events.list.filters.upcoming');
|
||||||
const statusTone = statusKey === 'draft' ? 'warning' : statusKey === 'past' ? 'muted' : 'success';
|
const statusTone = statusKey === 'draft' ? 'warning' : statusKey === 'past' ? 'muted' : 'success';
|
||||||
return (
|
return (
|
||||||
<EventRow
|
<EventRow
|
||||||
@@ -359,7 +365,8 @@ function EventRow({
|
|||||||
onOpen: (slug: string) => void;
|
onOpen: (slug: string) => void;
|
||||||
onEdit?: (slug: string) => void;
|
onEdit?: (slug: string) => void;
|
||||||
}) {
|
}) {
|
||||||
const { t } = useTranslation('management');
|
const { t, i18n } = useTranslation('management');
|
||||||
|
const locale = i18n.language;
|
||||||
const stats = buildEventListStats(event);
|
const stats = buildEventListStats(event);
|
||||||
return (
|
return (
|
||||||
<Card
|
<Card
|
||||||
@@ -377,18 +384,18 @@ function EventRow({
|
|||||||
<XStack justifyContent="space-between" alignItems="flex-start" space="$2">
|
<XStack justifyContent="space-between" alignItems="flex-start" space="$2">
|
||||||
<YStack space="$1">
|
<YStack space="$1">
|
||||||
<Text fontSize="$md" fontWeight="800" color={text}>
|
<Text fontSize="$md" fontWeight="800" color={text}>
|
||||||
{renderName(event.name)}
|
{renderName(event.name, t)}
|
||||||
</Text>
|
</Text>
|
||||||
<XStack alignItems="center" space="$2">
|
<XStack alignItems="center" space="$2">
|
||||||
<CalendarDays size={14} color={subtle} />
|
<CalendarDays size={14} color={subtle} />
|
||||||
<Text fontSize="$sm" color={muted}>
|
<Text fontSize="$sm" color={muted}>
|
||||||
{formatDate(event.event_date)}
|
{formatDate(event.event_date, t, locale)}
|
||||||
</Text>
|
</Text>
|
||||||
</XStack>
|
</XStack>
|
||||||
<XStack alignItems="center" space="$2">
|
<XStack alignItems="center" space="$2">
|
||||||
<MapPin size={14} color={subtle} />
|
<MapPin size={14} color={subtle} />
|
||||||
<Text fontSize="$sm" color={muted}>
|
<Text fontSize="$sm" color={muted}>
|
||||||
{resolveLocation(event)}
|
{resolveLocation(event, t)}
|
||||||
</Text>
|
</Text>
|
||||||
</XStack>
|
</XStack>
|
||||||
<PillBadge tone={statusTone}>{statusLabel}</PillBadge>
|
<PillBadge tone={statusTone}>{statusLabel}</PillBadge>
|
||||||
@@ -405,19 +412,19 @@ function EventRow({
|
|||||||
<XStack alignItems="center" space="$2" flexWrap="wrap">
|
<XStack alignItems="center" space="$2" flexWrap="wrap">
|
||||||
<EventStatChip
|
<EventStatChip
|
||||||
icon={Camera}
|
icon={Camera}
|
||||||
label={t('events.list.stats.photos', 'Photos')}
|
label={t('events.list.stats.photos')}
|
||||||
value={stats.photos}
|
value={stats.photos}
|
||||||
muted={subtle}
|
muted={subtle}
|
||||||
/>
|
/>
|
||||||
<EventStatChip
|
<EventStatChip
|
||||||
icon={Users}
|
icon={Users}
|
||||||
label={t('events.list.stats.guests', 'Guests')}
|
label={t('events.list.stats.guests')}
|
||||||
value={stats.guests}
|
value={stats.guests}
|
||||||
muted={subtle}
|
muted={subtle}
|
||||||
/>
|
/>
|
||||||
<EventStatChip
|
<EventStatChip
|
||||||
icon={Sparkles}
|
icon={Sparkles}
|
||||||
label={t('events.list.stats.tasks', 'Tasks')}
|
label={t('events.list.stats.tasks')}
|
||||||
value={stats.tasks}
|
value={stats.tasks}
|
||||||
muted={subtle}
|
muted={subtle}
|
||||||
/>
|
/>
|
||||||
@@ -429,7 +436,7 @@ function EventRow({
|
|||||||
<XStack alignItems="center" justifyContent="flex-start" space="$2">
|
<XStack alignItems="center" justifyContent="flex-start" space="$2">
|
||||||
<Plus size={16} color={primary} />
|
<Plus size={16} color={primary} />
|
||||||
<Text fontSize="$sm" color={primary} fontWeight="700">
|
<Text fontSize="$sm" color={primary} fontWeight="700">
|
||||||
{t('events.list.actions.open', 'Open event')}
|
{t('events.list.actions.open')}
|
||||||
</Text>
|
</Text>
|
||||||
</XStack>
|
</XStack>
|
||||||
</Pressable>
|
</Pressable>
|
||||||
@@ -459,15 +466,15 @@ function EventStatChip({
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function renderName(name: TenantEvent['name']): string {
|
function renderName(name: TenantEvent['name'], t: (key: string) => string): string {
|
||||||
if (typeof name === 'string') return name;
|
if (typeof name === 'string') return name;
|
||||||
if (name && typeof name === 'object') {
|
if (name && typeof name === 'object') {
|
||||||
return name.de ?? name.en ?? Object.values(name)[0] ?? 'Unbenanntes Event';
|
return name.de ?? name.en ?? Object.values(name)[0] ?? t('events.placeholders.untitled');
|
||||||
}
|
}
|
||||||
return 'Unbenanntes Event';
|
return t('events.placeholders.untitled');
|
||||||
}
|
}
|
||||||
|
|
||||||
function resolveLocation(event: TenantEvent): string {
|
function resolveLocation(event: TenantEvent, t: (key: string) => string): string {
|
||||||
const settings = (event.settings ?? {}) as Record<string, unknown>;
|
const settings = (event.settings ?? {}) as Record<string, unknown>;
|
||||||
const candidate =
|
const candidate =
|
||||||
(settings.location as string | undefined) ??
|
(settings.location as string | undefined) ??
|
||||||
@@ -476,14 +483,15 @@ function resolveLocation(event: TenantEvent): string {
|
|||||||
if (candidate && candidate.trim()) {
|
if (candidate && candidate.trim()) {
|
||||||
return candidate;
|
return candidate;
|
||||||
}
|
}
|
||||||
return 'Location';
|
return t('events.detail.locationPlaceholder');
|
||||||
}
|
}
|
||||||
|
|
||||||
function formatDate(iso: string | null): string {
|
function formatDate(iso: string | null, t: (key: string) => string, locale?: string): string {
|
||||||
if (!iso) return 'Date tbd';
|
const fallback = t('events.detail.dateTbd');
|
||||||
|
if (!iso) return fallback;
|
||||||
const date = new Date(iso);
|
const date = new Date(iso);
|
||||||
if (Number.isNaN(date.getTime())) {
|
if (Number.isNaN(date.getTime())) {
|
||||||
return 'Date tbd';
|
return fallback;
|
||||||
}
|
}
|
||||||
return date.toLocaleDateString(undefined, { month: 'short', day: 'numeric', year: 'numeric' });
|
return date.toLocaleDateString(locale || undefined, { month: 'short', day: 'numeric', year: 'numeric' });
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import { MobileCard, CTAButton, PillBadge, SkeletonCard } from './components/Pri
|
|||||||
import { useAdminTheme } from './theme';
|
import { useAdminTheme } from './theme';
|
||||||
import { getPackages, Package, getTenantPackagesOverview, TenantPackageSummary } from '../api';
|
import { getPackages, Package, getTenantPackagesOverview, TenantPackageSummary } from '../api';
|
||||||
import { useQuery } from '@tanstack/react-query';
|
import { useQuery } from '@tanstack/react-query';
|
||||||
|
import { adminPath } from '../constants';
|
||||||
import {
|
import {
|
||||||
buildPackageComparisonRows,
|
buildPackageComparisonRows,
|
||||||
classifyPackageChange,
|
classifyPackageChange,
|
||||||
@@ -170,6 +171,7 @@ export default function MobilePackageShopPage() {
|
|||||||
<PackageShopCompareView
|
<PackageShopCompareView
|
||||||
entries={packageEntries}
|
entries={packageEntries}
|
||||||
onSelect={(pkg) => setSelectedPackage(pkg)}
|
onSelect={(pkg) => setSelectedPackage(pkg)}
|
||||||
|
onManage={() => navigate(adminPath('/mobile/billing#packages'))}
|
||||||
catalogType={catalogType}
|
catalogType={catalogType}
|
||||||
/>
|
/>
|
||||||
) : (
|
) : (
|
||||||
@@ -184,6 +186,7 @@ export default function MobilePackageShopPage() {
|
|||||||
isDowngrade={entry.isDowngrade}
|
isDowngrade={entry.isDowngrade}
|
||||||
catalogType={catalogType}
|
catalogType={catalogType}
|
||||||
onSelect={() => setSelectedPackage(entry.pkg)}
|
onSelect={() => setSelectedPackage(entry.pkg)}
|
||||||
|
onManage={() => navigate(adminPath('/mobile/billing#packages'))}
|
||||||
/>
|
/>
|
||||||
))
|
))
|
||||||
)}
|
)}
|
||||||
@@ -201,7 +204,8 @@ function PackageShopCard({
|
|||||||
isUpgrade,
|
isUpgrade,
|
||||||
isDowngrade,
|
isDowngrade,
|
||||||
catalogType,
|
catalogType,
|
||||||
onSelect
|
onSelect,
|
||||||
|
onManage,
|
||||||
}: {
|
}: {
|
||||||
pkg: Package;
|
pkg: Package;
|
||||||
owned?: TenantPackageSummary;
|
owned?: TenantPackageSummary;
|
||||||
@@ -210,7 +214,8 @@ function PackageShopCard({
|
|||||||
isUpgrade?: boolean;
|
isUpgrade?: boolean;
|
||||||
isDowngrade?: boolean;
|
isDowngrade?: boolean;
|
||||||
catalogType: 'endcustomer' | 'reseller';
|
catalogType: 'endcustomer' | 'reseller';
|
||||||
onSelect: () => void
|
onSelect: () => void;
|
||||||
|
onManage?: () => void;
|
||||||
}) {
|
}) {
|
||||||
const { textStrong, muted, border, primary, accentSoft } = useAdminTheme();
|
const { textStrong, muted, border, primary, accentSoft } = useAdminTheme();
|
||||||
const { t } = useTranslation('management');
|
const { t } = useTranslation('management');
|
||||||
@@ -219,15 +224,17 @@ function PackageShopCard({
|
|||||||
const statusLabel = getPackageStatusLabel({ t, isActive, owned });
|
const statusLabel = getPackageStatusLabel({ t, isActive, owned });
|
||||||
const isSubdued = Boolean(!isResellerCatalog && (isDowngrade || !isUpgrade) && !isActive);
|
const isSubdued = Boolean(!isResellerCatalog && (isDowngrade || !isUpgrade) && !isActive);
|
||||||
const canSelect = isResellerCatalog ? Boolean(pkg.paddle_price_id) : canSelectPackage(isUpgrade, isActive);
|
const canSelect = isResellerCatalog ? Boolean(pkg.paddle_price_id) : canSelectPackage(isUpgrade, isActive);
|
||||||
|
const hasManageAction = Boolean(isActive && onManage);
|
||||||
const includedTierLabel = resolveIncludedTierLabel(t, pkg.included_package_slug ?? null);
|
const includedTierLabel = resolveIncludedTierLabel(t, pkg.included_package_slug ?? null);
|
||||||
|
const handlePress = isActive ? onManage : canSelect ? onSelect : undefined;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<MobileCard
|
<MobileCard
|
||||||
onPress={canSelect ? onSelect : undefined}
|
onPress={handlePress}
|
||||||
borderColor={isRecommended ? primary : (isActive ? '$green8' : border)}
|
borderColor={isRecommended ? primary : (isActive ? '$green8' : border)}
|
||||||
borderWidth={isRecommended || isActive ? 2 : 1}
|
borderWidth={isRecommended || isActive ? 2 : 1}
|
||||||
space="$3"
|
space="$3"
|
||||||
pressStyle={canSelect ? { backgroundColor: accentSoft } : undefined}
|
pressStyle={handlePress ? { backgroundColor: accentSoft } : undefined}
|
||||||
backgroundColor={isActive ? '$green1' : undefined}
|
backgroundColor={isActive ? '$green1' : undefined}
|
||||||
style={{ opacity: isSubdued ? 0.6 : 1 }}
|
style={{ opacity: isSubdued ? 0.6 : 1 }}
|
||||||
>
|
>
|
||||||
@@ -314,9 +321,9 @@ function PackageShopCard({
|
|||||||
? t('shop.select', 'Select')
|
? t('shop.select', 'Select')
|
||||||
: t('shop.selectDisabled', 'Not available')
|
: t('shop.selectDisabled', 'Not available')
|
||||||
}
|
}
|
||||||
onPress={canSelect ? onSelect : undefined}
|
onPress={handlePress}
|
||||||
tone={isResellerCatalog ? (canSelect ? 'primary' : 'ghost') : isActive || !isUpgrade ? 'ghost' : 'primary'}
|
tone={isResellerCatalog ? (canSelect ? 'primary' : 'ghost') : isActive || !isUpgrade ? 'ghost' : 'primary'}
|
||||||
disabled={!canSelect}
|
disabled={!canSelect && !hasManageAction}
|
||||||
/>
|
/>
|
||||||
</MobileCard>
|
</MobileCard>
|
||||||
);
|
);
|
||||||
@@ -344,10 +351,12 @@ type PackageEntry = {
|
|||||||
function PackageShopCompareView({
|
function PackageShopCompareView({
|
||||||
entries,
|
entries,
|
||||||
onSelect,
|
onSelect,
|
||||||
|
onManage,
|
||||||
catalogType,
|
catalogType,
|
||||||
}: {
|
}: {
|
||||||
entries: PackageEntry[];
|
entries: PackageEntry[];
|
||||||
onSelect: (pkg: Package) => void;
|
onSelect: (pkg: Package) => void;
|
||||||
|
onManage: () => void;
|
||||||
catalogType: 'endcustomer' | 'reseller';
|
catalogType: 'endcustomer' | 'reseller';
|
||||||
}) {
|
}) {
|
||||||
const { t } = useTranslation('management');
|
const { t } = useTranslation('management');
|
||||||
@@ -520,13 +529,14 @@ function PackageShopCompareView({
|
|||||||
: entry.isUpgrade
|
: entry.isUpgrade
|
||||||
? t('shop.select', 'Select')
|
? t('shop.select', 'Select')
|
||||||
: t('shop.selectDisabled', 'Not available');
|
: t('shop.selectDisabled', 'Not available');
|
||||||
|
const handlePress = entry.isActive ? onManage : canSelect ? () => onSelect(entry.pkg) : undefined;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<YStack key={`cta-${entry.pkg.id}`} width={columnWidth} paddingHorizontal="$2">
|
<YStack key={`cta-${entry.pkg.id}`} width={columnWidth} paddingHorizontal="$2">
|
||||||
<CTAButton
|
<CTAButton
|
||||||
label={label}
|
label={label}
|
||||||
onPress={canSelect ? () => onSelect(entry.pkg) : undefined}
|
onPress={handlePress}
|
||||||
disabled={!canSelect}
|
disabled={!canSelect && !entry.isActive}
|
||||||
tone={
|
tone={
|
||||||
catalogType === 'reseller'
|
catalogType === 'reseller'
|
||||||
? canSelect
|
? canSelect
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { afterEach, describe, expect, it, vi } from 'vitest';
|
import { afterEach, describe, expect, it, vi } from 'vitest';
|
||||||
import { render, screen } from '@testing-library/react';
|
import { render, screen, waitFor } from '@testing-library/react';
|
||||||
|
import { ADMIN_EVENTS_PATH } from '../../constants';
|
||||||
|
|
||||||
const fixtures = vi.hoisted(() => ({
|
const fixtures = vi.hoisted(() => ({
|
||||||
event: {
|
event: {
|
||||||
@@ -41,6 +42,9 @@ const authState = {
|
|||||||
status: 'authenticated',
|
status: 'authenticated',
|
||||||
user: { role: 'tenant_admin' },
|
user: { role: 'tenant_admin' },
|
||||||
};
|
};
|
||||||
|
const paramsState = {
|
||||||
|
slug: fixtures.event.slug as string | undefined,
|
||||||
|
};
|
||||||
const eventContext = {
|
const eventContext = {
|
||||||
events: [fixtures.event],
|
events: [fixtures.event],
|
||||||
activeEvent: fixtures.event,
|
activeEvent: fixtures.event,
|
||||||
@@ -52,7 +56,7 @@ const eventContext = {
|
|||||||
vi.mock('react-router-dom', () => ({
|
vi.mock('react-router-dom', () => ({
|
||||||
useNavigate: () => navigateMock,
|
useNavigate: () => navigateMock,
|
||||||
useLocation: () => ({ search: '', pathname: '/event-admin/mobile/dashboard' }),
|
useLocation: () => ({ search: '', pathname: '/event-admin/mobile/dashboard' }),
|
||||||
useParams: () => ({ slug: fixtures.event.slug }),
|
useParams: () => paramsState,
|
||||||
}));
|
}));
|
||||||
|
|
||||||
vi.mock('react-i18next', () => ({
|
vi.mock('react-i18next', () => ({
|
||||||
@@ -143,6 +147,13 @@ vi.mock('../components/Sheet', () => ({
|
|||||||
vi.mock('../components/Primitives', () => ({
|
vi.mock('../components/Primitives', () => ({
|
||||||
MobileCard: ({ children }: { children: React.ReactNode }) => <div>{children}</div>,
|
MobileCard: ({ children }: { children: React.ReactNode }) => <div>{children}</div>,
|
||||||
CTAButton: ({ label }: { label: string }) => <button type="button">{label}</button>,
|
CTAButton: ({ label }: { label: string }) => <button type="button">{label}</button>,
|
||||||
|
KpiStrip: ({ items }: { items: Array<{ label: string; value: string | number }> }) => (
|
||||||
|
<div>
|
||||||
|
{items.map((item) => (
|
||||||
|
<span key={item.label}>{item.label}</span>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
),
|
||||||
KpiTile: ({ label, value }: { label: string; value: string | number }) => (
|
KpiTile: ({ label, value }: { label: string; value: string | number }) => (
|
||||||
<div>
|
<div>
|
||||||
<span>{label}</span>
|
<span>{label}</span>
|
||||||
@@ -244,6 +255,7 @@ describe('MobileDashboardPage', () => {
|
|||||||
eventContext.activeEvent = fixtures.event;
|
eventContext.activeEvent = fixtures.event;
|
||||||
eventContext.hasEvents = true;
|
eventContext.hasEvents = true;
|
||||||
eventContext.hasMultipleEvents = false;
|
eventContext.hasMultipleEvents = false;
|
||||||
|
paramsState.slug = fixtures.event.slug;
|
||||||
|
|
||||||
fixtures.activePackage.package_type = 'reseller';
|
fixtures.activePackage.package_type = 'reseller';
|
||||||
fixtures.activePackage.remaining_events = 3;
|
fixtures.activePackage.remaining_events = 3;
|
||||||
@@ -253,19 +265,27 @@ describe('MobileDashboardPage', () => {
|
|||||||
window.sessionStorage.clear();
|
window.sessionStorage.clear();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('shows a tasks setup nudge and prompt when no tasks are assigned', () => {
|
it('redirects to the event selector when no event is active', async () => {
|
||||||
|
eventContext.activeEvent = null as unknown as typeof fixtures.event;
|
||||||
|
eventContext.events = [fixtures.event];
|
||||||
|
eventContext.hasEvents = true;
|
||||||
|
paramsState.slug = undefined;
|
||||||
|
|
||||||
|
render(<MobileDashboardPage />);
|
||||||
|
|
||||||
|
await waitFor(() => {
|
||||||
|
expect(navigateMock).toHaveBeenCalledWith(ADMIN_EVENTS_PATH, { replace: true });
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('shows the next-step CTA when tasks are missing', () => {
|
||||||
fixtures.event.tasks_count = 0;
|
fixtures.event.tasks_count = 0;
|
||||||
fixtures.event.engagement_mode = 'tasks';
|
fixtures.event.engagement_mode = 'tasks';
|
||||||
window.sessionStorage.setItem(`tasksDecisionPrompt:${fixtures.event.id}`, 'pending');
|
window.sessionStorage.setItem(`tasksDecisionPrompt:${fixtures.event.id}`, 'pending');
|
||||||
|
|
||||||
render(<MobileDashboardPage />);
|
render(<MobileDashboardPage />);
|
||||||
|
|
||||||
expect(screen.getByText('Setup needed')).toBeInTheDocument();
|
expect(screen.getByText('Aufgaben hinzufügen')).toBeInTheDocument();
|
||||||
expect(
|
|
||||||
screen.getByText(
|
|
||||||
'Your event is live with tasks enabled, but no tasks are assigned yet. Choose to add tasks now or disable tasks for this event.'
|
|
||||||
)
|
|
||||||
).toBeInTheDocument();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('does not redirect endcustomer packages without remaining event quota', () => {
|
it('does not redirect endcustomer packages without remaining event quota', () => {
|
||||||
@@ -282,21 +302,21 @@ describe('MobileDashboardPage', () => {
|
|||||||
expect(navigateMock).not.toHaveBeenCalledWith('/event-admin/mobile/billing#packages', { replace: true });
|
expect(navigateMock).not.toHaveBeenCalledWith('/event-admin/mobile/billing#packages', { replace: true });
|
||||||
});
|
});
|
||||||
|
|
||||||
it('shows package usage progress when a limit is available', () => {
|
it('shows the activity pulse strip', () => {
|
||||||
render(<MobileDashboardPage />);
|
render(<MobileDashboardPage />);
|
||||||
|
|
||||||
expect(screen.getByText('2 of 5 events used')).toBeInTheDocument();
|
expect(screen.getAllByText('Photos').length).toBeGreaterThan(0);
|
||||||
expect(screen.getByText('3 remaining')).toBeInTheDocument();
|
expect(screen.getAllByText('Guests').length).toBeGreaterThan(0);
|
||||||
|
expect(screen.getAllByText('Pending').length).toBeGreaterThan(0);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('hides admin-only shortcuts for members', () => {
|
it('shows shortcut sections for members', () => {
|
||||||
authState.user = { role: 'member' };
|
authState.user = { role: 'member' };
|
||||||
|
|
||||||
render(<MobileDashboardPage />);
|
render(<MobileDashboardPage />);
|
||||||
|
|
||||||
expect(screen.getByText('Moderation & Live Show')).toBeInTheDocument();
|
expect(screen.getByText('Experience')).toBeInTheDocument();
|
||||||
expect(screen.queryByText('Event settings')).not.toBeInTheDocument();
|
expect(screen.getByText('Settings')).toBeInTheDocument();
|
||||||
expect(screen.queryByText('Live Show settings')).not.toBeInTheDocument();
|
|
||||||
|
|
||||||
authState.user = { role: 'tenant_admin' };
|
authState.user = { role: 'tenant_admin' };
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { describe, expect, it, vi } from 'vitest';
|
import { afterEach, describe, expect, it, vi } from 'vitest';
|
||||||
import { act, fireEvent, render, screen } from '@testing-library/react';
|
import { act, fireEvent, render, screen } from '@testing-library/react';
|
||||||
|
|
||||||
const backMock = vi.fn();
|
const backMock = vi.fn();
|
||||||
@@ -7,10 +7,11 @@ const navigateMock = vi.fn();
|
|||||||
const selectEventMock = vi.fn();
|
const selectEventMock = vi.fn();
|
||||||
const refetchMock = vi.fn();
|
const refetchMock = vi.fn();
|
||||||
const invalidateQueriesMock = vi.fn();
|
const invalidateQueriesMock = vi.fn();
|
||||||
|
const paramsState: { slug?: string } = {};
|
||||||
|
|
||||||
vi.mock('react-router-dom', () => ({
|
vi.mock('react-router-dom', () => ({
|
||||||
useNavigate: () => navigateMock,
|
useNavigate: () => navigateMock,
|
||||||
useParams: () => ({}),
|
useParams: () => paramsState,
|
||||||
}));
|
}));
|
||||||
|
|
||||||
vi.mock('@tanstack/react-query', () => ({
|
vi.mock('@tanstack/react-query', () => ({
|
||||||
@@ -50,11 +51,18 @@ vi.mock('../components/Primitives', () => ({
|
|||||||
{label}
|
{label}
|
||||||
</button>
|
</button>
|
||||||
),
|
),
|
||||||
|
FloatingActionButton: ({ label, onPress }: { label: string; onPress?: () => void }) => (
|
||||||
|
<button type="button" onClick={onPress}>
|
||||||
|
{label}
|
||||||
|
</button>
|
||||||
|
),
|
||||||
}));
|
}));
|
||||||
|
|
||||||
vi.mock('../components/FormControls', () => ({
|
vi.mock('../components/FormControls', () => ({
|
||||||
MobileField: ({ children }: { children: React.ReactNode }) => <div>{children}</div>,
|
MobileField: ({ children }: { children: React.ReactNode }) => <div>{children}</div>,
|
||||||
MobileDateTimeInput: (props: React.InputHTMLAttributes<HTMLInputElement>) => <input {...props} />,
|
MobileDateTimeInput: (props: React.InputHTMLAttributes<HTMLInputElement>) => (
|
||||||
|
<input type="datetime-local" {...props} />
|
||||||
|
),
|
||||||
MobileInput: (props: React.InputHTMLAttributes<HTMLInputElement>) => <input {...props} />,
|
MobileInput: (props: React.InputHTMLAttributes<HTMLInputElement>) => <input {...props} />,
|
||||||
MobileSelect: ({ children, ...props }: { children: React.ReactNode }) => <select {...props}>{children}</select>,
|
MobileSelect: ({ children, ...props }: { children: React.ReactNode }) => <select {...props}>{children}</select>,
|
||||||
MobileTextArea: (props: React.TextareaHTMLAttributes<HTMLTextAreaElement>) => <textarea {...props} />,
|
MobileTextArea: (props: React.TextareaHTMLAttributes<HTMLTextAreaElement>) => <textarea {...props} />,
|
||||||
@@ -108,11 +116,16 @@ vi.mock('../../context/EventContext', () => ({
|
|||||||
}),
|
}),
|
||||||
}));
|
}));
|
||||||
|
|
||||||
import { getEventTypes } from '../../api';
|
import { getEvent, getEventTypes } from '../../api';
|
||||||
import MobileEventFormPage from '../EventFormPage';
|
import MobileEventFormPage from '../EventFormPage';
|
||||||
|
|
||||||
describe('MobileEventFormPage', () => {
|
describe('MobileEventFormPage', () => {
|
||||||
|
afterEach(() => {
|
||||||
|
paramsState.slug = undefined;
|
||||||
|
});
|
||||||
|
|
||||||
it('renders a save draft button when creating a new event', async () => {
|
it('renders a save draft button when creating a new event', async () => {
|
||||||
|
paramsState.slug = undefined;
|
||||||
await act(async () => {
|
await act(async () => {
|
||||||
render(<MobileEventFormPage />);
|
render(<MobileEventFormPage />);
|
||||||
});
|
});
|
||||||
@@ -124,6 +137,7 @@ describe('MobileEventFormPage', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('defaults event type to wedding when available', async () => {
|
it('defaults event type to wedding when available', async () => {
|
||||||
|
paramsState.slug = undefined;
|
||||||
vi.mocked(getEventTypes).mockResolvedValueOnce([
|
vi.mocked(getEventTypes).mockResolvedValueOnce([
|
||||||
{ id: 11, slug: 'conference', name: 'Conference', name_translations: {}, icon: null, settings: {} },
|
{ id: 11, slug: 'conference', name: 'Conference', name_translations: {}, icon: null, settings: {} },
|
||||||
{ id: 22, slug: 'wedding', name: 'Wedding', name_translations: {}, icon: null, settings: {} },
|
{ id: 22, slug: 'wedding', name: 'Wedding', name_translations: {}, icon: null, settings: {} },
|
||||||
@@ -136,4 +150,24 @@ describe('MobileEventFormPage', () => {
|
|||||||
const select = screen.getByRole('combobox');
|
const select = screen.getByRole('combobox');
|
||||||
expect(select).toHaveValue('22');
|
expect(select).toHaveValue('22');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('disables the date field when the event is completed', async () => {
|
||||||
|
paramsState.slug = 'past-event';
|
||||||
|
vi.mocked(getEvent).mockResolvedValueOnce({
|
||||||
|
id: 1,
|
||||||
|
name: 'Past event',
|
||||||
|
slug: 'past-event',
|
||||||
|
event_date: '2020-01-01T10:00:00Z',
|
||||||
|
event_type_id: null,
|
||||||
|
event_type: null,
|
||||||
|
status: 'archived',
|
||||||
|
description: null,
|
||||||
|
settings: {},
|
||||||
|
} as any);
|
||||||
|
|
||||||
|
render(<MobileEventFormPage />);
|
||||||
|
|
||||||
|
const dateInput = await screen.findByDisplayValue('2020-01-01T10:00');
|
||||||
|
expect(dateInput).toBeDisabled();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -15,10 +15,12 @@ const fixtures = vi.hoisted(() => ({
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
stats: {
|
stats: {
|
||||||
photo_count: 12,
|
total: 12,
|
||||||
like_count: 3,
|
likes: 3,
|
||||||
pending_count: 1,
|
pending_photos: 1,
|
||||||
guest_count: 22,
|
recent_uploads: 4,
|
||||||
|
status: 'published',
|
||||||
|
is_active: true,
|
||||||
},
|
},
|
||||||
invites: [],
|
invites: [],
|
||||||
addons: [],
|
addons: [],
|
||||||
@@ -40,7 +42,12 @@ vi.mock('react-i18next', () => ({
|
|||||||
}
|
}
|
||||||
return key;
|
return key;
|
||||||
},
|
},
|
||||||
|
i18n: { language: 'de' },
|
||||||
}),
|
}),
|
||||||
|
initReactI18next: {
|
||||||
|
type: '3rdParty',
|
||||||
|
init: () => undefined,
|
||||||
|
},
|
||||||
}));
|
}));
|
||||||
|
|
||||||
vi.mock('../hooks/useBackNavigation', () => ({
|
vi.mock('../hooks/useBackNavigation', () => ({
|
||||||
@@ -54,6 +61,15 @@ vi.mock('../../api', () => ({
|
|||||||
getAddonCatalog: vi.fn().mockResolvedValue(fixtures.addons),
|
getAddonCatalog: vi.fn().mockResolvedValue(fixtures.addons),
|
||||||
updateEvent: vi.fn().mockResolvedValue(fixtures.event),
|
updateEvent: vi.fn().mockResolvedValue(fixtures.event),
|
||||||
createEventAddonCheckout: vi.fn(),
|
createEventAddonCheckout: vi.fn(),
|
||||||
|
getEventEngagement: vi.fn().mockResolvedValue({
|
||||||
|
summary: { totalPhotos: 0, uniqueGuests: 0, tasksSolved: 0, likesTotal: 0 },
|
||||||
|
leaderboards: { uploads: [], likes: [] },
|
||||||
|
highlights: { topPhoto: null, trendingEmotion: null, timeline: [] },
|
||||||
|
feed: [],
|
||||||
|
}),
|
||||||
|
listTenantDataExports: vi.fn().mockResolvedValue([]),
|
||||||
|
requestTenantDataExport: vi.fn(),
|
||||||
|
downloadTenantDataExport: vi.fn(),
|
||||||
}));
|
}));
|
||||||
|
|
||||||
vi.mock('../../auth/tokens', () => ({
|
vi.mock('../../auth/tokens', () => ({
|
||||||
@@ -76,6 +92,14 @@ vi.mock('../components/Primitives', () => ({
|
|||||||
SkeletonCard: () => <div>Loading...</div>,
|
SkeletonCard: () => <div>Loading...</div>,
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
vi.mock('../components/FormControls', () => ({
|
||||||
|
MobileSelect: ({ children, value, onChange }: any) => (
|
||||||
|
<select value={value ?? ''} onChange={onChange}>
|
||||||
|
{children}
|
||||||
|
</select>
|
||||||
|
),
|
||||||
|
}));
|
||||||
|
|
||||||
vi.mock('../components/LegalConsentSheet', () => ({
|
vi.mock('../components/LegalConsentSheet', () => ({
|
||||||
LegalConsentSheet: () => <div />,
|
LegalConsentSheet: () => <div />,
|
||||||
}));
|
}));
|
||||||
@@ -125,6 +149,7 @@ vi.mock('../theme', () => ({
|
|||||||
danger: '#dc2626',
|
danger: '#dc2626',
|
||||||
surface: '#ffffff',
|
surface: '#ffffff',
|
||||||
surfaceMuted: '#f9fafb',
|
surfaceMuted: '#f9fafb',
|
||||||
|
backdrop: '#111827',
|
||||||
accentSoft: '#eef2ff',
|
accentSoft: '#eef2ff',
|
||||||
textStrong: '#0f172a',
|
textStrong: '#0f172a',
|
||||||
}),
|
}),
|
||||||
|
|||||||
@@ -13,14 +13,34 @@ vi.mock('react-router-dom', () => ({
|
|||||||
|
|
||||||
vi.mock('react-i18next', () => ({
|
vi.mock('react-i18next', () => ({
|
||||||
useTranslation: () => ({
|
useTranslation: () => ({
|
||||||
t: (key: string, fallback?: string | Record<string, unknown>) => {
|
t: (key: string) => {
|
||||||
if (typeof fallback === 'string') {
|
const translations: Record<string, string> = {
|
||||||
return fallback;
|
'events.list.title': 'Your events',
|
||||||
}
|
'events.list.subtitle': 'Plan memorable moments. Manage everything around your events here.',
|
||||||
if (fallback && typeof fallback === 'object' && typeof fallback.defaultValue === 'string') {
|
'events.list.overview.title': 'Overview',
|
||||||
return fallback.defaultValue;
|
'events.list.overview.empty': 'No events yet – create your first one to get started.',
|
||||||
}
|
'events.list.filters.all': 'All',
|
||||||
return key;
|
'events.list.filters.upcoming': 'Upcoming',
|
||||||
|
'events.list.filters.draft': 'Draft',
|
||||||
|
'events.list.filters.past': 'Past',
|
||||||
|
'events.list.actions.create': 'New event',
|
||||||
|
'events.list.actions.open': 'Open event',
|
||||||
|
'events.list.empty.filtered': 'No events match this filter.',
|
||||||
|
'events.list.empty.filteredHint': 'Try a different status or clear your search.',
|
||||||
|
'events.list.stats.photos': 'Photos',
|
||||||
|
'events.list.stats.guests': 'Guests',
|
||||||
|
'events.list.stats.tasks': 'Tasks',
|
||||||
|
'events.workspace.fields.status': 'Status',
|
||||||
|
'events.detail.pickEvent': 'Select event',
|
||||||
|
'events.detail.dateTbd': 'Date tbd',
|
||||||
|
'events.detail.locationPlaceholder': 'Location',
|
||||||
|
'events.placeholders.untitled': 'Untitled event',
|
||||||
|
'events.errors.loadFailed': 'Event konnte nicht geladen werden.',
|
||||||
|
};
|
||||||
|
return translations[key] ?? key;
|
||||||
|
},
|
||||||
|
i18n: {
|
||||||
|
language: 'en',
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
}));
|
}));
|
||||||
@@ -136,7 +156,7 @@ describe('MobileEventsPage', () => {
|
|||||||
it('renders filters and event list', async () => {
|
it('renders filters and event list', async () => {
|
||||||
render(<MobileEventsPage />);
|
render(<MobileEventsPage />);
|
||||||
|
|
||||||
expect(await screen.findByText('Filters & Search')).toBeInTheDocument();
|
expect(await screen.findByText('Overview')).toBeInTheDocument();
|
||||||
expect(screen.getByText('Status')).toBeInTheDocument();
|
expect(screen.getByText('Status')).toBeInTheDocument();
|
||||||
expect(screen.getByText('Demo Event')).toBeInTheDocument();
|
expect(screen.getByText('Demo Event')).toBeInTheDocument();
|
||||||
});
|
});
|
||||||
@@ -147,7 +167,7 @@ describe('MobileEventsPage', () => {
|
|||||||
render(<MobileEventsPage />);
|
render(<MobileEventsPage />);
|
||||||
|
|
||||||
expect(await screen.findByText('Demo Event')).toBeInTheDocument();
|
expect(await screen.findByText('Demo Event')).toBeInTheDocument();
|
||||||
expect(screen.queryByText('Create New Event')).not.toBeInTheDocument();
|
expect(screen.queryByText('New event')).not.toBeInTheDocument();
|
||||||
|
|
||||||
authState.user = { role: 'tenant_admin' };
|
authState.user = { role: 'tenant_admin' };
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ type MobileShellProps = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export function MobileShell({ title, subtitle, children, activeTab, onBack, headerActions }: MobileShellProps) {
|
export function MobileShell({ title, subtitle, children, activeTab, onBack, headerActions }: MobileShellProps) {
|
||||||
const { events, activeEvent, hasMultipleEvents, selectEvent } = useEventContext();
|
const { events, activeEvent, selectEvent } = useEventContext();
|
||||||
const { user } = useAuth();
|
const { user } = useAuth();
|
||||||
const { go } = useMobileNav(activeEvent?.slug, activeTab);
|
const { go } = useMobileNav(activeEvent?.slug, activeTab);
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
@@ -45,6 +45,7 @@ export function MobileShell({ title, subtitle, children, activeTab, onBack, head
|
|||||||
const theme = useAdminTheme();
|
const theme = useAdminTheme();
|
||||||
|
|
||||||
const backgroundColor = theme.background;
|
const backgroundColor = theme.background;
|
||||||
|
const [isCompactHeader, setIsCompactHeader] = React.useState(false);
|
||||||
|
|
||||||
// --- DARK HEADER ---
|
// --- DARK HEADER ---
|
||||||
const headerSurface = '#0F172A'; // Slate 900
|
const headerSurface = '#0F172A'; // Slate 900
|
||||||
@@ -78,6 +79,27 @@ export function MobileShell({ title, subtitle, children, activeTab, onBack, head
|
|||||||
.finally(() => setLoadingEvents(false));
|
.finally(() => setLoadingEvents(false));
|
||||||
}, [events.length, loadingEvents, attemptedFetch, activeEvent, selectEvent]);
|
}, [events.length, loadingEvents, attemptedFetch, activeEvent, selectEvent]);
|
||||||
|
|
||||||
|
React.useEffect(() => {
|
||||||
|
if (typeof window === 'undefined' || !window.matchMedia) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const mediaQuery = window.matchMedia('(max-width: 320px)');
|
||||||
|
const handleChange = (event: MediaQueryListEvent | MediaQueryList) => {
|
||||||
|
setIsCompactHeader(event.matches);
|
||||||
|
};
|
||||||
|
|
||||||
|
handleChange(mediaQuery);
|
||||||
|
|
||||||
|
if (typeof mediaQuery.addEventListener === 'function') {
|
||||||
|
mediaQuery.addEventListener('change', handleChange);
|
||||||
|
return () => mediaQuery.removeEventListener('change', handleChange);
|
||||||
|
}
|
||||||
|
|
||||||
|
mediaQuery.addListener?.(handleChange);
|
||||||
|
return () => mediaQuery.removeListener?.(handleChange);
|
||||||
|
}, []);
|
||||||
|
|
||||||
React.useEffect(() => {
|
React.useEffect(() => {
|
||||||
const path = `${location.pathname}${location.search}${location.hash}`;
|
const path = `${location.pathname}${location.search}${location.hash}`;
|
||||||
if (!location.pathname.includes('/billing/shop') && !location.pathname.includes('/welcome')) {
|
if (!location.pathname.includes('/billing/shop') && !location.pathname.includes('/welcome')) {
|
||||||
@@ -102,7 +124,7 @@ export function MobileShell({ title, subtitle, children, activeTab, onBack, head
|
|||||||
|
|
||||||
const pageTitle = title ?? t('header.appName', 'Event Admin');
|
const pageTitle = title ?? t('header.appName', 'Event Admin');
|
||||||
const isEventsIndex = location.pathname === ADMIN_EVENTS_PATH;
|
const isEventsIndex = location.pathname === ADMIN_EVENTS_PATH;
|
||||||
const canSwitchEvents = hasMultipleEvents && !isEventsIndex;
|
const canSwitchEvents = effectiveEvents.length > 1 && !isEventsIndex;
|
||||||
const isMember = user?.role === 'member';
|
const isMember = user?.role === 'member';
|
||||||
const memberPermissions = Array.isArray(effectiveActive?.member_permissions) ? effectiveActive?.member_permissions ?? [] : [];
|
const memberPermissions = Array.isArray(effectiveActive?.member_permissions) ? effectiveActive?.member_permissions ?? [] : [];
|
||||||
|
|
||||||
@@ -119,7 +141,7 @@ export function MobileShell({ title, subtitle, children, activeTab, onBack, head
|
|||||||
|
|
||||||
// --- CONTEXT PILL ---
|
// --- CONTEXT PILL ---
|
||||||
const EventContextPill = () => {
|
const EventContextPill = () => {
|
||||||
if (!effectiveActive || isEventsIndex) {
|
if (!effectiveActive || isEventsIndex || isCompactHeader) {
|
||||||
return (
|
return (
|
||||||
<Text fontSize="$md" fontWeight="800" fontFamily="$display" color="white">
|
<Text fontSize="$md" fontWeight="800" fontFamily="$display" color="white">
|
||||||
{pageTitle}
|
{pageTitle}
|
||||||
@@ -138,7 +160,7 @@ export function MobileShell({ title, subtitle, children, activeTab, onBack, head
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Pressable onPress={() => setSwitcherOpen(true)}>
|
<Pressable onPress={() => setSwitcherOpen(true)} aria-label={t('header.eventSwitcher', 'Switch event')}>
|
||||||
<XStack
|
<XStack
|
||||||
backgroundColor="rgba(255, 255, 255, 0.12)"
|
backgroundColor="rgba(255, 255, 255, 0.12)"
|
||||||
paddingHorizontal="$3"
|
paddingHorizontal="$3"
|
||||||
|
|||||||
@@ -157,7 +157,6 @@ describe('MobileShell', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('shows the event switcher when multiple events are available', async () => {
|
it('shows the event switcher when multiple events are available', async () => {
|
||||||
eventContext.hasMultipleEvents = true;
|
|
||||||
eventContext.events = [
|
eventContext.events = [
|
||||||
{ slug: 'event-1', name: 'Test Event', event_date: '2024-01-01', status: 'active', settings: {} },
|
{ slug: 'event-1', name: 'Test Event', event_date: '2024-01-01', status: 'active', settings: {} },
|
||||||
{ slug: 'event-2', name: 'Second Event', event_date: '2024-02-01', status: 'active', settings: {} },
|
{ slug: 'event-2', name: 'Second Event', event_date: '2024-02-01', status: 'active', settings: {} },
|
||||||
@@ -177,7 +176,6 @@ describe('MobileShell', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('hides the event switcher on the events list page', async () => {
|
it('hides the event switcher on the events list page', async () => {
|
||||||
eventContext.hasMultipleEvents = true;
|
|
||||||
eventContext.events = [
|
eventContext.events = [
|
||||||
{ slug: 'event-1', name: 'Test Event', event_date: '2024-01-01', status: 'active', settings: {} },
|
{ slug: 'event-1', name: 'Test Event', event_date: '2024-01-01', status: 'active', settings: {} },
|
||||||
{ slug: 'event-2', name: 'Second Event', event_date: '2024-02-01', status: 'active', settings: {} },
|
{ slug: 'event-2', name: 'Second Event', event_date: '2024-02-01', status: 'active', settings: {} },
|
||||||
|
|||||||
@@ -8,6 +8,8 @@ use App\Models\EventType;
|
|||||||
use App\Models\Package;
|
use App\Models\Package;
|
||||||
use App\Services\EventJoinTokenService;
|
use App\Services\EventJoinTokenService;
|
||||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||||
|
use Illuminate\Support\Facades\Storage;
|
||||||
|
use Illuminate\Support\Facades\URL;
|
||||||
use Tests\TestCase;
|
use Tests\TestCase;
|
||||||
|
|
||||||
class EventBrandingResponseTest extends TestCase
|
class EventBrandingResponseTest extends TestCase
|
||||||
@@ -131,4 +133,19 @@ class EventBrandingResponseTest extends TestCase
|
|||||||
$response->assertJsonPath('branding.secondary_color', '#fedcba');
|
$response->assertJsonPath('branding.secondary_color', '#fedcba');
|
||||||
$response->assertJsonPath('branding.buttons.radius', 8);
|
$response->assertJsonPath('branding.buttons.radius', 8);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function test_branding_asset_uses_public_disk(): void
|
||||||
|
{
|
||||||
|
Storage::fake('public');
|
||||||
|
Storage::disk('public')->put('branding/logos/test.png', 'logo');
|
||||||
|
|
||||||
|
$url = URL::temporarySignedRoute('api.v1.branding.asset', now()->addMinutes(5), [
|
||||||
|
'path' => 'branding/logos/test.png',
|
||||||
|
]);
|
||||||
|
|
||||||
|
$response = $this->get($url);
|
||||||
|
|
||||||
|
$response->assertOk();
|
||||||
|
$this->assertSame('logo', $response->streamedContent());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -214,12 +214,16 @@ class EventControllerTest extends TenantTestCase
|
|||||||
$response = $this->authenticatedRequest('PUT', "/api/v1/tenant/events/{$event->slug}", [
|
$response = $this->authenticatedRequest('PUT', "/api/v1/tenant/events/{$event->slug}", [
|
||||||
'settings' => [
|
'settings' => [
|
||||||
'engagement_mode' => 'photo_only',
|
'engagement_mode' => 'photo_only',
|
||||||
|
'guest_downloads_enabled' => false,
|
||||||
|
'guest_sharing_enabled' => true,
|
||||||
],
|
],
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$response->assertOk();
|
$response->assertOk();
|
||||||
$event->refresh();
|
$event->refresh();
|
||||||
$this->assertSame('photo_only', data_get($event->settings, 'engagement_mode'));
|
$this->assertSame('photo_only', data_get($event->settings, 'engagement_mode'));
|
||||||
|
$this->assertFalse((bool) data_get($event->settings, 'guest_downloads_enabled'));
|
||||||
|
$this->assertTrue((bool) data_get($event->settings, 'guest_sharing_enabled'));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function test_create_event_rejects_unavailable_service_tier_for_partner_kontingent(): void
|
public function test_create_event_rejects_unavailable_service_tier_for_partner_kontingent(): void
|
||||||
@@ -299,6 +303,94 @@ class EventControllerTest extends TenantTestCase
|
|||||||
$this->assertSame('blur_last', data_get($settings, 'live_show.background_mode'));
|
$this->assertSame('blur_last', data_get($settings, 'live_show.background_mode'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function test_update_event_accepts_svg_watermark_data_url(): void
|
||||||
|
{
|
||||||
|
Storage::fake('public');
|
||||||
|
|
||||||
|
$eventType = EventType::factory()->create();
|
||||||
|
$event = Event::factory()->for($this->tenant)->create([
|
||||||
|
'event_type_id' => $eventType->id,
|
||||||
|
'name' => 'SVG Watermark Event',
|
||||||
|
'slug' => 'svg-watermark',
|
||||||
|
'date' => now()->addDays(2),
|
||||||
|
]);
|
||||||
|
|
||||||
|
$svg = '<svg xmlns="http://www.w3.org/2000/svg" width="40" height="20"></svg>';
|
||||||
|
$dataUrl = 'data:image/svg+xml;base64,'.base64_encode($svg);
|
||||||
|
|
||||||
|
$response = $this->authenticatedRequest('PUT', "/api/v1/tenant/events/{$event->slug}", [
|
||||||
|
'settings' => [
|
||||||
|
'watermark' => [
|
||||||
|
'mode' => 'custom',
|
||||||
|
'asset_data_url' => $dataUrl,
|
||||||
|
'position' => 'bottom-right',
|
||||||
|
],
|
||||||
|
],
|
||||||
|
]);
|
||||||
|
|
||||||
|
$response->assertOk();
|
||||||
|
|
||||||
|
$event->refresh();
|
||||||
|
$path = data_get($event->settings, 'watermark.asset');
|
||||||
|
$this->assertSame("branding/watermarks/event-{$event->id}.svg", $path);
|
||||||
|
Storage::disk('public')->assertExists($path);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function test_show_event_includes_signed_watermark_asset_url(): void
|
||||||
|
{
|
||||||
|
Storage::fake('public');
|
||||||
|
|
||||||
|
$eventType = EventType::factory()->create();
|
||||||
|
$event = Event::factory()->for($this->tenant)->create([
|
||||||
|
'event_type_id' => $eventType->id,
|
||||||
|
'name' => 'Watermark Preview Event',
|
||||||
|
'slug' => 'watermark-preview',
|
||||||
|
'date' => now()->addDays(2),
|
||||||
|
'settings' => [
|
||||||
|
'watermark' => [
|
||||||
|
'mode' => 'custom',
|
||||||
|
'asset' => 'branding/watermarks/event-123.png',
|
||||||
|
],
|
||||||
|
],
|
||||||
|
]);
|
||||||
|
|
||||||
|
Storage::disk('public')->put('branding/watermarks/event-123.png', 'asset');
|
||||||
|
|
||||||
|
$response = $this->authenticatedRequest('GET', "/api/v1/tenant/events/{$event->slug}");
|
||||||
|
|
||||||
|
$response->assertOk();
|
||||||
|
$url = (string) $response->json('data.settings.watermark.asset_url');
|
||||||
|
$this->assertNotSame('', $url);
|
||||||
|
$this->assertStringContainsString('/api/v1/branding/asset/branding/watermarks/event-123.png', $url);
|
||||||
|
$this->assertStringContainsString('signature=', $url);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function test_show_event_includes_base_watermark_asset_url_when_missing_settings(): void
|
||||||
|
{
|
||||||
|
Storage::fake('public');
|
||||||
|
|
||||||
|
config(['watermark.base.asset' => 'branding/watermarks/base-watermark.png']);
|
||||||
|
Storage::disk('public')->put('branding/watermarks/base-watermark.png', 'asset');
|
||||||
|
|
||||||
|
$eventType = EventType::factory()->create();
|
||||||
|
$event = Event::factory()->for($this->tenant)->create([
|
||||||
|
'event_type_id' => $eventType->id,
|
||||||
|
'name' => 'Base Watermark Preview',
|
||||||
|
'slug' => 'base-watermark-preview',
|
||||||
|
'date' => now()->addDays(2),
|
||||||
|
'settings' => [],
|
||||||
|
]);
|
||||||
|
|
||||||
|
$response = $this->authenticatedRequest('GET', "/api/v1/tenant/events/{$event->slug}");
|
||||||
|
|
||||||
|
$response->assertOk();
|
||||||
|
$this->assertSame('base', $response->json('data.settings.watermark.mode'));
|
||||||
|
$url = (string) $response->json('data.settings.watermark.asset_url');
|
||||||
|
$this->assertNotSame('', $url);
|
||||||
|
$this->assertStringContainsString('/api/v1/branding/asset/branding/watermarks/base-watermark.png', $url);
|
||||||
|
$this->assertStringContainsString('signature=', $url);
|
||||||
|
}
|
||||||
|
|
||||||
public function test_update_event_uploads_branding_logo_data_url(): void
|
public function test_update_event_uploads_branding_logo_data_url(): void
|
||||||
{
|
{
|
||||||
Storage::fake('public');
|
Storage::fake('public');
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ class SeedDemoSwitcherTenantsTest extends TestCase
|
|||||||
{
|
{
|
||||||
use RefreshDatabase;
|
use RefreshDatabase;
|
||||||
|
|
||||||
public function testStarterEmptyTenantHasOneRemainingEvent(): void
|
public function test_starter_empty_tenant_has_one_remaining_event(): void
|
||||||
{
|
{
|
||||||
config(['app.env' => 'local']);
|
config(['app.env' => 'local']);
|
||||||
app()->detectEnvironment(fn () => 'local');
|
app()->detectEnvironment(fn () => 'local');
|
||||||
@@ -32,7 +32,7 @@ class SeedDemoSwitcherTenantsTest extends TestCase
|
|||||||
$this->assertSame(1, $starterPackage->package->max_events_per_year - $starterPackage->used_events);
|
$this->assertSame(1, $starterPackage->package->max_events_per_year - $starterPackage->used_events);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testStarterWeddingTenantConsumesEvent(): void
|
public function test_standard_wedding_tenant_consumes_event(): void
|
||||||
{
|
{
|
||||||
config(['app.env' => 'local']);
|
config(['app.env' => 'local']);
|
||||||
app()->detectEnvironment(fn () => 'local');
|
app()->detectEnvironment(fn () => 'local');
|
||||||
@@ -42,12 +42,12 @@ class SeedDemoSwitcherTenantsTest extends TestCase
|
|||||||
|
|
||||||
Artisan::call('demo:seed-switcher');
|
Artisan::call('demo:seed-switcher');
|
||||||
|
|
||||||
$starterWedding = Tenant::where('slug', 'demo-starter-wedding')->firstOrFail();
|
$standardWedding = Tenant::where('slug', 'demo-starter-wedding')->firstOrFail();
|
||||||
$starterPackage = TenantPackage::where('tenant_id', $starterWedding->id)->with('package')->firstOrFail();
|
$standardPackage = TenantPackage::where('tenant_id', $standardWedding->id)->with('package')->firstOrFail();
|
||||||
|
|
||||||
$this->assertSame('starter', $starterPackage->package->slug);
|
$this->assertSame('standard', $standardPackage->package->slug);
|
||||||
$this->assertSame(1, $starterPackage->used_events);
|
$this->assertSame(1, $standardPackage->used_events);
|
||||||
$this->assertSame(0, $starterPackage->package->max_events_per_year - $starterPackage->used_events);
|
$this->assertSame(4, $standardPackage->package->max_events_per_year - $standardPackage->used_events);
|
||||||
}
|
}
|
||||||
|
|
||||||
private function seedDemoPackages(): void
|
private function seedDemoPackages(): void
|
||||||
|
|||||||
@@ -70,4 +70,28 @@ class TenantPackageOverviewTest extends TenantTestCase
|
|||||||
$this->assertSame(10, $payload['active_package']['package_limits']['used_gallery_days']);
|
$this->assertSame(10, $payload['active_package']['package_limits']['used_gallery_days']);
|
||||||
$this->assertSame(9, $payload['active_package']['remaining_events']);
|
$this->assertSame(9, $payload['active_package']['remaining_events']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function test_active_package_falls_back_to_active_endcustomer_package(): void
|
||||||
|
{
|
||||||
|
$package = Package::factory()->endcustomer()->create([
|
||||||
|
'features' => ['custom_branding'],
|
||||||
|
'branding_allowed' => true,
|
||||||
|
'watermark_allowed' => false,
|
||||||
|
]);
|
||||||
|
|
||||||
|
TenantPackage::factory()->create([
|
||||||
|
'tenant_id' => $this->tenant->id,
|
||||||
|
'package_id' => $package->id,
|
||||||
|
'active' => true,
|
||||||
|
]);
|
||||||
|
|
||||||
|
$request = Request::create('/api/v1/tenant/packages', 'GET');
|
||||||
|
$request->attributes->set('tenant', $this->tenant);
|
||||||
|
|
||||||
|
$response = app(TenantPackageController::class)->index($request);
|
||||||
|
$payload = $response->getData(true);
|
||||||
|
|
||||||
|
$this->assertSame($package->id, $payload['active_package']['package_id']);
|
||||||
|
$this->assertSame(['custom_branding'], $payload['active_package']['package_limits']['features']);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user