Commit b2c350bc authored by Mahmoud Aglan's avatar Mahmoud Aglan

fix: review accuracy threshold, friends empty state, profile fresh fetch

- Classifier: book threshold reduced from 5 to 2 full moves (was classifying
  everything as book in short games, resulting in 0% accuracy)
- Friends empty state: shows friendly illustration + 'invite friends' CTA button
  instead of hostile 'لا توجد بيانات' on black void
- Profile: always fetches fresh data from API on mount (fixes stale rating
  showing 1200 after playing rated games)
Co-Authored-By: 's avatarClaude Opus 4.6 <noreply@anthropic.com>
parent 7f8d52fe
...@@ -16,8 +16,8 @@ export function classifyMove(evalBefore, evalAfter, bestEval, isPlayerWhite, mov ...@@ -16,8 +16,8 @@ export function classifyMove(evalBefore, evalAfter, bestEval, isPlayerWhite, mov
const evalChange = (evalAfter - evalBefore) * sign; const evalChange = (evalAfter - evalBefore) * sign;
const lossFromBest = (bestEval - evalAfter) * sign; const lossFromBest = (bestEval - evalAfter) * sign;
// Book moves (first 5 moves) // Book moves (first 2 full moves = 4 half-moves)
if (moveNum <= 5) return { class: 'book', symbol: '📖', color: '#94a3b8' }; if (moveNum <= 2) return { class: 'book', symbol: '📖', color: '#94a3b8' };
// If eval is mate-level, special handling // If eval is mate-level, special handling
if (Math.abs(evalAfter) > 900) { if (Math.abs(evalAfter) > 900) {
......
...@@ -2,9 +2,15 @@ import * as store from '../../../core/store.js'; ...@@ -2,9 +2,15 @@ import * as store from '../../../core/store.js';
import * as scene from '../../../core/scene.js'; import * as scene from '../../../core/scene.js';
import * as audio from '../../../core/audio.js'; import * as audio from '../../../core/audio.js';
import * as bus from '../../../core/bus.js'; import * as bus from '../../../core/bus.js';
import * as net from '../../../core/net.js';
import { t } from '../../../core/i18n.js'; import { t } from '../../../core/i18n.js';
export function mountView(el) { export async function mountView(el) {
// Always fetch fresh profile data
try {
const fresh = await net.get('profile.php');
if (fresh && !fresh.error) store.set('player', fresh);
} catch (e) {}
const player = store.get('player') || {}; const player = store.get('player') || {};
el.innerHTML = ` el.innerHTML = `
......
...@@ -27,7 +27,13 @@ export async function mountFriends(el) { ...@@ -27,7 +27,13 @@ export async function mountFriends(el) {
function renderFriends(el, friends) { function renderFriends(el, friends) {
const list = el.querySelector('#friends-list'); const list = el.querySelector('#friends-list');
if (friends.length === 0) { if (friends.length === 0) {
list.innerHTML = `<p style="color:var(--text-secondary);text-align:center;padding:var(--s-8);">${t('common.empty')}</p>`; list.innerHTML = `
<div style="text-align:center;padding:48px 24px;">
<div style="font-size:56px;margin-bottom:16px;opacity:0.6;">👥</div>
<div style="font-size:16px;font-weight:700;color:#f8fafc;margin-bottom:6px;">لا يوجد أصدقاء بعد</div>
<div style="font-size:13px;color:#64748b;margin-bottom:20px;">أضف أصدقاء للعب معهم ومتابعة نتائجهم</div>
<button class="btn btn-primary" style="font-size:14px;" onclick="navigator.clipboard.writeText(window.location.origin);this.textContent='✓ تم نسخ الرابط';">📤 شارك رابط الدعوة</button>
</div>`;
return; return;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment