Переглянути джерело

Ready for protainer

feature/code-cleanup-joca
Djordje Mitrovic 3 роки тому
джерело
коміт
4b65f2d824

+ 1
- 1
src/components/Cards/CreateOfferCard/CreateOffer.js Переглянути файл

historyRouter.location.pathname.length historyRouter.location.pathname.length
); );
dispatch(fetchProfileOffers(userId)); dispatch(fetchProfileOffers(userId));
history.push({
historyRouter.push({
pathname: HOME_PAGE, pathname: HOME_PAGE,
state: { state: {
from: history.location.pathname, from: history.location.pathname,

+ 7
- 0
src/components/Cards/CreateOfferCard/CreateOffer.styled.js Переглянути файл

props.currentStep !== 3 ? "calc(50% - 310px);" : "calc(50% - 420px);"}; props.currentStep !== 3 ? "calc(50% - 310px);" : "calc(50% - 420px);"};
z-index: 150; z-index: 150;
padding: ${(props) => (props.currentStep !== 3 ? "0 120px" : "0 130px")}; padding: ${(props) => (props.currentStep !== 3 ? "0 120px" : "0 130px")};
overflow-y: auto;
&::-webkit-scrollbar { &::-webkit-scrollbar {
width: 5px; width: 5px;
} }
scrollbar-width: thin; scrollbar-width: thin;
scrollbar-color: #ddd; scrollbar-color: #ddd;


@media (max-height: 820px) {
top: ${props => props.currentStep === 1 ? 'calc(50% - 340px)' : 'calc(50% - 340px)'};

}

@media screen and (max-width: 628px) { @media screen and (max-width: 628px) {
height: 100vh; height: 100vh;
max-height: 100vh; max-height: 100vh;
left: 0; left: 0;
padding: 0 30px; padding: 0 30px;
} }

`; `;


export const ModalHeader = styled(Box)` export const ModalHeader = styled(Box)`

+ 13
- 6
src/components/Cards/ItemDetailsCard/ItemDetailsCard.js Переглянути файл

import { useHistory } from "react-router-dom"; import { useHistory } from "react-router-dom";
import { increaseCounter } from "../../../store/actions/counter/counterActions"; import { increaseCounter } from "../../../store/actions/counter/counterActions";
import _ from "lodash"; import _ from "lodash";
import { selectUserId } from "../../../store/selectors/loginSelectors";


const ItemDetailsCard = (props) => { const ItemDetailsCard = (props) => {
const offer = props.offer; const offer = props.offer;
const history = useHistory(); const history = useHistory();
const chats = useSelector(selectLatestChats); const chats = useSelector(selectLatestChats);
const userId = useSelector(selectUserId);
const dispatch = useDispatch(); const dispatch = useDispatch();
const dateCreated = new Date(offer?.offer?._created); const dateCreated = new Date(offer?.offer?._created);


useEffect(() => { useEffect(() => {
if (offer?.offer?._id) { if (offer?.offer?._id) {
_.once(function() {
dispatch(increaseCounter(offer?.offer?._id))
_.once(function () {
dispatch(increaseCounter(offer?.offer?._id));
})(); })();
} }
}, [offer]); }, [offer]);
if (chatItem !== undefined) { if (chatItem !== undefined) {
history.push(`/messages/${chatItem.chat._id}`); history.push(`/messages/${chatItem.chat._id}`);
} else { } else {
history.push(`/messages/newMessage`, {
offerId: offer?.offer?._id,
});
if (offer?.offer?.userId !== userId) {
history.push(`/messages/newMessage`, {
offerId: offer?.offer?._id,
});
}
} }
}; };
return ( return (
{dayCreated}.{monthCreated}.{yearCreated} {dayCreated}.{monthCreated}.{yearCreated}
</PostDate> </PostDate>
</OfferInfo> </OfferInfo>
<Details hasScrollBar={!props.showPublishButton} exchange={props.showExchangeButton}>
<Details
hasScrollBar={!props.showPublishButton}
exchange={props.showExchangeButton}
>
<OfferTitle>{offer?.offer?.name}</OfferTitle> <OfferTitle>{offer?.offer?.name}</OfferTitle>
<Scroller> <Scroller>
{offer?.offer?.images?.map((item) => { {offer?.offer?.images?.map((item) => {

+ 1
- 1
src/components/Cards/UserReviewsCard/UserReviewsCard.js Переглянути файл

<ThumbBox item> <ThumbBox item>
{isGood ? <ThumbUp color="success" /> : <ThumbDown color="error" />} {isGood ? <ThumbUp color="success" /> : <ThumbDown color="error" />}
</ThumbBox> </ThumbBox>
<ReviewQuoteBox item xs={11}>
<ReviewQuoteBox item>
<ReviewQuoteText <ReviewQuoteText
sx={{ display: "inline" }} sx={{ display: "inline" }}
component="span" component="span"

+ 5
- 2
src/components/DirectChat/DirectChat.js Переглянути файл

console.log("interlucatorObject: ", interlocutorObject); console.log("interlucatorObject: ", interlocutorObject);
const dispatch = useDispatch(); const dispatch = useDispatch();
useEffect(() => { useEffect(() => {
refreshChat();
}, [routeMatch.params.idChat]);
console.log(location.state)
if (routeMatch.params.idChat && location.state?.offerId) {
refreshChat();
}
}, [routeMatch.params.idChat, location.state?.offerId]);
const refreshChat = () => { const refreshChat = () => {
if (routeMatch.params.idChat === "newMessage") { if (routeMatch.params.idChat === "newMessage") {
dispatch(fetchOneOffer(location.state.offerId)) dispatch(fetchOneOffer(location.state.offerId))

+ 3
- 3
src/components/MarketPlace/Offers/Offers.js Переглянути файл

}; };


const messageOneUser = (offer) => { const messageOneUser = (offer) => {
const chatItem = chats.find(item => item.chat.offerId === offer?.offer?._id);
const chatItem = chats.find(item => item.chat.offerId === offer?._id);
if (chatItem !== undefined) { if (chatItem !== undefined) {
history.push(`/messages/${chatItem.chat._id}`) history.push(`/messages/${chatItem.chat._id}`)
} else { } else {
if (offer?.offer?.userId !== userId) {
if (offer?.userId !== userId) {
history.push(`/messages/newMessage`, { history.push(`/messages/newMessage`, {
offerId: offer?.offer?._id
offerId: offer?._id
}) })
} }
} }

+ 3
- 3
src/components/UserReviews/UserReviews.styled.js Переглянути файл

export const ReviewsBox = styled(Box)` export const ReviewsBox = styled(Box)`
width: 100%; width: 100%;
/* One review is 185px in height and 82 px are header title + padding */ /* One review is 185px in height and 82 px are header title + padding */
height: ${props => props.numOfReviews > 0 ? props.numOfReviews * 185 + 82 + 'px' : `calc(100% - 90px)`};
max-height: 100vh;
/* height: ${props => props.numOfReviews > 0 ? props.numOfReviews * 185 + 82 + 'px' : `calc(100% - 90px)`}; */
/* max-height: 100vh; */
@media (max-width: 1200px) { @media (max-width: 1200px) {
padding: 0; padding: 0;
} }
position: relative; position: relative;
top: -45px; top: -45px;
overflow: hidden; overflow: hidden;
max-height: 350px;
max-height: ${props => props.numOfReviews > 2 ? "650px" : props.numOfReviews > 1 ? "450px" : "350px"};
padding: 0; padding: 0;
} }
`; `;

+ 1
- 0
src/store/saga/offersSaga.js Переглянути файл

function* fetchProfileOffers(payload) { function* fetchProfileOffers(payload) {
try { try {
const userId = payload.payload; const userId = payload.payload;
if (!userId || userId?.length === 0) throw new Error("User id is not defined!");
const data = yield call(attemptFetchProfileOffers, userId); const data = yield call(attemptFetchProfileOffers, userId);
yield put(setProfileOffers(data.data)); yield put(setProfileOffers(data.data));
} catch (e) { } catch (e) {

Завантаження…
Відмінити
Зберегти