Skip to content

Commit 233761f

Browse files
committed
Merge remote-tracking branch 'origin/main' into ultra
# Conflicts: # resources/views/components/dashboard-menu.blade.php # resources/views/customer/dashboard.blade.php # resources/views/customer/licenses/index.blade.php # resources/views/customer/licenses/list.blade.php # resources/views/customer/licenses/show.blade.php # resources/views/customer/purchased-plugins/index.blade.php
2 parents 740c169 + ec1b4d7 commit 233761f

29 files changed

+402
-2815
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?php
2+
3+
namespace App\Livewire\Customer\WallOfLove;
4+
5+
use App\Models\WallOfLoveSubmission;
6+
use Livewire\Attributes\Layout;
7+
use Livewire\Attributes\Title;
8+
use Livewire\Component;
9+
10+
#[Layout('components.layouts.dashboard')]
11+
#[Title('Edit Your Listing')]
12+
class Edit extends Component
13+
{
14+
public WallOfLoveSubmission $wallOfLoveSubmission;
15+
16+
public function mount(WallOfLoveSubmission $wallOfLoveSubmission): void
17+
{
18+
abort_if($wallOfLoveSubmission->user_id !== auth()->id(), 403);
19+
}
20+
}

app/Livewire/WallOfLoveBanner.php

Lines changed: 0 additions & 35 deletions
This file was deleted.

app/Livewire/WallOfLoveSubmissionForm.php

Lines changed: 65 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,34 +10,83 @@ class WallOfLoveSubmissionForm extends Component
1010
{
1111
use WithFileUploads;
1212

13+
public ?WallOfLoveSubmission $submission = null;
14+
15+
public bool $isEditing = false;
16+
1317
public $name = '';
1418

1519
public $company = '';
1620

1721
public $photo;
1822

23+
public ?string $existingPhoto = null;
24+
1925
public $url = '';
2026

2127
public $testimonial = '';
2228

23-
protected $rules = [
24-
'name' => 'required|string|max:255',
25-
'company' => 'nullable|string|max:255',
26-
'photo' => 'nullable|image|max:2048', // 2MB max
27-
'url' => 'nullable|url|max:255',
28-
'testimonial' => 'nullable|string|max:1000',
29-
];
29+
public function mount(?WallOfLoveSubmission $submission = null): void
30+
{
31+
if ($submission && $submission->exists && $submission->user_id === auth()->id()) {
32+
$this->submission = $submission;
33+
$this->isEditing = true;
34+
$this->name = $submission->name;
35+
$this->company = $submission->company ?? '';
36+
$this->existingPhoto = $submission->photo_path;
37+
$this->url = $submission->url ?? '';
38+
$this->testimonial = $submission->testimonial ?? '';
39+
} else {
40+
// Pre-fill name if user has a name
41+
$this->name = auth()->user()->name ?? '';
42+
}
43+
}
3044

31-
public function mount()
45+
public function rules(): array
3246
{
33-
// Pre-fill name if user has a name
34-
$this->name = auth()->user()->name ?? '';
47+
if ($this->isEditing) {
48+
return [
49+
'company' => 'nullable|string|max:255',
50+
'photo' => 'nullable|image|max:2048',
51+
];
52+
}
53+
54+
return [
55+
'name' => 'required|string|max:255',
56+
'company' => 'nullable|string|max:255',
57+
'photo' => 'nullable|image|max:2048',
58+
'url' => 'nullable|url|max:255',
59+
'testimonial' => 'nullable|string|max:1000',
60+
];
3561
}
3662

37-
public function submit()
63+
public function submit(): mixed
3864
{
3965
$this->validate();
4066

67+
if ($this->isEditing && $this->submission) {
68+
$data = [
69+
'company' => $this->company ?: null,
70+
];
71+
72+
if ($this->photo) {
73+
$data['photo_path'] = $this->photo->store('wall-of-love-photos', 'public');
74+
} elseif ($this->existingPhoto === null) {
75+
$data['photo_path'] = null;
76+
}
77+
78+
$this->submission->update($data);
79+
80+
if ($this->photo) {
81+
$this->existingPhoto = $data['photo_path'];
82+
$this->reset('photo');
83+
}
84+
85+
session()->flash('success', 'Your listing has been updated.');
86+
87+
return null;
88+
}
89+
4190
$photoPath = null;
4291
if ($this->photo) {
4392
$photoPath = $this->photo->store('wall-of-love-photos', 'public');
@@ -55,6 +104,11 @@ public function submit()
55104
return to_route('dashboard')->with('success', 'Thank you! Your submission has been received and is awaiting review.');
56105
}
57106

107+
public function removeExistingPhoto(): void
108+
{
109+
$this->existingPhoto = null;
110+
}
111+
58112
public function render()
59113
{
60114
return view('livewire.wall-of-love-submission-form');

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

resources/css/app.css

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,11 @@
7979
}
8080
}
8181

82-
/* Compensate for custom scrollbar width when Flux locks scroll */
83-
html[data-flux-scroll-unlock] {
84-
padding-right: 8px !important;
82+
/* Compensate for custom scrollbar width when Flux locks scroll (desktop only) */
83+
@media (pointer: fine) {
84+
html[data-flux-scroll-unlock] {
85+
padding-right: 8px !important;
86+
}
8587
}
8688

8789
/* Scrollbar width */

resources/views/components/dashboard-menu.blade.php

Lines changed: 0 additions & 83 deletions
This file was deleted.

resources/views/components/layouts/dashboard.blade.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,17 @@ class="min-h-screen bg-white font-poppins antialiased dark:bg-zinc-900 dark:text
115115
<flux:sidebar.item href="{{ route('customer.showcase.index') }}" :current="request()->routeIs('customer.showcase.*')">
116116
Showcase
117117
</flux:sidebar.item>
118+
@if(auth()->user()->licenses()->where('created_at', '<', '2025-06-01')->exists())
119+
@php
120+
$wallOfLoveSubmission = auth()->user()->wallOfLoveSubmissions()->first();
121+
$wallOfLoveUrl = $wallOfLoveSubmission
122+
? route('customer.wall-of-love.edit', $wallOfLoveSubmission)
123+
: route('customer.wall-of-love.create');
124+
@endphp
125+
<flux:sidebar.item href="{{ $wallOfLoveUrl }}" :current="request()->routeIs('customer.wall-of-love.*')">
126+
Wall of Love
127+
</flux:sidebar.item>
128+
@endif
118129
<flux:sidebar.item href="https://discord.gg/nativephp" target="_blank">
119130
Discord
120131
</flux:sidebar.item>

0 commit comments

Comments
 (0)