Skip to content

Commit

Permalink
πŸ› (Dashboard.php): Remove outdated OverlookWidget and replace it with…
Browse files Browse the repository at this point in the history
… OverlookV2Widget

πŸ› (OverlookV2Widget.php): Remove unnecessary code related to OverlookWidget and clean up code
πŸ› (manifest.json): Update CSS file path in manifest.json
πŸ› (overlook-v2.blade.php): Clean up and remove unnecessary code related to OverlookWidget
  • Loading branch information
marco76tv committed Jun 26, 2024
1 parent 7fa7dd9 commit 8b7fc8a
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 92 deletions.
4 changes: 0 additions & 4 deletions Filament/Pages/Dashboard.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,6 @@ public function getHeaderWidgets(): array
{
return [
WidgetsSamples\Bar02Chart::make(),
<<<<<<< HEAD
WidgetsSamples\OverlookWidget::make(),
=======
>>>>>>> 6cf35d5 (add new version of stat chart)
WidgetsSamples\OverlookV2Widget::make(),
WidgetsSamples\Doughnut01Chart::make(),
WidgetsSamples\Sample01Chart::make(),
Expand Down
53 changes: 1 addition & 52 deletions Filament/Widgets/Samples/OverlookV2Widget.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
<?php
<<<<<<< HEAD

declare(strict_types=1);
=======
>>>>>>> 6cf35d5 (add new version of stat chart)
/**
* @see https://github.com/awcodes/overlook/blob/2.x/src/Widgets/OverlookWidget.php
*/
Expand All @@ -12,22 +9,14 @@

use Awcodes\Overlook\Contracts\CustomizeOverlookWidget;
use Awcodes\Overlook\OverlookPlugin;
<<<<<<< HEAD
=======
use Exception;
>>>>>>> 6cf35d5 (add new version of stat chart)
use Filament\Widgets\Widget;
use NumberFormatter;

class OverlookV2Widget extends Widget
{
protected static string $view = 'chart::filament.widgets.samples.overlook-v2';

<<<<<<< HEAD
protected int|string|array $columnSpan = 'full';
=======
protected int | string | array $columnSpan = 'full';
>>>>>>> 6cf35d5 (add new version of stat chart)

public array $data = [];

Expand All @@ -40,11 +29,7 @@ class OverlookV2Widget extends Widget
public array $icons = [];

/**
<<<<<<< HEAD
* @throws \Exception
=======
* @throws Exception
>>>>>>> 6cf35d5 (add new version of stat chart)
*/
public function mount(): void
{
Expand Down Expand Up @@ -84,18 +69,10 @@ public function formatRawCount(string $number): string
}

/**
<<<<<<< HEAD
* @throws \Exception
*/
public function getData(): array
{
=======
* @throws Exception
*/
public function getData(): array
{

>>>>>>> 6cf35d5 (add new version of stat chart)
$includes = [];
$excludes = [];
$icons = $this->icons;
Expand All @@ -107,10 +84,6 @@ public function getData(): array
return collect($rawResources)->filter(function ($resource) use ($excludes) {
return ! in_array($resource, $excludes);
})->transform(function ($resource) use ($icons) {
<<<<<<< HEAD
=======

>>>>>>> 6cf35d5 (add new version of stat chart)
$customIcon = array_search($resource, $icons);

$res = app($resource);
Expand All @@ -121,11 +94,7 @@ public function getData(): array
$rawCount = $res->getOverlookWidgetQuery($widgetQuery)->count();
$title = $res->getOverlookWidgetTitle();
} else {
<<<<<<< HEAD
$rawCount = 666; // $widgetQuery->count();
=======
$rawCount = 666;//$widgetQuery->count();
>>>>>>> 6cf35d5 (add new version of stat chart)
$title = ucfirst($res->getPluralModelLabel());
}

Expand All @@ -134,15 +103,6 @@ public function getData(): array
'name' => $title,
'raw_count' => $this->formatRawcount($rawCount),
'count' => $this->convertCount($rawCount),
<<<<<<< HEAD
'icon' => $customIcon ?: 'heroicon-o-envelope',
'url' => $res->getUrl('index'),
];
}
})
->filter()
// ->when($plugin->shouldSortAlphabetical(), fn ($collection) => $collection->sortBy('name'))
=======
'icon' => $customIcon ?: $res->getNavigationIcon(),
'url' => $res->getUrl('index'),
];
Expand All @@ -151,33 +111,22 @@ public function getData(): array
return null;
})
->filter()
//->when($plugin->shouldSortAlphabetical(), fn ($collection) => $collection->sortBy('name'))
>>>>>>> 6cf35d5 (add new version of stat chart)
// ->when($plugin->shouldSortAlphabetical(), fn ($collection) => $collection->sortBy('name'))
->values()
->toArray();
}

