/
sc_coder
/
MentalCheckList
Обзор
Документация
Войти
/
sc_coder
/
MentalCheckList
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
index.html
214 строк
12 KB
ScCoder
Показывать картинку кота по проценту результата теста
14 июл 2026, 09:50
14 июл 2026, 09:50
0483506
Код
Авторство
О чём код?
<!DOCTYPE html> <html lang="ru"> <head> <meta charset="UTF-8" /> <meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover" /> <title>Ментальный Чек-Лист</title> <meta name="description" content="Ежедневный мониторинг ментального состояния — раннее обнаружение желтой зоны" /> <meta name="theme-color" content="#4f46e5" /> <link rel="manifest" href="manifest.json" /> <link rel="icon" href="icons/icon.svg" type="image/svg+xml" /> <link rel="apple-touch-icon" href="icons/icon.svg" /> <link rel="preconnect" href="https://fonts.googleapis.com" /> <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin /> <link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap" rel="stylesheet" /> <script src="https://cdn.tailwindcss.com"></script> <style> * { font-family: 'Inter', ui-sans-serif, system-ui, sans-serif; } body { background: radial-gradient(circle at top, #eef2ff 0%, #f9fafb 45%, #f9fafb 100%); } @keyframes fadeSlideIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } } .anim-in { animation: fadeSlideIn 0.32s ease both; } @keyframes popIn { 0% { opacity: 0; transform: scale(0.9); } 100% { opacity: 1; transform: scale(1); } } .anim-pop { animation: popIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) both; } .btn-press:active { transform: scale(0.97); } /* Без этого правила Tailwind-классы display (flex/inline-flex/grid) на том же элементе перебивают атрибут [hidden] — он не имеет !important в браузере. */ [hidden] { display: none !important; } ::-webkit-scrollbar { width: 6px; height: 6px; } ::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 999px; } </style> </head> <body class="min-h-screen text-gray-900"> <div id="app" class="max-w-md mx-auto min-h-screen flex flex-col pb-8"> <header class="px-5 pt-8 pb-5 text-center"> <div class="inline-flex items-center justify-center w-12 h-12 rounded-2xl bg-indigo-600 shadow-lg shadow-indigo-200 mb-3"> <svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"> <path d="M12 21C12 21 4 16.5 4 10.5C4 7 6.5 5 9 5C10.5 5 11.5 5.8 12 6.5C12.5 5.8 13.5 5 15 5C17.5 5 20 7 20 10.5C20 16.5 12 21 12 21Z" fill="white" fill-opacity="0.15"/> <path d="M6 12h3l1.5-3 2 5 1.5-2.5H18"/> </svg> </div> <h1 class="text-xl font-extrabold tracking-tight text-gray-900">Ментальный Чек-Лист</h1> <p id="today-date" class="text-sm text-gray-400 mt-1 font-medium"></p> </header> <nav class="flex gap-1 px-5 mb-5"> <div class="flex w-full gap-1 bg-white/70 backdrop-blur rounded-2xl p-1 shadow-sm ring-1 ring-black/5"> <button id="tab-today" type="button" class="flex-1 py-2.5 rounded-xl text-sm font-semibold transition-all duration-200">Сегодня</button> <button id="tab-settings" type="button" class="flex-1 py-2.5 rounded-xl text-sm font-semibold transition-all duration-200">Настройки</button> <button id="tab-history" type="button" class="flex-1 py-2.5 rounded-xl text-sm font-semibold transition-all duration-200">История</button> </div> </nav> <main class="flex-1 px-5"> <!-- Сегодняшний опрос --> <section id="view-today"> <!-- Стартовый экран --> <div id="today-intro" class="anim-in"> <div class="bg-white rounded-3xl shadow-md ring-1 ring-black/5 p-7 text-center"> <div id="today-summary" hidden class="inline-flex items-center gap-2 px-3 py-1.5 rounded-full text-xs font-semibold mb-4"></div> <h2 id="intro-title" class="text-lg font-bold text-gray-900 mb-2">Как ты сегодня?</h2> <p id="intro-subtitle" class="text-sm text-gray-500 mb-6 leading-relaxed">Пройди короткий опрос, чтобы отследить своё состояние</p> <button id="start-quiz-btn" type="button" class="btn-press w-full bg-indigo-600 hover:bg-indigo-700 text-white font-semibold py-3.5 rounded-2xl shadow-lg shadow-indigo-200 transition-all"> Пройти чек-лист </button> </div> </div> <!-- Пошаговый опрос --> <div id="today-quiz" hidden> <div id="quiz-progress" class="flex items-center justify-center gap-1.5 mb-5"></div> <div id="quiz-card" class="anim-pop bg-white rounded-3xl shadow-md ring-1 ring-black/5 p-7 min-h-[220px] flex flex-col justify-between"> <p id="quiz-counter" class="text-xs font-semibold text-indigo-500 uppercase tracking-wide mb-3"></p> <p id="quiz-question-text" class="text-lg font-semibold text-gray-900 leading-snug mb-8"></p> <div class="flex gap-3"> <button id="quiz-no-btn" type="button" class="btn-press flex-1 py-3.5 rounded-2xl font-semibold text-gray-600 bg-gray-100 hover:bg-gray-200 transition-all"> Нет </button> <button id="quiz-yes-btn" type="button" class="btn-press flex-1 py-3.5 rounded-2xl font-semibold text-white bg-indigo-600 hover:bg-indigo-700 shadow-md shadow-indigo-200 transition-all"> Да </button> </div> </div> </div> <!-- Результат --> <div id="today-result-view" hidden class="anim-in"> <div id="warning-banner" hidden class="flex gap-3 bg-amber-50 border border-amber-300 text-amber-800 text-sm rounded-2xl px-4 py-3 mb-4"> <span class="text-lg leading-none">⚠️</span> <span>Сегодняшний результат превысил порог. Возможно, стоит присмотреться к своему состоянию и, если нужно, обратиться за поддержкой.</span> </div> <div class="bg-white rounded-3xl shadow-md ring-1 ring-black/5 p-7 text-center mb-4"> <img id="result-cat-image" alt="" class="w-32 h-32 rounded-2xl object-cover mx-auto mb-4 ring-1 ring-black/5" /> <div id="result-badge" class="w-20 h-20 rounded-full flex items-center justify-center mx-auto mb-4 text-2xl font-extrabold"></div> <p id="result-message" class="text-base font-bold text-gray-900 mb-1"></p> <p id="result-detail" class="text-sm text-gray-500 mb-4"></p> <ul id="result-checked-list" class="flex flex-wrap gap-1.5 justify-center"></ul> </div> <div class="flex gap-3"> <button id="result-redo-btn" type="button" class="btn-press flex-1 py-3 rounded-2xl font-semibold text-gray-600 bg-gray-100 hover:bg-gray-200 transition-all"> Пройти заново </button> <button id="result-done-btn" type="button" class="btn-press flex-1 py-3 rounded-2xl font-semibold text-white bg-indigo-600 hover:bg-indigo-700 shadow-md shadow-indigo-200 transition-all"> Готово </button> </div> </div> </section> <!-- Настройки --> <section id="view-settings" hidden class="anim-in"> <h2 class="text-xs font-bold text-gray-400 uppercase tracking-wide mb-2 px-1">Порог предупреждения</h2> <div class="bg-white rounded-2xl shadow-sm ring-1 ring-black/5 p-5 mb-6"> <div class="flex items-center gap-4"> <input id="threshold-slider" type="range" min="10" max="100" step="1" class="flex-1 accent-indigo-600" /> <span id="threshold-value" class="text-sm font-bold text-indigo-600 w-12 text-right"></span> </div> </div> <h2 class="text-xs font-bold text-gray-400 uppercase tracking-wide mb-2 px-1">Напоминание</h2> <div class="bg-white rounded-2xl shadow-sm ring-1 ring-black/5 p-5 mb-1"> <label class="flex items-center justify-between cursor-pointer mb-4"> <span class="text-sm font-medium text-gray-800">Напоминать пройти чек-лист</span> <span class="relative inline-flex items-center"> <input id="reminder-enabled" type="checkbox" class="sr-only peer" /> <span class="w-11 h-6 bg-gray-200 rounded-full peer-checked:bg-indigo-600 transition-colors"></span> <span class="absolute left-1 top-1 w-4 h-4 bg-white rounded-full shadow transition-transform peer-checked:translate-x-5"></span> </span> </label> <div class="flex items-center justify-between"> <span class="text-sm text-gray-500">Время напоминания</span> <input id="reminder-time" type="time" class="rounded-xl border border-gray-200 px-3 py-1.5 text-sm font-medium" /> </div> </div> <p id="reminder-status" class="text-xs text-gray-400 mb-6 px-1 leading-relaxed"></p> <h2 class="text-xs font-bold text-gray-400 uppercase tracking-wide mb-2 px-1">Базовые вопросы</h2> <ul id="pool-questions" class="flex flex-col gap-2 mb-6"></ul> <h2 class="text-xs font-bold text-gray-400 uppercase tracking-wide mb-2 px-1">Свои вопросы</h2> <ul id="custom-questions" class="flex flex-col gap-2 mb-3"></ul> <form id="add-question-form" class="bg-white rounded-2xl shadow-sm ring-1 ring-black/5 p-5 flex flex-col gap-3"> <div> <label for="new-question-negative" class="block text-xs font-semibold text-gray-500 mb-1"> Негативная формулировка (описание симптома) </label> <input id="new-question-negative" type="text" placeholder="Например: Стал(а) хуже спать" class="w-full rounded-xl border border-gray-200 bg-white px-4 py-2.5 text-sm shadow-sm focus:outline-none focus:ring-2 focus:ring-indigo-200" /> </div> <div> <label for="new-question-positive" class="block text-xs font-semibold text-gray-500 mb-1"> Позитивная формулировка (необязательно) </label> <input id="new-question-positive" type="text" placeholder="Например: Сплю как обычно?" class="w-full rounded-xl border border-gray-200 bg-white px-4 py-2.5 text-sm shadow-sm focus:outline-none focus:ring-2 focus:ring-indigo-200" /> </div> <button type="submit" class="btn-press bg-indigo-600 hover:bg-indigo-700 text-white text-sm font-semibold py-2.5 rounded-xl shadow-md shadow-indigo-200 transition-all"> Добавить вопрос </button> </form> <p class="text-xs text-gray-400 mt-2 px-1 leading-relaxed"> Если задать обе формулировки, вопрос будет показываться в случайной из них во время опроса — это защита от автоматических ответов. Без позитивной формулировки вопрос всегда показывается как есть. </p> </section> <!-- История --> <section id="view-history" hidden class="anim-in"> <div class="bg-white rounded-2xl shadow-sm ring-1 ring-black/5 p-4 mb-4"> <div class="flex items-center justify-between mb-4"> <button id="prev-month" type="button" class="w-8 h-8 rounded-full flex items-center justify-center text-gray-400 hover:bg-gray-100 hover:text-gray-700 transition">‹</button> <span id="calendar-label" class="text-sm font-bold text-gray-800 capitalize"></span> <button id="next-month" type="button" class="w-8 h-8 rounded-full flex items-center justify-center text-gray-400 hover:bg-gray-100 hover:text-gray-700 transition">›</button> </div> <div id="calendar-grid" class="grid grid-cols-7 gap-1.5"></div> </div> <div id="day-detail"></div> </section> </main> </div> <script src="logic.js"></script> <script src="storage.js"></script> <script src="app.js"></script> </body> </html>