feat(hints): auto-inject on every main page via URL→key registry
Registry now covers ~50 hints across Service, CRM, Depozit, Finanțe, Admin, Marketing, Analiză, Shop. Every main tenant page has an entry. New Hints::forPath(\$path) does str_starts_with matching against a curated URL prefix map. First match wins so specific paths (e.g. /work-orders/create) beat broader ones (/work-orders). A single render hook on PAGE_HEADER_ACTIONS_BEFORE looks up the current request path and, if it matches, renders a "?" icon next to the page header actions. Blades that already have <x-hint> tags embedded (WO dashboard, Calendar, Pipeline, Excel wizard) keep those on top of the auto-injected header hint. Net effect: users see "?" icons everywhere in the panel now, and adding coverage for a new page is a 2-line change (registry entry + one URL prefix in forPath). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -229,6 +229,19 @@ class TenantPanelProvider extends PanelProvider
|
||||
BLADE),
|
||||
scopes: [Dashboard::class],
|
||||
)
|
||||
// Auto-injected hint on every page whose URL maps to a hint key.
|
||||
// Reads the current request path and looks it up in Hints::forPath().
|
||||
// Blades that already embedded <x-hint> stay untouched — this only
|
||||
// fires on pages that don't have their own.
|
||||
->renderHook(
|
||||
PanelsRenderHook::PAGE_HEADER_ACTIONS_BEFORE,
|
||||
fn (): string => Blade::render(<<<'BLADE'
|
||||
@php $__hintKey = \App\Support\Hints::forPath(request()->path()); @endphp
|
||||
@if ($__hintKey)
|
||||
<span style="display:inline-flex;align-items:center;margin-right:8px;"><x-hint :key="$__hintKey" /></span>
|
||||
@endif
|
||||
BLADE),
|
||||
)
|
||||
->renderHook(
|
||||
PanelsRenderHook::BODY_END,
|
||||
fn (): string => Blade::render(<<<'BLADE'
|
||||
|
||||
Reference in New Issue
Block a user