Переделана навигация к датчикам, добавлена работа поиска тултипов на модели, добавлен функционал перехода из дашборда и истории тревог к датчику с тревогой на 3д модели

This commit is contained in:
2026-02-03 16:42:15 +03:00
parent eccc564cc7
commit 458222817e
19 changed files with 5111 additions and 61 deletions

View File

@@ -47,50 +47,6 @@ const SceneToolbar: React.FC<SceneToolbarProps> = ({
}
};
const handleHomeClick = async () => {
if (!onSelectModel) return;
try {
let zones: Zone[] = Array.isArray(currentZones) ? currentZones : [];
// Если зоны ещё не загружены, откройте Monitoring и загрузите зоны для текущего объекта
if ((!zones || zones.length === 0) && currentObject?.id) {
if (!showMonitoring) {
openMonitoring();
}
await loadZones(currentObject.id);
zones = useNavigationStore.getState().currentZones || [];
}
if (!Array.isArray(zones) || zones.length === 0) {
console.warn('No zones available to select a model from.');
return;
}
const sorted = zones.slice().sort((a: Zone, b: Zone) => {
const oa = typeof a.order === 'number' ? a.order : 0;
const ob = typeof b.order === 'number' ? b.order : 0;
if (oa !== ob) return oa - ob;
return (a.name || '').localeCompare(b.name || '');
});
const top = sorted[0];
let chosenPath: string | null = top?.model_path && String(top.model_path).trim() ? top.model_path! : null;
if (!chosenPath) {
const nextWithModel = sorted.find((z) => z.model_path && String(z.model_path).trim());
chosenPath = nextWithModel?.model_path ?? null;
}
if (chosenPath) {
onSelectModel(chosenPath);
} else {
console.warn('No zone has a valid model_path to open.');
}
} catch (error) {
console.error('Error selecting top zone model:', error);
}
};
const defaultButtons: ToolbarButton[] = [
{
icon: '/icons/Zoom.png',
@@ -127,11 +83,6 @@ const SceneToolbar: React.FC<SceneToolbarProps> = ({
onClick: onToggleSensorHighlights || (() => console.log('Toggle Sensor Highlights')),
active: sensorHighlightsActive,
},
{
icon: '/icons/Warehouse.png',
label: 'Домой',
onClick: handleHomeClick,
},
{
icon: '/icons/Layers.png',
label: 'Уровни',