fix
This commit is contained in:
parent
c5002e1a7a
commit
f3872e7ce1
@ -10,5 +10,4 @@
|
|||||||
align-self: flex-end;
|
align-self: flex-end;
|
||||||
margin-left: auto;
|
margin-left: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,20 +1,21 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import clsx from "clsx";
|
|
||||||
import { useEffect } from "react";
|
import { useEffect } from "react";
|
||||||
|
import clsx from "clsx";
|
||||||
|
|
||||||
import type { IChatMessage } from "@/entities/chats/types";
|
import type { IChatMessage } from "@/entities/chats/types";
|
||||||
import { useShowRefillModal } from "@/hooks/refill/useShowRefillModal";
|
import { useShowRefillModal } from "@/hooks/refill/useShowRefillModal";
|
||||||
import { useChat } from "@/providers/chat-provider";
|
import { useChat } from "@/providers/chat-provider";
|
||||||
import { formatTime } from "@/shared/utils/date";
|
import { formatTime } from "@/shared/utils/date";
|
||||||
|
|
||||||
import styles from "./ChatMessage.module.scss";
|
|
||||||
import MessageBubble from "./MessageBubble/MessageBubble";
|
import MessageBubble from "./MessageBubble/MessageBubble";
|
||||||
import MessageMeta from "./MessageMeta/MessageMeta";
|
import MessageMeta from "./MessageMeta/MessageMeta";
|
||||||
import MessageStatus from "./MessageStatus/MessageStatus";
|
import MessageStatus from "./MessageStatus/MessageStatus";
|
||||||
import MessageText from "./MessageText/MessageText";
|
import MessageText from "./MessageText/MessageText";
|
||||||
import MessageTyping from "./MessageTyping/MessageTyping";
|
import MessageTyping from "./MessageTyping/MessageTyping";
|
||||||
|
|
||||||
|
import styles from "./ChatMessage.module.scss";
|
||||||
|
|
||||||
export interface ChatMessageProps {
|
export interface ChatMessageProps {
|
||||||
// message: {
|
// message: {
|
||||||
// id: string;
|
// id: string;
|
||||||
|
|||||||
@ -10,7 +10,9 @@
|
|||||||
&.blurred {
|
&.blurred {
|
||||||
filter: blur(4px);
|
filter: blur(4px);
|
||||||
opacity: 0.6;
|
opacity: 0.6;
|
||||||
transition: filter 0.3s ease, opacity 0.3s ease;
|
transition:
|
||||||
|
filter 0.3s ease,
|
||||||
|
opacity 0.3s ease;
|
||||||
pointer-events: none;
|
pointer-events: none;
|
||||||
user-select: none; // Запрещаем выделение текста
|
user-select: none; // Запрещаем выделение текста
|
||||||
-webkit-user-select: none; // Safari
|
-webkit-user-select: none; // Safari
|
||||||
|
|||||||
@ -28,7 +28,7 @@ export default function MessageText({
|
|||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
onClick={handleClick}
|
onClick={handleClick}
|
||||||
style={isBlurred ? { cursor: 'pointer' } : undefined}
|
style={isBlurred ? { cursor: "pointer" } : undefined}
|
||||||
>
|
>
|
||||||
<Typography
|
<Typography
|
||||||
as="p"
|
as="p"
|
||||||
|
|||||||
@ -81,7 +81,9 @@ export default function ChatModalsWrapper() {
|
|||||||
return (
|
return (
|
||||||
<ModalSheet
|
<ModalSheet
|
||||||
open={isModalOpen}
|
open={isModalOpen}
|
||||||
onClose={modalChild === "refill-timer" ? handleTimerModalClose : handleModalClose}
|
onClose={
|
||||||
|
modalChild === "refill-timer" ? handleTimerModalClose : handleModalClose
|
||||||
|
}
|
||||||
variant={modalChild === "refill-timer" ? "gray" : "white"}
|
variant={modalChild === "refill-timer" ? "gray" : "white"}
|
||||||
disableBackdropClose={true}
|
disableBackdropClose={true}
|
||||||
>
|
>
|
||||||
|
|||||||
@ -41,7 +41,11 @@ export default function GlobalNewMessagesBanner() {
|
|||||||
onClick={() => setHomeNewMessages({ isVisibleAll: !isVisibleAll })}
|
onClick={() => setHomeNewMessages({ isVisibleAll: !isVisibleAll })}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
<NewMessages chats={unreadChats} isVisibleAll={isVisibleAll} currentBalance={balance} />
|
<NewMessages
|
||||||
|
chats={unreadChats}
|
||||||
|
isVisibleAll={isVisibleAll}
|
||||||
|
currentBalance={balance}
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -21,7 +21,9 @@
|
|||||||
&.blurred {
|
&.blurred {
|
||||||
filter: blur(4px);
|
filter: blur(4px);
|
||||||
opacity: 0.6;
|
opacity: 0.6;
|
||||||
transition: filter 0.3s ease, opacity 0.3s ease;
|
transition:
|
||||||
|
filter 0.3s ease,
|
||||||
|
opacity 0.3s ease;
|
||||||
user-select: none;
|
user-select: none;
|
||||||
-webkit-user-select: none;
|
-webkit-user-select: none;
|
||||||
-moz-user-select: none;
|
-moz-user-select: none;
|
||||||
|
|||||||
@ -25,8 +25,7 @@ export default function LastMessagePreview({
|
|||||||
|
|
||||||
// Определяем нужно ли блюрить сообщение
|
// Определяем нужно ли блюрить сообщение
|
||||||
const shouldBlur =
|
const shouldBlur =
|
||||||
message.sentWithZeroBalance === true &&
|
message.sentWithZeroBalance === true && currentBalance <= 0;
|
||||||
currentBalance <= 0;
|
|
||||||
|
|
||||||
const getMessageIcon = () => {
|
const getMessageIcon = () => {
|
||||||
switch (message.type) {
|
switch (message.type) {
|
||||||
@ -80,7 +79,7 @@ export default function LastMessagePreview({
|
|||||||
size="sm"
|
size="sm"
|
||||||
color="secondary"
|
color="secondary"
|
||||||
align="left"
|
align="left"
|
||||||
className={`${styles.text} ${shouldBlur ? styles.blurred : ''}`}
|
className={`${styles.text} ${shouldBlur ? styles.blurred : ""}`}
|
||||||
>
|
>
|
||||||
{getMessageText()}
|
{getMessageText()}
|
||||||
</Typography>
|
</Typography>
|
||||||
|
|||||||
@ -12,7 +12,10 @@ interface MessageInputProps {
|
|||||||
disabled?: boolean;
|
disabled?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function MessageInput({ onSend, disabled = false }: MessageInputProps) {
|
export default function MessageInput({
|
||||||
|
onSend,
|
||||||
|
disabled = false,
|
||||||
|
}: MessageInputProps) {
|
||||||
const t = useTranslations("Chat");
|
const t = useTranslations("Chat");
|
||||||
const [message, setMessage] = useState("");
|
const [message, setMessage] = useState("");
|
||||||
|
|
||||||
|
|||||||
@ -34,7 +34,11 @@ export default function NewMessagesWrapper() {
|
|||||||
}}
|
}}
|
||||||
isVisibleViewAll={unreadChats.length > 1}
|
isVisibleViewAll={unreadChats.length > 1}
|
||||||
>
|
>
|
||||||
<NewMessages chats={unreadChats} isVisibleAll={isVisibleAll} currentBalance={balance} />
|
<NewMessages
|
||||||
|
chats={unreadChats}
|
||||||
|
isVisibleAll={isVisibleAll}
|
||||||
|
currentBalance={balance}
|
||||||
|
/>
|
||||||
</ChatItemsList>
|
</ChatItemsList>
|
||||||
)}
|
)}
|
||||||
</>
|
</>
|
||||||
|
|||||||
@ -31,7 +31,11 @@ export default function NewMessagesSection() {
|
|||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
<NewMessages chats={unreadChats} isVisibleAll={isVisibleAll} currentBalance={balance} />
|
<NewMessages
|
||||||
|
chats={unreadChats}
|
||||||
|
isVisibleAll={isVisibleAll}
|
||||||
|
currentBalance={balance}
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
</>
|
</>
|
||||||
|
|||||||
@ -39,7 +39,13 @@ export default function ModalSheet({
|
|||||||
return (
|
return (
|
||||||
<Modal
|
<Modal
|
||||||
open={open || isOpen}
|
open={open || isOpen}
|
||||||
onClose={disableBackdropClose ? () => { /* Backdrop close disabled */ } : onClose}
|
onClose={
|
||||||
|
disableBackdropClose
|
||||||
|
? () => {
|
||||||
|
/* Backdrop close disabled */
|
||||||
|
}
|
||||||
|
: onClose
|
||||||
|
}
|
||||||
className={clsx(className, styles.overlay, {
|
className={clsx(className, styles.overlay, {
|
||||||
[styles.closed]: !open && isOpen,
|
[styles.closed]: !open && isOpen,
|
||||||
})}
|
})}
|
||||||
|
|||||||
@ -13,7 +13,7 @@ export const useBalance = () => {
|
|||||||
const { balance: apiBalance, isLoading } = useUserBalance();
|
const { balance: apiBalance, isLoading } = useUserBalance();
|
||||||
|
|
||||||
// Слушаем обновления баланса через WebSocket
|
// Слушаем обновления баланса через WebSocket
|
||||||
useSocketEvent("balance_updated", (b) => {
|
useSocketEvent("balance_updated", b => {
|
||||||
setSocketBalance(b.data.balance);
|
setSocketBalance(b.data.balance);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user