fix: handle existing ri- prefix in stored icon names
- Check if icon already has ri- prefix before adding it - Prevents ri-ri-icon-name double prefix error
This commit is contained in:
@@ -56,8 +56,12 @@
|
||||
@if($server->user_set_icon)
|
||||
@php
|
||||
$iconColor = $server->user_set_icon_color ?: 'currentColor';
|
||||
// Handle both old format (ri-icon-name) and new format (icon-name)
|
||||
$iconName = str_starts_with($server->user_set_icon, 'ri-')
|
||||
? $server->user_set_icon
|
||||
: 'ri-' . $server->user_set_icon;
|
||||
@endphp
|
||||
<x-dynamic-component :component="'ri-' . $server->user_set_icon" class="size-5" style="color: {{ $iconColor }}" />
|
||||
<x-dynamic-component :component="$iconName" class="size-5" style="color: {{ $iconColor }}" />
|
||||
@else
|
||||
<x-ri-server-line class="size-5 text-secondary" />
|
||||
@endif
|
||||
|
||||
Reference in New Issue
Block a user