Commit the Projects/Tasks/Ideas/TaskComments feature
This was already implemented, migrated, and running live, but had never been committed. Bringing it into git: Project/Task/Idea/ TaskComment models, their JSON API (CRUD + status transitions, task comments, idea<->project linking), Livewire UI pages, and the nav/route wiring for them. All 42 of its own tests pass. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,116 @@
|
||||
<div>
|
||||
<div class="flex justify-between items-center mb-4">
|
||||
<div>
|
||||
<h1 class="text-xl font-semibold">Task Comments</h1>
|
||||
@if($task)
|
||||
<p class="text-sm text-gray-500 mt-1">
|
||||
Task: <span class="font-medium">{{ $task->title }}</span>
|
||||
@if($task->project)
|
||||
| Project: <span class="text-blue-600">{{ $task->project->name }}</span>
|
||||
@endif
|
||||
</p>
|
||||
@endif
|
||||
</div>
|
||||
<div class="flex gap-2">
|
||||
@if($task)
|
||||
<button wire:click="create" class="bg-blue-600 text-white px-4 py-2 rounded">Add Comment</button>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@if($task)
|
||||
<div class="bg-white border border-gray-200 rounded p-4 mb-6">
|
||||
<h3 class="font-semibold mb-2">Task Details</h3>
|
||||
<p class="text-gray-600 mb-2">{{ $task->description }}</p>
|
||||
<div class="flex gap-4 text-sm text-gray-500">
|
||||
<span>Status: {{ ucfirst(str_replace('_', ' ', $task->status)) }}</span>
|
||||
@if($task->priority > 0)
|
||||
<span>Priority: {{ $task->priority }}</span>
|
||||
@endif
|
||||
@if($task->due_at)
|
||||
<span>Due: {{ $task->due_at->format('M d, Y') }}</span>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
@else
|
||||
<div class="bg-yellow-50 border border-yellow-200 rounded p-4 mb-6">
|
||||
<p class="text-yellow-800">No task selected. Please select a task to view its comments.</p>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
<div class="space-y-4">
|
||||
@forelse ($comments as $comment)
|
||||
<div wire:key="comment-{{ $comment->id }}" class="bg-white border border-gray-200 rounded p-4">
|
||||
<div class="flex justify-between items-start">
|
||||
<div class="flex-1">
|
||||
<div class="flex items-center gap-2 mb-2">
|
||||
<span class="{{ $this->getAuthorColor($comment->author_type) }} text-xs px-2 py-0.5 rounded font-medium">
|
||||
{{ ucfirst($comment->author_type) }}
|
||||
</span>
|
||||
<span class="font-medium text-gray-800">{{ $comment->author_name }}</span>
|
||||
<span class="text-xs text-gray-400">{{ $comment->created_at->format('M d, Y H:i') }}</span>
|
||||
</div>
|
||||
<div class="prose max-w-none text-gray-700">
|
||||
{{ $comment->body }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex gap-1">
|
||||
<button wire:click="edit({{ $comment->id }})" class="text-blue-600 hover:text-blue-800 text-sm">Edit</button>
|
||||
<button wire:click="delete({{ $comment->id }})" wire:confirm="Delete this comment?" class="text-red-600 hover:text-red-800 text-sm">Delete</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@empty
|
||||
@if($task)
|
||||
<div class="bg-gray-50 border border-gray-200 rounded p-8 text-center text-gray-500">
|
||||
No comments yet. Add your first comment!
|
||||
</div>
|
||||
@endif
|
||||
@endforelse
|
||||
</div>
|
||||
|
||||
@if ($showForm)
|
||||
<div class="fixed inset-0 bg-black/30 flex items-center justify-center z-50">
|
||||
<div class="bg-white p-6 rounded w-full max-w-lg space-y-4">
|
||||
<h2 class="text-lg font-semibold">{{ $editingId ? 'Edit Comment' : 'Add Comment' }}</h2>
|
||||
|
||||
<div>
|
||||
<label class="block text-sm font-medium">Author Type</label>
|
||||
<div class="flex gap-2">
|
||||
<button wire:click="setAuthorAsUser"
|
||||
class="px-3 py-1 rounded {{ $authorType === 'user' ? 'bg-blue-600 text-white' : 'bg-gray-200' }}">
|
||||
User
|
||||
</button>
|
||||
<button wire:click="setAuthorAsAI"
|
||||
class="px-3 py-1 rounded {{ $authorType === 'ai' ? 'bg-purple-600 text-white' : 'bg-gray-200' }}">
|
||||
AI
|
||||
</button>
|
||||
<button wire:click="setAuthorAsSystem"
|
||||
class="px-3 py-1 rounded {{ $authorType === 'system' ? 'bg-gray-600 text-white' : 'bg-gray-200' }}">
|
||||
System
|
||||
</button>
|
||||
</div>
|
||||
<input type="hidden" wire:model="authorType">
|
||||
@error('authorType') <span class="text-red-600 text-sm">{{ $message }}</span> @enderror
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label class="block text-sm font-medium">Author Name</label>
|
||||
<input type="text" wire:model="authorName" class="w-full border rounded p-2">
|
||||
@error('authorName') <span class="text-red-600 text-sm">{{ $message }}</span> @enderror
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label class="block text-sm font-medium">Comment</label>
|
||||
<textarea wire:model="body" rows="6" class="w-full border rounded p-2"></textarea>
|
||||
@error('body') <span class="text-red-600 text-sm">{{ $message }}</span> @enderror
|
||||
</div>
|
||||
|
||||
<div class="flex justify-end gap-2">
|
||||
<button wire:click="$set('showForm', false)" class="px-4 py-2">Cancel</button>
|
||||
<button wire:click="save" class="bg-blue-600 text-white px-4 py-2 rounded">Save</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
Reference in New Issue
Block a user