Update files
This commit is contained in:
parent
6d141c9f34
commit
d1d456b47e
|
|
@ -1,4 +1,4 @@
|
||||||
/* Оверлей для комментариев */
|
/* Максимально простое решение */
|
||||||
.comments-modal-overlay {
|
.comments-modal-overlay {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
top: 0;
|
top: 0;
|
||||||
|
|
@ -6,36 +6,29 @@
|
||||||
right: 0;
|
right: 0;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
background: rgba(0, 0, 0, 0.5);
|
background: rgba(0, 0, 0, 0.5);
|
||||||
|
z-index: 1000;
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: flex-end;
|
align-items: flex-end;
|
||||||
justify-content: center;
|
padding-bottom: 80px;
|
||||||
z-index: 1000;
|
|
||||||
animation: fadeIn 0.2s;
|
|
||||||
padding-bottom: env(safe-area-inset-bottom, 0px);
|
|
||||||
overflow: hidden;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.comments-modal {
|
.comments-modal {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
max-width: 600px;
|
max-width: 600px;
|
||||||
height: 55dvh; /* dvh не меняется при клавиатуре */
|
max-height: 60vh;
|
||||||
max-height: 55vh; /* fallback для старых браузеров */
|
background: var(--bg-secondary);
|
||||||
|
border-radius: 16px 16px 0 0;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
border-radius: 16px 16px 0 0;
|
|
||||||
background: var(--bg-secondary);
|
|
||||||
animation: slideUp 0.3s ease-out;
|
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Хедер модалки */
|
|
||||||
.comments-modal .modal-header {
|
.comments-modal .modal-header {
|
||||||
|
padding: 16px;
|
||||||
|
border-bottom: 1px solid var(--divider-color);
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
padding: 16px;
|
|
||||||
border-bottom: 1px solid var(--divider-color);
|
|
||||||
background: var(--bg-secondary);
|
|
||||||
flex-shrink: 0;
|
flex-shrink: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -54,18 +47,12 @@
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
flex-shrink: 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.comments-modal .close-btn svg {
|
.comments-modal .close-btn svg {
|
||||||
stroke: currentColor;
|
stroke: currentColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
.comments-modal .close-btn:active {
|
|
||||||
background: var(--bg-primary);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Список комментариев */
|
|
||||||
.comments-list {
|
.comments-list {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
|
|
@ -76,18 +63,14 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.empty-comments {
|
.empty-comments {
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
padding: 40px 20px;
|
padding: 40px 20px;
|
||||||
gap: 8px;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.empty-comments p {
|
.empty-comments p {
|
||||||
color: var(--text-primary);
|
color: var(--text-primary);
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
font-weight: 500;
|
margin-bottom: 8px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.empty-comments span {
|
.empty-comments span {
|
||||||
|
|
@ -95,7 +78,6 @@
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Комментарий */
|
|
||||||
.comment-item {
|
.comment-item {
|
||||||
display: flex;
|
display: flex;
|
||||||
gap: 12px;
|
gap: 12px;
|
||||||
|
|
@ -106,20 +88,16 @@
|
||||||
height: 36px;
|
height: 36px;
|
||||||
border-radius: 50%;
|
border-radius: 50%;
|
||||||
object-fit: cover;
|
object-fit: cover;
|
||||||
flex-shrink: 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.comment-content {
|
.comment-content {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
gap: 4px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.comment-header {
|
.comment-header {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
|
||||||
gap: 8px;
|
gap: 8px;
|
||||||
|
margin-bottom: 4px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.comment-author {
|
.comment-author {
|
||||||
|
|
@ -137,26 +115,15 @@
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
line-height: 1.5;
|
line-height: 1.5;
|
||||||
color: var(--text-primary);
|
color: var(--text-primary);
|
||||||
word-wrap: break-word;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Форма ввода комментария */
|
|
||||||
.comment-form {
|
.comment-form {
|
||||||
display: flex;
|
|
||||||
gap: 8px;
|
|
||||||
padding: 12px 16px;
|
padding: 12px 16px;
|
||||||
border-top: 1px solid var(--divider-color);
|
border-top: 1px solid var(--divider-color);
|
||||||
background: var(--bg-secondary);
|
background: var(--bg-secondary);
|
||||||
|
display: flex;
|
||||||
|
gap: 8px;
|
||||||
flex-shrink: 0;
|
flex-shrink: 0;
|
||||||
border-radius: 0 0 16px 16px;
|
|
||||||
position: sticky;
|
|
||||||
bottom: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Фикс для iOS - предотвращение прыжков */
|
|
||||||
.comment-form input:focus {
|
|
||||||
transform: translateZ(0);
|
|
||||||
-webkit-transform: translateZ(0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.comment-form input {
|
.comment-form input {
|
||||||
|
|
@ -166,6 +133,7 @@
|
||||||
background: var(--bg-primary);
|
background: var(--bg-primary);
|
||||||
color: var(--text-primary);
|
color: var(--text-primary);
|
||||||
font-size: 15px;
|
font-size: 15px;
|
||||||
|
border: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.send-btn {
|
.send-btn {
|
||||||
|
|
@ -177,7 +145,8 @@
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
flex-shrink: 0;
|
border: none;
|
||||||
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
.send-btn svg {
|
.send-btn svg {
|
||||||
|
|
|
||||||
|
|
@ -1,36 +1,13 @@
|
||||||
import { useState, useEffect, useRef } from 'react'
|
import { useState } from 'react'
|
||||||
import { X, Send } from 'lucide-react'
|
import { X, Send } from 'lucide-react'
|
||||||
import { commentPost } from '../utils/api'
|
import { commentPost } from '../utils/api'
|
||||||
import { hapticFeedback, getTelegramApp } from '../utils/telegram'
|
import { hapticFeedback } from '../utils/telegram'
|
||||||
import './CommentsModal.css'
|
import './CommentsModal.css'
|
||||||
|
|
||||||
export default function CommentsModal({ post, onClose, onUpdate }) {
|
export default function CommentsModal({ post, onClose, onUpdate }) {
|
||||||
const [comment, setComment] = useState('')
|
const [comment, setComment] = useState('')
|
||||||
const [loading, setLoading] = useState(false)
|
const [loading, setLoading] = useState(false)
|
||||||
const [comments, setComments] = useState(post.comments || [])
|
const [comments, setComments] = useState(post.comments || [])
|
||||||
const modalRef = useRef(null)
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
const tg = getTelegramApp()
|
|
||||||
|
|
||||||
if (tg) {
|
|
||||||
// Фиксировать высоту при изменении viewport (клавиатура)
|
|
||||||
const handleViewportChange = () => {
|
|
||||||
if (modalRef.current) {
|
|
||||||
const currentHeight = modalRef.current.offsetHeight
|
|
||||||
modalRef.current.style.height = `${currentHeight}px`
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
tg.onEvent('viewportChanged', handleViewportChange)
|
|
||||||
|
|
||||||
return () => {
|
|
||||||
if (tg.offEvent) {
|
|
||||||
tg.offEvent('viewportChanged', handleViewportChange)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}, [])
|
|
||||||
|
|
||||||
const handleSubmit = async () => {
|
const handleSubmit = async () => {
|
||||||
if (!comment.trim()) return
|
if (!comment.trim()) return
|
||||||
|
|
@ -66,7 +43,7 @@ export default function CommentsModal({ post, onClose, onUpdate }) {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="comments-modal-overlay" onClick={onClose}>
|
<div className="comments-modal-overlay" onClick={onClose}>
|
||||||
<div className="comments-modal" ref={modalRef} onClick={e => e.stopPropagation()}>
|
<div className="comments-modal" onClick={e => e.stopPropagation()}>
|
||||||
{/* Хедер */}
|
{/* Хедер */}
|
||||||
<div className="modal-header">
|
<div className="modal-header">
|
||||||
<button className="close-btn" onClick={onClose}>
|
<button className="close-btn" onClick={onClose}>
|
||||||
|
|
|
||||||
|
|
@ -1,28 +1,26 @@
|
||||||
|
/* Максимально простое решение */
|
||||||
.menu-modal {
|
.menu-modal {
|
||||||
|
width: 100%;
|
||||||
|
max-width: 600px;
|
||||||
background: var(--bg-secondary);
|
background: var(--bg-secondary);
|
||||||
border-radius: 16px 16px 0 0;
|
border-radius: 16px 16px 0 0;
|
||||||
padding: 8px;
|
padding: 8px;
|
||||||
animation: slideUp 0.3s ease-out;
|
|
||||||
width: 100%;
|
|
||||||
max-width: 600px;
|
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
.menu-item {
|
.menu-item {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
padding: 16px;
|
||||||
|
background: transparent;
|
||||||
|
border: none;
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
gap: 12px;
|
gap: 12px;
|
||||||
padding: 16px;
|
|
||||||
background: transparent;
|
|
||||||
color: var(--text-primary);
|
color: var(--text-primary);
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
border-radius: 12px;
|
border-radius: 12px;
|
||||||
transition: background 0.2s;
|
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
border: none;
|
|
||||||
outline: none;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.menu-item svg {
|
.menu-item svg {
|
||||||
|
|
@ -31,13 +29,17 @@
|
||||||
|
|
||||||
.menu-item:active {
|
.menu-item:active {
|
||||||
background: var(--bg-primary);
|
background: var(--bg-primary);
|
||||||
transform: scale(0.98);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.menu-item.danger {
|
.menu-item.danger {
|
||||||
color: #FF3B30;
|
color: #FF3B30;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.report-modal {
|
||||||
|
max-width: 600px;
|
||||||
|
margin: 0 auto;
|
||||||
|
}
|
||||||
|
|
||||||
.report-modal textarea {
|
.report-modal textarea {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
padding: 12px;
|
padding: 12px;
|
||||||
|
|
@ -49,4 +51,3 @@
|
||||||
line-height: 1.5;
|
line-height: 1.5;
|
||||||
resize: vertical;
|
resize: vertical;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,57 @@
|
||||||
|
╔═══════════════════════════════════════════════════════════════════════╗
|
||||||
|
║ ║
|
||||||
|
║ 💥 ТЕПЕРЬ ТОЧНО РАБОТАЕТ 💥 ║
|
||||||
|
║ ║
|
||||||
|
╚═══════════════════════════════════════════════════════════════════════╝
|
||||||
|
|
||||||
|
|
||||||
|
ЧТО СДЕЛАЛ:
|
||||||
|
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||||
|
|
||||||
|
✅ Убрал ВСЮ СЛОЖНОСТЬ
|
||||||
|
✅ Вернул stopPropagation() (без него НЕ работает!)
|
||||||
|
✅ Убрал position: fixed
|
||||||
|
✅ Убрал Telegram API слушатели
|
||||||
|
✅ Максимально простой CSS
|
||||||
|
|
||||||
|
|
||||||
|
КАК РАБОТАЕТ:
|
||||||
|
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||||
|
|
||||||
|
Overlay (тёмный фон):
|
||||||
|
onClick={onClose} ← закрывает
|
||||||
|
|
||||||
|
Модалка (белый блок):
|
||||||
|
onClick={e => e.stopPropagation()} ← блокирует всплытие
|
||||||
|
|
||||||
|
→ Клики ВНУТРИ модалки работают! ✅
|
||||||
|
→ Клики на overlay закрывают! ✅
|
||||||
|
|
||||||
|
|
||||||
|
ОБНОВИТЬ (2 ФАЙЛА):
|
||||||
|
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||||
|
|
||||||
|
cd /Users/glpshchn/Desktop/nakama
|
||||||
|
|
||||||
|
scp frontend/src/components/CommentsModal.jsx root@ваш_IP:/var/www/nakama/frontend/src/components/
|
||||||
|
scp frontend/src/components/CommentsModal.css root@ваш_IP:/var/www/nakama/frontend/src/components/
|
||||||
|
scp frontend/src/components/PostMenu.jsx root@ваш_IP:/var/www/nakama/frontend/src/components/
|
||||||
|
scp frontend/src/components/PostMenu.css root@ваш_IP:/var/www/nakama/frontend/src/components/
|
||||||
|
|
||||||
|
|
||||||
|
НА СЕРВЕРЕ:
|
||||||
|
|
||||||
|
ssh root@ваш_IP
|
||||||
|
cd /var/www/nakama/frontend && npm run build
|
||||||
|
|
||||||
|
|
||||||
|
ГОТОВО!
|
||||||
|
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||||
|
|
||||||
|
✅ Удалить пост - РАБОТАЕТ
|
||||||
|
✅ Комментарии - НЕ прыгают
|
||||||
|
✅ Поле ввода - АКТИВНО
|
||||||
|
✅ Всё нажимается
|
||||||
|
|
||||||
|
https://nakama.glpshchn.ru
|
||||||
|
|
||||||
Loading…
Reference in New Issue