Procházet zdrojové kódy

Ready for protainer

feature/code-cleanup-joca
Djordje Mitrovic před 3 roky
rodič
revize
4b65f2d824

+ 1
- 1
src/components/Cards/CreateOfferCard/CreateOffer.js Zobrazit soubor

@@ -78,7 +78,7 @@ const CreateOffer = ({ history, closeCreateOfferModal, editOffer, offer }) => {
historyRouter.location.pathname.length
);
dispatch(fetchProfileOffers(userId));
history.push({
historyRouter.push({
pathname: HOME_PAGE,
state: {
from: history.location.pathname,

+ 7
- 0
src/components/Cards/CreateOfferCard/CreateOffer.styled.js Zobrazit soubor

@@ -15,6 +15,7 @@ export const ModalCreateOfferContainer = styled(Box)`
props.currentStep !== 3 ? "calc(50% - 310px);" : "calc(50% - 420px);"};
z-index: 150;
padding: ${(props) => (props.currentStep !== 3 ? "0 120px" : "0 130px")};
overflow-y: auto;
&::-webkit-scrollbar {
width: 5px;
}
@@ -27,6 +28,11 @@ export const ModalCreateOfferContainer = styled(Box)`
scrollbar-width: thin;
scrollbar-color: #ddd;

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

}

@media screen and (max-width: 628px) {
height: 100vh;
max-height: 100vh;
@@ -36,6 +42,7 @@ export const ModalCreateOfferContainer = styled(Box)`
left: 0;
padding: 0 30px;
}

`;

export const ModalHeader = styled(Box)`

+ 13
- 6
src/components/Cards/ItemDetailsCard/ItemDetailsCard.js Zobrazit soubor

@@ -27,18 +27,20 @@ import { selectLatestChats } from "../../../store/selectors/chatSelectors";
import { useHistory } from "react-router-dom";
import { increaseCounter } from "../../../store/actions/counter/counterActions";
import _ from "lodash";
import { selectUserId } from "../../../store/selectors/loginSelectors";

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

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

+ 1
- 1
src/components/Cards/UserReviewsCard/UserReviewsCard.js Zobrazit soubor

@@ -86,7 +86,7 @@ const UserReviewsCard = (props) => {
<ThumbBox item>
{isGood ? <ThumbUp color="success" /> : <ThumbDown color="error" />}
</ThumbBox>
<ReviewQuoteBox item xs={11}>
<ReviewQuoteBox item>
<ReviewQuoteText
sx={{ display: "inline" }}
component="span"

+ 5
- 2
src/components/DirectChat/DirectChat.js Zobrazit soubor

@@ -52,8 +52,11 @@ const DirectChat = () => {
console.log("interlucatorObject: ", interlocutorObject);
const dispatch = useDispatch();
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 = () => {
if (routeMatch.params.idChat === "newMessage") {
dispatch(fetchOneOffer(location.state.offerId))

+ 3
- 3
src/components/MarketPlace/Offers/Offers.js Zobrazit soubor

@@ -215,13 +215,13 @@ const Offers = (props) => {
};

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) {
history.push(`/messages/${chatItem.chat._id}`)
} else {
if (offer?.offer?.userId !== userId) {
if (offer?.userId !== userId) {
history.push(`/messages/newMessage`, {
offerId: offer?.offer?._id
offerId: offer?._id
})
}
}

+ 3
- 3
src/components/UserReviews/UserReviews.styled.js Zobrazit soubor

@@ -7,8 +7,8 @@ import selectedTheme from "../../themes";
export const ReviewsBox = styled(Box)`
width: 100%;
/* 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) {
padding: 0;
}
@@ -16,7 +16,7 @@ export const ReviewsBox = styled(Box)`
position: relative;
top: -45px;
overflow: hidden;
max-height: 350px;
max-height: ${props => props.numOfReviews > 2 ? "650px" : props.numOfReviews > 1 ? "450px" : "350px"};
padding: 0;
}
`;

+ 1
- 0
src/store/saga/offersSaga.js Zobrazit soubor

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

Načítá se…
Zrušit
Uložit