Add Docker build and deploy pipeline
Some checks failed
deploy-frontend / deploy (push) Failing after 11s
Some checks failed
deploy-frontend / deploy (push) Failing after 11s
This commit is contained in:
@@ -1,13 +1,16 @@
|
||||
import { useState, useCallback, useEffect, useRef, useMemo } from "react";
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import CloseIcon from "./icons/CloseIcon";
|
||||
import CheckIcon from "./icons/CheckIcon";
|
||||
import Toast from "./Toast";
|
||||
import { getImageUrl } from "../config/authConstants";
|
||||
import { CATEGORY_PET } from "../config/feedConstants";
|
||||
import { getFoundAt, formatFoundDate } from "../utils/foundAt";
|
||||
import { useContactSeller } from "../hooks/useContactSeller";
|
||||
import { useAuthContext } from "../context/AuthContext";
|
||||
|
||||
export default function ImageViewer({ images, initialIndex = 0, onClose, postData }) {
|
||||
const { t } = useTranslation();
|
||||
const { t, i18n } = useTranslation();
|
||||
const [index, setIndex] = useState(initialIndex);
|
||||
const touchStart = useRef(null);
|
||||
const swiped = useRef(false);
|
||||
@@ -65,7 +68,17 @@ export default function ImageViewer({ images, initialIndex = 0, onClose, postDat
|
||||
contactSeller(onClose);
|
||||
}, [contactSeller, onClose]);
|
||||
|
||||
const showContact = isAuthenticated && postData && !postData.isOwner && postData.status !== 'CLOSED';
|
||||
const isClosed = postData?.status === 'CLOSED';
|
||||
const showContact = isAuthenticated && postData && !postData.isOwner && !isClosed;
|
||||
// Статус «найдено» держим на каждом слайде: перелистывая карусель, человек
|
||||
// не должен терять из виду, что вещь/питомец уже вернулся к владельцу.
|
||||
const foundText = postData?.category === CATEGORY_PET
|
||||
? t('postCard.petFoundStatus')
|
||||
: t('postCard.foundStatus');
|
||||
const foundDate = isClosed ? formatFoundDate(getFoundAt(postData), i18n.language) : null;
|
||||
const foundTitle = foundDate
|
||||
? t('postCard.foundStatusWithDate', { status: foundText, date: foundDate })
|
||||
: foundText;
|
||||
|
||||
if (!urls.length) return null;
|
||||
|
||||
@@ -81,11 +94,18 @@ export default function ImageViewer({ images, initialIndex = 0, onClose, postDat
|
||||
</button>
|
||||
|
||||
<div className="f-viewer">
|
||||
{isClosed && (
|
||||
<span className="f-viewer-found-badge" title={String(foundTitle)}>
|
||||
<CheckIcon size={14}/>
|
||||
<span>{foundText}</span>
|
||||
</span>
|
||||
)}
|
||||
|
||||
<div className="f-viewer-img-wrap" onClick={handleImgClick}>
|
||||
<img
|
||||
src={urls[index]}
|
||||
alt=""
|
||||
className="f-viewer-img"
|
||||
className={`f-viewer-img${isClosed ? ' f-viewer-img-closed' : ''}`}
|
||||
/>
|
||||
</div>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user