mirror of
https://github.com/AnimeThemes/animethemes-server.git
synced 2026-07-11 01:24:46 +02:00
style(filament): the panel should use the full width (#684)
This commit is contained in:
@@ -56,7 +56,7 @@ class DiscordThreadUpdated extends AdminUpdatedEvent
|
||||
protected function updateThread(): void
|
||||
{
|
||||
Http::withHeaders(['x-api-key' => Config::get('services.discord.api_key')])
|
||||
->put(Config::get('services.discord.api_url') . '/thread', $this->getModel())
|
||||
->put(Config::get('services.discord.api_url') . '/thread', $this->getModel()->toArray())
|
||||
->throw();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ class DiscordVideoNotificationBulkAction extends BaseBulkAction
|
||||
/**
|
||||
* Handle the action.
|
||||
*
|
||||
* @param Collection<int, Video> $videos
|
||||
* @param Collection $videos
|
||||
* @param array $fields
|
||||
*/
|
||||
public function handle(Collection $videos, array $fields): void
|
||||
|
||||
@@ -10,6 +10,7 @@ use App\Models\BaseModel;
|
||||
use Filament\Support\Enums\FontWeight;
|
||||
use Filament\Tables\Columns\TextColumn as ColumnsTextColumn;
|
||||
use Illuminate\Support\Arr;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
/**
|
||||
* Class TextColumn.
|
||||
@@ -22,23 +23,25 @@ class TextColumn extends ColumnsTextColumn
|
||||
* @param class-string<BaseResource> $resourceRelated
|
||||
* @param string $relation
|
||||
* @param bool|null $shouldUseName
|
||||
* @param int|null $limit
|
||||
* @return static
|
||||
*/
|
||||
public function urlToRelated(string $resourceRelated, string $relation, ?bool $shouldUseName = false): static
|
||||
public function urlToRelated(string $resourceRelated, string $relation, ?bool $shouldUseName = false, ?int $limit = null): static
|
||||
{
|
||||
return $this
|
||||
->weight(FontWeight::SemiBold)
|
||||
->html()
|
||||
->hiddenOn(BaseRelationManager::class)
|
||||
->url(function (BaseModel $record) use ($resourceRelated, $relation, $shouldUseName) {
|
||||
->url(function (BaseModel $record) use ($resourceRelated, $relation, $shouldUseName, $limit) {
|
||||
foreach (explode('.', $relation) as $element) {
|
||||
$record = Arr::get($record, $element);
|
||||
if ($record === null) return null;
|
||||
}
|
||||
|
||||
$this->formatStateUsing(function ($state) use ($shouldUseName, $record) {
|
||||
$this->formatStateUsing(function ($state) use ($shouldUseName, $record, $limit) {
|
||||
$name = $shouldUseName ? $record->getName() : $state;
|
||||
return "<p style='color: rgb(64, 184, 166);'>{$name}</p>";
|
||||
$nameLimited = Str::limit($name, $limit ?? 100);
|
||||
return "<p style='color: rgb(64, 184, 166);'>{$nameLimited}</p>";
|
||||
});
|
||||
|
||||
return (new $resourceRelated)::getUrl('edit', ['record' => $record]);
|
||||
|
||||
@@ -253,12 +253,16 @@ class Anime extends BaseResource
|
||||
->label(__('filament.fields.anime.name.name'))
|
||||
->sortable()
|
||||
->copyableWithMessage()
|
||||
->toggleable(),
|
||||
->toggleable()
|
||||
->limit(50)
|
||||
->tooltip(fn (TextColumn $column) => $column->getState()),
|
||||
|
||||
TextColumn::make(AnimeModel::ATTRIBUTE_SLUG)
|
||||
->label(__('filament.fields.anime.slug.name'))
|
||||
->sortable()
|
||||
->toggleable(),
|
||||
->toggleable()
|
||||
->limit(20)
|
||||
->tooltip(fn (TextColumn $column) => $column->getState()),
|
||||
|
||||
TextColumn::make(AnimeModel::ATTRIBUTE_YEAR)
|
||||
->label(__('filament.fields.anime.year.name'))
|
||||
|
||||
@@ -163,7 +163,8 @@ class Synonym extends BaseResource
|
||||
TextColumn::make(SynonymModel::RELATION_ANIME.'.'.AnimeModel::ATTRIBUTE_NAME)
|
||||
->label(__('filament.resources.singularLabel.anime'))
|
||||
->toggleable()
|
||||
->urlToRelated(AnimeResource::class, SynonymModel::RELATION_ANIME),
|
||||
->urlToRelated(AnimeResource::class, SynonymModel::RELATION_ANIME, limit: 40)
|
||||
->tooltip(fn (TextColumn $column) => $column->getState()),
|
||||
|
||||
TextColumn::make(SynonymModel::ATTRIBUTE_TYPE)
|
||||
->label(__('filament.fields.anime_synonym.type.name'))
|
||||
@@ -173,7 +174,9 @@ class Synonym extends BaseResource
|
||||
TextColumn::make(SynonymModel::ATTRIBUTE_TEXT)
|
||||
->label(__('filament.fields.anime_synonym.text.name'))
|
||||
->sortable()
|
||||
->toggleable(),
|
||||
->toggleable()
|
||||
->limit(70)
|
||||
->tooltip(fn (TextColumn $column) => $column->getState()),
|
||||
])
|
||||
->searchable()
|
||||
->defaultSort(SynonymModel::ATTRIBUTE_ID, 'desc')
|
||||
|
||||
@@ -219,7 +219,8 @@ class Theme extends BaseResource
|
||||
TextColumn::make(ThemeModel::RELATION_ANIME.'.'.AnimeModel::ATTRIBUTE_NAME)
|
||||
->label(__('filament.resources.singularLabel.anime'))
|
||||
->toggleable()
|
||||
->urlToRelated(AnimeResource::class, ThemeModel::RELATION_ANIME),
|
||||
->urlToRelated(AnimeResource::class, ThemeModel::RELATION_ANIME, limit: 30)
|
||||
->tooltip(fn (TextColumn $column) => $column->getState()),
|
||||
|
||||
TextColumn::make(ThemeModel::ATTRIBUTE_ID)
|
||||
->label(__('filament.fields.base.id'))
|
||||
@@ -252,7 +253,8 @@ class Theme extends BaseResource
|
||||
->label(__('filament.resources.singularLabel.song'))
|
||||
->toggleable()
|
||||
->placeholder('-')
|
||||
->urlToRelated(SongResource::class, ThemeModel::RELATION_SONG),
|
||||
->urlToRelated(SongResource::class, ThemeModel::RELATION_SONG, limit: 30)
|
||||
->tooltip(fn (TextColumn $column) => $column->getState()),
|
||||
])
|
||||
->searchable()
|
||||
->defaultSort(ThemeModel::ATTRIBUTE_ID, 'desc')
|
||||
|
||||
@@ -234,7 +234,8 @@ class Entry extends BaseResource
|
||||
->label(__('filament.resources.singularLabel.anime'))
|
||||
->toggleable()
|
||||
->placeholder('-')
|
||||
->urlToRelated(AnimeResource::class, EntryModel::RELATION_ANIME),
|
||||
->urlToRelated(AnimeResource::class, EntryModel::RELATION_ANIME, limit: 30)
|
||||
->tooltip(fn (TextColumn $column) => $column->getState()),
|
||||
|
||||
TextColumn::make(EntryModel::ATTRIBUTE_THEME)
|
||||
->label(__('filament.resources.singularLabel.anime_theme'))
|
||||
|
||||
@@ -36,7 +36,6 @@ use Filament\Infolists\Infolist;
|
||||
use Filament\Resources\RelationManagers\RelationGroup;
|
||||
use Filament\Support\Enums\MaxWidth;
|
||||
use Filament\Tables\Actions\ActionGroup;
|
||||
use Filament\Tables\Actions\BulkActionGroup;
|
||||
use Filament\Tables\Columns\IconColumn;
|
||||
use Filament\Tables\Filters\Filter;
|
||||
use Filament\Tables\Filters\SelectFilter;
|
||||
@@ -412,12 +411,11 @@ class Video extends BaseResource
|
||||
return array_merge(
|
||||
parent::getBulkActions(),
|
||||
[
|
||||
BulkActionGroup::make([
|
||||
DiscordVideoNotificationBulkAction::make('discord-notification')
|
||||
->label(__('filament.bulk_actions.discord.notification.name'))
|
||||
->requiresConfirmation()
|
||||
->authorize('create', DiscordThread::class),
|
||||
]),
|
||||
DiscordVideoNotificationBulkAction::make('discord-notification')
|
||||
->label(__('filament.bulk_actions.discord.notification.name'))
|
||||
->icon(__('filament.bulk_actions.discord.notification.icon'))
|
||||
->requiresConfirmation()
|
||||
->authorize('create', DiscordThread::class),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@ use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
* Class DiscordThread.
|
||||
*
|
||||
* @property Anime $anime
|
||||
* @property int $anime_id
|
||||
* @property int $thread_id
|
||||
* @property string $name
|
||||
*/
|
||||
|
||||
@@ -11,6 +11,7 @@ use Filament\Http\Middleware\DispatchServingFilamentEvent;
|
||||
use Filament\Panel;
|
||||
use Filament\PanelProvider;
|
||||
use Filament\Support\Colors\Color;
|
||||
use Filament\Support\Enums\MaxWidth;
|
||||
use Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse;
|
||||
use Illuminate\Cookie\Middleware\EncryptCookies;
|
||||
use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken;
|
||||
@@ -31,7 +32,11 @@ class FilamentPanelProvider extends PanelProvider
|
||||
->path(Config::get('filament.path'))
|
||||
->domain(Config::get('filament.domain'))
|
||||
->login()
|
||||
->brandLogo(asset('img/logo.svg'))
|
||||
->darkModeBrandLogo(asset('img/gray-logo.svg'))
|
||||
->brandLogoHeight('1.8rem')
|
||||
->globalSearch(GlobalSearchScoutProvider::class)
|
||||
->maxContentWidth(MaxWidth::Full)
|
||||
->databaseNotifications()
|
||||
->sidebarCollapsibleOnDesktop()
|
||||
->profile()
|
||||
|
||||
@@ -412,6 +412,7 @@ return [
|
||||
],
|
||||
'discord' => [
|
||||
'notification' => [
|
||||
'icon' => 'heroicon-o-bell',
|
||||
'name' => 'Create Discord Notification',
|
||||
'type' => [
|
||||
'help' => 'Are they new videos or replacement?',
|
||||
@@ -426,8 +427,8 @@ return [
|
||||
],
|
||||
'dashboards' => [
|
||||
'icon' => [
|
||||
'admin' => 'heroicon-m-home',
|
||||
'wiki' => 'heroicon-m-home',
|
||||
'admin' => 'heroicon-m-chart-bar',
|
||||
'wiki' => 'heroicon-m-chart-bar',
|
||||
],
|
||||
'label' => [
|
||||
'admin' => 'Admin',
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 160 86.6" class="h-6" fill="currentColor"><polygon points="56.25 32.48 56.25 75.78 75 86.6 75 0 0 43.3 18.75 54.13 56.25 32.48" fill="#ccc"/><polygon points="103.75 32.48 141.25 54.13 160 43.3 85 0 85 86.6 103.75 75.78 103.75 32.48" fill="#ccc"/></svg>
|
||||
|
After Width: | Height: | Size: 306 B |
Reference in New Issue
Block a user