Rename UI to LED Editor and improve mobile editor layout

Use "LED Editor" in page titles and the home heading. On narrow
viewports, make the file tree an off-canvas drawer with backdrop,
hamburger toggle, Escape to close, and auto-close after opening a
file. Add safe-area and tap-target tweaks, cache-bust static assets.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-05-10 03:16:35 +12:00
parent a2318f2244
commit 9f28eabd2d
6 changed files with 199 additions and 39 deletions

View File

@@ -3,7 +3,7 @@
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Python Editor</title>
<title>LED Editor</title>
<link rel="icon" href="data:,">
<style>
* { box-sizing: border-box; }
@@ -182,7 +182,7 @@
</head>
<body>
<main class="home-card">
<h1>Python Editor</h1>
<h1>LED Editor</h1>
<div id="auth-nav" class="nav">
<span id="auth-greeting" class="hidden"></span>
<a class="btn btn-ghost hidden" id="link-login" href="/login">Sign in</a>

View File

@@ -2,14 +2,16 @@
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Python Editor</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-fit=cover">
<meta name="theme-color" content="#2d3748">
<title>LED Editor</title>
<link rel="icon" href="data:,">
<link rel="stylesheet" href="/static/styles.css?v=12">
<link rel="stylesheet" href="/static/styles.css?v=13">
</head>
<body>
<div class="container">
<div class="sidebar">
<div class="sidebar-backdrop" id="sidebar-backdrop" hidden></div>
<div class="sidebar" id="sidebar">
<div class="sidebar-header">
<h3>Files</h3>
<div class="sidebar-actions">
@@ -26,6 +28,7 @@
<div class="main-content">
<div class="editor-header">
<button id="sidebar-toggle" class="sidebar-toggle" type="button" aria-label="Toggle file tree" aria-controls="sidebar" aria-expanded="false"></button>
<div class="file-info">
<span id="save-status" class="save-status"></span>
<span class="runtime-hint" title="Python runs locally in your browser via Pyodide; completions use Jedi in the same runtime.">Browser · Pyodide</span>
@@ -87,6 +90,6 @@
</div>
</div>
<script type="module" src="/static/script.js?v=26"></script>
<script type="module" src="/static/script.js?v=27"></script>
</body>
</html>

View File

@@ -3,7 +3,7 @@
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Sign in — Python Editor</title>
<title>Sign in — LED Editor</title>
<link rel="icon" href="data:,">
<style>
* { box-sizing: border-box; }

View File

@@ -3,7 +3,7 @@
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Register — Python Editor</title>
<title>Register — LED Editor</title>
<link rel="icon" href="data:,">
<style>
* { box-sizing: border-box; }

View File

