From f6ebeb143e4dfe30c8d857084154b1e175adcfc1 Mon Sep 17 00:00:00 2001 From: one Date: Wed, 3 Sep 2025 14:25:47 +0800 Subject: [PATCH] refactor: remove scrollbar, add space for app dragging --- .../src/components/Tab/TabContainer.tsx | 31 ++++++++++--------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/src/renderer/src/components/Tab/TabContainer.tsx b/src/renderer/src/components/Tab/TabContainer.tsx index 92f1a3bab9..d42adae0a2 100644 --- a/src/renderer/src/components/Tab/TabContainer.tsx +++ b/src/renderer/src/components/Tab/TabContainer.tsx @@ -1,7 +1,6 @@ import { PlusOutlined } from '@ant-design/icons' import { TopNavbarOpenedMinappTabs } from '@renderer/components/app/PinnedMinapps' import { Sortable, useDndReorder } from '@renderer/components/dnd' -import Scrollbar from '@renderer/components/Scrollbar' import { isLinux, isMac, isWin } from '@renderer/config/constant' import { useTheme } from '@renderer/context/ThemeProvider' import { useFullscreen } from '@renderer/hooks/useFullscreen' @@ -143,11 +142,11 @@ const TabsContainer: React.FC = ({ children }) => { navigate(tab.path) } - const filteredTabs = useMemo(() => tabs.filter((tab) => !specialTabs.includes(tab.id)), [tabs]) + const visibleTabs = useMemo(() => tabs.filter((tab) => !specialTabs.includes(tab.id)), [tabs]) const { onSortEnd } = useDndReorder({ originalList: tabs, - filteredList: filteredTabs, + filteredList: visibleTabs, onUpdate: (newTabs) => dispatch(setTabs(newTabs)), itemKey: 'id' }) @@ -156,14 +155,15 @@ const TabsContainer: React.FC = ({ children }) => { - + ( handleTabClick(tab)}> @@ -184,7 +184,7 @@ const TabsContainer: React.FC = ({ children }) => { )} /> - + @@ -246,8 +246,9 @@ const TabsArea = styled.div` align-items: center; flex: 1 1 auto; min-width: 0; - overflow: hidden; gap: 6px; + padding-right: 2rem; + overflow: hidden; -webkit-app-region: drag; @@ -256,24 +257,26 @@ const TabsArea = styled.div` } ` -const TabsScroll = styled(Scrollbar)` - &::-webkit-scrollbar { - display: none; +const SortableWrapper = styled.div` + overflow: hidden; + + .tabs-sortable > * { + flex: 1 1 auto; + min-width: 0; } ` -const Tab = styled.div<{ active?: boolean }>` +const Tab = styled.div<{ active?: boolean; $tabCount?: number }>` display: flex; align-items: center; justify-content: space-between; padding: 4px 10px; padding-right: 8px; background: ${(props) => (props.active ? 'var(--color-list-item)' : 'transparent')}; + transition: background 0.2s; border-radius: var(--list-item-border-radius); user-select: none; height: 30px; - min-width: 90px; - transition: background 0.2s; .close-button { opacity: 0; @@ -309,10 +312,8 @@ const TabTitle = styled.span` display: flex; align-items: center; margin-right: 4px; - text-overflow: ellipsis; overflow: hidden; white-space: nowrap; - min-width: 0; ` const CloseButton = styled.span`