<x-layouts.app :title="$project->name.' — TrafficPumper'"><x-customer-shell class="tp-project-detail">
<nav aria-label="{{ __('projects.breadcrumb') }}"><ol class="breadcrumb"><li class="breadcrumb-item"><a href="{{ route('projects.index') }}">{{ __('customer.projects') }}</a></li><li class="breadcrumb-item active">{{ $project->name }}</li></ol></nav>
<header class="tp-page-header"><div><p>{{ __('customer.rank_tracking') }}</p><h1>{{ $project->name }}</h1><span>{{ $project->domain }}</span></div><div class="d-flex flex-wrap gap-2"><span class="badge align-self-center text-bg-{{ $project->status===\App\Enums\ProjectStatus::Active?'success':'secondary' }}">{{ $project->status->label() }}</span>@if($project->status===\App\Enums\ProjectStatus::Active)<a class="btn btn-outline-secondary" href="{{route('projects.edit',$project)}}">{{__('projects.edit')}}</a><form method="POST" action="{{route('projects.archive',$project)}}" onsubmit="return confirm('{{__('projects.archive_confirm')}}')">@csrf<button class="btn btn-outline-danger">{{__('projects.archive')}}</button></form>@else<form method="POST" action="{{route('projects.restore',$project)}}">@csrf<button class="btn btn-primary">{{__('projects.restore')}}</button></form>@endif</div></header>
<section class="tp-metric-grid tp-project-metrics"><x-metric-card :label="__('customer.tracked_keywords')" :value="$summary['keywords']" icon="⌕"/><x-metric-card :label="__('projects.last_serp_check')" :value="$summary['last_check']?->diffForHumans()" icon="◷"/><x-metric-card :label="__('customer.average_rank')" :value="$summary['average']" icon="◎"/><x-metric-card :label="__('customer.top10')" :value="$summary['top10']" icon="↗"/><x-metric-card :label="__('customer.rising')" :value="$summary['winners']" icon="↑"/><x-metric-card :label="__('customer.falling')" :value="$summary['losers']" icon="↓"/></section>
<div class="tp-two-columns"><section class="tp-panel"><div class="tp-panel-heading"><h2>{{__('projects.details')}}</h2></div><dl class="tp-detail-list"><div><dt>{{__('projects.root_url')}}</dt><dd><a href="{{$project->url}}" rel="noopener noreferrer">{{$project->url}}</a></dd></div><div><dt>{{__('roles.fields.status')}}</dt><dd>{{$project->status->label()}}</dd></div><div><dt>{{__('projects.created')}}</dt><dd>{{$project->created_at->translatedFormat('d M Y H:i')}}</dd></div><div><dt>{{__('projects.updated')}}</dt><dd>{{$project->updated_at->translatedFormat('d M Y H:i')}}</dd></div><div class="tp-technical-detail"><dt>{{__('projects.id')}}</dt><dd><code>{{$project->ulid}}</code></dd></div></dl></section><section class="tp-panel"><div class="tp-panel-heading"><h2>{{__('customer.ranking_performance')}}</h2></div>@if($summary['average']===null)<x-empty-state :title="__('customer.no_rank_data')" :description="__('customer.after_first_check')"/>@else<div class="tp-rank-bars"><div><span>{{__('customer.average_rank')}}</span><i style="--rank:{{min($summary['average'],100)}}"></i><strong>#{{$summary['average']}}</strong></div></div>@endif</section></div>
<section class="tp-panel"><div class="tp-panel-heading"><h2>{{__('customer.keywords')}}</h2><div class="d-flex gap-2"><a class="btn btn-sm btn-outline-secondary" href="{{route('keywords.index',['project'=>$project->ulid])}}">{{__('keywords.view_all')}}</a><a class="btn btn-sm btn-primary" href="{{route('keywords.create',['project'=>$project->ulid])}}">＋ {{__('projects.add_keyword')}}</a></div></div>@if($project->keywords->isEmpty())<x-empty-state :title="__('customer.no_keywords')" :description="__('customer.add_keyword_hint')"/>@else<div class="table-responsive"><table class="table tp-data-table"><thead><tr><th>{{__('customer.keyword')}}</th><th>{{__('customer.target')}}</th><th>{{__('roles.fields.status')}}</th></tr></thead><tbody>@foreach($project->keywords as $keyword)<tr><td><a href="{{route('keywords.show',$keyword)}}">{{$keyword->phrase}}</a></td><td>{{$keyword->search_engine->label()}} · {{$keyword->device->label()}}</td><td>{{$keyword->status->label()}}</td></tr>@endforeach</tbody></table></div>@endif</section>
</x-customer-shell></x-layouts.app>