@@ -705,7 +705,43 @@ class TextEditor {
this.hideCompletionDropdown();
}
isMobileViewport() {
return typeof window !== 'undefined' && window.matchMedia && window.matchMedia('(max-width: 768px)').matches;
}
setMobileSidebarOpen(open) {
const sidebar = document.getElementById('sidebar');
const backdrop = document.getElementById('sidebar-backdrop');
const toggle = document.getElementById('sidebar-toggle');
if (!sidebar || !backdrop || !toggle) return;
sidebar.classList.toggle('is-open', open);
backdrop.classList.toggle('is-open', open);
backdrop.hidden = !open;
toggle.setAttribute('aria-expanded', String(open));
}
setupMobileSidebar() {
const toggle = document.getElementById('sidebar-toggle');
const backdrop = document.getElementById('sidebar-backdrop');
if (!toggle || !backdrop) return;
toggle.addEventListener('click', () => {
const sidebar = document.getElementById('sidebar');
const isOpen = sidebar?.classList.contains('is-open');
this.setMobileSidebarOpen(!isOpen);
});
backdrop.addEventListener('click', () => this.setMobileSidebarOpen(false));
document.addEventListener('keydown', (event) => {
if (event.key === 'Escape') {
const sidebar = document.getElementById('sidebar');
if (sidebar?.classList.contains('is-open')) {
this.setMobileSidebarOpen(false);
}
}
});
}
setupEventListeners() {
this.setupMobileSidebar();
const persistSession = () => {
this.saveSessionState();
};
@@ -1061,6 +1097,9 @@ class TextEditor {
await this.toggleDirectory(path);
} else if (!isDirectory) {
this.openFile(path);
if (this.isMobileViewport()) {
this.setMobileSidebarOpen(false);
}
} else {
this.renderFileTree();
}

View File

@@ -9,12 +9,45 @@ body {
background-color: #f5f5f5;
height: 100dvh;
overflow: hidden;
-webkit-text-size-adjust: 100%;
overscroll-behavior: none;
}
button,
.tab,
.file-item,
.mode-btn {
touch-action: manipulation;
}
.container {
display: flex;
height: 100dvh;
overflow: hidden;
position: relative;
}
.sidebar-toggle {
display: none;
align-items: center;
justify-content: center;
width: 40px;
height: 40px;
border: 1px solid #cbd5e0;
background: white;
color: #2d3748;
border-radius: 8px;
font-size: 1.2rem;
cursor: pointer;
flex-shrink: 0;
}
.sidebar-toggle:hover {
background: #f7fafc;
}
.sidebar-backdrop {
display: none;
}
/* Sidebar */
@@ -543,86 +576,155 @@ body {
/* Responsive design */
@media (max-width: 768px) {
body {
height: 100dvh;
overflow: hidden;
}
.container {
flex-direction: column;
height: 100dvh;
overflow: hidden;
}
/* Sidebar becomes an off-canvas drawer. */
.sidebar {
width: 100%;
max-height: 30vh;
min-height: 170px;
position: fixed;
top: 0;
left: 0;
bottom: 0;
width: min(82vw, 320px);
height: 100dvh;
transform: translateX(-100%);
transition: transform 0.2s ease;
z-index: 50;
box-shadow: 2px 0 16px rgba(0, 0, 0, 0.25);
padding-top: env(safe-area-inset-top);
padding-bottom: env(safe-area-inset-bottom);
}
.sidebar-header {
padding: 0.7rem 0.8rem;
.sidebar.is-open {
transform: translateX(0);
}
.file-tree {
min-height: 100px;
.sidebar-backdrop {
display: block;
position: fixed;
inset: 0;
background: rgba(0, 0, 0, 0.45);
z-index: 40;
opacity: 0;
pointer-events: none;
transition: opacity 0.2s ease;
}
.sidebar-backdrop.is-open {
opacity: 1;
pointer-events: auto;
}
.sidebar-backdrop[hidden] {
/* Even when the JS hasn't toggled it yet, hide on desktop only. Mobile keeps it
in the layer for transitions; explicit [hidden] still wins via display:none below. */
display: none;
}
.sidebar-toggle {
display: inline-flex;
}
.sidebar-actions button {
min-width: 40px;
min-height: 40px;
font-size: 1.15rem;
}
.main-content {
width: 100%;
min-height: 0;
}
.editor-header {
padding: 0.65rem;
padding: 0.55rem 0.65rem;
flex-wrap: wrap;
gap: 0.55rem;
align-items: stretch;
gap: 0.45rem;
align-items: center;
padding-top: max(0.55rem, env(safe-area-inset-top));
}
.file-info {
width: 100%;
justify-content: space-between;
flex: 1 1 auto;
min-width: 0;
gap: 0.5rem;
flex-wrap: wrap;
}
.file-info .runtime-hint {
font-size: 0.7rem;
padding: 0.15rem 0.4rem;
}
.mode-toggle {
order: 3;
}
.mode-btn {
min-height: 36px;
padding: 0.5rem 0.85rem;
}
.editor-actions {
width: 100%;
order: 4;
flex-wrap: wrap;
gap: 0.4rem;
}
.editor-actions button {
flex: 1 1 100px;
flex: 1 1 110px;
min-height: 40px;
font-size: 0.95rem;
}
.run-main-toggle {
width: 100%;
justify-content: flex-start;
flex: 1 1 100%;
flex: 1 1 calc(50% - 0.4rem);
min-height: 40px;
font-size: 0.85rem;
}
.tabs {
padding: 0.3rem 0.35rem;
gap: 0.3rem;
-webkit-overflow-scrolling: touch;
}
.tab {
padding: 0.45rem 0.55rem;
}
.tab-title {
max-width: 150px;
max-width: 140px;
}
.tab-close {
font-size: 18px;
padding: 0 0.25rem;
}
.editor-container {
min-height: 46vh;
min-height: 42vh;
}
.cm-editor {
font-size: 13px;
font-size: 14px; /* >=16px would prevent iOS zoom but feels too large here; CM is contenteditable so no zoom anyway. */
}
.modal-content {
width: 90%;
margin: 20% auto;
width: min(92vw, 420px);
margin: 18vh auto;
padding: 1.25rem;
}
.modal-content input {
font-size: 16px; /* prevent iOS focus zoom */
}
.modal-actions button {
min-height: 40px;
flex: 1 1 100px;
}
.led-grid {
@@ -640,8 +742,24 @@ body {
flex-wrap: wrap;
}
.led-sim-actions button {
flex: 1 1 80px;
min-height: 36px;
}
.console-container {
height: 180px;
height: 160px;
}
.file-item {
padding: 0.65rem 0.5rem;
}
}
/* Hide drawer affordances entirely on desktop, even with [hidden] flipped off. */
@media (min-width: 769px) {
.sidebar-backdrop {
display: none !important;
}
}