orchidsoftware / platform

Orchid is a @laravel package that allows for rapid application development of back-office applications, admin/user panels, and dashboards.
https://orchid.software
MIT License
4.26k stars 631 forks source link

Icon not found on notification page #2848

Open olexin-pro opened 6 days ago

olexin-pro commented 6 days ago

Describe the bug Error on notifications page:

Orchid\Icons\IconFinder::getContent(): Argument #3 ($dir) must be of type string, bool given, called in /opt/apps/app-source/vendor/orchid/blade-icons/src/IconFinder.php on line 66

To Reproduce Steps to reproduce the behavior:

  1. Open the notifications page when there are no notifications

Expected behavior Apparently it now throws an exception when there is no icon, I didn’t notice this behavior before

Server (please complete the following information):

Additional context The iconNotFound method should return bs.bell in the NotificationTable class:

<?php

declare(strict_types=1);

namespace Orchid\Platform\Http\Layouts;

use Orchid\Screen\Layouts\Table;
use Orchid\Screen\TD;

class NotificationTable extends Table
{
    /**
     * Data source.
     *
     * @var string
     */
    public $target = 'notifications';

    /**
     * @return TD[]
     */
    public function columns(): array
    {
        return [
            TD::make('Message', __('Messages'))
                ->cantHide()
                ->render(static fn ($notification) => view('platform::partials.notification', [
                    'notification' => $notification,
                ])),
        ];
    }

    public function textNotFound(): string
    {
        return __('No notifications');
    }

    public function iconNotFound(): string
    {
        return 'bell';
    }

    public function subNotFound(): string
    {
        return __('You currently have no notifications, but maybe they will appear later.');
    }
}
tabuna commented 2 days ago

Thank you for pointing out the missing prefix on the icon. I was unable to reproduce this issue on the latest version, likely due to the orchid/blade-icons package (tested on version 4). To prevent this issue, I have added the bs prefix, which is the default for Bootstrap icons. This prefix is available starting from version 14.26.1, so please update your package.