This commit is contained in:
dev.daminik00 2025-09-19 00:49:01 +02:00
parent c5002e1a7a
commit f3872e7ce1
13 changed files with 42 additions and 16 deletions

View File

@ -10,5 +10,4 @@
align-self: flex-end;
margin-left: auto;
}
}

View File

@ -1,20 +1,21 @@
"use client";
import clsx from "clsx";
import { useEffect } from "react";
import clsx from "clsx";
import type { IChatMessage } from "@/entities/chats/types";
import { useShowRefillModal } from "@/hooks/refill/useShowRefillModal";
import { useChat } from "@/providers/chat-provider";
import { formatTime } from "@/shared/utils/date";
import styles from "./ChatMessage.module.scss";
import MessageBubble from "./MessageBubble/MessageBubble";
import MessageMeta from "./MessageMeta/MessageMeta";
import MessageStatus from "./MessageStatus/MessageStatus";
import MessageText from "./MessageText/MessageText";
import MessageTyping from "./MessageTyping/MessageTyping";
import styles from "./ChatMessage.module.scss";
export interface ChatMessageProps {
// message: {
// id: string;

View File

@ -10,7 +10,9 @@
&.blurred {
filter: blur(4px);
opacity: 0.6;
transition: filter 0.3s ease, opacity 0.3s ease;
transition:
filter 0.3s ease,
opacity 0.3s ease;
pointer-events: none;
user-select: none; // Запрещаем выделение текста
-webkit-user-select: none; // Safari

View File

@ -28,7 +28,7 @@ export default function MessageText({
return (
<div
onClick={handleClick}
style={isBlurred ? { cursor: 'pointer' } : undefined}
style={isBlurred ? { cursor: "pointer" } : undefined}
>
<Typography
as="p"

View File

@ -81,7 +81,9 @@ export default function ChatModalsWrapper() {
return (
<ModalSheet
open={isModalOpen}
onClose={modalChild === "refill-timer" ? handleTimerModalClose : handleModalClose}
onClose={
modalChild === "refill-timer" ? handleTimerModalClose : handleModalClose
}
variant={modalChild === "refill-timer" ? "gray" : "white"}
disableBackdropClose={true}
>

View File

@ -41,7 +41,11 @@ export default function GlobalNewMessagesBanner() {
onClick={() => setHomeNewMessages({ isVisibleAll: !isVisibleAll })}
/>
)}
<NewMessages chats={unreadChats} isVisibleAll={isVisibleAll} currentBalance={balance} />
<NewMessages
chats={unreadChats}
isVisibleAll={isVisibleAll}
currentBalance={balance}
/>
</div>
);
}

View File

@ -21,7 +21,9 @@
&.blurred {
filter: blur(4px);
opacity: 0.6;
transition: filter 0.3s ease, opacity 0.3s ease;
transition:
filter 0.3s ease,
opacity 0.3s ease;
user-select: none;
-webkit-user-select: none;
-moz-user-select: none;

View File

@ -25,8 +25,7 @@ export default function LastMessagePreview({
// Определяем нужно ли блюрить сообщение
const shouldBlur =
message.sentWithZeroBalance === true &&
currentBalance <= 0;
message.sentWithZeroBalance === true && currentBalance <= 0;
const getMessageIcon = () => {
switch (message.type) {
@ -80,7 +79,7 @@ export default function LastMessagePreview({
size="sm"
color="secondary"
align="left"
className={`${styles.text} ${shouldBlur ? styles.blurred : ''}`}
className={`${styles.text} ${shouldBlur ? styles.blurred : ""}`}
>
{getMessageText()}
</Typography>

View File

@ -12,7 +12,10 @@ interface MessageInputProps {
disabled?: boolean;
}
export default function MessageInput({ onSend, disabled = false }: MessageInputProps) {
export default function MessageInput({
onSend,
disabled = false,
}: MessageInputProps) {
const t = useTranslations("Chat");
const [message, setMessage] = useState("");

View File

@ -34,7 +34,11 @@ export default function NewMessagesWrapper() {
}}
isVisibleViewAll={unreadChats.length > 1}
>
<NewMessages chats={unreadChats} isVisibleAll={isVisibleAll} currentBalance={balance} />
<NewMessages
chats={unreadChats}
isVisibleAll={isVisibleAll}
currentBalance={balance}
/>
</ChatItemsList>
)}
</>

View File

@ -31,7 +31,11 @@ export default function NewMessagesSection() {
}}
/>
)}
<NewMessages chats={unreadChats} isVisibleAll={isVisibleAll} currentBalance={balance} />
<NewMessages
chats={unreadChats}
isVisibleAll={isVisibleAll}
currentBalance={balance}
/>
</div>
)}
</>

View File

@ -39,7 +39,13 @@ export default function ModalSheet({
return (
<Modal
open={open || isOpen}
onClose={disableBackdropClose ? () => { /* Backdrop close disabled */ } : onClose}
onClose={
disableBackdropClose
? () => {
/* Backdrop close disabled */
}
: onClose
}
className={clsx(className, styles.overlay, {
[styles.closed]: !open && isOpen,
})}

View File

@ -13,7 +13,7 @@ export const useBalance = () => {
const { balance: apiBalance, isLoading } = useUserBalance();
// Слушаем обновления баланса через WebSocket
useSocketEvent("balance_updated", (b) => {
useSocketEvent("balance_updated", b => {
setSocketBalance(b.data.balance);
});