From 8d23c810fe01e3639670f1d5f1b107133e4ab187 Mon Sep 17 00:00:00 2001 From: kangfenmao Date: Fri, 13 Jun 2025 20:44:08 +0800 Subject: [PATCH] refactor(App, MainSidebar, OpenedMinapps): streamline component code and enhance layout - Simplified the handleClick function in App component by removing unnecessary line breaks. - Adjusted MainMenu component in MainSidebar to remove inline margin styling for cleaner layout. - Updated OpenedMinapps to apply margin styling directly to TabsContainer for improved spacing. - Removed the PinnedApps component to declutter the sidebar and enhance performance. --- src/renderer/src/pages/apps/App.tsx | 4 +- .../pages/home/MainSidebar/MainSidebar.tsx | 2 +- .../pages/home/MainSidebar/OpenedMinapps.tsx | 2 +- .../src/pages/home/MainSidebar/PinnedApps.tsx | 67 ------------------- 4 files changed, 3 insertions(+), 72 deletions(-) delete mode 100644 src/renderer/src/pages/home/MainSidebar/PinnedApps.tsx diff --git a/src/renderer/src/pages/apps/App.tsx b/src/renderer/src/pages/apps/App.tsx index f03e5f934d..0c4c46951e 100644 --- a/src/renderer/src/pages/apps/App.tsx +++ b/src/renderer/src/pages/apps/App.tsx @@ -29,9 +29,7 @@ const App: FC = ({ app, onClick, size = 60, isLast }) => { const handleClick = () => { if (!isHome) { - setTimeout(() => { - navigate('/') - }, 300) + setTimeout(() => navigate('/'), 300) } openMinappKeepAlive(app) diff --git a/src/renderer/src/pages/home/MainSidebar/MainSidebar.tsx b/src/renderer/src/pages/home/MainSidebar/MainSidebar.tsx index 57c5a22a6f..984595d206 100644 --- a/src/renderer/src/pages/home/MainSidebar/MainSidebar.tsx +++ b/src/renderer/src/pages/home/MainSidebar/MainSidebar.tsx @@ -173,7 +173,7 @@ const MainSidebar: FC = () => { overflow: showAssistants ? 'initial' : 'hidden' }}> - + setIsAppMenuExpanded(!isAppMenuExpanded)}> diff --git a/src/renderer/src/pages/home/MainSidebar/OpenedMinapps.tsx b/src/renderer/src/pages/home/MainSidebar/OpenedMinapps.tsx index 87023187ef..8aa94d5455 100644 --- a/src/renderer/src/pages/home/MainSidebar/OpenedMinapps.tsx +++ b/src/renderer/src/pages/home/MainSidebar/OpenedMinapps.tsx @@ -81,7 +81,7 @@ const OpenedMinapps: FC = () => { if (!isShowApps) return return ( - + { - const { pinned, updatePinnedMinapps } = useMinapps() - const { t } = useTranslation() - const { openMinappKeepAlive } = useMinappPopup() - const { openedKeepAliveMinapps } = useRuntime() - - if (isEmpty(pinned)) { - return null - } - - return ( -
- - - {(app) => { - const menuItems: MenuProps['items'] = [ - { - key: 'togglePin', - label: t('minapp.sidebar.remove.title'), - onClick: () => { - const newPinned = pinned.filter((item) => item.id !== app.id) - updatePinnedMinapps(newPinned) - } - } - ] - - return ( - - openMinappKeepAlive(app)}> - - - - - {app.name} - - - - ) - }} - - {isEmpty(openedKeepAliveMinapps) && } -
- ) -} - -const Divider = styled.div` - width: 100%; - height: 1px; - background-color: var(--color-border); - opacity: 0.5; -` - -export default PinnedApps