Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,18 @@

All notable changes to this project will be documented in this file.

## [1.7.0] - 2026-03-07

### Added
- Game description field with Markdown editor support
- Card Type print settings: per-type background image and overlay style for PDF export
- Card Type background and overlay take priority over Deck settings in printed PDFs
- Dashboard widget showing the latest version changelog entries

### Changed
- Admin table filters for Cards, Card Types, Hexas, Figures, and Decks now show only the current user's games and types
- Admin cards table now defaults to newest first

## [1.6.0] - 2026-03-07

### Changed
Expand Down
5 changes: 3 additions & 2 deletions app/Filament/Resources/CardResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ public static function form(Form $form): Form
public static function table(Table $table): Table
{
return $table
->defaultSort('created_at', 'desc')
->columns([
Tables\Columns\ImageColumn::make('image')
->label('Image')
Expand Down Expand Up @@ -152,12 +153,12 @@ public static function table(Table $table): Table
->filters([
Tables\Filters\SelectFilter::make('game_id')
->label('Game')
->relationship('game', 'name')
->relationship('game', 'name', fn (Builder $query) => $query->where('creator_id', auth()->id()))
->preload(),

Tables\Filters\SelectFilter::make('type_id')
->label('Type')
->relationship('cardType', 'name')
->relationship('cardType', 'name', fn (Builder $query) => $query->where('user_id', auth()->id()))
->preload(),
])
->actions([
Expand Down
28 changes: 27 additions & 1 deletion app/Filament/Resources/CardTypeResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
use App\Models\CardType;
use App\Models\Game;
use Filament\Forms;
use Filament\Forms\Components\FileUpload;
use Filament\Forms\Form;
use Filament\Resources\Resource;
use Filament\Tables;
Expand Down Expand Up @@ -86,6 +87,31 @@ public static function form(Form $form): Form
->columnSpanFull(),
])
->collapsible(),

Forms\Components\Section::make('Print Settings')
->description('Customize how cards of this type look when printed as a PDF')
->schema([
FileUpload::make('pdf_background')
->label('Card Background Image')
->disk('public')
->directory('pdf-backgrounds')
->image()
->imageEditor()
->maxSize(5120)
->helperText('Overrides the system default. Appears behind each card illustration in the printed PDF.')
->columnSpanFull(),

Forms\Components\Select::make('pdf_overlay')
->label('Overlay Style')
->options([
'dark' => 'Dark — dark overlay, light text',
'light' => 'Light — light overlay, dark text',
])
->placeholder('Use system default')
->helperText('Overrides the system default overlay style for this card type only.')
->columnSpanFull(),
])
->collapsible(),
]);
}

Expand Down Expand Up @@ -151,7 +177,7 @@ public static function table(Table $table): Table
->filters([
Tables\Filters\SelectFilter::make('game_id')
->label('Game')
->relationship('game', 'name')
->relationship('game', 'name', fn (Builder $query) => $query->where('creator_id', auth()->id()))
->preload()
->multiple(),

Expand Down
2 changes: 1 addition & 1 deletion app/Filament/Resources/DeckResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ public static function table(Table $table): Table
->filters([
Tables\Filters\SelectFilter::make('game_id')
->label('Game')
->relationship('game', 'name')
->relationship('game', 'name', fn (Builder $query) => $query->where('creator_id', auth()->id()))
->preload(),
])
->actions([
Expand Down
2 changes: 1 addition & 1 deletion app/Filament/Resources/FigureResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ public static function table(Table $table): Table
->filters([
Tables\Filters\SelectFilter::make('game_id')
->label('Game')
->relationship('game', 'name')
->relationship('game', 'name', fn (Builder $query) => $query->where('creator_id', auth()->id()))
->preload()
->multiple(),
])
Expand Down
15 changes: 15 additions & 0 deletions app/Filament/Resources/GameResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,21 @@ public static function form(Form $form): Form
Forms\Components\TextInput::make('name')
->required()
->maxLength(255),

Forms\Components\MarkdownEditor::make('description')
->toolbarButtons([
'bold',
'italic',
'bulletList',
'orderedList',
'heading',
'link',
'blockquote',
'undo',
'redo',
])
->nullable()
->columnSpanFull(),
]);
}

Expand Down
2 changes: 1 addition & 1 deletion app/Filament/Resources/HexaResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ public static function table(Table $table): Table
->filters([
Tables\Filters\SelectFilter::make('game_id')
->label('Game')
->relationship('game', 'name')
->relationship('game', 'name', fn (Builder $query) => $query->where('creator_id', auth()->id()))
->preload()
->multiple(),
])
Expand Down
86 changes: 86 additions & 0 deletions app/Filament/Widgets/LatestChangelogWidget.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
<?php
/**
* Webtech-solutions 2025, All rights reserved.
*/

namespace App\Filament\Widgets;

use Filament\Widgets\Widget;

class LatestChangelogWidget extends Widget
{
protected static ?int $sort = -2;

protected static bool $isDiscovered = false;

protected static string $view = 'filament.widgets.latest-changelog-widget';

protected int | string | array $columnSpan = [
'default' => 2,
'sm' => 2,
'md' => 2,
'lg' => 2,
'xl' => 2,
];

public function getViewData(): array
{
return [
'version' => $this->parseLatestVersion(),
];
}

protected function parseLatestVersion(): ?array
{
$changelogPath = base_path('CHANGELOG.md');

if (! file_exists($changelogPath)) {
return null;
}

$content = file_get_contents($changelogPath);
$lines = explode("\n", $content);

$version = null;
$date = null;
$sections = [];
$currentSection = null;
$inVersion = false;

foreach ($lines as $line) {
// Match version header: ## [x.x.x] - YYYY-MM-DD
if (preg_match('/^## \[(\d+\.\d+\.\d+)\] - (\d{4}-\d{2}-\d{2})/', $line, $matches)) {
if ($inVersion) {
// We've hit the next version, stop
break;
}
$version = $matches[1];
$date = $matches[2];
$inVersion = true;
continue;
}

if (! $inVersion) {
continue;
}

// Match section header: ### Added / ### Changed / ### Fixed
if (preg_match('/^### (.+)/', $line, $matches)) {
$currentSection = $matches[1];
$sections[$currentSection] = [];
continue;
}

// Match list item
if ($currentSection && preg_match('/^- (.+)/', $line, $matches)) {
$sections[$currentSection][] = $matches[1];
}
}

if (! $version) {
return null;
}

return compact('version', 'date', 'sections');
}
}
2 changes: 2 additions & 0 deletions app/Models/CardType.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ class CardType extends Model
'name',
'typetext',
'description',
'pdf_background',
'pdf_overlay',
];

