Skip to content

Conversation

@notAreYouScared
Copy link
Member

image

@coderabbitai
Copy link

coderabbitai bot commented Jan 17, 2026

📝 Walkthrough

Walkthrough

Adds a GitHub-based egg import tab to the import modal that builds category tabs with CheckboxList items, dispatches InstallEgg jobs per selected egg URL, sends a background-install-started notification, and expands the modal width. Also updates translation import.github to "GitHub".

Changes

Cohort / File(s) Summary
GitHub Egg Import UI
app/Filament/Components/Actions/ImportEggAction.php
Added importEggsFromGitHub(): Tab to render a GitHub tab with category-based tabs and CheckboxList of eggs; integrated into main Tabs. Dispatches InstallEgg jobs for each selected egg URL and sends a background-install-started notification. Modal width set to ScreenExtraLarge. Added/updated UI imports and removed previous Select/afterState logic.
Translation Update
lang/en/admin/egg.php
Changed translation for key import.github from 'Add from Github' to 'GitHub'.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  rect rgba(240,240,255,0.5)
    participant User
    participant FilamentUI as "Filament UI (ImportEggAction)"
    participant Queue as "Queue Dispatcher"
    participant Worker as "Background Worker"
    participant Installer as "InstallEgg Job"
    participant Notifier as "Notification Service"
  end

  User->>FilamentUI: Open import modal, select GitHub eggs and confirm
  FilamentUI->>Queue: Dispatch InstallEgg job for each selected egg URL
  FilamentUI->>Notifier: Send background-install-started notification (count)
  Queue->>Worker: Jobs enqueued
  Worker->>Installer: Execute InstallEgg job (fetch & install egg)
  Installer->>Notifier: Send completion/status notifications
Loading
🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Add github eggs to egg importer' clearly summarizes the main change: introducing GitHub-based egg imports to the egg importer component.
Description check ✅ Passed The description is minimal (only an embedded image) but relates to the changeset by visually demonstrating the new GitHub eggs import UI feature.

✏️ 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.

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: 3

🤖 Fix all issues with AI agents
In `@app/Filament/Components/Actions/ImportEggAction.php`:
- Around line 116-120: The GitHub selections under the eggs.* state are not
being merged into the import list, so update the import construction in
ImportEggAction (the method that currently merges urls and files) to also
include the eggs selections by retrieving $this->getState('eggs', []) (or the
eggs state key used) and merging it into the array that is processed for
imports; ensure any eggs entries are mapped/normalized the same way as
urls/files so GitHub imports are actually queued/run (check
importEggsFromGitHub() usage and the method that builds the $imports array).
- Around line 198-205: The Tab currently created with Tab::make('') uses an
empty key which can break Livewire DOM diffing; update that Tab creation to use
a non-empty unique key (e.g., Tab::make('github')) while keeping the existing
->label(trans('admin/egg.import.github')), ->icon('tabler-brand-github'),
->columnSpanFull(), and ->schema([...]) in the same return block so it matches
the other tabs and avoids key collisions (look for the Tab::make('') occurrence
inside the return Tab block and the surrounding
Tabs::make('egg_tabs')->tabs($tabs) structure).

In `@lang/en/admin/egg.php`:
- Line 27: Update the user-facing label for the 'github' entry in
lang/en/admin/egg.php to use correct brand capitalization; locate the array key
'github' => 'Github' and change the value to 'GitHub' so the displayed label
matches official branding.
🧹 Nitpick comments (1)
app/Filament/Components/Actions/ImportEggAction.php (1)

171-182: Consider modernizing to Laravel 12's native helper methods.

While str_slug and array_sort work with the installed laravel/helpers package, prefer the native Laravel 12 methods: str()->slug() and Arr::sort() for consistency with modern Laravel conventions.

♻️ Proposed replacement
-            $id = str_slug($label, '_');
+            $id = str($label)->slug('_')->toString();
...
-                        ->options(fn () => array_sort($eggs[$label]))
+                        ->options(fn () => Arr::sort($eggs[$label]))

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: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
app/Filament/Components/Actions/ImportEggAction.php (1)

51-76: Rename foreach variable to prevent shadowing $eggs used for URL/file imports.

foreach ($gitHubEggs as $category => $eggs) at line 55 overwrites the $eggs array built from urls/files at line 52, so URL/file imports are skipped after GitHub eggs are processed. When both sources are submitted, only GitHub eggs are imported. Rename the loop variable to $categoryEggs.

Also use Arr::get() instead of array_get() for consistency with the codebase (Arr is already imported and used elsewhere).

Proposed fix
-            $gitHubEggs = array_get($this->data, 'eggs', []);
+            $gitHubEggs = Arr::get($this->data, 'eggs', []);
             $eggs = array_merge(collect($data['urls'])->flatten()->whereNotNull()->unique()->all(), Arr::wrap($data['files']));
 
             if ($gitHubEggs) {
-                foreach ($gitHubEggs as $category => $eggs) {
-                    foreach ($eggs as $downloadUrl) {
+                foreach ($gitHubEggs as $category => $categoryEggs) {
+                    foreach ($categoryEggs as $downloadUrl) {
                         InstallEgg::dispatch($downloadUrl);
                     }
                 }
🧹 Nitpick comments (1)
app/Filament/Components/Actions/ImportEggAction.php (1)

191-204: Use Str::slug / Arr::sort instead of legacy helpers.

str_slug() and array_sort() are not standard in recent Laravel releases; prefer Str::slug() and Arr::sort() unless a helper package is explicitly enabled.

♻️ Proposed refactor
+use Illuminate\Support\Str;
...
-            $id = str_slug($label, '_');
+            $id = Str::slug($label, '_');
...
-                        ->options(fn () => array_sort($eggs[$label]))
+                        ->options(fn () => Arr::sort($eggs[$label]))

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: 1

🤖 Fix all issues with AI agents
In `@app/Filament/Components/Actions/ImportEggAction.php`:
- Line 55: The foreach in ImportEggAction.php is declaring an unused key
variable $category; change the loop to iterate without the key by replacing
"foreach ($gitHubEggs as $category => $sortedEggs)" with "foreach ($gitHubEggs
as $sortedEggs)" in the ImportEggAction class where $gitHubEggs is processed so
only $sortedEggs is used.

@notAreYouScared notAreYouScared merged commit 15172b1 into main Jan 18, 2026
32 checks passed
@notAreYouScared notAreYouScared deleted the charles/update-egg-list branch January 18, 2026 21:33
@github-actions github-actions bot locked and limited conversation to collaborators Jan 18, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants