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