@extends('layouts.app') @section('content') {{-- ── Sentiment Summary ── --}} @if($sentimentSummary)
Sentimen Keseluruhan
{{ $sentimentSummary['sentiment'] === 'positive' ? 'Positif' : ($sentimentSummary['sentiment'] === 'negative' ? 'Negatif' : 'Netral') }}
{{ $sentimentSummary['totalWords'] }} kata dianalisis
Distribusi Sentimen
Positif{{ $sentimentSummary['posPercent'] }}%
Negatif{{ $sentimentSummary['negPercent'] }}%
Netral{{ $sentimentSummary['neutralPercent'] }}%
Kata Kunci Sinyal
@if($sentimentSummary['matchedPositive'])
🟒 Positif:
{{ implode(', ', array_slice($sentimentSummary['matchedPositive'], 0, 8)) }}
@endif @if($sentimentSummary['matchedNegative'])
πŸ”΄ Negatif:
{{ implode(', ', array_slice($sentimentSummary['matchedNegative'], 0, 8)) }}
@endif
@endif {{-- ── Search + Live news ── --}}
{{-- Search --}}
{{-- Live news articles - FULL WIDTH --}}
Berita Terbaru @if(!empty($allArticles)) {{ count($allArticles) }} artikel @else Memuat... @endif
@if(!empty($allArticles))
{{ count($allArticles) }} berita berhasil dimuat dari GNews API dengan gambar terbaru
{{-- Debug: Show first article URL for testing --}} @if(config('app.debug') && !empty($allArticles[0]['url']))
DEBUG: Sample URL = {{ Str::limit($allArticles[0]['url'], 80) }}
Valid: {{ filter_var($allArticles[0]['url'], FILTER_VALIDATE_URL) ? 'βœ… YES' : '❌ NO' }}
@endif @else
Sedang memuat berita... Jika tidak muncul dalam 30 detik, silakan refresh halaman
@endif @foreach($allArticles as $article) @php $cleanUrl = $article['url'] ?? ''; // Strict URL validation $isValidUrl = !empty($cleanUrl) && $cleanUrl !== '#' && filter_var($cleanUrl, FILTER_VALIDATE_URL) && (str_starts_with($cleanUrl, 'http://') || str_starts_with($cleanUrl, 'https://')); // Security: ensure URL is not javascript: or data: protocol if ($isValidUrl && (str_starts_with(strtolower($cleanUrl), 'javascript:') || str_starts_with(strtolower($cleanUrl), 'data:'))) { $isValidUrl = false; } @endphp {{-- CLEAN STRUCTURE:
wrapper, inside for clickability --}} @endforeach @if(empty($allArticles))

Sedang memuat berita terbaru dari GNews API...

Status Koneksi:
β€’ API GNews: {{ substr('8315d8a4fd1748c5b4e06c134451b4d4', 0, 10) }}...
β€’ Cache: Dinonaktifkan untuk data real-time
β€’ Topics: Technology, Business, World News, Breaking News
β€’ Filter: Artikel dengan gambar diprioritaskan
β€’ Status: Menghubungi GNews API...
@endif
{{-- Sentiment Summary at Bottom (Full Width) --}} @if($sentimentSummary)
Ringkasan Sentimen Berita
{{ $sentimentSummary['posPercent'] }}%
Positif
{{ $sentimentSummary['negPercent'] }}%
Negatif
{{ $sentimentSummary['neutralPercent'] }}%
Netral
@endif @endsection @push('scripts') @endpush