changed reward on button
This commit is contained in:
@@ -8,15 +8,18 @@ import {useContactSeller} from "../hooks/useContactSeller";
|
||||
import {useAuthContext} from "../context/AuthContext";
|
||||
import {getImageUrl} from "../config/authConstants";
|
||||
import DateCalendarPopup from "../components/DateCalendarPopup";
|
||||
import RewardPopup from "../components/feed/RewardPopup";
|
||||
import Toast from "../components/Toast";
|
||||
import {useTranslation} from 'react-i18next';
|
||||
|
||||
export default function PostOnFeed({ ad, liked, likeCountAdj, onLike, onEdit, onDelete, onMarkFound, isOwner, onImageClick, onLocationClick, onAuthRequired, compact }) {
|
||||
const { t } = useTranslation();
|
||||
const [showCalendar, setShowCalendar] = useState(false);
|
||||
const [showReward, setShowReward] = useState(false);
|
||||
const [descExpanded, setDescExpanded] = useState(false);
|
||||
const [descTruncated, setDescTruncated] = useState(false);
|
||||
const dateAnchorRef = useRef(null);
|
||||
const rewardAnchorRef = useRef(null);
|
||||
const descRef = useRef(null);
|
||||
const { isAuthenticated } = useAuthContext();
|
||||
const { contactSeller, error: contactError, clearError } = useContactSeller(ad);
|
||||
@@ -163,9 +166,26 @@ export default function PostOnFeed({ ad, liked, likeCountAdj, onLike, onEdit, on
|
||||
</div>
|
||||
)}
|
||||
{ad.reward && (
|
||||
<span className="f-card-reward-text">
|
||||
{t("postCard.reward")}
|
||||
</span>
|
||||
<>
|
||||
<button
|
||||
ref={rewardAnchorRef}
|
||||
type="button"
|
||||
className="f-card-reward-text f-card-reward-btn"
|
||||
onClick={e => {
|
||||
e.stopPropagation();
|
||||
setShowReward(s => !s);
|
||||
}}
|
||||
>
|
||||
<span className="f-reward-btn-label">{t("postCard.reward")}</span>
|
||||
</button>
|
||||
{showReward && (
|
||||
<RewardPopup
|
||||
text={ad.rewardText || t("postCard.reward")}
|
||||
anchorRef={rewardAnchorRef}
|
||||
onClose={() => setShowReward(false)}
|
||||
/>
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
|
||||
Reference in New Issue
Block a user