feat: Add selected city functional with some debugging

This commit is contained in:
2025-10-22 03:04:58 +03:00
parent 9e47ab667f
commit 50ad374cf5
14 changed files with 430 additions and 175 deletions

View File

@@ -35,6 +35,7 @@ export const ImageUploadCard: React.FC<ImageUploadCardProps> = ({
console.log("isDragOver");
}
}, [isDragOver]);
// --- Click to select file ---
const handleZoneClick = () => {
// Trigger the hidden file input click

View File

@@ -10,17 +10,9 @@ const clearGLTFCache = (url?: string) => {
// Если это blob URL, очищаем его из кеша
if (url.startsWith("blob:")) {
useGLTF.clear(url);
console.log("🧹 clearGLTFCache: Очистка blob URL из кеша GLTF", {
url,
});
} else {
useGLTF.clear(url);
console.log("🧹 clearGLTFCache: Очистка кеша для URL", { url });
}
} else {
// Очищаем весь кеш GLTF
useGLTF.clear();
console.log("🧹 clearGLTFCache: Очистка всего кеша GLTF");
}
} catch (error) {
console.warn("⚠️ clearGLTFCache: Ошибка при очистке кеша", error);
@@ -56,17 +48,6 @@ const isValid3DFile = (url: string): boolean => {
const isValid =
hasValidExtension || hasValidType || isBlobUrl || isServerUrl;
console.log("🔍 isValid3DFile: Проверка файла", {
url,
pathname,
hasValidExtension,
fileType,
hasValidType,
isBlobUrl,
isServerUrl,
isValid,
});
return isValid;
} catch (error) {
console.warn("⚠️ isValid3DFile: Ошибка при проверке URL", error);
@@ -144,15 +125,9 @@ export const ThreeView = ({
useEffect(() => {
// Очищаем кеш сразу при монтировании компонента
clearGLTFCache(fileUrl);
console.log("🧹 ThreeView: Очистка кеша модели при монтировании", {
fileUrl,
});
return () => {
clearGLTFCache(fileUrl);
console.log("🧹 ThreeView: Очистка кеша модели при размонтировании", {
fileUrl,
});
};
}, [fileUrl]);

View File

@@ -45,15 +45,6 @@ export class ThreeViewErrorBoundary extends Component<Props, State> {
// Сбрасываем ошибку только если изменился ID медиа (пользователь выбрал другую модель)
if (oldMediaId !== newMediaId) {
console.log(
"🔄 ThreeViewErrorBoundary: Сброс ошибки при смене модели",
{
oldKey: state.lastResetKey,
newKey: props.resetKey,
oldMediaId,
newMediaId,
}
);
return {
hasError: false,
error: null,
@@ -63,13 +54,7 @@ export class ThreeViewErrorBoundary extends Component<Props, State> {
// Если изменился только счетчик (нажата кнопка "Попробовать снова"), обновляем lastResetKey
// но не сбрасываем ошибку автоматически - ждем результата загрузки
console.log(
"🔄 ThreeViewErrorBoundary: Обновление lastResetKey без сброса ошибки",
{
oldKey: state.lastResetKey,
newKey: props.resetKey,
}
);
return {
lastResetKey: props.resetKey,
};
@@ -142,10 +127,6 @@ export class ThreeViewErrorBoundary extends Component<Props, State> {
};
handleReset = () => {
console.log(
"🔄 ThreeViewErrorBoundary: Перезагрузка компонента и перезапрос модели"
);
// Сначала сбрасываем состояние ошибки
this.setState(
{
@@ -161,7 +142,6 @@ export class ThreeViewErrorBoundary extends Component<Props, State> {
};
handleClose = () => {
console.log("❌ ThreeViewErrorBoundary: Закрытие ошибки");
this.setState({
hasError: false,
error: null,
@@ -237,9 +217,6 @@ export class ThreeViewErrorBoundary extends Component<Props, State> {
variant="contained"
startIcon={<RefreshCw size={16} />}
onClick={() => {
console.log(
"🖱️ ThreeViewErrorBoundary: Клик на кнопку 'Попробовать снова'"
);
this.handleReset();
}}
sx={{

View File

@@ -33,15 +33,8 @@ export function MediaViewer({
string | number | null
>(null);
// Сбрасываем ключ при смене медиа
useEffect(() => {
if (media?.id !== previousMediaId) {
console.log("🔄 MediaViewer: Смена медиа, сброс ключа", {
previousMediaId,
newMediaId: media?.id,
mediaType: media?.media_type,
});
// Используем новый cache manager для очистки кеша
clearMediaTransitionCache(
previousMediaId,
@@ -55,16 +48,9 @@ export function MediaViewer({
}, [media?.id, media?.media_type, previousMediaId]);
const handleReset = () => {
console.log("🔄 MediaViewer: handleReset вызван", {
currentResetKey: resetKey,
mediaId: media?.id,
});
setResetKey((prev) => {
const newKey = prev + 1;
console.log("🔄 MediaViewer: resetKey обновлен", {
oldKey: prev,
newKey,
});
return newKey;
});
};

View File

@@ -87,7 +87,6 @@ export const RightWidgetTab = observer(
}
};
fetchData();
console.log(sight[language].right);
}, [sight.common.id]);
const [activeArticleIndex, setActiveArticleIndex] = useState<number | null>(
@@ -175,10 +174,6 @@ export const RightWidgetTab = observer(
toast.success("Достопримечательность сохранена");
};
useEffect(() => {
console.log(sight[language].right);
}, [sight[language].right]);
const handleDragEnd = (result: DropResult) => {
const { source, destination } = result;

View File

@@ -43,8 +43,6 @@ export const EditStationModal = observer(
} = routeStore;
const handleSave = async () => {
console.log(routeId, selectedStationId);
await saveRouteStations(Number(routeId), selectedStationId);
toast.success("Успешно сохранено");
onClose();