Collapsible chat list on wide screens
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
c82ab5028b
commit
5fc405d86a
4 files changed
+44
-15
No files matched your search
@@ -3,6 +3,12 @@
|
||||
All notable changes to CodeCraft. Versions follow [Semantic Versioning](https://semver.org/);
|
||||
until 1.0, minor versions may contain breaking changes.
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
### Changed
|
||||
|
||||
- **Collapsible chat list** on wide screens: the menu button in the title bar folds the chat list away (remembered), so chat menus are no longer hidden behind it on small monitors.
|
||||
|
||||
## [v202611-00058] – 2026-11-17
|
||||
|
||||
### Changed
|
||||
|
||||
+30
-13
@@ -36,6 +36,23 @@ export function App() {
|
||||
const [info, setInfo] = useState<Info>();
|
||||
const [error, setError] = useState<string>();
|
||||
const [menuOpen, setMenuOpen] = useState(false);
|
||||
// Wide screens: the chat list can be folded away (remembered); narrow screens use the slide-in drawer.
|
||||
const [folded, setFolded] = useState(() => {
|
||||
try {
|
||||
return localStorage.getItem("codecraft.sidebarFolded") === "1";
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
const openMenu = () => {
|
||||
if (window.matchMedia("(max-width: 800px)").matches) return setMenuOpen(true);
|
||||
setFolded((f) => {
|
||||
try {
|
||||
localStorage.setItem("codecraft.sidebarFolded", f ? "0" : "1");
|
||||
} catch {}
|
||||
return !f;
|
||||
});
|
||||
};
|
||||
const [shared, setShared] = useState(pendingShare);
|
||||
const offline = useStore((s) => s.offline);
|
||||
useTitleActivity();
|
||||
@@ -98,40 +115,40 @@ export function App() {
|
||||
const [section, arg] = route;
|
||||
let content;
|
||||
const chatIds = section === "s" && arg ? arg.split("+").filter(Boolean).slice(0, MAX_PANES) : [];
|
||||
if (chatIds.length === 1) content = <ChatView key={chatIds[0]} sessionId={chatIds[0]} onMenu={() => setMenuOpen(true)} />;
|
||||
if (chatIds.length === 1) content = <ChatView key={chatIds[0]} sessionId={chatIds[0]} onMenu={openMenu} />;
|
||||
else if (chatIds.length > 1)
|
||||
content = (
|
||||
<div className="split-view">
|
||||
{chatIds.map((id) => (
|
||||
<div key={id} className="split-pane">
|
||||
<ChatView sessionId={id} onMenu={() => setMenuOpen(true)} onClosePane={() => closePane(id)} />
|
||||
<ChatView sessionId={id} onMenu={openMenu} onClosePane={() => closePane(id)} />
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
);
|
||||
else if (section === "settings") content = <Settings tab={arg} onMenu={() => setMenuOpen(true)} />;
|
||||
else if (section === "p" && arg) content = <ProjectPage key={arg} cwd={decodeURIComponent(arg)} onMenu={() => setMenuOpen(true)} />;
|
||||
else if (section === "factory") content = <Factory onMenu={() => setMenuOpen(true)} />;
|
||||
else if (section === "stats") content = <Stats onMenu={() => setMenuOpen(true)} />;
|
||||
else if (section === "images") content = <Images onMenu={() => setMenuOpen(true)} />;
|
||||
else if (section === "jobs" && arg) content = <JobEditor key={arg} id={arg} onMenu={() => setMenuOpen(true)} />;
|
||||
else if (section === "jobs") content = <Jobs onMenu={() => setMenuOpen(true)} />;
|
||||
else if (section === "settings") content = <Settings tab={arg} onMenu={openMenu} />;
|
||||
else if (section === "p" && arg) content = <ProjectPage key={arg} cwd={decodeURIComponent(arg)} onMenu={openMenu} />;
|
||||
else if (section === "factory") content = <Factory onMenu={openMenu} />;
|
||||
else if (section === "stats") content = <Stats onMenu={openMenu} />;
|
||||
else if (section === "images") content = <Images onMenu={openMenu} />;
|
||||
else if (section === "jobs" && arg) content = <JobEditor key={arg} id={arg} onMenu={openMenu} />;
|
||||
else if (section === "jobs") content = <Jobs onMenu={openMenu} />;
|
||||
else if (section === "terminal")
|
||||
content = (
|
||||
<Suspense fallback={<div className="empty"><Spinner /></div>}>
|
||||
<TerminalPage id={arg} onMenu={() => setMenuOpen(true)} />
|
||||
<TerminalPage id={arg} onMenu={openMenu} />
|
||||
</Suspense>
|
||||
);
|
||||
else if (section === "files")
|
||||
content = (
|
||||
<Suspense fallback={<div className="empty"><Spinner /></div>}>
|
||||
<Files onMenu={() => setMenuOpen(true)} />
|
||||
<Files onMenu={openMenu} />
|
||||
</Suspense>
|
||||
);
|
||||
else content = <NewSession onMenu={() => setMenuOpen(true)} onCreated={(id) => navigate(`/s/${id}`)} />;
|
||||
else content = <NewSession onMenu={openMenu} onCreated={(id) => navigate(`/s/${id}`)} />;
|
||||
|
||||
return (
|
||||
<div className="app">
|
||||
<div className={`app ${folded ? "side-folded" : ""}`}>
|
||||
{menuOpen && <div className="backdrop" onClick={() => setMenuOpen(false)} />}
|
||||
<Sidebar open={menuOpen} activeIds={chatIds} section={section ?? ""} />
|
||||
<main className="main">
|
||||
|
||||
+4
-2
@@ -477,8 +477,10 @@ button.session-group:hover {
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
.menu-btn {
|
||||
display: none;
|
||||
@media (min-width: 801px) {
|
||||
.app.side-folded .sidebar {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
.chip {
|
||||
|
||||
@@ -3,6 +3,10 @@
|
||||
* under "unreleased"; scripts/release.sh renames the key to the release version.
|
||||
*/
|
||||
export const WHATS_NEW: Record<string, { en: string[]; de: string[] }> = {
|
||||
unreleased: {
|
||||
en: ["The chat list can be folded away on wide screens (menu button in the title bar)"],
|
||||
de: ["Die Chatliste lässt sich auf breiten Bildschirmen zuklappen (Menü-Button in der Titelleiste)"],
|
||||
},
|
||||
"202611-00058": {
|
||||
en: ["README and screenshots updated"],
|
||||
de: ["README und Screenshots aktualisiert"],
|
||||
|
||||
Reference in new issue
Block a user