Skip to content

Add view-all link in Trending section on landing page #8824

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 19, 2025
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
28 changes: 14 additions & 14 deletions app/lib/frontend/templates/views/landing/page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ d.Node landingPageNode({
title: 'Trending packages',
info: d.text('Top trending packages in the last 30 days'),
content: miniListNode('most-trending', trendingPackages!),
viewAllUrl: urls.listingByTrending(),
viewAllEvent: 'landing-trending-view-all',
viewAllTitle: 'Search trending packages',
)
Expand Down Expand Up @@ -123,12 +124,12 @@ d.Node _block({
required String title,
required d.Node info,
required d.Node content,
String? viewAllUrl,
required String viewAllUrl,
required String viewAllEvent,
String viewAllLabel = 'View all',
required String viewAllTitle,
}) {
final isExternalUrl = viewAllUrl != null && !viewAllUrl.startsWith('/');
final isExternalUrl = !viewAllUrl.startsWith('/');
return d.div(
classes: ['home-block', 'home-block-$shortId'],
children: [
Expand All @@ -145,19 +146,18 @@ d.Node _block({
d.h1(classes: ['home-block-title'], text: title),
d.p(classes: ['home-block-context-info'], child: info),
content,
if (viewAllUrl != null)
d.div(
classes: ['home-block-view-all'],
child: d.a(
classes: ['home-block-view-all-link'],
href: viewAllUrl,
target: isExternalUrl ? '_blank' : null,
rel: isExternalUrl ? 'noopener nofollow' : 'nofollow',
text: viewAllLabel,
title: viewAllTitle,
attributes: {'data-ga-click-event': viewAllEvent},
),
d.div(
classes: ['home-block-view-all'],
child: d.a(
classes: ['home-block-view-all-link'],
href: viewAllUrl,
target: isExternalUrl ? '_blank' : null,
rel: isExternalUrl ? 'noopener nofollow' : 'nofollow',
text: viewAllLabel,
title: viewAllTitle,
attributes: {'data-ga-click-event': viewAllEvent},
),
),
],
),
// image: after content
Expand Down