mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-12 04:18:54 +00:00
feat(core): adjust app sidebar (#8572)
This commit is contained in:
@@ -48,7 +48,6 @@ export function AppSidebar({ children }: PropsWithChildren) {
|
|||||||
const smallScreenMode = useLiveData(appSidebarService.smallScreenMode$);
|
const smallScreenMode = useLiveData(appSidebarService.smallScreenMode$);
|
||||||
const hovering = useLiveData(appSidebarService.hovering$) && open !== true;
|
const hovering = useLiveData(appSidebarService.hovering$) && open !== true;
|
||||||
const resizing = useLiveData(appSidebarService.resizing$);
|
const resizing = useLiveData(appSidebarService.resizing$);
|
||||||
const [deferredHovering, setDeferredHovering] = useState(false);
|
|
||||||
const [initialized, setInitialized] = useState(false);
|
const [initialized, setInitialized] = useState(false);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@@ -65,29 +64,13 @@ export function AppSidebar({ children }: PropsWithChildren) {
|
|||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
if (open) {
|
|
||||||
// if open, we don't need to show the floating sidebar
|
|
||||||
setDeferredHovering(false);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// we make a little delay here.
|
|
||||||
// this allow the sidebar close animation to complete.
|
|
||||||
const timeout = setTimeout(() => {
|
|
||||||
setDeferredHovering(hovering);
|
|
||||||
}, 150);
|
|
||||||
return () => {
|
|
||||||
clearTimeout(timeout);
|
|
||||||
};
|
|
||||||
}, [hovering, open]);
|
|
||||||
|
|
||||||
const sidebarState = smallScreenMode
|
const sidebarState = smallScreenMode
|
||||||
? open
|
? open
|
||||||
? 'floating-with-mask'
|
? 'floating-with-mask'
|
||||||
: 'close'
|
: 'close'
|
||||||
: open
|
: open
|
||||||
? 'open'
|
? 'open'
|
||||||
: deferredHovering
|
: hovering
|
||||||
? 'floating'
|
? 'floating'
|
||||||
: 'close';
|
: 'close';
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
"fr": 77,
|
"fr": 77,
|
||||||
"hi": 2,
|
"hi": 2,
|
||||||
"it": 1,
|
"it": 1,
|
||||||
"ja": 75,
|
"ja": 100,
|
||||||
"ko": 91,
|
"ko": 91,
|
||||||
"pl": 0,
|
"pl": 0,
|
||||||
"pt-BR": 99,
|
"pt-BR": 99,
|
||||||
|
|||||||
Reference in New Issue
Block a user