fix bug and errors
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import { useCallback, useEffect, useState } from "react";
|
||||
import CloseIcon from "../components/icons/CloseIcon";
|
||||
import RulesModal from "./RulesModal";
|
||||
import { EMPTY_FORM, CATEGORY_KEYS } from "../config/feedConstants";
|
||||
import { EMPTY_FORM, CATEGORIES } from "../config/feedConstants";
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { usePostMutation } from "../hooks/usePostMutation";
|
||||
import { useImageUpload, ACCEPT, MAX_SIZE_MB } from "../hooks/useImageUpload";
|
||||
@@ -67,7 +67,7 @@ export default function CreateUpdatePost({ onClose, onSuccess, initialData, admi
|
||||
? { latitude: initialData.latitude, longitude: initialData.longitude }
|
||||
: null;
|
||||
|
||||
const { mapRef, coords, address, addressRef, loading: mapLoading, moveTo } = useYandexMap(
|
||||
const { mapRef, coords, address, addressRef, loading: mapLoading, loadError: mapLoadError, moveTo } = useYandexMap(
|
||||
mapModalOpen,
|
||||
initialCoords,
|
||||
isEdit ? (initialData.location || "") : ""
|
||||
@@ -301,7 +301,9 @@ export default function CreateUpdatePost({ onClose, onSuccess, initialData, admi
|
||||
onChange={e => set("category", e.target.value)}
|
||||
>
|
||||
<option value="">{t('categories.select')}</option>
|
||||
{CATEGORY_KEYS.map(k => <option key={k} value={t(k)}>{t(k)}</option>)}
|
||||
{CATEGORIES.map(c => (
|
||||
<option key={c.value} value={c.value}>{t(c.labelKey)}</option>
|
||||
))}
|
||||
</select>
|
||||
{errors.category && <p className="f-err-msg">{errors.category}</p>}
|
||||
</div>
|
||||
@@ -317,6 +319,7 @@ export default function CreateUpdatePost({ onClose, onSuccess, initialData, admi
|
||||
{form.address ? `📍 ${form.address}` : t('post.mapPickLabel')}
|
||||
</button>
|
||||
{!coords && <p className="f-hint">{t('post.mapHint')}</p>}
|
||||
{mapLoadError && <p className="f-err-msg">{mapLoadError}</p>}
|
||||
{errors.map && <p className="f-err-msg">{errors.map}</p>}
|
||||
</div>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user