Skip to content

Commit

Permalink
Fix #3
Browse files Browse the repository at this point in the history
  • Loading branch information
Hasnayeen committed Sep 4, 2023
1 parent b391eba commit dce501a
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 17 deletions.
14 changes: 2 additions & 12 deletions .github/ISSUE_TEMPLATE/bug.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ body:
attributes:
label: Package Version
description: What version of our Package are you running? Please be as specific as possible
placeholder: 2.0.0
placeholder: 3.0.0
validations:
required: true
- type: input
Expand All @@ -44,19 +44,9 @@ body:
attributes:
label: Laravel Version
description: What version of Laravel are you running? Please be as specific as possible
placeholder: 9.0.0
placeholder: 10.0.0
validations:
required: true
- type: dropdown
id: operating-systems
attributes:
label: Which operating systems does with happen with?
description: You may select more than one.
multiple: true
options:
- macOS
- Windows
- Linux
- type: textarea
id: notes
attributes:
Expand Down
2 changes: 1 addition & 1 deletion resources/views/filament/pages/themes.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
<x-filament::section>
<x-slot name="heading">
{{ ucfirst($name) }}
@if ($this->getCurrentTheme() === $name)
@if ($this->getCurrentTheme()->getName() === $name)
<span class="ml-2 text-xs bg-primary-200 text-primary-700 px-2 py-1 rounded">Active</span>
@endif
</x-slot>
Expand Down
2 changes: 1 addition & 1 deletion src/Filament/Pages/Themes.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public function getThemes()

public function getCurrentTheme()
{
return app(\Hasnayeen\Themes\Themes::class)->getCurrentTheme()->getName();
return app(\Hasnayeen\Themes\Themes::class)->getCurrentTheme();
}

public function getColors()
Expand Down
4 changes: 3 additions & 1 deletion src/Themes.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ public function getCurrentThemeColor(): array
$color = Filament::getCurrentPanel()->auth()->user()->theme_color ?? null;
}

return ['primary' => Arr::get($this->getCurrentTheme()->getThemeColor(), $color)] ?? $this->getCurrentTheme()->getPrimaryColor();
return Arr::has($this->getCurrentTheme()->getThemeColor(), $color)
? ['primary' => Arr::get($this->getCurrentTheme()->getThemeColor(), $color)]
: $this->getCurrentTheme()->getPrimaryColor();

Check failure on line 70 in src/Themes.php

View workflow job for this annotation

GitHub Actions / phpstan

Call to an undefined method Hasnayeen\Themes\Contracts\HasChangeableColor&Hasnayeen\Themes\Contracts\Theme::getPrimaryColor().

Check failure on line 70 in src/Themes.php

View workflow job for this annotation

GitHub Actions / phpstan

Call to an undefined method Hasnayeen\Themes\Contracts\HasChangeableColor&Hasnayeen\Themes\Contracts\Theme::getPrimaryColor().
}
}
2 changes: 1 addition & 1 deletion src/Themes/DefaultTheme.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,6 @@ public function getThemeColor(): array

public function getPrimaryColor(): array
{
return ['primary' => Color::rgb($this->getThemeColor()['blue'])];
return ['primary' => $this->getThemeColor()['blue']];
}
}
2 changes: 1 addition & 1 deletion src/Themes/Sunset.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@ public function getThemeColor(): array

public function getPrimaryColor(): array
{
return ['primary' => Color::rgb($this->getThemeColor()['blue'])];
return ['primary' => $this->getThemeColor()['blue']];
}
}
11 changes: 11 additions & 0 deletions src/ThemesServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@

namespace Hasnayeen\Themes;

use Composer\InstalledVersions;
use Filament\Support\Assets\Asset;
use Filament\Support\Assets\Css;
use Filament\Support\Facades\FilamentAsset;
use Hasnayeen\Themes\Commands\UpgradeCommand;
use Illuminate\Foundation\Console\AboutCommand;
use Spatie\LaravelPackageTools\Commands\InstallCommand;
use Spatie\LaravelPackageTools\Package;
use Spatie\LaravelPackageTools\PackageServiceProvider;
Expand Down Expand Up @@ -65,6 +67,15 @@ public function packageBooted(): void
if (app()->runningInConsole()) {
FilamentAsset::register($this->getAssets(), $this->getAssetPackageName());
}
if (class_exists(AboutCommand::class) && class_exists(InstalledVersions::class)) {
AboutCommand::add('Themes', [
'Version' => InstalledVersions::getPrettyVersion('hasnayeen/themes'),
'Themes' => app(Themes::class)
->getThemes()
->transform(fn ($item, $key) => $key)
->join(', '),
]);
}
}

protected function getAssetPackageName(): ?string
Expand Down

0 comments on commit dce501a

Please sign in to comment.