| @@ -1,6 +1,6 @@ | |||
| { | |||
| "name": "web", | |||
| "version": "4.0.8", | |||
| "version": "4.0.9", | |||
| "private": true, | |||
| "dependencies": { | |||
| "@emotion/react": "^11.5.0", | |||
| @@ -9,8 +9,8 @@ export const CheckButtonContainer = styled(PrimaryButton)` | |||
| bottom: 9px; | |||
| right: 9px; | |||
| &:hover button { | |||
| background-color: ${selectedTheme.colors.primaryPurple} !important; | |||
| color: white !important; | |||
| background-color: ${props => !props.disabled && `${selectedTheme.colors.primaryPurple} !important`}; | |||
| color: ${props => !props.disabled && `white !important`}; | |||
| } | |||
| @media (max-width: 1150px) { | |||
| display: none; | |||
| @@ -139,6 +139,8 @@ const OfferCard = (props) => { | |||
| return true; | |||
| }, [userId, props.offer]); | |||
| console.log("props", props); | |||
| return ( | |||
| <React.Fragment> | |||
| <OfferCardContainer | |||
| @@ -279,14 +281,21 @@ const OfferCard = (props) => { | |||
| </LikeIconContainer> | |||
| ) : ( | |||
| <AcceptIconContainer // MENJATI | |||
| customDisabled={ | |||
| props.exchangeState === exchangeStatus.I_OFFERED | |||
| // customDisabled={ | |||
| // props.exchangeState === exchangeStatus.I_OFFERED || | |||
| // props.disabledReviews | |||
| // } | |||
| disabled={ | |||
| props.exchangeState === exchangeStatus.I_OFFERED || | |||
| props.disabledReviews | |||
| } | |||
| disabled={props.exchangeState === exchangeStatus.I_OFFERED} | |||
| onClick={acceptExchange} | |||
| > | |||
| <AcceptIcon | |||
| disabled={props.exchangeState === exchangeStatus.I_OFFERED} | |||
| disabled={ | |||
| props.disabledReviews || | |||
| props.exchangeState === exchangeStatus.I_OFFERED | |||
| } | |||
| /> | |||
| </AcceptIconContainer> | |||
| ) | |||
| @@ -395,7 +395,7 @@ export const LikeIcon = styled(Like)` | |||
| & path { | |||
| stroke: ${(props) => | |||
| props.disabled | |||
| ? selectedTheme.colors.primaryPurpleDisabled | |||
| ? selectedTheme.colors.primaryPurple | |||
| : selectedTheme.colors.primaryPurple}; | |||
| } | |||
| @media (max-width: 600px) { | |||
| @@ -407,7 +407,7 @@ export const AcceptIcon = styled(Accept)` | |||
| & path { | |||
| fill: ${(props) => | |||
| props.disabled | |||
| ? selectedTheme.colors.primaryPurpleDisabled | |||
| ? selectedTheme.colors.primaryPurple | |||
| : selectedTheme.colors.primaryPurple}; | |||
| } | |||
| @media (max-width: 600px) { | |||
| @@ -17,7 +17,8 @@ export const MessagesList = styled(Box)` | |||
| max-height: 425px; | |||
| height: ${(props) => | |||
| props.exchangeState === exchangeStatus.ACCEPTED || | |||
| props.exchangeState === exchangeStatus.I_OFFERED | |||
| props.exchangeState === exchangeStatus.I_OFFERED || | |||
| props.exchangeState === exchangeStatus.REVIEWED | |||
| ? "385px" | |||
| : "425px"}; | |||
| overflow-y: auto; | |||
| @@ -8,6 +8,7 @@ import { | |||
| import MiniChatCard from "../../Cards/MiniChatCard/MiniChatCard"; | |||
| import { useDispatch, useSelector } from "react-redux"; | |||
| import { | |||
| selectChatsTotal, | |||
| selectLatestChats, | |||
| selectSelectedChat, | |||
| } from "../../../store/selectors/chatSelectors"; | |||
| @@ -23,6 +24,7 @@ import Paging from "../../Paging/Paging"; | |||
| const MiniChatColumn = () => { | |||
| const chats = useSelector(selectLatestChats); | |||
| const total = useSelector(selectChatsTotal); | |||
| const selectedChat = useSelector(selectSelectedChat); | |||
| const offer = useSelector(selectOffer); | |||
| const location = useLocation(); | |||
| @@ -79,9 +81,7 @@ const MiniChatColumn = () => { | |||
| elementsPerPage={6} | |||
| customPaging | |||
| current={paging.currentPage} | |||
| pages={ | |||
| chats.length === 6 ? paging.currentPage + 1 : paging.currentPage | |||
| } | |||
| totalElements={total} | |||
| changePage={handleChangePage} | |||
| > | |||
| <ChatPagingText> | |||
| @@ -5,7 +5,7 @@ import selectedTheme from "../../../themes"; | |||
| export const MiniChatColumnContainer = styled(Box)` | |||
| position: relative; | |||
| padding-bottom: 50px; | |||
| @media (max-width: 600px) { | |||
| @media (max-width: 900px) { | |||
| display: none; | |||
| } | |||
| `; | |||
| @@ -86,7 +86,7 @@ const ItemDetailsHeaderCard = (props) => { | |||
| ) : ( | |||
| <Tooltip title={t("messages.tooltip")}> | |||
| <TooltipInnerContainer> | |||
| <MessageIcon disabled onClick={() => messageUser(offer)}> | |||
| <MessageIcon onClick={() => messageUser(offer)}> | |||
| <MessageColor /> | |||
| </MessageIcon> | |||
| </TooltipInnerContainer> | |||
| @@ -3,9 +3,18 @@ import PropTypes from "prop-types"; | |||
| import { MarketPlaceContainer } from "./MarketPlace.styled"; | |||
| import Header from "./Header/Header"; | |||
| import Offers from "./Offers/Offers"; | |||
| import { useDispatch } from "react-redux"; | |||
| import { useEffect } from "react"; | |||
| import { fetchChats } from "../../store/actions/chat/chatActions"; | |||
| const MarketPlace = (props) => { | |||
| const [isGrid, setIsGrid] = useState(false); | |||
| const dispatch = useDispatch(); | |||
| useEffect(() => { | |||
| dispatch(fetchChats({ | |||
| currentPage: 1, | |||
| })); | |||
| }, []) | |||
| const offers = props.offers; | |||
| return ( | |||
| <MarketPlaceContainer> | |||
| @@ -32,6 +32,7 @@ export const CHAT_NEW_FETCH_SUCCESS = createSuccessType(CHAT_NEW_SCOPE); | |||
| export const CHAT_NEW_FETCH_ERROR = createErrorType(CHAT_NEW_SCOPE); | |||
| export const CHAT_SET = createSetType("CHAT_SET"); | |||
| export const CHAT_TOTAL_SET = createSetType("CHAT_TOTAL_SET"); | |||
| export const CHAT_ONE_SET = createSetType("CHAT_ONE_SET"); | |||
| export const CHAT_CLEAR = createSetType("CHAT_CLEAR"); | |||
| export const CHAT_ADD_MESSAGE = createSetType("CHAT_ADD_MESSAGE"); | |||
| @@ -19,6 +19,7 @@ import { | |||
| CHAT_SEND_FETCH, | |||
| CHAT_SEND_SUCCESS, | |||
| CHAT_SET, | |||
| CHAT_TOTAL_SET, | |||
| } from "./chatActionConstants"; | |||
| export const fetchChats = (payload) => ({ | |||
| @@ -33,6 +34,10 @@ export const setChats = (payload) => ({ | |||
| type: CHAT_SET, | |||
| payload, | |||
| }); | |||
| export const setChatsTotal = (payload) => ({ | |||
| type: CHAT_TOTAL_SET, | |||
| payload, | |||
| }); | |||
| export const fetchOneChat = (payload) => ({ | |||
| type: CHAT_ONE_FETCH, | |||
| payload, | |||
| @@ -3,17 +3,20 @@ import { | |||
| CHAT_CLEAR, | |||
| CHAT_ONE_SET, | |||
| CHAT_SET, | |||
| CHAT_TOTAL_SET, | |||
| } from "../../actions/chat/chatActionConstants"; | |||
| import createReducer from "../../utils/createReducer"; | |||
| const initialState = { | |||
| latestChats: [], | |||
| selectedChat: {}, | |||
| total: 0, | |||
| }; | |||
| export default createReducer( | |||
| { | |||
| [CHAT_SET]: setChats, | |||
| [CHAT_TOTAL_SET]: setChatsTotal, | |||
| [CHAT_ONE_SET]: setOneChat, | |||
| [CHAT_CLEAR]: clearChats, | |||
| [CHAT_ADD_MESSAGE]: addNewMessage, | |||
| @@ -27,6 +30,12 @@ function setChats(state, action) { | |||
| latestChats: [...action.payload], | |||
| }; | |||
| } | |||
| function setChatsTotal(state, action) { | |||
| return { | |||
| ...state, | |||
| total: action.payload | |||
| }; | |||
| } | |||
| function setOneChat(state, action) { | |||
| return { | |||
| ...state, | |||
| @@ -24,6 +24,7 @@ import { | |||
| sendMessageError, | |||
| sendMessageSuccess, | |||
| setChats, | |||
| setChatsTotal, | |||
| setOneChat, | |||
| startNewChatError, | |||
| startNewChatSuccess, | |||
| @@ -60,6 +61,7 @@ function* fetchChats({ payload }) { | |||
| }); | |||
| yield call(console.dir, data); | |||
| yield put(setChats([...data.data.chatsWithData])); | |||
| yield put(setChatsTotal(data.data.total)) | |||
| yield put(fetchChatsSuccess()); | |||
| } catch (e) { | |||
| yield put(fetchChatsError()); | |||
| @@ -140,7 +142,9 @@ function* startNewChat(payload) { | |||
| }); | |||
| const queryString = yield select(selectQueryString); | |||
| const data = yield call(attemptFetchChats, { userId, queryString }); | |||
| yield put(setChats([...data.data])); | |||
| yield put(setChats([...data.data.chatsWithData])); | |||
| yield put(setChatsTotal(data.data.total)) | |||
| console.log(data); | |||
| const newChatId = newChatData.data.chatId; | |||
| yield put(startNewChatSuccess()); | |||
| yield call( | |||
| @@ -6,6 +6,10 @@ export const selectLatestChats = createSelector( | |||
| chatSelector, | |||
| (state) => state.latestChats | |||
| ) | |||
| export const selectChatsTotal = createSelector( | |||
| chatSelector, | |||
| (state) => state.total | |||
| ) | |||
| export const selectSelectedChat = createSelector( | |||
| chatSelector, | |||
| (state) => state.selectedChat | |||