added button back from map and fix post on map

This commit is contained in:
SlimusMinus
2026-09-07 01:32:22 +03:00
parent 3299df14c6
commit f0a7327a1a
6 changed files with 140 additions and 11 deletions

View File

@@ -1,4 +1,5 @@
import { useEffect, useRef, useState } from "react";
import { useTranslation } from "react-i18next";
import { API_URL, getImageUrl } from "../config/authConstants";
import { useGeolocation, GEO_STATUS } from "../hooks/useGeolocation";
@@ -40,7 +41,8 @@ function createMarkerLayout(color, imageUrl) {
const FOCUS_ZOOM = 16;
const COORD_MATCH_TOLERANCE = 0.005;
export default function MapView({ focusPostId, focusLat, focusLng, onPostClick }) {
export default function MapView({ focusPostId, focusLat, focusLng, onPostClick, onBack }) {
const { t } = useTranslation();
const mapRef = useRef(null);
const ymapRef = useRef(null);
const userMarkerRef = useRef(null);
@@ -215,6 +217,15 @@ export default function MapView({ focusPostId, focusLat, focusLng, onPostClick }
{geoStatus === GEO_STATUS.UNSUPPORTED && (
<div className="f-mapview-geo f-mapview-geo-warn">Геолокация недоступна</div>
)}
{onBack && (
<button type="button" className="f-mapview-back" onClick={onBack}>
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth={2.2} strokeLinecap="round" strokeLinejoin="round" className="f-mapview-back-icon">
<path d="M19 12H5" />
<path d="m12 19-7-7 7-7" />
</svg>
{t('map.backToListings')}
</button>
)}
</div>
);
}