fix: restore Component.php and move icon functionality to Overview.php only

- Reverted Component.php to original state (was breaking all Livewire modals)
- Icon properties and methods now only in Overview.php where they belong
- Icon button only shows as clickable on Overview page
- Other pages show the icon as display-only (not a button)
- Icon modal only renders on Overview page
- Fixed saveIcon method to accept icon and color arguments
This commit is contained in:
2025-12-06 09:35:02 -05:00
parent f0b401767b
commit 1c677c45e0
3 changed files with 62 additions and 61 deletions

View File

@@ -22,6 +22,12 @@ class Overview extends Component
public $isEditingPassword = false;
public $passwordError = '';
// Icon customization properties
public bool $showIconModal = false;
public string $selectedIcon = '';
public string $selectedIconColor = '#3b82f6';
public string $iconSearchQuery = '';
public string $cpuTimeRange = 'hour';
public string $cpuAggregation = 'average';
@@ -521,6 +527,44 @@ class Overview extends Component
}
}
// Icon customization methods
public function openIconModal()
{
$this->selectedIcon = $this->server->user_set_icon ?? '';
$this->selectedIconColor = $this->server->user_set_icon_color ?? '#3b82f6';
$this->iconSearchQuery = '';
$this->showIconModal = true;
}
public function closeIconModal()
{
$this->showIconModal = false;
}
public function saveIcon($icon = null, $color = null)
{
$this->server->update([
'user_set_icon' => $icon ?: null,
'user_set_icon_color' => $color ?: null,
]);
$this->showIconModal = false;
$this->notify('Icon saved successfully', 'success');
}
public function resetIcon()
{
$this->server->update([
'user_set_icon' => null,
'user_set_icon_color' => null,
]);
$this->selectedIcon = '';
$this->selectedIconColor = '#3b82f6';
$this->showIconModal = false;
$this->notify('Icon reset to default', 'success');
}
public function render()
{
return view('proxmox::overview')->layoutData([