chore: удалены мёртвые файлы (модалки, пустые хуки) — 1100+ строк (22.09.2026)

This commit is contained in:
2026-09-22 22:03:04 +03:00
parent 2b16a8573e
commit b88b9b21de
10 changed files with 269 additions and 1122 deletions
+269
View File
@@ -0,0 +1,269 @@
#!/usr/bin/env python3
"""
Code Summary — сводка по коду проекта Filwords PL.
Проходит по всем .py (backend) или .ts/.tsx (frontend) файлам,
вытаскивает docstring, функции, классы, импорты.
Формирует .md файл для быстрого ознакомления.
(22.09.2026) Первая версия. Без AI — только парсинг.
"""
from __future__ import annotations
import argparse
import ast
import re
import sys
from datetime import datetime
from pathlib import Path
# ============ Настройки ============
IGNORE_DIRS = {
"venv", ".venv", "__pycache__", ".git", ".gitea",
"node_modules", "dist", "build", ".vite", "coverage",
"archive", "uploads", "tts_cache", ".cache", "public",
}
# Большие файлы контента (не код) — пропускаем
IGNORE_FILES = {
"level_a1.py", "level_a2.py", "level_b1.py", "level_b2.py",
"level_c1.py", "level_c2.py",
}
# Максимальный размер файла для парсинга
MAX_FILE_SIZE = 100_000
# ============ Парсер Python ============
def parse_python(path: Path, repo_root: Path) -> dict | None:
"""Парсит один .py файл. Возвращает dict со сводкой или None."""
try:
content = path.read_text(encoding="utf-8")
except Exception as e:
print(f"⚠️ Не прочитал {path}: {e}", file=sys.stderr)
return None
if len(content) > MAX_FILE_SIZE:
return None
try:
tree = ast.parse(content)
except SyntaxError as e:
print(f"⚠️ Синтаксис {path}: {e}", file=sys.stderr)
return None
# Docstring модуля
module_doc = ast.get_docstring(tree) or ""
first_line = module_doc.strip().split("\n")[0] if module_doc else ""
# Функции и классы
functions: list[str] = []
classes: list[str] = []
for node in tree.body:
if isinstance(node, (ast.FunctionDef, ast.AsyncFunctionDef)):
args = [a.arg for a in node.args.args]
functions.append(f"{node.name}({', '.join(args)})")
elif isinstance(node, ast.ClassDef):
classes.append(node.name)
# Импорты
imports: list[str] = []
for node in tree.body:
if isinstance(node, ast.Import):
for alias in node.names:
imports.append(alias.name.split(".")[0])
elif isinstance(node, ast.ImportFrom):
if node.module:
imports.append(node.module.split(".")[0])
# Топ-3 импорта
imports = list(dict.fromkeys(imports))[:5]
rel = str(path.relative_to(repo_root)).replace("\\", "/")
return {
"path": rel,
"lang": "python",
"doc": first_line,
"functions": functions,
"classes": classes,
"imports": imports,
"lines": len(content.split("\n")),
}
# ============ Парсер TypeScript ============
def parse_typescript(path: Path, repo_root: Path) -> dict | None:
"""Парсит один .ts/.tsx файл. Возвращает dict со сводкой или None."""
try:
content = path.read_text(encoding="utf-8")
except Exception as e:
print(f"⚠️ Не прочитал {path}: {e}", file=sys.stderr)
return None
if len(content) > MAX_FILE_SIZE:
return None
# Docstring — первая многострочная /** ... */ или // в начале
doc_match = re.match(r'^(?:/\*\*(.*?)\*/|//\s*(.+?)$)', content, re.DOTALL | re.MULTILINE)
doc = ""
if doc_match:
doc = (doc_match.group(1) or doc_match.group(2) or "").strip()
doc = doc.split("\n")[0].strip().lstrip("*").strip()
# Функции (function name, const name = () =>)
funcs = re.findall(r'(?:export\s+)?(?:async\s+)?function\s+(\w+)', content)
funcs += re.findall(r'(?:export\s+)?const\s+(\w+)\s*=\s*(?:async\s+)?\(', content)
funcs = list(dict.fromkeys(funcs))[:15] # максимум 15
# Компоненты (const Name: React.FC)
components = re.findall(r'const\s+(\w+):\s*React\.FC', content)
components = list(dict.fromkeys(components))[:15]
# Импорты — топ-5
imports_raw = re.findall(r"from\s+['\"]([^'\"]+)['\"]", content)
imports_raw = [i for i in imports_raw if not i.startswith(".")][:5]
rel = str(path.relative_to(repo_root)).replace("\\", "/")
return {
"path": rel,
"lang": "typescript",
"doc": doc,
"functions": funcs,
"classes": components, # переиспользуем поле под компоненты
"imports": imports_raw,
"lines": len(content.split("\n")),
}
# ============ Обход файлов ============
def collect_files(repo_root: Path, mode: str) -> list[Path]:
"""Собирает файлы для парсинга."""
if mode == "backend":
extensions = {".py"}
else:
extensions = {".ts", ".tsx", ".js", ".jsx"}
files: list[Path] = []
for path in sorted(repo_root.rglob("*")):
if not path.is_file():
continue
if path.suffix not in extensions:
continue
if any(part in IGNORE_DIRS for part in path.relative_to(repo_root).parts):
continue
if path.name in IGNORE_FILES:
continue
files.append(path)
return files
# ============ Формирование сводки ============
def format_summary(items: list[dict], mode: str, repo_name: str) -> str:
"""Формирует markdown-сводку."""
lines: list[str] = []
date_str = datetime.now().strftime("%Y-%m-%d %H:%M")
lines.append(f"# 📋 Code Summary — {repo_name}")
lines.append("")
lines.append(f"**Дата:** {date_str}")
lines.append(f"**Режим:** {mode}")
lines.append(f"**Файлов:** {len(items)}")
lines.append("")
lines.append("---")
lines.append("")
for item in items:
lines.append(f"## `{item['path']}`")
lines.append("")
if item["doc"]:
lines.append(f"- **Назначение:** {item['doc']}")
else:
lines.append(f"- **Назначение:** _(docstring отсутствует)_")
if item["functions"]:
lines.append(f"- **Функции:** {', '.join(item['functions'][:20])}")
if len(item["functions"]) > 20:
lines.append(f" _(+{len(item['functions']) - 20} ещё)_")
if item["classes"]:
label = "Компоненты" if mode == "frontend" else "Классы"
lines.append(f"- **{label}:** {', '.join(item['classes'][:20])}")
if item["imports"]:
lines.append(f"- **Импорты:** {', '.join(item['imports'])}")
lines.append(f"- **Строк:** {item['lines']}")
lines.append("")
return "\n".join(lines)
# ============ Main ============
def main() -> None:
parser = argparse.ArgumentParser(description="Code Summary для Filwords PL")
parser.add_argument("mode", choices=["backend", "frontend"], help="Режим")
parser.add_argument(
"--path",
type=str,
default=None,
help="Путь к репозиторию (по умолчанию — текущая папка)",
)
parser.add_argument(
"--output",
type=str,
default=None,
help="Путь к выходному .md (по умолчанию — ~/Desktop/CODE_SUMMARY_*.md)",
)
args = parser.parse_args()
repo_root = Path(args.path).resolve() if args.path else Path(".").resolve()
if not repo_root.exists():
print(f"❌ Папка не найдена: {repo_root}", file=sys.stderr)
sys.exit(1)
print(f"📁 Репозиторий: {repo_root}")
print(f"🎯 Режим: {args.mode}")
files = collect_files(repo_root, args.mode)
print(f"📂 Найдено файлов: {len(files)}")
items: list[dict] = []
for f in files:
if args.mode == "backend":
result = parse_python(f, repo_root)
else:
result = parse_typescript(f, repo_root)
if result:
items.append(result)
print(f"✅ Обработано: {len(items)}")
repo_name = repo_root.name
summary = format_summary(items, args.mode, repo_name)
if args.output:
output_path = Path(args.output)
else:
date_str = datetime.now().strftime("%Y%m%d_%H%M")
output_path = Path.home() / "Desktop" / f"CODE_SUMMARY_{args.mode.upper()}_{date_str}.md"
output_path.write_text(summary, encoding="utf-8")
print(f"💾 Сохранено: {output_path}")
print(f"📊 Размер: {len(summary):,} символов")
if __name__ == "__main__":
main()
View File
View File
View File
-248
View File
@@ -1,248 +0,0 @@
import { useEffect, useRef } from 'react';
import { useLanguage } from '../../i18n/LanguageContext';
import { radius } from '../../styles/theme';
interface AppsModalProps {
isOpen: boolean;
onClose: () => void;
}
const AppsModal: React.FC<AppsModalProps> = ({ isOpen, onClose }) => {
const { t } = useLanguage();
const scrollRef = useRef<HTMLDivElement>(null);
const accentColor = '#4FA9E8';
const textColor = '#1A1A2E';
const subColor = '#6B7280';
const cardBg = 'rgba(255,255,255,0.55)';
const glass = (extra: React.CSSProperties = {}): React.CSSProperties => ({
background: cardBg,
backdropFilter: 'blur(24px) saturate(180%)',
WebkitBackdropFilter: 'blur(24px) saturate(180%)',
border: '1px solid rgba(255,255,255,0.7)',
boxShadow: '0 8px 32px rgba(31,38,73,0.10), inset 0 1px 0 rgba(255,255,255,0.85)',
...extra,
});
useEffect(() => {
if (isOpen && scrollRef.current) {
scrollRef.current.scrollTop = 0;
}
}, [isOpen]);
useEffect(() => {
if (!isOpen) return;
const handleKey = (e: KeyboardEvent) => {
if (e.key === 'Escape') onClose();
};
window.addEventListener('keydown', handleKey);
return () => window.removeEventListener('keydown', handleKey);
}, [isOpen, onClose]);
if (!isOpen) return null;
return (
<div
style={{
position: 'fixed',
top: 0,
left: 0,
right: 0,
bottom: 0,
background: 'rgba(20,22,35,0.35)',
zIndex: 1000,
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
padding: '20px',
backdropFilter: 'blur(6px)',
WebkitBackdropFilter: 'blur(6px)',
animation: 'appsFadeIn 0.2s ease',
}}
onClick={(e) => {
if (e.target === e.currentTarget) onClose();
}}
>
<style>{`
@keyframes appsFadeIn {
0% { opacity: 0; }
100% { opacity: 1; }
}
@keyframes appsSlideUp {
0% { transform: translateY(20px); opacity: 0; }
100% { transform: translateY(0); opacity: 1; }
}
@keyframes appsPopIn {
0% { transform: scale(0.4); opacity: 0; }
60% { transform: scale(1.1); opacity: 1; }
100% { transform: scale(1); opacity: 1; }
}
@keyframes appsFloat {
0%, 100% { transform: translateY(0); }
50% { transform: translateY(-6px); }
}
`}</style>
<div
ref={scrollRef}
onClick={(e) => e.stopPropagation()}
style={{
...glass({
borderRadius: radius.lg,
padding: '24px',
width: '100%',
maxWidth: '400px',
maxHeight: '80vh',
overflowY: 'auto',
boxShadow: '0 24px 60px rgba(31,38,73,0.25), inset 0 1px 0 rgba(255,255,255,0.85)',
}),
animation: 'appsSlideUp 0.3s ease',
}}
>
{/* ============ Заголовок ============ */}
<div
style={{
display: 'flex',
alignItems: 'center',
justifyContent: 'space-between',
marginBottom: '20px',
paddingBottom: '14px',
borderBottom: '1px solid rgba(0,0,0,0.06)',
}}
>
<div style={{ display: 'flex', alignItems: 'center', gap: '10px' }}>
{/* 🔧 ФИКС iOS 27: lineHeight 1.2 для эмодзи в заголовке */}
<span style={{ fontSize: '24px', lineHeight: '1.2', display: 'inline-block' }}>📱</span>
<h3
style={{
margin: 0,
fontSize: '18px',
fontWeight: 800,
color: textColor,
letterSpacing: '-0.2px',
}}
>
{t('appsModalTitle')}
</h3>
</div>
<button
onClick={onClose}
aria-label="Close"
style={{
...glass({
padding: '8px 14px',
borderRadius: radius.sm,
}),
color: textColor,
fontSize: '14px',
fontWeight: 600,
cursor: 'pointer',
WebkitTapHighlightColor: 'transparent',
}}
onTouchStart={(e) => {
e.currentTarget.style.transform = 'scale(0.9)';
}}
onTouchEnd={(e) => {
e.currentTarget.style.transform = 'scale(1)';
}}
>
✕
</button>
</div>
{/* ============ Пустое состояние ============ */}
<div
style={{
display: 'flex',
flexDirection: 'column',
alignItems: 'center',
justifyContent: 'center',
padding: '32px 16px',
textAlign: 'center',
}}
>
{/* 🔧 ФИКС iOS 27: lineHeight 1.2 + padding для большого эмодзи */}
<div
style={{
fontSize: '64px',
lineHeight: '1.2',
padding: '8px 0',
marginBottom: '20px',
animation: 'appsPopIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1), appsFloat 3s ease-in-out 0.5s infinite',
filter: `drop-shadow(0 8px 20px ${accentColor}40)`,
userSelect: 'none',
display: 'inline-block',
}}
>
📱
</div>
<p
style={{
margin: 0,
fontSize: '15px',
fontWeight: 500,
color: subColor,
lineHeight: '1.5',
maxWidth: '280px',
}}
>
{t('appsModalEmpty')}
</p>
<div
style={{
display: 'flex',
gap: '6px',
marginTop: '24px',
}}
>
{[0, 1, 2].map((i) => (
<div
key={i}
style={{
width: '6px',
height: '6px',
borderRadius: '50%',
background: accentColor,
opacity: 0.3 + i * 0.2,
}}
/>
))}
</div>
</div>
{/* ============ Кнопка "Понятно" ============ */}
<button
onClick={onClose}
style={{
width: '100%',
marginTop: '16px',
padding: '14px 20px',
borderRadius: radius.md,
border: 'none',
background: `linear-gradient(135deg, ${accentColor}, #3E9BE0)`,
color: '#FFFFFF',
fontSize: '15px',
fontWeight: 700,
cursor: 'pointer',
boxShadow: `0 6px 20px ${accentColor}40`,
WebkitTapHighlightColor: 'transparent',
letterSpacing: '0.2px',
}}
onTouchStart={(e) => {
e.currentTarget.style.transform = 'scale(0.97)';
}}
onTouchEnd={(e) => {
e.currentTarget.style.transform = 'scale(1)';
}}
>
{t('modalGotIt')}
</button>
</div>
</div>
);
};
export default AppsModal;
-248
View File
@@ -1,248 +0,0 @@
import { useEffect, useRef } from 'react';
import { useLanguage } from '../../i18n/LanguageContext';
import { radius } from '../../styles/theme';
interface ContactsModalProps {
isOpen: boolean;
onClose: () => void;
}
const ContactsModal: React.FC<ContactsModalProps> = ({ isOpen, onClose }) => {
const { t } = useLanguage();
const scrollRef = useRef<HTMLDivElement>(null);
const accentColor = '#8B5CF6';
const textColor = '#1A1A2E';
const subColor = '#6B7280';
const cardBg = 'rgba(255,255,255,0.55)';
const glass = (extra: React.CSSProperties = {}): React.CSSProperties => ({
background: cardBg,
backdropFilter: 'blur(24px) saturate(180%)',
WebkitBackdropFilter: 'blur(24px) saturate(180%)',
border: '1px solid rgba(255,255,255,0.7)',
boxShadow: '0 8px 32px rgba(31,38,73,0.10), inset 0 1px 0 rgba(255,255,255,0.85)',
...extra,
});
useEffect(() => {
if (isOpen && scrollRef.current) {
scrollRef.current.scrollTop = 0;
}
}, [isOpen]);
useEffect(() => {
if (!isOpen) return;
const handleKey = (e: KeyboardEvent) => {
if (e.key === 'Escape') onClose();
};
window.addEventListener('keydown', handleKey);
return () => window.removeEventListener('keydown', handleKey);
}, [isOpen, onClose]);
if (!isOpen) return null;
return (
<div
style={{
position: 'fixed',
top: 0,
left: 0,
right: 0,
bottom: 0,
background: 'rgba(20,22,35,0.35)',
zIndex: 1000,
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
padding: '20px',
backdropFilter: 'blur(6px)',
WebkitBackdropFilter: 'blur(6px)',
animation: 'contactsFadeIn 0.2s ease',
}}
onClick={(e) => {
if (e.target === e.currentTarget) onClose();
}}
>
<style>{`
@keyframes contactsFadeIn {
0% { opacity: 0; }
100% { opacity: 1; }
}
@keyframes contactsSlideUp {
0% { transform: translateY(20px); opacity: 0; }
100% { transform: translateY(0); opacity: 1; }
}
@keyframes contactsPopIn {
0% { transform: scale(0.4); opacity: 0; }
60% { transform: scale(1.1); opacity: 1; }
100% { transform: scale(1); opacity: 1; }
}
@keyframes contactsFloat {
0%, 100% { transform: translateY(0); }
50% { transform: translateY(-6px); }
}
`}</style>
<div
ref={scrollRef}
onClick={(e) => e.stopPropagation()}
style={{
...glass({
borderRadius: radius.lg,
padding: '24px',
width: '100%',
maxWidth: '400px',
maxHeight: '80vh',
overflowY: 'auto',
boxShadow: '0 24px 60px rgba(31,38,73,0.25), inset 0 1px 0 rgba(255,255,255,0.85)',
}),
animation: 'contactsSlideUp 0.3s ease',
}}
>
{/* ============ Заголовок ============ */}
<div
style={{
display: 'flex',
alignItems: 'center',
justifyContent: 'space-between',
marginBottom: '20px',
paddingBottom: '14px',
borderBottom: '1px solid rgba(0,0,0,0.06)',
}}
>
<div style={{ display: 'flex', alignItems: 'center', gap: '10px' }}>
{/* 🔧 ФИКС iOS 27: lineHeight 1.2 для эмодзи в заголовке */}
<span style={{ fontSize: '24px', lineHeight: '1.2', display: 'inline-block' }}>📞</span>
<h3
style={{
margin: 0,
fontSize: '18px',
fontWeight: 800,
color: textColor,
letterSpacing: '-0.2px',
}}
>
{t('contactsModalTitle')}
</h3>
</div>
<button
onClick={onClose}
aria-label="Close"
style={{
...glass({
padding: '8px 14px',
borderRadius: radius.sm,
}),
color: textColor,
fontSize: '14px',
fontWeight: 600,
cursor: 'pointer',
WebkitTapHighlightColor: 'transparent',
}}
onTouchStart={(e) => {
e.currentTarget.style.transform = 'scale(0.9)';
}}
onTouchEnd={(e) => {
e.currentTarget.style.transform = 'scale(1)';
}}
>
✕
</button>
</div>
{/* ============ Пустое состояние ============ */}
<div
style={{
display: 'flex',
flexDirection: 'column',
alignItems: 'center',
justifyContent: 'center',
padding: '32px 16px',
textAlign: 'center',
}}
>
{/* 🔧 ФИКС iOS 27: lineHeight 1.2 + padding для большого эмодзи */}
<div
style={{
fontSize: '64px',
lineHeight: '1.2',
padding: '8px 0',
marginBottom: '20px',
animation: 'contactsPopIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1), contactsFloat 3s ease-in-out 0.5s infinite',
filter: `drop-shadow(0 8px 20px ${accentColor}40)`,
userSelect: 'none',
display: 'inline-block',
}}
>
📞
</div>
<p
style={{
margin: 0,
fontSize: '15px',
fontWeight: 500,
color: subColor,
lineHeight: '1.5',
maxWidth: '280px',
}}
>
{t('contactsModalEmpty')}
</p>
<div
style={{
display: 'flex',
gap: '6px',
marginTop: '24px',
}}
>
{[0, 1, 2].map((i) => (
<div
key={i}
style={{
width: '6px',
height: '6px',
borderRadius: '50%',
background: accentColor,
opacity: 0.3 + i * 0.2,
}}
/>
))}
</div>
</div>
{/* ============ Кнопка "Понятно" ============ */}
<button
onClick={onClose}
style={{
width: '100%',
marginTop: '16px',
padding: '14px 20px',
borderRadius: radius.md,
border: 'none',
background: `linear-gradient(135deg, ${accentColor}, #6B46C1)`,
color: '#FFFFFF',
fontSize: '15px',
fontWeight: 700,
cursor: 'pointer',
boxShadow: `0 6px 20px ${accentColor}40`,
WebkitTapHighlightColor: 'transparent',
letterSpacing: '0.2px',
}}
onTouchStart={(e) => {
e.currentTarget.style.transform = 'scale(0.97)';
}}
onTouchEnd={(e) => {
e.currentTarget.style.transform = 'scale(1)';
}}
>
{t('modalGotIt')}
</button>
</div>
</div>
);
};
export default ContactsModal;
-378
View File
@@ -1,378 +0,0 @@
import { useEffect, useRef, useState } from 'react';
import { useLanguage } from '../../i18n/LanguageContext';
import { radius } from '../../styles/theme';
interface NewsModalProps {
isOpen: boolean;
onClose: () => void;
/** Флаг админа — приходит из MenuPage (уже есть в MenuPage) */
isAdmin?: boolean;
}
const NewsModal: React.FC<NewsModalProps> = ({ isOpen, onClose, isAdmin = false }) => {
const { t } = useLanguage();
const scrollRef = useRef<HTMLDivElement>(null);
const [showAdminStub, setShowAdminStub] = useState(false);
const accentColor = '#E8B93F';
const accentDark = '#CE9A1E';
const textColor = '#1A1A2E';
const subColor = '#6B7280';
const cardBg = 'rgba(255,255,255,0.55)';
const glass = (extra: React.CSSProperties = {}): React.CSSProperties => ({
background: cardBg,
backdropFilter: 'blur(24px) saturate(180%)',
WebkitBackdropFilter: 'blur(24px) saturate(180%)',
border: '1px solid rgba(255,255,255,0.7)',
boxShadow: '0 8px 32px rgba(31,38,73,0.10), inset 0 1px 0 rgba(255,255,255,0.85)',
...extra,
});
// Сброс скролла и админ-заглушки при каждом открытии
useEffect(() => {
if (isOpen) {
if (scrollRef.current) scrollRef.current.scrollTop = 0;
setShowAdminStub(false);
}
}, [isOpen]);
// Escape
useEffect(() => {
if (!isOpen) return;
const handleKey = (e: KeyboardEvent) => {
if (e.key === 'Escape') onClose();
};
window.addEventListener('keydown', handleKey);
return () => window.removeEventListener('keydown', handleKey);
}, [isOpen, onClose]);
if (!isOpen) return null;
return (
<div
style={{
position: 'fixed',
top: 0,
left: 0,
right: 0,
bottom: 0,
background: 'rgba(20,22,35,0.35)',
zIndex: 1000,
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
padding: '20px',
backdropFilter: 'blur(6px)',
WebkitBackdropFilter: 'blur(6px)',
animation: 'newsFadeIn 0.2s ease',
}}
onClick={(e) => {
if (e.target === e.currentTarget) onClose();
}}
>
<style>{`
@keyframes newsFadeIn {
0% { opacity: 0; }
100% { opacity: 1; }
}
@keyframes newsSlideUp {
0% { transform: translateY(20px); opacity: 0; }
100% { transform: translateY(0); opacity: 1; }
}
@keyframes newsPopIn {
0% { transform: scale(0.4); opacity: 0; }
60% { transform: scale(1.1); opacity: 1; }
100% { transform: scale(1); opacity: 1; }
}
@keyframes newsFloat {
0%, 100% { transform: translateY(0); }
50% { transform: translateY(-6px); }
}
`}</style>
<div
ref={scrollRef}
onClick={(e) => e.stopPropagation()}
style={{
...glass({
borderRadius: radius.lg,
padding: '24px',
width: '100%',
maxWidth: '400px',
maxHeight: '80vh',
overflowY: 'auto',
boxShadow: '0 24px 60px rgba(31,38,73,0.25), inset 0 1px 0 rgba(255,255,255,0.85)',
}),
animation: 'newsSlideUp 0.3s ease',
}}
>
{/* ============ Заголовок ============ */}
<div
style={{
display: 'flex',
alignItems: 'center',
justifyContent: 'space-between',
marginBottom: '20px',
paddingBottom: '14px',
borderBottom: '1px solid rgba(0,0,0,0.06)',
gap: '8px',
}}
>
<div style={{ display: 'flex', alignItems: 'center', gap: '10px', minWidth: 0 }}>
{/* 🔧 ФИКС iOS 27: lineHeight 1.2 для эмодзи в заголовке */}
<span style={{ fontSize: '24px', flexShrink: 0, lineHeight: '1.2', display: 'inline-block' }}>📰</span>
<h3
style={{
margin: 0,
fontSize: '18px',
fontWeight: 800,
color: textColor,
letterSpacing: '-0.2px',
whiteSpace: 'nowrap',
overflow: 'hidden',
textOverflow: 'ellipsis',
}}
>
{t('newsModalTitle')}
</h3>
</div>
<div style={{ display: 'flex', gap: '6px', flexShrink: 0 }}>
{/* ➕ Кнопка добавления — только админу */}
{isAdmin && !showAdminStub && (
<button
onClick={() => setShowAdminStub(true)}
aria-label="Add news"
title="Add news"
style={{
...glass({
padding: '8px 12px',
borderRadius: radius.sm,
}),
color: accentDark,
fontSize: '16px',
fontWeight: 800,
cursor: 'pointer',
WebkitTapHighlightColor: 'transparent',
lineHeight: '1.2', // 🔧 ФИКС iOS 27
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
minHeight: '36px',
}}
onTouchStart={(e) => {
e.currentTarget.style.transform = 'scale(0.9)';
}}
onTouchEnd={(e) => {
e.currentTarget.style.transform = 'scale(1)';
}}
>
➕
</button>
)}
{/* Кнопка закрытия */}
<button
onClick={onClose}
aria-label="Close"
style={{
...glass({
padding: '8px 14px',
borderRadius: radius.sm,
}),
color: textColor,
fontSize: '14px',
fontWeight: 600,
cursor: 'pointer',
WebkitTapHighlightColor: 'transparent',
}}
onTouchStart={(e) => {
e.currentTarget.style.transform = 'scale(0.9)';
}}
onTouchEnd={(e) => {
e.currentTarget.style.transform = 'scale(1)';
}}
>
✕
</button>
</div>
</div>
{/* ============ Админ-заглушка (по кнопке ➕) ============ */}
{showAdminStub ? (
<div
style={{
display: 'flex',
flexDirection: 'column',
alignItems: 'center',
justifyContent: 'center',
padding: '32px 16px',
textAlign: 'center',
animation: 'newsPopIn 0.3s ease',
}}
>
{/* 🔧 ФИКС iOS 27: lineHeight 1.2 + padding для эмодзи 56px */}
<div
style={{
fontSize: '56px',
lineHeight: '1.2',
padding: '8px 0',
marginBottom: '16px',
filter: `drop-shadow(0 8px 20px ${accentColor}40)`,
userSelect: 'none',
display: 'inline-block',
}}
>
🛠️
</div>
<div
style={{
fontSize: '14px',
fontWeight: 700,
color: accentDark,
marginBottom: '8px',
textTransform: 'uppercase',
letterSpacing: '0.5px',
}}
>
Admin mode
</div>
<p
style={{
margin: 0,
fontSize: '14px',
fontWeight: 500,
color: subColor,
lineHeight: '1.5',
maxWidth: '280px',
}}
>
News management is coming soon.
</p>
<button
onClick={() => setShowAdminStub(false)}
style={{
marginTop: '20px',
padding: '10px 20px',
borderRadius: radius.md,
border: `1px solid ${accentColor}40`,
background: `${accentColor}15`,
color: accentDark,
fontSize: '13px',
fontWeight: 700,
cursor: 'pointer',
WebkitTapHighlightColor: 'transparent',
}}
onTouchStart={(e) => {
e.currentTarget.style.transform = 'scale(0.96)';
}}
onTouchEnd={(e) => {
e.currentTarget.style.transform = 'scale(1)';
}}
>
← {t('back')}
</button>
</div>
) : (
/* ============ Пустое состояние для всех ============ */
<div
style={{
display: 'flex',
flexDirection: 'column',
alignItems: 'center',
justifyContent: 'center',
padding: '32px 16px',
textAlign: 'center',
}}
>
{/* 🔧 ФИКС iOS 27: lineHeight 1.2 + padding для большого эмодзи */}
<div
style={{
fontSize: '64px',
lineHeight: '1.2',
padding: '8px 0',
marginBottom: '20px',
animation: 'newsPopIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1), newsFloat 3s ease-in-out 0.5s infinite',
filter: `drop-shadow(0 8px 20px ${accentColor}40)`,
userSelect: 'none',
display: 'inline-block',
}}
>
📰
</div>
<p
style={{
margin: 0,
fontSize: '15px',
fontWeight: 500,
color: subColor,
lineHeight: '1.5',
maxWidth: '280px',
}}
>
{t('newsModalEmpty')}
</p>
<div
style={{
display: 'flex',
gap: '6px',
marginTop: '24px',
}}
>
{[0, 1, 2].map((i) => (
<div
key={i}
style={{
width: '6px',
height: '6px',
borderRadius: '50%',
background: accentColor,
opacity: 0.3 + i * 0.2,
}}
/>
))}
</div>
</div>
)}
{/* ============ Кнопка "Понятно" — только когда не админ-заглушка ============ */}
{!showAdminStub && (
<button
onClick={onClose}
style={{
width: '100%',
marginTop: '16px',
padding: '14px 20px',
borderRadius: radius.md,
border: 'none',
background: `linear-gradient(135deg, ${accentColor}, ${accentDark})`,
color: '#FFFFFF',
fontSize: '15px',
fontWeight: 700,
cursor: 'pointer',
boxShadow: `0 6px 20px ${accentColor}40`,
WebkitTapHighlightColor: 'transparent',
letterSpacing: '0.2px',
}}
onTouchStart={(e) => {
e.currentTarget.style.transform = 'scale(0.97)';
}}
onTouchEnd={(e) => {
e.currentTarget.style.transform = 'scale(1)';
}}
>
{t('modalGotIt')}
</button>
)}
</div>
</div>
);
};
export default NewsModal;
-248
View File
@@ -1,248 +0,0 @@
import { useEffect, useRef } from 'react';
import { useLanguage } from '../../i18n/LanguageContext';
import { radius } from '../../styles/theme';
interface PartnersModalProps {
isOpen: boolean;
onClose: () => void;
}
const PartnersModal: React.FC<PartnersModalProps> = ({ isOpen, onClose }) => {
const { t } = useLanguage();
const scrollRef = useRef<HTMLDivElement>(null);
const brandColor = '#2ECC71';
const textColor = '#1A1A2E';
const subColor = '#6B7280';
const cardBg = 'rgba(255,255,255,0.55)';
const glass = (extra: React.CSSProperties = {}): React.CSSProperties => ({
background: cardBg,
backdropFilter: 'blur(24px) saturate(180%)',
WebkitBackdropFilter: 'blur(24px) saturate(180%)',
border: '1px solid rgba(255,255,255,0.7)',
boxShadow: '0 8px 32px rgba(31,38,73,0.10), inset 0 1px 0 rgba(255,255,255,0.85)',
...extra,
});
useEffect(() => {
if (isOpen && scrollRef.current) {
scrollRef.current.scrollTop = 0;
}
}, [isOpen]);
useEffect(() => {
if (!isOpen) return;
const handleKey = (e: KeyboardEvent) => {
if (e.key === 'Escape') onClose();
};
window.addEventListener('keydown', handleKey);
return () => window.removeEventListener('keydown', handleKey);
}, [isOpen, onClose]);
if (!isOpen) return null;
return (
<div
style={{
position: 'fixed',
top: 0,
left: 0,
right: 0,
bottom: 0,
background: 'rgba(20,22,35,0.35)',
zIndex: 1000,
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
padding: '20px',
backdropFilter: 'blur(6px)',
WebkitBackdropFilter: 'blur(6px)',
animation: 'partnersFadeIn 0.2s ease',
}}
onClick={(e) => {
if (e.target === e.currentTarget) onClose();
}}
>
<style>{`
@keyframes partnersFadeIn {
0% { opacity: 0; }
100% { opacity: 1; }
}
@keyframes partnersSlideUp {
0% { transform: translateY(20px); opacity: 0; }
100% { transform: translateY(0); opacity: 1; }
}
@keyframes partnersPopIn {
0% { transform: scale(0.4); opacity: 0; }
60% { transform: scale(1.1); opacity: 1; }
100% { transform: scale(1); opacity: 1; }
}
@keyframes partnersFloat {
0%, 100% { transform: translateY(0); }
50% { transform: translateY(-6px); }
}
`}</style>
<div
ref={scrollRef}
onClick={(e) => e.stopPropagation()}
style={{
...glass({
borderRadius: radius.lg,
padding: '24px',
width: '100%',
maxWidth: '400px',
maxHeight: '80vh',
overflowY: 'auto',
boxShadow: '0 24px 60px rgba(31,38,73,0.25), inset 0 1px 0 rgba(255,255,255,0.85)',
}),
animation: 'partnersSlideUp 0.3s ease',
}}
>
{/* ============ Заголовок ============ */}
<div
style={{
display: 'flex',
alignItems: 'center',
justifyContent: 'space-between',
marginBottom: '20px',
paddingBottom: '14px',
borderBottom: '1px solid rgba(0,0,0,0.06)',
}}
>
<div style={{ display: 'flex', alignItems: 'center', gap: '10px' }}>
{/* 🔧 ФИКС iOS 27: lineHeight 1.2 для эмодзи в заголовке */}
<span style={{ fontSize: '24px', lineHeight: '1.2', display: 'inline-block' }}>🤝</span>
<h3
style={{
margin: 0,
fontSize: '18px',
fontWeight: 800,
color: textColor,
letterSpacing: '-0.2px',
}}
>
{t('partnersModalTitle')}
</h3>
</div>
<button
onClick={onClose}
aria-label="Close"
style={{
...glass({
padding: '8px 14px',
borderRadius: radius.sm,
}),
color: textColor,
fontSize: '14px',
fontWeight: 600,
cursor: 'pointer',
WebkitTapHighlightColor: 'transparent',
}}
onTouchStart={(e) => {
e.currentTarget.style.transform = 'scale(0.9)';
}}
onTouchEnd={(e) => {
e.currentTarget.style.transform = 'scale(1)';
}}
>
✕
</button>
</div>
{/* ============ Пустое состояние ============ */}
<div
style={{
display: 'flex',
flexDirection: 'column',
alignItems: 'center',
justifyContent: 'center',
padding: '32px 16px',
textAlign: 'center',
}}
>
{/* 🔧 ФИКС iOS 27: lineHeight 1.2 + padding для большого эмодзи */}
<div
style={{
fontSize: '64px',
lineHeight: '1.2',
padding: '8px 0',
marginBottom: '20px',
animation: 'partnersPopIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1), partnersFloat 3s ease-in-out 0.5s infinite',
filter: `drop-shadow(0 8px 20px ${brandColor}40)`,
userSelect: 'none',
display: 'inline-block',
}}
>
🤝
</div>
<p
style={{
margin: 0,
fontSize: '15px',
fontWeight: 500,
color: subColor,
lineHeight: '1.5',
maxWidth: '280px',
}}
>
{t('partnersModalEmpty')}
</p>
<div
style={{
display: 'flex',
gap: '6px',
marginTop: '24px',
}}
>
{[0, 1, 2].map((i) => (
<div
key={i}
style={{
width: '6px',
height: '6px',
borderRadius: '50%',
background: brandColor,
opacity: 0.3 + i * 0.2,
}}
/>
))}
</div>
</div>
{/* ============ Кнопка "Понятно" ============ */}
<button
onClick={onClose}
style={{
width: '100%',
marginTop: '16px',
padding: '14px 20px',
borderRadius: radius.md,
border: 'none',
background: `linear-gradient(135deg, ${brandColor}, #27AE60)`,
color: '#FFFFFF',
fontSize: '15px',
fontWeight: 700,
cursor: 'pointer',
boxShadow: `0 6px 20px ${brandColor}40`,
WebkitTapHighlightColor: 'transparent',
letterSpacing: '0.2px',
}}
onTouchStart={(e) => {
e.currentTarget.style.transform = 'scale(0.97)';
}}
onTouchEnd={(e) => {
e.currentTarget.style.transform = 'scale(1)';
}}
>
{t('modalGotIt')}
</button>
</div>
</div>
);
};
export default PartnersModal;
View File
View File