refactor: mode atom (#3221)

This commit is contained in:
Alex Yang
2023-07-13 23:11:00 +08:00
committed by GitHub
parent d18df12951
commit 492852ba0c
4 changed files with 18 additions and 22 deletions
+12
View File
@@ -0,0 +1,12 @@
import { currentPageIdAtom } from '@toeverything/plugin-infra/manager';
import { atom } from 'jotai/vanilla';
import { pageSettingFamily } from './index';
export const currentModeAtom = atom<'page' | 'edgeless'>(get => {
const pageId = get(currentPageIdAtom);
if (!pageId) {
return 'page';
}
return get(pageSettingFamily(pageId)).mode;
});