| toggleDeleteOfferModal, | toggleDeleteOfferModal, | ||||
| toggleEditOfferModal, | toggleEditOfferModal, | ||||
| } from "../../../store/actions/modal/modalActions"; | } from "../../../store/actions/modal/modalActions"; | ||||
| import { fetchChats } from "../../../store/actions/chat/chatActions"; | |||||
| const ItemDetailsCard = (props) => { | const ItemDetailsCard = (props) => { | ||||
| // const offer = props.offer; | // const offer = props.offer; | ||||
| const date = formatDateLocale(new Date(offer?._created)); | const date = formatDateLocale(new Date(offer?._created)); | ||||
| const startExchange = () => { | const startExchange = () => { | ||||
| dispatch(fetchChats({ userId: userId, offerId: props.offer._id })); | |||||
| startChat(chats, offer, userId); | startChat(chats, offer, userId); | ||||
| }; | }; | ||||
| ); | ); | ||||
| }; | }; | ||||
| console.log(props) | |||||
| console.log(props); | |||||
| return ( | return ( | ||||
| <> | <> | ||||
| <ItemDetailsCardContainer | <ItemDetailsCardContainer |
| import SkeletonDirectChat from "./SkeletonDirectChat/SkeletonDirectChat"; | import SkeletonDirectChat from "./SkeletonDirectChat/SkeletonDirectChat"; | ||||
| import { selectIsLoadingByActionType } from "../../store/selectors/loadingSelectors"; | import { selectIsLoadingByActionType } from "../../store/selectors/loadingSelectors"; | ||||
| import { CHAT_SCOPE } from "../../store/actions/chat/chatActionConstants"; | import { CHAT_SCOPE } from "../../store/actions/chat/chatActionConstants"; | ||||
| import { | |||||
| selectUserId, | |||||
| } from "../../store/selectors/loginSelectors"; | |||||
| import { selectUserId } from "../../store/selectors/loginSelectors"; | |||||
| import { | import { | ||||
| acceptExchangeSocket, | acceptExchangeSocket, | ||||
| addMessageListener, | addMessageListener, |
| const UserButton = (props) => { | const UserButton = (props) => { | ||||
| const location = useLocation(); | const location = useLocation(); | ||||
| const {t} = useTranslation(); | |||||
| const { t } = useTranslation(); | |||||
| const [userPopoverOpen, setUserPopoverOpen] = useState(false); | const [userPopoverOpen, setUserPopoverOpen] = useState(false); | ||||
| const [userAnchorEl, setUserAnchorEl] = useState(null); | const [userAnchorEl, setUserAnchorEl] = useState(null); | ||||
| color: selectedTheme.colors.primaryPurple, | color: selectedTheme.colors.primaryPurple, | ||||
| }} | }} | ||||
| > | > | ||||
| <AccountCircle /> | |||||
| <AccountCircle onClick={openUserPopover} /> | |||||
| </IconButton> | </IconButton> | ||||
| </UserButtonContainer> | </UserButtonContainer> | ||||
| <PopoverComponent | <PopoverComponent |
| _id: newChatId, | _id: newChatId, | ||||
| message: { | message: { | ||||
| user: { | user: { | ||||
| _id: userId | |||||
| _id: userId, | |||||
| }, | }, | ||||
| text: payload.payload.message, | text: payload.payload.message, | ||||
| _created: new Date().toISOString(), | _created: new Date().toISOString(), |