| ... | @@ -143,6 +143,7 @@ import { | ... | @@ -143,6 +143,7 @@ import { |
| 143 | SidebarMenuSubItem, | 143 | SidebarMenuSubItem, |
| 144 | SidebarSeparator, | 144 | SidebarSeparator, |
| 145 | SidebarTrigger, | 145 | SidebarTrigger, |
| | 146 | useSidebar, |
| 146 | } from "./ui/sidebar"; | 147 | } from "./ui/sidebar"; |
| 147 | import { useThreadSelectionStore } from "../threadSelectionStore"; | 148 | import { useThreadSelectionStore } from "../threadSelectionStore"; |
| 148 | import { useCommandPaletteStore } from "../commandPaletteStore"; | 149 | import { useCommandPaletteStore } from "../commandPaletteStore"; |
| ... | @@ -931,6 +932,7 @@ const SidebarProjectItem = memo(function SidebarProjectItem(props: SidebarProjec | ... | @@ -931,6 +932,7 @@ const SidebarProjectItem = memo(function SidebarProjectItem(props: SidebarProjec |
| 931 | })); | 932 | })); |
| 932 | const { updateSettings } = useUpdateSettings(); | 933 | const { updateSettings } = useUpdateSettings(); |
| 933 | const router = useRouter(); | 934 | const router = useRouter(); |
| | 935 | const { isMobile, setOpenMobile } = useSidebar(); |
| 934 | const markThreadUnread = useUiStateStore((state) => state.markThreadUnread); | 936 | const markThreadUnread = useUiStateStore((state) => state.markThreadUnread); |
| 935 | const toggleProject = useUiStateStore((state) => state.toggleProject); | 937 | const toggleProject = useUiStateStore((state) => state.toggleProject); |
| 936 | const toggleThreadSelection = useThreadSelectionStore((state) => state.toggleThread); | 938 | const toggleThreadSelection = useThreadSelectionStore((state) => state.toggleThread); |
| ... | @@ -1519,12 +1521,15 @@ const SidebarProjectItem = memo(function SidebarProjectItem(props: SidebarProjec | ... | @@ -1519,12 +1521,15 @@ const SidebarProjectItem = memo(function SidebarProjectItem(props: SidebarProjec |
| 1519 | clearSelection(); | 1521 | clearSelection(); |
| 1520 | } | 1522 | } |
| 1521 | setSelectionAnchor(scopedThreadKey(threadRef)); | 1523 | setSelectionAnchor(scopedThreadKey(threadRef)); |
| | 1524 | if (isMobile) { |
| | 1525 | setOpenMobile(false); |
| | 1526 | } |
| 1522 | void router.navigate({ | 1527 | void router.navigate({ |
| 1523 | to: "/$environmentId/$threadId", | 1528 | to: "/$environmentId/$threadId", |
| 1524 | params: buildThreadRouteParams(threadRef), | 1529 | params: buildThreadRouteParams(threadRef), |
| 1525 | }); | 1530 | }); |
| 1526 | }, | 1531 | }, |
| 1527 | [clearSelection, router, setSelectionAnchor], | 1532 | [clearSelection, isMobile, router, setOpenMobile, setSelectionAnchor], |
| 1528 | ); | 1533 | ); |
| 1529 | | 1534 | |
| 1530 | const handleThreadClick = useCallback( | 1535 | const handleThreadClick = useCallback( |
| ... | @@ -1555,12 +1560,23 @@ const SidebarProjectItem = memo(function SidebarProjectItem(props: SidebarProjec | ... | @@ -1555,12 +1560,23 @@ const SidebarProjectItem = memo(function SidebarProjectItem(props: SidebarProjec |
| 1555 | clearSelection(); | 1560 | clearSelection(); |
| 1556 | } | 1561 | } |
| 1557 | setSelectionAnchor(threadKey); | 1562 | setSelectionAnchor(threadKey); |
| | 1563 | if (isMobile) { |
| | 1564 | setOpenMobile(false); |
| | 1565 | } |
| 1558 | void router.navigate({ | 1566 | void router.navigate({ |
| 1559 | to: "/$environmentId/$threadId", | 1567 | to: "/$environmentId/$threadId", |
| 1560 | params: buildThreadRouteParams(threadRef), | 1568 | params: buildThreadRouteParams(threadRef), |
| 1561 | }); | 1569 | }); |
| 1562 | }, | 1570 | }, |
| 1563 | [clearSelection, rangeSelectTo, router, setSelectionAnchor, toggleThreadSelection], | 1571 | [ |
| | 1572 | clearSelection, |
| | 1573 | isMobile, |
| | 1574 | rangeSelectTo, |
| | 1575 | router, |
| | 1576 | setOpenMobile, |
| | 1577 | setSelectionAnchor, |
| | 1578 | toggleThreadSelection, |
| | 1579 | ], |
| 1564 | ); | 1580 | ); |
| 1565 | | 1581 | |
| 1566 | const handleMultiSelectContextMenu = useCallback( | 1582 | const handleMultiSelectContextMenu = useCallback( |
| ... | @@ -1658,6 +1674,9 @@ const SidebarProjectItem = memo(function SidebarProjectItem(props: SidebarProjec | ... | @@ -1658,6 +1674,9 @@ const SidebarProjectItem = memo(function SidebarProjectItem(props: SidebarProjec |
| 1658 | } | 1674 | } |
| 1659 | : null, | 1675 | : null, |
| 1660 | }); | 1676 | }); |
| | 1677 | if (isMobile) { |
| | 1678 | setOpenMobile(false); |
| | 1679 | } |
| 1661 | void handleNewThread(scopeProjectRef(member.environmentId, member.id), { | 1680 | void handleNewThread(scopeProjectRef(member.environmentId, member.id), { |
| 1662 | ...(seedContext.branch !== undefined ? { branch: seedContext.branch } : {}), | 1681 | ...(seedContext.branch !== undefined ? { branch: seedContext.branch } : {}), |
| 1663 | ...(seedContext.worktreePath !== undefined | 1682 | ...(seedContext.worktreePath !== undefined |
| ... | @@ -1666,7 +1685,7 @@ const SidebarProjectItem = memo(function SidebarProjectItem(props: SidebarProjec | ... | @@ -1666,7 +1685,7 @@ const SidebarProjectItem = memo(function SidebarProjectItem(props: SidebarProjec |
| 1666 | envMode: seedContext.envMode, | 1685 | envMode: seedContext.envMode, |
| 1667 | }); | 1686 | }); |
| 1668 | }, | 1687 | }, |
| 1669 | [defaultThreadEnvMode, handleNewThread, router], | 1688 | [defaultThreadEnvMode, handleNewThread, isMobile, router, setOpenMobile], |
| 1670 | ); | 1689 | ); |
| 1671 | | 1690 | |
| 1672 | const handleCreateThreadClick = useCallback( | 1691 | const handleCreateThreadClick = useCallback( |
| ... | @@ -2703,6 +2722,7 @@ export default function Sidebar() { | ... | @@ -2703,6 +2722,7 @@ export default function Sidebar() { |
| 2703 | const { updateSettings } = useUpdateSettings(); | 2722 | const { updateSettings } = useUpdateSettings(); |
| 2704 | const { handleNewThread } = useNewThreadHandler(); | 2723 | const { handleNewThread } = useNewThreadHandler(); |
| 2705 | const { archiveThread, deleteThread } = useThreadActions(); | 2724 | const { archiveThread, deleteThread } = useThreadActions(); |
| | 2725 | const { isMobile, setOpenMobile } = useSidebar(); |
| 2706 | const routeThreadRef = useParams({ | 2726 | const routeThreadRef = useParams({ |
| 2707 | strict: false, | 2727 | strict: false, |
| 2708 | select: (params) => resolveThreadRouteRef(params), | 2728 | select: (params) => resolveThreadRouteRef(params), |
| ... | @@ -2855,12 +2875,15 @@ export default function Sidebar() { | ... | @@ -2855,12 +2875,15 @@ export default function Sidebar() { |
| 2855 | clearSelection(); | 2875 | clearSelection(); |
| 2856 | } | 2876 | } |
| 2857 | setSelectionAnchor(scopedThreadKey(threadRef)); | 2877 | setSelectionAnchor(scopedThreadKey(threadRef)); |
| | 2878 | if (isMobile) { |
| | 2879 | setOpenMobile(false); |
| | 2880 | } |
| 2858 | void navigate({ | 2881 | void navigate({ |
| 2859 | to: "/$environmentId/$threadId", | 2882 | to: "/$environmentId/$threadId", |
| 2860 | params: buildThreadRouteParams(threadRef), | 2883 | params: buildThreadRouteParams(threadRef), |
| 2861 | }); | 2884 | }); |
| 2862 | }, | 2885 | }, |
| 2863 | [clearSelection, navigate, setSelectionAnchor], | 2886 | [clearSelection, isMobile, navigate, setOpenMobile, setSelectionAnchor], |
| 2864 | ); | 2887 | ); |
| 2865 | | 2888 | |
| 2866 | const projectDnDSensors = useSensors( | 2889 | const projectDnDSensors = useSensors( |