Skip to content

Commit 2d6e762

Browse files
committed
Fix frontend layout and script wiring
1 parent 8be80db commit 2d6e762

2 files changed

Lines changed: 8 additions & 121 deletions

File tree

frontend/index.html

Lines changed: 6 additions & 119 deletions
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,7 @@
363363
font-size: clamp(2.8rem, 6vw, 5rem);
364364
font-weight: 800;
365365
letter-spacing: -0.04em;
366-
line-height: 1.05;
366+
line-height: 1.16;
367367
margin-bottom: 20px;
368368
}
369369

@@ -373,6 +373,7 @@
373373
-webkit-background-clip: text;
374374
-webkit-text-fill-color: transparent;
375375
background-clip: text;
376+
display: inline-block;
376377
}
377378

378379
.hero-sub {
@@ -1832,7 +1833,8 @@
18321833
/* responsive */
18331834
@media(max-width:600px) {
18341835
.hero h1 {
1835-
font-size: 2.2rem
1836+
font-size: 2.2rem;
1837+
line-height: 1.18
18361838
}
18371839

18381840
nav {
@@ -1948,7 +1950,8 @@
19481950
}
19491951

19501952
.hero h1 {
1951-
font-size: 1.9rem
1953+
font-size: 1.9rem;
1954+
line-height: 1.2
19521955
}
19531956

19541957
.feat-pill-info p {
@@ -2233,24 +2236,8 @@ <h4>File Upload</h4>
22332236
<div class="spinner" id="spinner" aria-hidden="true"></div>
22342237
<span class="btn-text">Analyze Code</span>
22352238
</button>
2236-
<button id="analyze-btn" title="Analyze Code (Ctrl+Enter)" align="center">Analyze <span
2237-
class="desktop-hint">(Ctrl+Enter)</span>
2238-
</button>
22392239
</div>
22402240
</div>
2241-
2242-
<!-- Result tabs -->
2243-
<div class="result-tabs" role="tablist" aria-label="Analysis Results">
2244-
<button class="result-tab active" data-rtab="explain" role="tab" aria-selected="true" aria-controls="pane-explain" tabindex="0">
2245-
<svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true"><path d="M2 3h6a4 4 0 0 1 4 4v14a3 3 0 0 0-3-3H2z"/><path d="M22 3h-6a4 4 0 0 0-4 4v14a3 3 0 0 1 3-3h7z"/></svg> Explain <span class="tab-badge" id="explainBadge"></span>
2246-
</button>
2247-
<button class="result-tab" data-rtab="debug" role="tab" aria-selected="false" aria-controls="pane-debug" tabindex="-1">
2248-
<svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true"><path d="M8 2l1.5 1.5"/><path d="M14.5 3.5L16 2"/><path d="M9 7.5A3 3 0 0 1 12 5a3 3 0 0 1 3 2.5"/><path d="M6.5 9H4a1 1 0 0 0-1 1v1a8 8 0 0 0 16 0v-1a1 1 0 0 0-1-1h-2.5"/><line x1="12" y1="12" x2="12" y2="16"/><path d="M4.5 15H2"/><path d="M22 15h-2.5"/><path d="M4.5 19l-2 2"/><path d="M19.5 19l2 2"/></svg> Debug <span class="tab-badge" id="debugBadge"></span>
2249-
</button>
2250-
<button class="result-tab" data-rtab="suggest" role="tab" aria-selected="false" aria-controls="pane-suggest" tabindex="-1">
2251-
<svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true"><polygon points="13,2 3,14 12,14 11,22 21,10 12,10"/></svg> Improve <span class="tab-badge" id="suggestBadge"></span>
2252-
</button>
2253-
</div>
22542241
<!-- Results Panel -->
22552242
<div class="panel">
22562243
<div class="panel-header">
@@ -2599,106 +2586,6 @@ <h3>No suggestions yet</h3>
25992586
}
26002587
}
26012588
}
2602-
2603-
/* ═══════════════════════════════════════════════════════════════
2604-
MODE BUTTONS
2605-
═══════════════════════════════════════════════════════════════ */
2606-
document.querySelectorAll('.mode-btn').forEach(b => {
2607-
b.addEventListener('click', () => {
2608-
selectedMode = b.dataset.mode;
2609-
document.querySelectorAll('.mode-btn').forEach(x => {
2610-
x.classList.remove('active');
2611-
x.setAttribute('aria-pressed', 'false');
2612-
});
2613-
b.classList.add('active');
2614-
b.setAttribute('aria-pressed', 'true');
2615-
});
2616-
});
2617-
2618-
/* ═══════════════════════════════════════════════════════════════
2619-
RESULT TABS
2620-
═══════════════════════════════════════════════════════════════ */
2621-
document.querySelectorAll('.result-tab').forEach((t, index, tabs) => {
2622-
t.addEventListener('click', () => {
2623-
const tab = t.dataset.rtab;
2624-
2625-
document.querySelectorAll('.result-tab').forEach(x => {
2626-
x.classList.remove('active');
2627-
x.setAttribute('aria-selected', 'false');
2628-
});
2629-
2630-
document.querySelectorAll('.result-pane').forEach(x =>
2631-
x.classList.remove('active')
2632-
);
2633-
2634-
t.classList.add('active');
2635-
t.setAttribute('aria-selected', 'true');
2636-
2637-
document.getElementById(`pane-${tab}`).classList.add('active');
2638-
});
2639-
2640-
t.addEventListener('keydown', (e) => {
2641-
if (e.key === 'ArrowRight') {
2642-
e.preventDefault();
2643-
tabs[(index + 1) % tabs.length].focus();
2644-
}
2645-
2646-
if (e.key === 'ArrowLeft') {
2647-
e.preventDefault();
2648-
tabs[(index - 1 + tabs.length) % tabs.length].focus();
2649-
}
2650-
2651-
if (e.key === 'Enter' || e.key === ' ') {
2652-
e.preventDefault();
2653-
t.click();
2654-
}
2655-
});
2656-
});
2657-
2658-
/* ═══════════════════════════════════════════════════════════════
2659-
CLEAR / COPY
2660-
═══════════════════════════════════════════════════════════════ */
2661-
document.getElementById('clearBtn').addEventListener('click', () => {
2662-
editor.value = '';
2663-
updateEditor();
2664-
resetResults();
2665-
});
2666-
document.getElementById('copyBtn').addEventListener('click', () => {
2667-
if (!editor.value.trim()) return;
2668-
navigator.clipboard.writeText(editor.value).then(() => toast('Code copied!', 'success'));
2669-
});
2670-
2671-
/* ═══════════════════════════════════════════════════════════════
2672-
API PING
2673-
═══════════════════════════════════════════════════════════════ */
2674-
async function pingApi() {
2675-
const base = apiUrlInput.value.replace(/\/$/, '');
2676-
try {
2677-
const r = await fetch(`${base}/health`, {signal: AbortSignal.timeout(5000)});
2678-
if (r.ok) {
2679-
apiDot.classList.add('connected');
2680-
apiStatusText.textContent = 'Connected';
2681-
toast('API is reachable', 'success');
2682-
} else {
2683-
apiDot.classList.remove('connected');
2684-
apiStatusText.textContent = 'Error ' + r.status;
2685-
}
2686-
} catch {
2687-
apiDot.classList.remove('connected');
2688-
apiStatusText.textContent = 'Unreachable';
2689-
toast('Cannot reach API. Check the URL.', 'error');
2690-
}
2691-
}
2692-
document.getElementById('pingBtn').addEventListener('click', pingApi);
2693-
// CTRL + ENTER
2694-
else if (
2695-
e.key === 'Enter' &&
2696-
(e.ctrlKey || e.metaKey)
2697-
) {
2698-
2699-
e.preventDefault();
2700-
doAnalyze();
2701-
}
27022589
});
27032590

27042591
/* ═══════════════════════════════════════════════════════════════

frontend/style.css

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,6 @@ body {
120120
gap: 4rem;
121121
align-items: center;
122122
padding: 6rem 4rem 5rem;
123-
overflow: hidden;
124123
min-height: calc(100vh - 52px);
125124
}
126125
.hero-grid-bg {
@@ -160,13 +159,14 @@ body {
160159
font-family: var(--font-serif);
161160
font-size: clamp(2.8rem, 5vw, 4.5rem);
162161
font-weight: 400;
163-
line-height: 1.1;
162+
line-height: 1.18;
164163
letter-spacing: -0.02em;
165164
margin-bottom: 1.5rem;
166165
}
167166
.hero-title em {
168167
font-style: italic;
169168
color: var(--text-2);
169+
display: inline-block;
170170
}
171171
.hero-sub {
172172
font-size: 15px;

0 commit comments

Comments
 (0)