document.addEventListener('DOMContentLoaded',()=>{
const q=new URLSearchParams(location.search);
document.documentElement.dataset.theme='dark';
const view=q.get('view')||'dashboard';
document.querySelectorAll('.view').forEach(v=>v.classList.toggle('active',v.dataset.view===view));
if(view==='dashboard'){
document.querySelector('#summaryText').textContent='3 urządzenia online · 2 aktywne termostaty';
document.querySelector('#metrics').innerHTML='Online 3/3Aktywne 2';
document.querySelector('#heroTemperature').innerHTML='21.4°C';
document.querySelector('#houseClimate').innerHTML='
Tryb domu
Wspólne ustawienia dla stref.
Na zewnątrz 12.8°C ';
document.querySelector('#controlPlan').innerHTML='Salon
Utrzymuj 21.5°C do 22:30
AktywneSypialnia
Tryb nocny od 22:30
za 2h ';
}
if(view==='flows'){
document.querySelector('#flowListCount').textContent='3 flow';
document.querySelector('#flowList').innerHTML=`Okno w salonie
Wyłącza grzanie, gdy okno jest otwarte.
Bloki5
Harmonogramy0
Automatyzacje1
Tani prąd
Podbija temperaturę przy niskiej cenie energii.
Bloki7
Harmonogramy1
Automatyzacje2
`;
}
if(q.get('editor')==='1'){
document.querySelector('#flowEditor').hidden=false; document.body.classList.add('flow-editor-open');
document.querySelector('#flowName').hidden=true; document.querySelector('#flowNameView').hidden=false; document.querySelector('#flowNameText').textContent='Okno w salonie';
document.querySelector('#flowCompileStatus').textContent='0 harm. · 1 autom.'; document.querySelector('#flowSaveStatus').textContent='Zapisano';
document.querySelector('#flowInterpretation').textContent='Jeśli okno w salonie jest otwarte przez 30 s, wyłącz termostat Salon.';
document.querySelector('#flowRuntimeSummary').textContent='Ostatnie wykonanie: 07:12 · wynik: prawda';
document.querySelector('#flowEmptyHint').style.display='none';
document.querySelector('#flowNodes').innerHTML=`Wspólne wejście
Okno w salonie
Terazotwarte
Utrzymuje się przez…
30 sekund
Termostat
Salon · wyłącz
`;
document.querySelector('#flowInspector').classList.add('has-selection');
document.querySelector('#flowInspector').innerHTML='Ustawienia bloku
Wspólne wejście
Czujnik używany tylko we Flow. Nie jest zapisywany do metryk.
';
}
});