@devries-cameron20 / t3code Mirror · read-only / commits / a4298f1ceb
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 25, 05:00 UTC

fix(web): hide mobile sidebar after thread selection or creation (#1293)

Co-authored-by: Murat Aslan <murataslan1@users.noreply.github.com> Co-authored-by: Julius Marminge <julius0216@outlook.com>

Murat Aslan committed Apr 30, 2026 at 21:10 UTC a4298f1ceb13dc496bd20eb5372ae691dbd3ca62
1 file changed +27 -4
apps/web/src/components/Sidebar.tsx
+27 -4
@@ -143,6 +143,7 @@ import {
143 SidebarMenuSubItem,
144 SidebarSeparator,
145 SidebarTrigger,
146 + useSidebar,
147 } from "./ui/sidebar";
148 import { useThreadSelectionStore } from "../threadSelectionStore";
149 import { useCommandPaletteStore } from "../commandPaletteStore";
@@ -931,6 +932,7 @@ const SidebarProjectItem = memo(function SidebarProjectItem(props: SidebarProjec
932 }));
933 const { updateSettings } = useUpdateSettings();
934 const router = useRouter();
935 + const { isMobile, setOpenMobile } = useSidebar();
936 const markThreadUnread = useUiStateStore((state) => state.markThreadUnread);
937 const toggleProject = useUiStateStore((state) => state.toggleProject);
938 const toggleThreadSelection = useThreadSelectionStore((state) => state.toggleThread);
@@ -1519,12 +1521,15 @@ const SidebarProjectItem = memo(function SidebarProjectItem(props: SidebarProjec
1521 clearSelection();
1522 }
1523 setSelectionAnchor(scopedThreadKey(threadRef));
1524 + if (isMobile) {
1525 + setOpenMobile(false);
1526 + }
1527 void router.navigate({
1528 to: "/$environmentId/$threadId",
1529 params: buildThreadRouteParams(threadRef),
1530 });
1531 },
1527 - [clearSelection, router, setSelectionAnchor],
1532 + [clearSelection, isMobile, router, setOpenMobile, setSelectionAnchor],
1533 );
1534
1535 const handleThreadClick = useCallback(
@@ -1555,12 +1560,23 @@ const SidebarProjectItem = memo(function SidebarProjectItem(props: SidebarProjec
1560 clearSelection();
1561 }
1562 setSelectionAnchor(threadKey);
1563 + if (isMobile) {
1564 + setOpenMobile(false);
1565 + }
1566 void router.navigate({
1567 to: "/$environmentId/$threadId",
1568 params: buildThreadRouteParams(threadRef),
1569 });
1570 },
1563 - [clearSelection, rangeSelectTo, router, setSelectionAnchor, toggleThreadSelection],
1571 + [
1572 + clearSelection,
1573 + isMobile,
1574 + rangeSelectTo,
1575 + router,
1576 + setOpenMobile,
1577 + setSelectionAnchor,
1578 + toggleThreadSelection,
1579 + ],
1580 );
1581
1582 const handleMultiSelectContextMenu = useCallback(
@@ -1658,6 +1674,9 @@ const SidebarProjectItem = memo(function SidebarProjectItem(props: SidebarProjec
1674 }
1675 : null,
1676 });
1677 + if (isMobile) {
1678 + setOpenMobile(false);
1679 + }
1680 void handleNewThread(scopeProjectRef(member.environmentId, member.id), {
1681 ...(seedContext.branch !== undefined ? { branch: seedContext.branch } : {}),
1682 ...(seedContext.worktreePath !== undefined
@@ -1666,7 +1685,7 @@ const SidebarProjectItem = memo(function SidebarProjectItem(props: SidebarProjec
1685 envMode: seedContext.envMode,
1686 });
1687 },
1669 - [defaultThreadEnvMode, handleNewThread, router],
1688 + [defaultThreadEnvMode, handleNewThread, isMobile, router, setOpenMobile],
1689 );
1690
1691 const handleCreateThreadClick = useCallback(
@@ -2703,6 +2722,7 @@ export default function Sidebar() {
2722 const { updateSettings } = useUpdateSettings();
2723 const { handleNewThread } = useNewThreadHandler();
2724 const { archiveThread, deleteThread } = useThreadActions();
2725 + const { isMobile, setOpenMobile } = useSidebar();
2726 const routeThreadRef = useParams({
2727 strict: false,
2728 select: (params) => resolveThreadRouteRef(params),
@@ -2855,12 +2875,15 @@ export default function Sidebar() {
2875 clearSelection();
2876 }
2877 setSelectionAnchor(scopedThreadKey(threadRef));
2878 + if (isMobile) {
2879 + setOpenMobile(false);
2880 + }
2881 void navigate({
2882 to: "/$environmentId/$threadId",
2883 params: buildThreadRouteParams(threadRef),
2884 });
2885 },
2863 - [clearSelection, navigate, setSelectionAnchor],
2886 + [clearSelection, isMobile, navigate, setOpenMobile, setSelectionAnchor],
2887 );
2888
2889 const projectDnDSensors = useSensors(