mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-12 12:28:42 +00:00
fix(electron): window only ui (#2926)
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { migrateToSubdoc } from '@affine/env/blocksuite';
|
||||
import { setupGlobal } from '@affine/env/global';
|
||||
import { platformSchema, setupGlobal } from '@affine/env/global';
|
||||
import type {
|
||||
LocalIndexedDBDownloadProvider,
|
||||
WorkspaceAdapter,
|
||||
@@ -39,6 +39,13 @@ if (!environment.isServer) {
|
||||
import('@affine/bookmark-block');
|
||||
}
|
||||
|
||||
// platform check
|
||||
{
|
||||
if (globalThis.platform) {
|
||||
platformSchema.parse(globalThis.platform);
|
||||
}
|
||||
}
|
||||
|
||||
if (!environment.isDesktop && !environment.isServer) {
|
||||
// Polyfill Electron
|
||||
const unimplemented = () => {
|
||||
|
||||
@@ -4,7 +4,7 @@ import {
|
||||
appSidebarOpenAtom,
|
||||
} from '@affine/component/app-sidebar';
|
||||
import { SidebarSwitch } from '@affine/component/app-sidebar/sidebar-header';
|
||||
import { isBrowser, isDesktop } from '@affine/env/constant';
|
||||
import { isDesktop } from '@affine/env/constant';
|
||||
import { WorkspaceFlavour } from '@affine/env/workspace';
|
||||
import { CloseIcon, MinusIcon, RoundedRectangleIcon } from '@blocksuite/icons';
|
||||
import type { Page } from '@blocksuite/store';
|
||||
@@ -123,7 +123,10 @@ const HeaderRightItems: Record<HeaderRightItemName, HeaderItem> = {
|
||||
});
|
||||
}, []);
|
||||
return (
|
||||
<div className={styles.windowAppControlsWrapper}>
|
||||
<div
|
||||
data-platform-target="win32"
|
||||
className={styles.windowAppControlsWrapper}
|
||||
>
|
||||
<button
|
||||
data-type="minimize"
|
||||
className={styles.windowAppControl}
|
||||
@@ -149,7 +152,7 @@ const HeaderRightItems: Record<HeaderRightItemName, HeaderItem> = {
|
||||
);
|
||||
},
|
||||
availableWhen: () => {
|
||||
return isDesktop && isBrowser;
|
||||
return isDesktop && globalThis.platform === 'win32';
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user