<x-layouts.app :title="$keyword->phrase.' — TrafficPumper'"><x-customer-shell><nav aria-label="breadcrumb"><ol class="breadcrumb"><li class="breadcrumb-item"><a href="{{route('keywords.index',['project'=>$keyword->project->ulid])}}">{{__('keywords.title')}}</a></li><li class="breadcrumb-item active">{{$keyword->phrase}}</li></ol></nav><header class="tp-page-header"><div><p>{{$keyword->project->name}} · {{$keyword->project->domain}}</p><h1>{{$keyword->phrase}}</h1><span>{{$keyword->status->label()}}</span></div>@if($keyword->status===\App\Enums\KeywordStatus::Active)<a class="btn btn-outline-secondary" href="{{route('keywords.edit',$keyword)}}">{{__('keywords.edit')}}</a>@endif</header>
<section class="tp-metric-grid tp-keyword-metrics"><x-metric-card :label="__('keywords.current')" :value="$keyword->current_rank?'#'.$keyword->current_rank:'—'" icon="◎"/><x-metric-card :label="__('keywords.previous')" :value="$keyword->previous_rank?'#'.$keyword->previous_rank:'—'" icon="◷"/><x-metric-card :label="__('keywords.change')" :value="$keyword->rank_change??__('customer.new')" icon="↕"/><x-metric-card :label="__('keywords.best')" :value="$best?'#'.$best:'—'" icon="★"/><x-metric-card :label="__('keywords.last_check')" :value="$keyword->last_checked_at?->diffForHumans()" icon="◴"/><x-metric-card :label="__('keywords.status')" :value="$keyword->status->label()" icon="●"/></section>
<div class="tp-two-columns"><section class="tp-panel"><div class="tp-panel-heading"><h2>{{__('keywords.details')}}</h2></div><dl class="tp-detail-list"><div><dt>{{__('keywords.project')}}</dt><dd>{{$keyword->project->name}}</dd></div><div><dt>{{__('keywords.domain')}}</dt><dd>{{$keyword->project->domain}}</dd></div><div><dt>{{__('keywords.target')}}</dt><dd>{{$keyword->search_engine->label()}} · {{$countries[$keyword->country_code]}} · {{$languages[$keyword->language_code]}} · {{$keyword->device->label()}}</dd></div><div><dt>{{__('keywords.created')}}</dt><dd>{{$keyword->created_at->translatedFormat('d M Y H:i')}}</dd></div></dl></section><section class="tp-panel"><div class="tp-panel-heading"><h2>{{__('keywords.history')}}</h2></div>@if($history->isEmpty())<x-empty-state :title="__('customer.no_rank_data')" :description="__('customer.after_first_check')"/>@else<div class="tp-history-list">@foreach($history as $point)<div><time>{{\Illuminate\Support\Carbon::parse($point['date'])->translatedFormat('d M Y')}}</time><span style="--rank:{{min($point['rank'],100)}}"></span><strong>#{{$point['rank']}}</strong></div>@endforeach</div>@endif</section></div>
<section class="tp-panel"><div class="tp-panel-heading"><h2>{{__('keywords.recent_checks')}}</h2></div><div class="table-responsive"><table class="table tp-data-table"><thead><tr><th>{{__('keywords.last_check')}}</th><th>{{__('keywords.current')}}</th><th>{{__('keywords.results')}}</th></tr></thead><tbody>@forelse($keyword->serpChecks->take(10) as $check)<tr><td>{{$check->checked_at?->translatedFormat('d M Y H:i')}}</td><td>{{$check->results->firstWhere('is_project_domain',true)?->position?'#'.$check->results->firstWhere('is_project_domain',true)->position:'100+'}}</td><td>{{$check->result_count}}</td></tr>@empty<tr><td colspan="3">{{__('keywords.not_checked')}}</td></tr>@endforelse</tbody></table></div></section></x-customer-shell></x-layouts.app>
