v12 — ИИ-помощник внутри приложения для спортсмена и родителя
This commit is contained in:
parent
ec7595e38f
commit
ca046a17aa
95
index.html
95
index.html
@ -394,6 +394,18 @@ input[type=file]{display:none}
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</main>
|
</main>
|
||||||
|
|
||||||
|
<!-- AI ASSISTANT для приложения -->
|
||||||
|
<div class="ai-helper" id="aiAppHelper">
|
||||||
|
<div class="ai-header" onclick="toggleAppAI()">
|
||||||
|
🤖 ИИ-помощник
|
||||||
|
<button onclick="event.stopPropagation();toggleAppAI()" id="aiAppToggleBtn">▼</button>
|
||||||
|
</div>
|
||||||
|
<div class="ai-body" id="aiAppBody">
|
||||||
|
<div class="ai-msg">👋 Я здесь! Выбери раздел — я подскажу что делать.</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="toast" id="toast">Сохранено!</div>
|
<div class="toast" id="toast">Сохранено!</div>
|
||||||
@ -522,9 +534,9 @@ function updateCityList() {
|
|||||||
cities.forEach(c => { const opt = document.createElement('option'); opt.value = c; datalist.appendChild(opt); });
|
cities.forEach(c => { const opt = document.createElement('option'); opt.value = c; datalist.appendChild(opt); });
|
||||||
}
|
}
|
||||||
|
|
||||||
function toggleAI() {
|
function toggleAppAI() {
|
||||||
const ai = document.getElementById('aiHelper');
|
const ai = document.getElementById('aiAppHelper');
|
||||||
const btn = document.getElementById('aiToggleBtn');
|
const btn = document.getElementById('aiAppToggleBtn');
|
||||||
if (ai.classList.contains('minimized')) {
|
if (ai.classList.contains('minimized')) {
|
||||||
ai.classList.remove('minimized');
|
ai.classList.remove('minimized');
|
||||||
btn.textContent = '\u25BC';
|
btn.textContent = '\u25BC';
|
||||||
@ -535,14 +547,86 @@ function toggleAI() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function aiSay(msg) {
|
function aiSay(msg) {
|
||||||
const body = document.getElementById('aiBody');
|
// Find active AI helper
|
||||||
|
const body = document.getElementById('aiAppBody') || document.getElementById('aiBody');
|
||||||
|
if (!body) return;
|
||||||
const div = document.createElement('div');
|
const div = document.createElement('div');
|
||||||
div.className = 'ai-msg';
|
div.className = 'ai-msg';
|
||||||
div.textContent = msg;
|
div.innerHTML = msg;
|
||||||
body.appendChild(div);
|
body.appendChild(div);
|
||||||
body.scrollTop = body.scrollHeight;
|
body.scrollTop = body.scrollHeight;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function getTabHelp(tab) {
|
||||||
|
const helps = {
|
||||||
|
diary: [
|
||||||
|
'📖 Это твой дневник тренировок. Записывай сюда каждую тренировку!',
|
||||||
|
'✏ Заполни дату, тип тренировки, километраж и лучшее время.',
|
||||||
|
'📈 Через месяц ты увидишь свой прогресс — это очень мотивирует!'
|
||||||
|
],
|
||||||
|
health: [
|
||||||
|
'❤️ Здесь ты следишь за здоровьем. Витамины, сон, анализы.',
|
||||||
|
'💊 Отмечай галочками принятые витамины каждый день.',
|
||||||
|
'💤 Записывай часы сна и утренний пульс — это важно для восстановления!'
|
||||||
|
],
|
||||||
|
norms: [
|
||||||
|
'📊 Здесь таблица разрядов. Смотри, сколько осталось до следующего уровня!',
|
||||||
|
'🎯 Твоя цель — МС (23 секунды). Ты уже перешагнул 3 взрослый!'
|
||||||
|
],
|
||||||
|
video: [
|
||||||
|
'🎬 Загружай видео своих заплывов и смотри в повторе.',
|
||||||
|
'📹 Снимай сбоку от бортика — так лучше видно технику гребка и поворота.'
|
||||||
|
],
|
||||||
|
photos: [
|
||||||
|
'📷 Галерея твоих достижений. Загружай фото с соревнований!'
|
||||||
|
],
|
||||||
|
grades: [
|
||||||
|
'🎓 Школьные оценки. Учёба важна не меньше тренировок — особенно для NCAA!',
|
||||||
|
'📊 Средний балл считается автоматически. Держи его выше 4.0!'
|
||||||
|
],
|
||||||
|
lessons: [
|
||||||
|
'📚 Здесь ссылки на обучающие видео. Найди их на YouTube и учись у лучших!'
|
||||||
|
],
|
||||||
|
ranking: [
|
||||||
|
'⭐ Рейтинг спортсменов и тренеров. Родители могут голосовать за лучших!',
|
||||||
|
'🏆 Топ-3 отмечены золотом, серебром и бронзой.'
|
||||||
|
]
|
||||||
|
};
|
||||||
|
return helps[tab] || ['👋 Я здесь чтобы помочь! Выбери раздел и я подскажу что делать.'];
|
||||||
|
}
|
||||||
|
|
||||||
|
function aiWelcome() {
|
||||||
|
const tab = document.querySelector('.tab-btn.active');
|
||||||
|
const tabId = tab ? tab.dataset.tab : 'diary';
|
||||||
|
const msgs = getTabHelp(tabId);
|
||||||
|
msgs.forEach((m, i) => setTimeout(() => aiSay(m), i * 1200));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update welcome on tab switch
|
||||||
|
document.querySelectorAll('.tab-btn').forEach(btn => {
|
||||||
|
const orig = btn.onclick;
|
||||||
|
btn.addEventListener('click', () => {
|
||||||
|
setTimeout(() => {
|
||||||
|
const helps = getTabHelp(btn.dataset.tab);
|
||||||
|
aiSay('📌 ' + helps[0]);
|
||||||
|
}, 300);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
function toggleAI() {
|
||||||
|
const ai = document.getElementById('aiHelper');
|
||||||
|
const btn = document.getElementById('aiToggleBtn');
|
||||||
|
if (ai.classList.contains('minimized')) {
|
||||||
|
ai.classList.remove('minimized');
|
||||||
|
btn.textContent = '\u25BC';
|
||||||
|
} else {
|
||||||
|
ai.classList.add('minimized');
|
||||||
|
btn.textContent = '\u25B2';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function aiHelp(field) {
|
function aiHelp(field) {
|
||||||
const tips = {
|
const tips = {
|
||||||
regName: '✏ Напиши свои Фамилию, Имя и Отчество. Например: Кайрат Гали Аскарович.',
|
regName: '✏ Напиши свои Фамилию, Имя и Отчество. Например: Кайрат Гали Аскарович.',
|
||||||
@ -616,6 +700,7 @@ function loginProfile(id) {
|
|||||||
}
|
}
|
||||||
renderAll();
|
renderAll();
|
||||||
renderRankings();
|
renderRankings();
|
||||||
|
setTimeout(aiWelcome, 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
function showProfileScreen() {
|
function showProfileScreen() {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user