Skip to content

Commit 22db1e6

Browse files
✨ Enhance Wall of Love component with user image handling and improved layout
1 parent 02965c1 commit 22db1e6

File tree

2 files changed

+17
-7
lines changed

2 files changed

+17
-7
lines changed

resources/views/components/wall-of-love/early-adopter-card.blade.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,11 @@
44
'url' => '',
55
'image' => '',
66
'featured' => false,
7+
'hasUserImage' => false,
78
])
89

910
<article
10-
class="group mt-3 inline-block break-inside-avoid overflow-hidden rounded-2xl text-center transition duration-300 ease-out will-change-transform hover:scale-102 xl:mt-5"
11+
class="group w-full break-inside-avoid overflow-hidden rounded-2xl text-center transition duration-300 ease-out will-change-transform not-last:mb-3 hover:scale-102 xl:not-last:mb-5"
1112
itemscope
1213
>
1314
<figure class="grid">
@@ -32,7 +33,7 @@ class="capitalize transition duration-300 ease-out will-change-transform group-h
3233
</h3>
3334
<p
3435
@class([
35-
'opacity-50',
36+
'truncate opacity-50',
3637
'text-sm' => $featured,
3738
'text-xs' => ! $featured,
3839
])
@@ -53,9 +54,10 @@ class="capitalize transition duration-300 ease-out will-change-transform group-h
5354
decoding="async"
5455
itemprop="image"
5556
@class([
56-
'relative z-10 self-center justify-self-center object-cover brightness-80 transition duration-300 [grid-area:1/-1] group-hover:brightness-100',
57+
'relative z-10 w-full self-center justify-self-center object-cover brightness-80 transition duration-300 [grid-area:1/-1] group-hover:brightness-100',
5758
'aspect-[1/1.3] xl:aspect-[1/1.5]' => $featured,
5859
'aspect-square max-h-50 xl:max-h-none' => ! $featured,
60+
'grayscale-50 dark:brightness-50' => ! $hasUserImage,
5961
])
6062
/>
6163

resources/views/wall-of-love.blade.php

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -116,17 +116,24 @@ class="mx-auto mt-5 max-w-2xl text-center text-base/relaxed text-gray-600 sm:tex
116116
->inRandomOrder()
117117
->get();
118118
119+
// Check if any submissions have user-uploaded images
120+
$hasAnyUserImages = $approvedSubmissions->contains(fn ($s) => ! empty($s->photo_path));
121+
119122
// Convert approved submissions to the format expected by the component
120123
$earlyAdopters = $approvedSubmissions
121-
->map(function ($submission) {
124+
->map(function ($submission) use ($hasAnyUserImages) {
125+
$hasUserImage = ! empty($submission->photo_path);
126+
122127
return [
123128
'name' => $submission->name,
124129
'title' => $submission->company,
125130
'url' => $submission->url,
126-
'image' => $submission->photo_path
131+
'image' => $hasUserImage
127132
? asset('storage/' . $submission->photo_path)
128-
: 'https://avatars.laravel.cloud/' . rand(1, 70) . '?vibe=' . array_rand(['ocean', 'crystal', 'bubble', 'forest', 'sunset']),
129-
'featured' => rand(0, 4) === 0, // Randomly feature about 20% of submissions
133+
: 'https://avatars.laravel.cloud/' . rand(1, 70) . '?vibe=' . array_rand(['ocean', 'stealth', 'bubble', 'ice']),
134+
'hasUserImage' => $hasUserImage,
135+
// Only allow featured if has user image (unless no submissions have images)
136+
'featured' => ($hasAnyUserImages ? $hasUserImage : true) && rand(0, 4) === 0,
130137
'testimonial' => $submission->testimonial,
131138
];
132139
})
@@ -144,6 +151,7 @@ class="relative z-10 mt-10 grid place-items-center 2xs:block 2xs:columns-[10rem]
144151
:url="$adopter['url'] ?? null"
145152
:title="$adopter['title'] ?? null"
146153
:featured="$adopter['featured'] ?? false"
154+
:hasUserImage="$adopter['hasUserImage'] ?? false"
147155
/>
148156
@endforeach
149157
</div>

0 commit comments

Comments
 (0)