From add79574301b0f04e7ab0a81f713c937ebbbad50 Mon Sep 17 00:00:00 2001 From: boban Date: Sun, 17 May 2026 15:05:31 +0200 Subject: [PATCH] fix(ui): proper 3/4-arc spinner centered in button, honest AI prompt MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Button: wire:loading.remove on label (DOM removal, no z-index fight) spinner span is normal flex child — button's own flex centers it SVG: track circle opacity 25% + 3/4 arc via stroke-dasharray 42.4/56.6, stroke-linecap round, rotated -90deg so arc starts at top - AI prompt: explicitly flags sparse data (<3 links or <10 clicks), requires every claim reference a specific slug, forbids generic padding Co-Authored-By: Claude Sonnet 4.6 --- app/Livewire/Pages/Ai/Insights.php | 18 ++++++++---------- resources/views/components/ui/button.blade.php | 12 +++++++----- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/app/Livewire/Pages/Ai/Insights.php b/app/Livewire/Pages/Ai/Insights.php index 4e8d7fd..6b5a599 100644 --- a/app/Livewire/Pages/Ai/Insights.php +++ b/app/Livewire/Pages/Ai/Insights.php @@ -54,21 +54,19 @@ class Insights extends Component $summary = $topLinks->map(fn ($l) => "- {$l->slug} ({$l->clicks_count} clicks) → {$l->target_url}")->implode("\n"); $prompt = <<name} -Total links analysed: {$linkCount} | Total clicks: {$totalClicks} +Links analysed: {$linkCount} | Total clicks: {$totalClicks} -Top links: +Data: {$summary} -Provide 3–4 short, specific insights: -- Which link types or destinations perform best and why -- Patterns across target domains (e.g. social, docs, pricing pages) -- What the low-click links have in common and how to improve them -- One concrete next action for this workspace - -No generic marketing advice. Base every insight on the data above. Be direct, no fluff. +Rules: +- If fewer than 3 links or fewer than 10 total clicks exist, say so upfront and explain that reliable patterns need more data. Give 1–2 observations possible from the limited data, then stop. +- Otherwise give 3–4 insights: best-performing destination types, domain patterns, what underperforming links share, one concrete next action. +- Every claim must reference a specific slug or URL from the data above. +- No generic marketing advice. No padding. Plain language, no excessive formatting. PROMPT; $result = app(AiService::class)->complete($prompt); diff --git a/resources/views/components/ui/button.blade.php b/resources/views/components/ui/button.blade.php index 915c44d..e1c3a85 100644 --- a/resources/views/components/ui/button.blade.php +++ b/resources/views/components/ui/button.blade.php @@ -21,14 +21,16 @@ $cls = $base . ' ' . ($variants[$variant] ?? $variants['primary']); {{ $attributes->merge(['type' => $type, 'class' => $cls]) }} @if($action) wire:loading.attr="disabled" wire:target="{{ $action }}" @endif > - + {{ $slot->isNotEmpty() ? $slot : $label }} @if($action) - - - - + + + + @endif