Skip to content

Commit e92eee1

Browse files
authored
fix: prevent shaking when switching between chat and search pages (#955)
* fix: prevent shaking when switching between chat and search pages in compact mode * docs: add release note
1 parent 1996298 commit e92eee1

3 files changed

Lines changed: 11 additions & 7 deletions

File tree

docs/content.en/docs/release-notes/_index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ fix(Window Management): Next/Previous Desktop do not work #926
3434
fix: fix page rapidly flickering issue #935
3535
fix(view extension): broken search bar UI when opening extensions via hotkey #938
3636
fix: allow deletion after selecting all text #943
37+
fix: prevent shaking when switching between chat and search pages #955
3738

3839
### ✈️ Improvements
3940

src/components/Common/ChatSwitch.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ const ChatSwitch: React.FC<ChatSwitchProps> = ({ isChatMode, onChange }) => {
2929
<div
3030
role="switch"
3131
aria-checked={isChatMode}
32-
className={`relative flex items-center justify-between w-10 h-[18px] rounded-full cursor-pointer transition-colors duration-300 ${
32+
className={`relative flex items-center justify-between w-10 h-[20px] rounded-full cursor-pointer transition-colors duration-300 ${
3333
isChatMode ? "bg-[#0072ff]" : "bg-[var(--coco-primary-color)]"
3434
}`}
3535
onClick={handleToggle}
@@ -39,8 +39,8 @@ const ChatSwitch: React.FC<ChatSwitchProps> = ({ isChatMode, onChange }) => {
3939
{!isChatMode ? <Search className="w-4 h-4 text-white" /> : <div></div>}
4040
</div>
4141
<div
42-
className={`absolute top-[1px] h-4 w-4 bg-white rounded-full shadow-md transform transition-transform duration-300 ${
43-
isChatMode ? "translate-x-6" : "translate-x-0"
42+
className={`absolute top-[1px] left-[1px] h-[18px] w-[18px] bg-white rounded-full shadow-md transform transition-transform duration-300 ${
43+
isChatMode ? "translate-x-5" : "translate-x-0"
4444
}`}
4545
></div>
4646
</div>

src/components/SearchChat/index.tsx

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ function SearchChat({
114114
if (searchBar && filterBar) {
115115
height = searchBar.clientHeight + filterBar.clientHeight + 16;
116116
} else {
117-
height = 82;
117+
height = 84;
118118
}
119119

120120
height = Math.min(height, 88);
@@ -278,6 +278,8 @@ function SearchChat({
278278
});
279279

280280
const opacity = useAppearanceStore((state) => state.opacity);
281+
const windowMode = useAppearanceStore((state) => state.windowMode);
282+
const isCompact = windowMode === "compact";
281283

282284
useEffect(() => {
283285
if (isTauri) {
@@ -338,10 +340,11 @@ function SearchChat({
338340
<div
339341
data-tauri-drag-region={isTauri}
340342
className={clsx(
341-
"p-2 w-full flex justify-center transition-all duration-500 border-[#E6E6E6] dark:border-[#272626]",
342-
[isTransitioned ? "border-t" : "border-b"],
343+
"p-2 w-full flex justify-center transition-all duration-500",
344+
!isCompact && "border-[#E6E6E6] dark:border-[#272626]",
345+
!isCompact && [isTransitioned ? "border-t" : "border-b"],
343346
{
344-
"min-h-[82px]": visibleSearchBar() && visibleFilterBar(),
347+
"min-h-[84px]": visibleSearchBar() && visibleFilterBar(),
345348
}
346349
)}
347350
>

0 commit comments

Comments
 (0)