label(__('panel.preview.label')) ->icon('heroicon-o-eye') ->color('gray') ->modalHeading(__('panel.preview.heading')) ->modalDescription(__('panel.preview.hint', ['hours' => PreviewLink::HOURS])) ->modalSubmitAction(false) // Nothing to preview without a public address to preview it at. ->visible(fn (Model $record) => filled(array_filter( array_map( fn (string $locale) => $record->getTranslation('slug', $locale, false), array_keys((array) config('locales.supported')), ), ))) ->modalContent(fn (Model $record) => view('filament.partials.preview-links', [ 'links' => collect(config('locales.supported')) ->mapWithKeys(fn (array $meta, string $locale) => [ ($meta['native'] ?? $locale) => PreviewLink::for($record, $type, $locale), ]) ->filter() ->all(), ])); } }