Skip to content

Conversation

@Boy132
Copy link
Member

@Boy132 Boy132 commented Jan 16, 2026

No description provided.

@Boy132 Boy132 self-assigned this Jan 16, 2026
@coderabbitai
Copy link

coderabbitai bot commented Jan 16, 2026

📝 Walkthrough

Walkthrough

Adds a new Artisan command to generate a TablerIcon PHP enum from vendor SVGs and converts existing string-based Tabler icon usages to a BackedEnum-based App\Enums\TablerIcon, updating return types and icon parameters across enums, interfaces, schemas, Filament pages/resources/components/models, and providers.

Changes

Cohort / File(s) Summary
Icon Enum Generation
app/Console/Commands/Dev/GenerateTablerIconsEnum.php
New Artisan command that scans vendor/secondnetwork/blade-tabler-icons/resources/svg for .svg files, filters duplicates/variants, builds enum cases, writes app/Enums/TablerIcon.php, and prints a success message.
TablerIcon enum & usages
app/Enums/..., app/Enums/TablerIcon.php (generated)
Introduces/targets the TablerIcon backed enum and migrates literal 'tabler-...' strings to TablerIcon::... constants across the codebase.
Enum return-type updates
app/Enums/{BackupStatus,ContainerStatus,PluginCategory,PluginStatus,ServerState,SubuserPermission,WebhookType}.php
Changed getIcon() signatures from string/?string to BackedEnum/?BackedEnum and return TablerIcon constants instead of strings.
Interface & schema type widening
app/Extensions/{Captcha,Schemas}/*, app/Extensions/OAuth/*
Widened interface signatures to accept BackedEnum and updated many OAuth/Captcha schema implementations to return TablerIcon enum values.
Filament pages & resources (admin & server)
app/Filament/{Admin,Server}/Pages/*, app/Filament/*/Resources/*, app/Filament/*/Widgets/*
Replaced navigation/action/icon string literals with TablerIcon constants; adjusted property unions to `string
Filament components & actions
app/Filament/Components/Actions/*, app/Filament/Components/Forms/Fields/StartupVariable.php
Switched icon(), hintIcon(), and related arguments from strings to TablerIcon enum values across action and form components.
Livewire installer & components
app/Livewire/Installer/*, app/Livewire/NodeSystemInformation.php
Replaced hint/icon strings with TablerIcon constants in installer steps and node information UI.
Models
app/Models/{ActivityLog,File,Role}.php
getIcon() return types changed to BackedEnum and return TablerIcon constants; model icon mapping/registering updated to accept enums.
Providers
app/Providers/{FilamentServiceProvider,AdminPanelProvider,AppPanelProvider,ServerPanelProvider}.php
Replaced registered/inline icon strings with TablerIcon constants (including DeleteAction and Filament icon registrations).

Sequence Diagram(s)

sequenceDiagram
  participant Dev as Developer (runs Artisan)
  participant CLI as Artisan Console
  participant Vendor as vendor SVG dir
  participant FS as Filesystem
  participant Enum as app/Enums/TablerIcon.php

  Dev->>CLI: php artisan dev:generate-tabler-icons-enum
  CLI->>Vendor: scan for .svg files
  CLI->>CLI: filter duplicates and variants\nsanitize & build enum cases
  CLI->>FS: write enum content to `app/Enums/TablerIcon.php`
  FS-->>CLI: write result
  CLI->>Dev: info("Wrote app/Enums/TablerIcon.php")
Loading

Possibly related PRs

🚥 Pre-merge checks | ✅ 1 | ❌ 2
❌ Failed checks (1 warning, 1 inconclusive)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 35.92% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check ❓ Inconclusive No pull request description was provided by the author. While a description would be helpful for context, the absence of one is not necessarily critical given the clear and self-documenting title and the comprehensive scope of changes that are evident from the code modifications. Consider adding a description explaining the motivation for this refactoring (e.g., type safety, consistency, maintainability) and any migration steps or breaking changes for downstream code.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Replace icon strings with enum' clearly and concisely summarizes the main change in the PR, which is converting hardcoded icon string literals to TablerIcon enum constants throughout the codebase.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@Boy132 Boy132 marked this pull request as ready for review January 19, 2026 10:59
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

🤖 Fix all issues with AI agents
In `@app/Enums/BackupStatus.php`:
- Line 5: The BackupStatus enum references TablerIcon but does not import it;
update the BackupStatus.php enum to either add an explicit import for
App\Enums\TablerIcon (so BackupStatus can use TablerIcon by name) or change the
TablerIcon references to the fully-qualified name (\App\Enums\TablerIcon);
locate the enum declaration (BackupStatus) and adjust the use/import accordingly
so the TablerIcon symbol resolves at runtime.

In `@app/Enums/ContainerStatus.php`:
- Line 5: The getIcon() implementations in the ContainerStatus enum (and
similarly in BackupStatus, ServerState, PluginStatus, PluginCategory,
WebhookType) currently return a BackedEnum instance which violates Filament's
HasIcon contract expecting string|null; update each enum's getIcon() to return
the icon's string value and adjust the method signature to public function
getIcon(): ?string (or public function getIcon(): string if null isn't used),
i.e., extract and return the enum's backed string (use ->value or return the
mapped string directly) so the return type matches HasIcon.

In `@app/Enums/SubuserPermission.php`:
- Around line 72-74: In getIcon(), remove the unused $permission binding from
the destructuring of $this->split(); replace "[$group, $permission] =
$this->split()" with a form that only captures the first value (e.g.,
destructure to [$group] = $this->split() or assign $group = $this->split()[0])
so $permission is not declared and static analysis warnings are eliminated.

In `@app/Extensions/OAuth/OAuthSchemaInterface.php`:
- Line 6: The CommonSchema::getIcon() signature is narrower than its parent
OAuthSchema; change CommonSchema::getIcon() to return null|string|BackedEnum to
match the parent. Update the method declaration in the CommonSchema class (and
any implemented interface reference in OAuthSchemaInterface if present) to use
the union return type null|string|BackedEnum and adjust any phpdoc if necessary
so the signature and docs align with OAuthSchema::getIcon().
🧹 Nitpick comments (3)
app/Enums/PluginCategory.php (1)

5-5: Consider adding explicit import for TablerIcon for consistency.

While TablerIcon is in the same App\Enums namespace and will resolve correctly, other files in this PR explicitly import it. Adding the import would improve consistency and make the dependency more obvious.

Suggested change
 use BackedEnum;
+use App\Enums\TablerIcon;
 use Filament\Support\Contracts\HasIcon;
app/Filament/Admin/Resources/Nodes/Pages/CreateNode.php (1)

43-53: Inconsistent icon string in Blade template.

The wizard navigation icons are correctly migrated to TablerIcon enum constants, but the submitAction still uses a hardcoded string 'tabler-file-plus' in the Blade template. Consider extracting this to maintain consistency with the enum migration.

♻️ Suggested approach

Since this is an inline Blade template, you could pass the icon as a variable:

-                    ->submitAction(new HtmlString(Blade::render(<<<'BLADE'
+                    ->submitAction(new HtmlString(Blade::render(<<<'BLADE'
                         <x-filament::icon-button
                             type="submit"
                             iconSize="xl"
-                            icon="tabler-file-plus"
+                            :icon="$icon"
                         >
                             {{ trans('admin/node.create') }}
                         </x-filament::icon-button>
-                    BLADE))),
+                    BLADE, ['icon' => TablerIcon::FilePlus->value]))),

Alternatively, keep the string if Blade components don't support enum icons directly.

app/Filament/Admin/Resources/Servers/Pages/EditServer.php (1)

263-265: Remaining string literal for dynamic dice icon is acceptable.

The dynamic icon construction 'tabler-dice-' . random_int(1, 6) cannot easily use the enum since it requires runtime concatenation. If you want full enum consistency in the future, consider using a match expression with individual TablerIcon::Dice1 through TablerIcon::Dice6 cases, but the current approach is simpler and works correctly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants