Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,13 @@
use Filament\Schemas\Schema;
use Filament\Tables;
use Filament\Tables\Table;
use Illuminate\Contracts\Support\Htmlable;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Http\UploadedFile;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\HtmlString;
use Illuminate\Validation\ValidationException;
use Spatie\Activitylog\ActivityLogger;

Expand Down Expand Up @@ -472,31 +474,40 @@ private function getScreenshotValidationRules(): array
]);
}

private function getScreenshotHelperText(): ?string
private function getScreenshotHelperText(): ?Htmlable
{
$system = $this->getOwnerRecord()?->system;
$resolutions = $system?->screenshot_resolutions;
if (empty($resolutions)) {
return null;
}

$formatted = collect($resolutions)
->map(fn (array $r) => "{$r['width']}x{$r['height']}")
->join(', ');
$supportsUpscaling = (bool) $system->supports_upscaled_screenshots;
$isSingleResolution = count($resolutions) === 1;

$label = count($resolutions) > 1 ? 'Accepted resolutions' : 'Expected resolution';
$natives = collect($resolutions)
->map(fn (array $r) => "{$r['width']}×{$r['height']}")
->join(', ');

$multiplesNote = $system->supports_upscaled_screenshots
? ' (or 2x/3x integer multiples)'
: '';
$lines = [];

$text = "{$label} for {$system->name}: {$formatted}{$multiplesNote}";
if ($supportsUpscaling) {
$lines[] = ['label' => 'Recommended', 'value' => "2× or 3× native, captured at your emulator's internal resolution"];
$lines[] = ['label' => 'Native', 'value' => $natives];
} else {
$label = $isSingleResolution ? 'Expected resolution' : 'Accepted resolutions';
$lines[] = ['label' => $label, 'value' => $natives];
}

if ($system->has_analog_tv_output) {
$text .= '. SMPTE 601 capture resolutions (704x480, 720x480, 720x486, 704x576, 720x576) are also accepted.';
$lines[] = ['label' => 'Also accepted', 'value' => 'SMPTE 601 capture sizes'];
}

return $text;
$html = collect($lines)
->map(fn (array $line) => '<span class="font-medium">' . e($line['label']) . ':</span> ' . e($line['value']))
->join('<br>');

return new HtmlString($html);
}

private function shouldShowArchivedScreenshots(): bool
Expand Down
Loading