Skip to content

Commit

Permalink
refactor new project
Browse files Browse the repository at this point in the history
  • Loading branch information
andrasbacsai committed Nov 3, 2024
1 parent 1bdc2c6 commit 8854eeb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 14 deletions.
17 changes: 4 additions & 13 deletions app/Livewire/Project/AddEmpty.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,17 @@
namespace App\Livewire\Project;

use App\Models\Project;
use Livewire\Attributes\Rule;
use Livewire\Component;

class AddEmpty extends Component
{
public string $name = '';
#[Rule(['required', 'string', 'min:3'])]
public string $name;

#[Rule(['nullable', 'string'])]
public string $description = '';

protected $rules = [
'name' => 'required|string|min:3',
'description' => 'nullable|string',
];

protected $validationAttributes = [
'name' => 'Project Name',
'description' => 'Project Description',
];

public function submit()
{
try {
Expand All @@ -34,8 +27,6 @@ public function submit()
return redirect()->route('project.show', $project->uuid);
} catch (\Throwable $e) {
return handleError($e, $this);
} finally {
$this->name = '';
}
}
}
3 changes: 2 additions & 1 deletion resources/views/livewire/project/add-empty.blade.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<form class="flex flex-col w-full gap-2 rounded" wire:submit='submit'>
<x-forms.input placeholder="Your Cool Project" id="name" label="Name" required />
<x-forms.input placeholder="This is my cool project everyone knows about" id="description" label="Description" />
<div class="subtitle">New project will have a default production environment.</div>
<div class="subtitle">New project will have a default <span class="dark:text-warning font-bold">production</span>
environment.</div>
<x-forms.button type="submit" @click="slideOverOpen=false">
Continue
</x-forms.button>
Expand Down

0 comments on commit 8854eeb

Please sign in to comment.