- Add tone column to sites table (nullable string) - Add TONES constant to Site model with predefined options: professional, casual, technical, friendly, formal, humorous, conversational, authoritative, inspirational, educational, minimal, detailed - Update Sites Livewire component to edit tone - Update Sites view with tone select dropdown in form - Add tone column to sites table display - Add tone to SiteResource API response AI agents can now read the site's tone and use it when generating content. Generated by Mistral Vibe. Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
133 lines
6.9 KiB
PHP
133 lines
6.9 KiB
PHP
<div>
|
|
<div class="flex justify-between items-center mb-4">
|
|
<h1 class="text-xl font-semibold">Sites</h1>
|
|
<button wire:click="create" class="bg-blue-600 text-white px-4 py-2 rounded">Add Site</button>
|
|
</div>
|
|
|
|
<table class="w-full bg-white border border-gray-200 rounded">
|
|
<thead>
|
|
<tr class="text-left border-b border-gray-200">
|
|
<th class="p-3">Name</th>
|
|
<th class="p-3">URL</th>
|
|
<th class="p-3">Description</th>
|
|
<th class="p-3">CMS Type</th>
|
|
<th class="p-3">Tone</th>
|
|
<th class="p-3"></th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
@foreach ($sites as $site)
|
|
<tr wire:key="site-{{ $site->id }}" class="border-b border-gray-100">
|
|
<td class="p-3">{{ $site->name }}</td>
|
|
<td class="p-3"><a href="{{ $site->url }}" target="_blank" class="text-blue-600">{{ $site->url }}</a></td>
|
|
<td class="p-3">{{ $site->description }}</td>
|
|
<td class="p-3">
|
|
{{ ucfirst($site->cms_type) }}
|
|
@if ($site->cms_type === 'wordpress')
|
|
<div class="text-xs text-gray-500">
|
|
{{ $site->wp_username }} /
|
|
@if ($revealedId === $site->id)
|
|
{{ $site->wp_app_password }}
|
|
@else
|
|
••••••••
|
|
@endif
|
|
<button wire:click="toggleReveal({{ $site->id }})" class="text-xs text-blue-600 ml-1">
|
|
{{ $revealedId === $site->id ? 'Hide' : 'Show' }}
|
|
</button>
|
|
</div>
|
|
@elseif ($site->api_instructions)
|
|
<div class="text-xs text-gray-500" title="{{ $site->api_instructions }}">Has API instructions</div>
|
|
@endif
|
|
</td>
|
|
<td class="p-3">
|
|
@if ($site->tone)
|
|
<span class="text-xs bg-purple-100 text-purple-800 px-2 py-0.5 rounded">{{ $site->tone }}</span>
|
|
@else
|
|
<span class="text-gray-400">—</span>
|
|
@endif
|
|
</td>
|
|
<td class="p-3 text-right space-x-2">
|
|
<button wire:click="edit({{ $site->id }})" class="text-blue-600">Edit</button>
|
|
<button wire:click="delete({{ $site->id }})" wire:confirm="Delete this site?" class="text-red-600">Delete</button>
|
|
</td>
|
|
</tr>
|
|
@endforeach
|
|
</tbody>
|
|
</table>
|
|
|
|
@if ($showForm)
|
|
<div class="fixed inset-0 bg-black/30 flex items-center justify-center">
|
|
<div class="bg-white p-6 rounded w-full max-w-md space-y-4">
|
|
<h2 class="text-lg font-semibold">{{ $editingId ? 'Edit Site' : 'Add Site' }}</h2>
|
|
|
|
<div>
|
|
<label class="block text-sm font-medium">Name</label>
|
|
<input type="text" wire:model="name" class="w-full border rounded p-2">
|
|
@error('name') <span class="text-red-600 text-sm">{{ $message }}</span> @enderror
|
|
</div>
|
|
|
|
<div>
|
|
<label class="block text-sm font-medium">URL</label>
|
|
<input type="text" wire:model="url" class="w-full border rounded p-2">
|
|
@error('url') <span class="text-red-600 text-sm">{{ $message }}</span> @enderror
|
|
</div>
|
|
|
|
<div>
|
|
<label class="block text-sm font-medium">Description</label>
|
|
<textarea wire:model="description" class="w-full border rounded p-2"></textarea>
|
|
</div>
|
|
|
|
<div>
|
|
<label class="block text-sm font-medium">Tone (optional for AI)</label>
|
|
<select wire:model="tone" class="w-full border rounded p-2">
|
|
<option value="">No tone specified</option>
|
|
@foreach ($tones as $t)
|
|
<option value="{{ $t }}">{{ ucfirst($t) }}</option>
|
|
@endforeach
|
|
</select>
|
|
<p class="text-xs text-gray-500 mt-1">
|
|
Writing style for AI-generated content (e.g., professional, casual, technical).
|
|
</p>
|
|
@error('tone') <span class="text-red-600 text-sm">{{ $message }}</span> @enderror
|
|
</div>
|
|
|
|
<div>
|
|
<label class="block text-sm font-medium">CMS Type</label>
|
|
<select wire:model.live="cmsType" class="w-full border rounded p-2">
|
|
@foreach ($cmsTypes as $type)
|
|
<option value="{{ $type }}">{{ ucfirst($type) }}</option>
|
|
@endforeach
|
|
</select>
|
|
@error('cmsType') <span class="text-red-600 text-sm">{{ $message }}</span> @enderror
|
|
</div>
|
|
|
|
@if ($cmsType === 'wordpress')
|
|
<div>
|
|
<label class="block text-sm font-medium">WP Username</label>
|
|
<input type="text" wire:model="wpUsername" class="w-full border rounded p-2">
|
|
@error('wpUsername') <span class="text-red-600 text-sm">{{ $message }}</span> @enderror
|
|
</div>
|
|
|
|
<div>
|
|
<label class="block text-sm font-medium">WP Application Password</label>
|
|
<input type="text" wire:model="wpAppPassword" class="w-full border rounded p-2">
|
|
@error('wpAppPassword') <span class="text-red-600 text-sm">{{ $message }}</span> @enderror
|
|
</div>
|
|
@else
|
|
<div>
|
|
<label class="block text-sm font-medium">API Instructions (optional)</label>
|
|
<p class="text-xs text-gray-500 mb-1">Notes for posting here via this site's own API — auth method, endpoints, payload shape, etc. Read by whoever (agent or you) ends up publishing to it.</p>
|
|
<textarea wire:model="apiInstructions" rows="4" class="w-full border rounded p-2"></textarea>
|
|
@error('apiInstructions') <span class="text-red-600 text-sm">{{ $message }}</span> @enderror
|
|
</div>
|
|
@endif
|
|
|
|
<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>
|