feat: Delete user
preview + snapshot
preview + coordinates update
This commit is contained in:
@ -42,7 +42,7 @@ export const InformationTab = observer(
|
||||
const { sight, updateSightInfo, updateSight } = editSightStore;
|
||||
|
||||
const [, setCity] = useState<number>(sight.common.city_id ?? 0);
|
||||
const [coordinates, setCoordinates] = useState<string>(`0 0`);
|
||||
const [coordinates, setCoordinates] = useState<string>(`0, 0`);
|
||||
|
||||
// Menu state for each media button
|
||||
const [menuAnchorEl, setMenuAnchorEl] = useState<null | HTMLElement>(null);
|
||||
@ -54,7 +54,7 @@ export const InformationTab = observer(
|
||||
useEffect(() => {
|
||||
// Показывать только при инициализации (не менять при ошибках пользователя)
|
||||
if (sight.common.latitude !== 0 || sight.common.longitude !== 0) {
|
||||
setCoordinates(`${sight.common.latitude} ${sight.common.longitude}`);
|
||||
setCoordinates(`${sight.common.latitude}, ${sight.common.longitude}`);
|
||||
}
|
||||
// если координаты обнулились — оставить поле как есть
|
||||
}, [sight.common.latitude, sight.common.longitude]);
|
||||
@ -178,10 +178,12 @@ export const InformationTab = observer(
|
||||
label="Координаты"
|
||||
value={coordinates}
|
||||
onChange={(e) => {
|
||||
const input = e.target.value;
|
||||
setCoordinates(input); // показываем как есть
|
||||
const newValue = e.target.value;
|
||||
setCoordinates(newValue); // сохраняем ввод пользователя как есть
|
||||
|
||||
const [latStr, lonStr] = input.split(/\s+/); // учитываем любые пробелы
|
||||
// Обрабатываем значение для сохранения
|
||||
const input = newValue.replace(/,/g, " ").trim();
|
||||
const [latStr, lonStr] = input.split(/\s+/);
|
||||
|
||||
const lat = parseFloat(latStr);
|
||||
const lon = parseFloat(lonStr);
|
||||
@ -212,7 +214,7 @@ export const InformationTab = observer(
|
||||
}}
|
||||
fullWidth
|
||||
variant="outlined"
|
||||
placeholder="Введите координаты в формате: широта долгота"
|
||||
placeholder="Введите координаты в формате: широта долгота (можно использовать запятые или пробелы)"
|
||||
/>
|
||||
</Box>
|
||||
|
||||
|
Reference in New Issue
Block a user