Skip to content

There can be more than Notion and Miro. AFFiNE(pronounced [ə‘fain]) is a next-gen knowledge base that brings planning, sorting and creating all together. Privacy first, open-source, customizable and ready to use.

feat(component): default collapse and float sidebar on mobile (#5077)

JimmFly469a18f794f8
diff --git a/packages/frontend/component/src/components/app-sidebar/index.jotai.ts b/packages/frontend/component/src/components/app-sidebar/index.jotai.ts
index 696e8620f4..f645cc33f4 100644
--- a/packages/frontend/component/src/components/app-sidebar/index.jotai.ts
+++ b/packages/frontend/component/src/components/app-sidebar/index.jotai.ts
@@ -2,8 +2,10 @@ import { atom } from 'jotai';
import { atomWithStorage } from 'jotai/utils';
export const APP_SIDEBAR_OPEN = 'app-sidebar-open';
-export const appSidebarOpenAtom = atomWithStorage(APP_SIDEBAR_OPEN, true);
-export const appSidebarFloatingAtom = atom(false);
+export const isMobile = window.innerWidth < 768;
+
+export const appSidebarOpenAtom = atomWithStorage(APP_SIDEBAR_OPEN, !isMobile);
+export const appSidebarFloatingAtom = atom(isMobile);
export const appSidebarResizingAtom = atom(false);
export const appSidebarWidthAtom = atomWithStorage(