public function user()
Expand Down
1 change: 1 addition & 0 deletions app/Models/Game.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ class Game extends Model
protected $fillable = [
'creator_id',
'name',
'description',
];

public function creator()
Expand Down
34 changes: 25 additions & 9 deletions app/Services/DeckPdfService.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public function expandCards(Deck $deck): array
/**
* Resolve the background image for the card layer:
* - If the card has its own illustration, use that.
* - Otherwise fall through: deck override → system default → built-in placeholder.
* - Otherwise fall through: card type override → deck override → system default → built-in placeholder.
*/
protected function resolveImagePath(Card $card, Deck $deck): string
{
Expand All @@ -75,15 +75,23 @@ protected function resolveImagePath(Card $card, Deck $deck): string
}
}

// 1. Deck override
// 1. Card type override
if (!empty($card->cardType?->pdf_background)) {
$path = Storage::disk('public')->path($card->cardType->pdf_background);
if (file_exists($path)) {
return $path;
}
}

// 2. Deck override
if (!empty($deck->pdf_background)) {
$path = Storage::disk('public')->path($deck->pdf_background);
if (file_exists($path)) {
return $path;
}
}

// 2. System default
// 3. System default
$setting = WebsiteSetting::get('card_pdf_background');
if (!empty($setting)) {
$path = Storage::disk('public')->path($setting);
Expand All @@ -92,7 +100,7 @@ protected function resolveImagePath(Card $card, Deck $deck): string
}
}

// 3. Built-in fallback
// 4. Built-in fallback
return public_path('images/cardsforge-back.png');
}

Expand All @@ -108,17 +116,25 @@ public function download(Deck $deck): \Symfony\Component\HttpFoundation\Streamed
$cardWidth = $deck->game->card_width_mm ?? 63.5;
$cardHeight = $deck->game->card_height_mm ?? 88.9;

// Resolve overlay mode: deck → system default → 'dark'
$overlayMode = $deck->pdf_overlay
?? WebsiteSetting::get('card_pdf_overlay', 'dark');
// System default overlay fallback
$systemOverlay = WebsiteSetting::get('card_pdf_overlay', 'dark');

// Top-level overlay for CSS stylesheet (deck → system default)
$overlayMode = $deck->pdf_overlay ?? $systemOverlay;

$pagesData = [];
foreach ($pages as $pageCards) {
$pageItems = [];
foreach ($pageCards as $card) {
// Per-card overlay: card type → deck → system default
$cardOverlay = $card->cardType?->pdf_overlay
?? $deck->pdf_overlay
?? $systemOverlay;

$pageItems[] = [
'card' => $card,
'imagePath' => $this->resolveImagePath($card, $deck),
'card' => $card,
'imagePath' => $this->resolveImagePath($card, $deck),
'overlayMode' => $cardOverlay,
];
}
$pagesData[] = $pageItems;
Expand Down
2 changes: 1 addition & 1 deletion config/app_version.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
|
*/

'version' => env('APP_VERSION', 'v1.6.0-stable'),
'version' => env('APP_VERSION', 'v1.7.0'),

'release_date' => '2026-03-07',

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('games', function (Blueprint $table) {
$table->text('description')->nullable()->after('name');
});
}

/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('games', function (Blueprint $table) {
$table->dropColumn('description');
});
}
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('cardtypes', function (Blueprint $table) {
$table->string('pdf_background')->nullable()->after('description');
});
}

/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('cardtypes', function (Blueprint $table) {
$table->dropColumn('pdf_background');
});
}
};
Loading
Loading