| ... | ... | @@ -15,6 +15,7 @@ const DIFF_INLINE_LAYOUT_MEDIA_QUERY = "(max-width: 1180px)"; |
| 15 | 15 | const DIFF_INLINE_SIDEBAR_WIDTH_STORAGE_KEY = "chat_diff_sidebar_width"; |
| 16 | 16 | const DIFF_INLINE_DEFAULT_WIDTH = "clamp(28rem,48vw,44rem)"; |
| 17 | 17 | const DIFF_INLINE_SIDEBAR_MIN_WIDTH = 26 * 16; |
| 18 | const COMPOSER_COMPACT_MIN_LEFT_CONTROLS_WIDTH_PX = 208; |
| 18 | 19 | |
| 19 | 20 | const DiffPanelSheet = (props: { |
| 20 | 21 | children: ReactNode; |
| ... | ... | @@ -91,8 +92,23 @@ const DiffPanelInlineSidebar = (props: { |
| 91 | 92 | composerViewport.clientWidth - viewportPaddingLeft - viewportPaddingRight, |
| 92 | 93 | ); |
| 93 | 94 | const formRect = composerForm.getBoundingClientRect(); |
| 95 | const composerFooter = composerForm.querySelector<HTMLElement>("[data-chat-composer-footer='true']"); |
| 96 | const composerRightActions = composerForm.querySelector<HTMLElement>( |
| 97 | "[data-chat-composer-actions='right']", |
| 98 | ); |
| 99 | const composerRightActionsWidth = composerRightActions?.getBoundingClientRect().width ?? 0; |
| 100 | const composerFooterGap = composerFooter |
| 101 | ? Number.parseFloat(window.getComputedStyle(composerFooter).columnGap) || |
| 102 | Number.parseFloat(window.getComputedStyle(composerFooter).gap) || |
| 103 | 0 |
| 104 | : 0; |
| 105 | const minimumComposerWidth = |
| 106 | COMPOSER_COMPACT_MIN_LEFT_CONTROLS_WIDTH_PX + |
| 107 | composerRightActionsWidth + |
| 108 | composerFooterGap; |
| 94 | 109 | const hasComposerOverflow = composerForm.scrollWidth > composerForm.clientWidth + 0.5; |
| 95 | 110 | const overflowsViewport = formRect.width > viewportContentWidth + 0.5; |
| 111 | const violatesMinimumComposerWidth = composerForm.clientWidth + 0.5 < minimumComposerWidth; |
| 96 | 112 | |
| 97 | 113 | if (previousSidebarWidth.length > 0) { |
| 98 | 114 | wrapper.style.setProperty("--sidebar-width", previousSidebarWidth); |
| ... | ... | @@ -100,7 +116,7 @@ const DiffPanelInlineSidebar = (props: { |
| 100 | 116 | wrapper.style.removeProperty("--sidebar-width"); |
| 101 | 117 | } |
| 102 | 118 | |
| 103 | | return !hasComposerOverflow && !overflowsViewport; |
| 119 | return !hasComposerOverflow && !overflowsViewport && !violatesMinimumComposerWidth; |
| 104 | 120 | }, |
| 105 | 121 | [], |
| 106 | 122 | ); |