mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-14 13:25:12 +00:00
fix(electron): fix tab view blink issue on open new tab (#7748)
fix AF-1197
This commit is contained in:
@@ -1,38 +1,16 @@
|
||||
import { useAppSettingHelper } from '@affine/core/hooks/affine/use-app-setting-helper';
|
||||
import { AppTabsHeader } from '@affine/core/modules/app-tabs-header';
|
||||
import { events } from '@affine/electron-api';
|
||||
import { useEffect, useState } from 'react';
|
||||
|
||||
import * as styles from './shell.css';
|
||||
|
||||
const useIsShellActive = () => {
|
||||
const [active, setActive] = useState(false);
|
||||
|
||||
useEffect(() => {
|
||||
const unsub = events?.ui.onTabShellViewActiveChange(active => {
|
||||
setActive(active);
|
||||
});
|
||||
return () => {
|
||||
unsub?.();
|
||||
};
|
||||
});
|
||||
|
||||
return active;
|
||||
};
|
||||
|
||||
export function ShellRoot() {
|
||||
const active = useIsShellActive();
|
||||
const { appSettings } = useAppSettingHelper();
|
||||
const translucent =
|
||||
environment.isDesktop &&
|
||||
environment.isMacOs &&
|
||||
appSettings.enableBlurBackground;
|
||||
return (
|
||||
<div
|
||||
className={styles.root}
|
||||
data-translucent={translucent}
|
||||
data-active={active}
|
||||
>
|
||||
<div className={styles.root} data-translucent={translucent}>
|
||||
<AppTabsHeader mode="shell" />
|
||||
</div>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user