public static function getSort(): int
{
<<<<<<< HEAD
// return OverlookPlugin::get()->getSort();
=======
//return OverlookPlugin::get()->getSort();
>>>>>>> 6cf35d5 (add new version of stat chart)
return 1;
}

public function shouldShowTooltips(string $number): bool
{
<<<<<<< HEAD
// $plugin = OverlookPlugin::get();

// return strlen($number) >= 4 && $plugin->shouldAbbreviateCount() && $plugin->shouldShowTooltips();
=======
//$plugin = OverlookPlugin::get();

//return strlen($number) >= 4 && $plugin->shouldAbbreviateCount() && $plugin->shouldShowTooltips();
>>>>>>> 6cf35d5 (add new version of stat chart)
return true;
}
}
4 changes: 0 additions & 4 deletions Resources/dist/manifest.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
{
"Resources/css/app.css": {
<<<<<<< HEAD
"file": "assets/app-Dh0FPYev.css",
=======
"file": "assets/app-D4rFEOff.css",
>>>>>>> 6cf35d5 (add new version of stat chart)
"src": "Resources/css/app.css",
"isEntry": true
},
Expand Down
32 changes: 0 additions & 32 deletions Resources/views/filament/widgets/samples/overlook-v2.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,41 +11,14 @@ class="gap-6"
<x-filament::grid.column>
<a
href="{{ $resource['url'] }}"
<<<<<<< HEAD
@if ($this->shouldShowTooltips($resource['raw_count']))
=======
@if($this->shouldShowTooltips($resource['raw_count']))
>>>>>>> 6cf35d5 (add new version of stat chart)
x-data x-tooltip="'{{ $resource['raw_count'] }}'"
@endif
>
<x-filament::section class="relative overflow-hidden overlook-card bg-gradient-to-tr group">
<div class="relative z-10">
<div class="text-center overlook-name ">{{ $resource['name'] }}</div>
{{-- <div class="absolute text-3xl font-bold leading-none text-gray-600 overlook-count dark:text-gray-300 bottom-3 right-4">{{ $resource['count'] }}</div> --}}
<<<<<<< HEAD
<div class="grid items-center sm:gap-6 sm:grid-cols-2">
<div class="py-4">
<h3 class="text-lg font-bold">2,318,589</h3>
<div class="flex items-center space-x-1 text-gray-400">
<x-heroicon-o-eye class="size-4" />
<span class="text-sm">Post views</span>
</div>
</div>
<div>
<div class="flex items-center justify-between text-gray-400">
<div class="flex items-center space-x-1">
<x-heroicon-o-chat-bubble-left class="size-4" />
<h4 class="text-gray-700 dark:text-white">412</h4>
</div>
<span class="text-sm">SMS</span>
</div>
<div class="flex items-center justify-between text-gray-400">
<div class="flex items-center space-x-1">
<x-heroicon-o-envelope class="size-4" />
<h4 class="text-gray-700 dark:text-white">1,241</h4>
</div>
=======
<div class="py-4">
<h3 class="text-lg font-bold">2,318,589</h3>
<div class="flex items-center space-x-1 text-gray-400">
Expand All @@ -66,7 +39,6 @@ class="gap-6"
<h4>412</h4>
<div class="flex items-center space-x-1 text-gray-400">
<x-heroicon-o-envelope class="size-4" />
>>>>>>> 6cf35d5 (add new version of stat chart)
<span class="text-sm">Email</span>
</div>
</div>
Expand All @@ -76,11 +48,7 @@ class="gap-6"
<x-filament::icon
:icon="$resource['icon']"
:size="24"
<<<<<<< HEAD
class="absolute w-auto transition left-2 text-primary-500 h-36 z-1 overlook-icon -bottom-12 opacity-10 dark:opacity-10 group-hover:scale-110 group-hover:-rotate-12 group-hover:opacity-30"
=======
class="absolute left-0 w-auto text-gray-500 transition h-36 z-1 overlook-icon -bottom-12 opacity-10 dark:opacity-10 group-hover:scale-110 group-hover:-rotate-12 group-hover:opacity-30"
>>>>>>> 6cf35d5 (add new version of stat chart)
/>
@endif
</x-filament::section>
Expand Down

0 comments on commit 8b7fc8a

Please sign in to comment.