-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsolution-render.js
More file actions
32 lines (25 loc) · 1.1 KB
/
solution-render.js
File metadata and controls
32 lines (25 loc) · 1.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
document.addEventListener('DOMContentLoaded', () => {
const spinner = document.getElementById('loading-spinner');
const solutionContainer = document.getElementById('solution-container');
if (!window.electronAPI) {
console.error('electronAPI is not available.');
return;
}
window.electronAPI.onDisplaySolution((solution) => {
console.log('onDisplaySolution triggered with solution:', solution);
spinner.style.display = 'none';
solutionContainer.style.display = 'block';
if (!solution) {
solutionContainer.innerText = 'No solution available.';
return;
}
solutionContainer.innerText = solution;
const { width, height } = solutionContainer.getBoundingClientRect();
window.electronAPI.requestResize(Math.ceil(width) + 30, Math.ceil(height) + 30);
});
window.electronAPI.onError((errorMsg) => {
spinner.style.display = 'none';
solutionContainer.style.display = 'block';
solutionContainer.innerHTML = `<span style="color: #ff6b6b;">❌ ${errorMsg}</span>`;
});
});