Give each specialty module a distinct Heroicon-style icon.
Deploy Ladill Care / deploy (push) Successful in 1m2s
Deploy Ladill Care / deploy (push) Successful in 1m2s
Icon names live on the specialty catalog; SVG paths resolve through a shared map and render in sidebar, dashboard, settings, and the specialty shell. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -40,6 +40,33 @@ class SpecialtyModuleService
|
||||
return $catalog[$key] ?? null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Heroicon-style icon identifier from the specialty catalog (e.g. bolt, heart).
|
||||
*/
|
||||
public function iconName(string $key): string
|
||||
{
|
||||
$name = (string) ($this->definition($key)['icon'] ?? 'squares-2x2');
|
||||
|
||||
return $name !== '' ? $name : 'squares-2x2';
|
||||
}
|
||||
|
||||
/**
|
||||
* Inline SVG path markup for sidebar / card icons (24×24 outline).
|
||||
*/
|
||||
public function iconSvgPath(string $key): string
|
||||
{
|
||||
$icons = config('care.specialty_icons', []);
|
||||
$name = $this->iconName($key);
|
||||
|
||||
if (is_array($icons) && isset($icons[$name]) && is_string($icons[$name]) && $icons[$name] !== '') {
|
||||
return $icons[$name];
|
||||
}
|
||||
|
||||
return is_array($icons) && isset($icons['squares-2x2']) && is_string($icons['squares-2x2'])
|
||||
? $icons['squares-2x2']
|
||||
: '';
|
||||
}
|
||||
|
||||
public function isDefaultOnPaidPlans(string $key): bool
|
||||
{
|
||||
return (bool) ($this->definition($key)['default_on_paid_plans'] ?? false);
|
||||
|
||||
@@ -46,6 +46,14 @@ if (! function_exists('care_money')) {
|
||||
}
|
||||
}
|
||||
|
||||
if (! function_exists('care_specialty_icon_path')) {
|
||||
/** Inline SVG path markup for a specialty module key (Heroicons-style outline). */
|
||||
function care_specialty_icon_path(string $moduleKey): string
|
||||
{
|
||||
return app(\App\Services\Care\SpecialtyModuleService::class)->iconSvgPath($moduleKey);
|
||||
}
|
||||
}
|
||||
|
||||
if (! function_exists('crm_money')) {
|
||||
/** @deprecated Use care_money() */
|
||||
function crm_money(?int $minor, ?string $currency = null): string
|
||||
|
||||
Reference in New Issue
Block a user