From b925731bf741d652d4ae3e970f3fbcdfe1e9bbe1 Mon Sep 17 00:00:00 2001 From: Peng Xiao Date: Thu, 14 Dec 2023 07:13:01 +0000 Subject: [PATCH] fix: add sidebar toggle and windows controls for empty collections page (#5304) Before this change, when the user gets to an empty collection page & hide the sidebar, there is no sidebar toggle any longer. Also added windows app control on windows. --- .../core/src/pages/workspace/collection.tsx | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/packages/frontend/core/src/pages/workspace/collection.tsx b/packages/frontend/core/src/pages/workspace/collection.tsx index 92d6852235..9d6585fb60 100644 --- a/packages/frontend/core/src/pages/workspace/collection.tsx +++ b/packages/frontend/core/src/pages/workspace/collection.tsx @@ -1,3 +1,7 @@ +import { + appSidebarOpenAtom, + SidebarSwitch, +} from '@affine/component/app-sidebar'; import { pushNotificationAtom } from '@affine/component/notification-center'; import { AffineShapeIcon, @@ -5,6 +9,7 @@ import { useCollectionManager, useEditCollection, } from '@affine/component/page-list'; +import { WindowsAppControls } from '@affine/core/components/pure/header/windows-app-controls'; import type { Collection } from '@affine/env/filter'; import { Trans } from '@affine/i18n'; import { useAFFiNEI18N } from '@affine/i18n/hooks'; @@ -90,6 +95,8 @@ export const Component = function CollectionPage() { ); }; +const isWindowsDesktop = environment.isDesktop && environment.isWindows; + const Placeholder = ({ collection }: { collection: Collection }) => { const { updateCollection } = useCollectionManager(collectionsCRUDAtom); const { node, open } = useEditCollection(useAllPageListConfig()); @@ -110,6 +117,7 @@ const Placeholder = ({ collection }: { collection: Collection }) => { localStorage.setItem('hide-empty-collection-help-info', 'true'); }, []); const t = useAFFiNEI18N(); + const leftSidebarOpen = useAtomValue(appSidebarOpenAtom); return (
{ display: 'flex', alignItems: 'center', gap: 8, - padding: '12px 24px', + height: 52, + paddingLeft: '16px', fontSize: 'var(--affine-font-xs)', ['WebkitAppRegion' as string]: 'drag', }} > +
{ > {collection.name}
+
+ {isWindowsDesktop && }