Files
Toiminnanohjaus/app/Providers/AppServiceProvider.php
T
petriandClaude Opus 5.5 51b40b24fe Give the UI an indigo look with cards, status badges and empty states
- Dark indigo header and tinted page background; the mobile main menu gets
  its own row, in the same order as the keyboard reaches it.
- Page titles with an icon chip (x-page-title, x-page, x-page-header) and
  card sections (x-panel, the card utility); x-table styled as a card with
  an indigo header row in AppServiceProvider::styleTables().
- Job and task statuses, late work, unapproved hours and stock states as
  badges with icon and text (x-status-badge, x-jobs.status,
  x-jobs.task-status), never colour alone.
- Empty lists as x-empty-state; dashboard quick link tiles, week hour bars
  and trend arrows; Kanban columns and task cards edged by status; calendar
  today column and bar accents; quick sale, reports and machine console
  restyled; signed-out pages show the app name.
- Focus rings use the primary colour in both themes (white in the header).
- Document the components in CLAUDE.md; test the status badges.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-29 10:53:10 +02:00

103 lines
4.1 KiB
PHP

<?php
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
use TallStackUi\Facades\TallStackUi;
class AppServiceProvider extends ServiceProvider
{
/**
* Register any application services.
*/
public function register(): void
{
//
}
/**
* Bootstrap any application services.
*/
public function boot(): void
{
$this->meetContrastRequirements();
$this->styleTables();
}
/**
* Tables as cards: a white (dark: zinc-900) surface with a soft shadow, an indigo-tinted header row and a
* row hover. Cell text is zinc-700 / zinc-200 (well over 4.5:1) instead of the package's gray-500.
*/
private function styleTables(): void
{
TallStackUi::customize()
->table()
->block('wrapper', 'overflow-hidden rounded-xl bg-white shadow-sm ring-1 ring-zinc-200 dark:bg-zinc-900 dark:ring-zinc-700')
->block('table.wrapper', 'relative soft-scrollbar overflow-auto bg-white dark:bg-zinc-900')
->block('table.base', 'min-w-full divide-y divide-zinc-200 dark:divide-zinc-700')
->block('table.th', 'px-3 py-3 text-xs font-semibold tracking-wide text-primary-900 dark:text-primary-100')
->block('table.th-compact', 'px-3 py-2 text-xs font-semibold tracking-wide text-primary-900 dark:text-primary-100')
->block('table.thead.normal', 'bg-primary-50 dark:bg-primary-950/70')
->block('table.tbody', 'divide-y divide-zinc-200 bg-white dark:divide-zinc-700/70 dark:bg-zinc-900')
->block('table.tr', 'transition-colors hover:bg-primary-50/50 dark:hover:bg-white/5')
->block('table.td', 'whitespace-nowrap px-3 py-3 text-sm text-zinc-700 dark:text-zinc-200')
->block('table.td-compact', 'whitespace-nowrap px-3 py-2 text-sm text-zinc-700 dark:text-zinc-200')
->block('empty', 'col-span-full whitespace-nowrap px-3 py-4 text-sm text-zinc-700 dark:text-zinc-200');
}
/**
* TallStackUI uses red-500 for error text, which is 3.8:1 on white and
* below the 4.5:1 WCAG 2.2 AA requires. Darker red in light mode, lighter
* red in dark mode. The typed value of a field in error is red-600, which is
* 3.8:1 on the dark input background, so inputs and selects change too.
*/
private function meetContrastRequirements(): void
{
TallStackUi::customize()
->form('error')
->block('text')
->replace('text-red-500', 'text-red-700 dark:text-red-400');
TallStackUi::customize()
->form('label')
->block('error')
->replace(['text-red-600' => 'text-red-700', 'dark:text-red-500' => 'dark:text-red-400']);
TallStackUi::customize()
->form('label')
->block('asterisk')
->replace('text-red-500', 'text-red-700 dark:text-red-400');
TallStackUi::customize()
->form('input')
->block('error')
->replace('text-red-600!', 'text-red-700! dark:!text-red-400');
TallStackUi::customize()
->form('hint')
->block('text')
->replace('text-gray-500', 'text-gray-600');
foreach (['radio.group', 'checkbox.group'] as $selectionGroup) {
foreach (['content.description', 'content.aside'] as $block) {
TallStackUi::customize()
->form($selectionGroup)
->block($block)
->replace('text-gray-500', 'text-gray-600');
}
}
TallStackUi::customize()
->select('native')
->block('error')
->replace('text-red-600!', 'text-red-700! dark:!text-red-400');
// Chart axis captions are gray-500 at 10 px, 4.4:1 on the page background.
foreach (['axis.y.label', 'axis.y.right.label', 'axis.x.label'] as $block) {
TallStackUi::customize('chart')
->block($block)
->replace(['text-gray-500' => 'text-gray-700', 'dark:text-dark-400' => 'dark:text-dark-200', 'text-[0.65rem]' => 'text-xs']);
}
}
}