diff --git a/.eslintrc.js b/.eslintrc.js index 7832c9da5a..fce388e000 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -34,8 +34,8 @@ const createPattern = packageName => [ { group: ['@affine/env/constant'], message: - 'Do not import from @affine/env/constant. Use `environment.isDesktop` instead', - importNames: ['isDesktop'], + 'Do not import from @affine/env/constant. Use `environment.isElectron` instead', + importNames: ['isElectron'], }, ]; diff --git a/packages/common/env/src/constant.ts b/packages/common/env/src/constant.ts index 843d9baf18..0771f9b29c 100644 --- a/packages/common/env/src/constant.ts +++ b/packages/common/env/src/constant.ts @@ -2,19 +2,16 @@ import type { DocCollection } from '@blocksuite/store'; declare global { - interface Window { - __appInfo: { - electron: boolean; - schema: string; - windowName: string; - }; - } + // eslint-disable-next-line no-var + var __appInfo: { + electron: boolean; + schema: string; + windowName: string; + }; } //#region runtime variables -export const isBrowser = typeof window !== 'undefined'; -export const isServer = !isBrowser && typeof navigator === 'undefined'; -export const isDesktop = isBrowser && !!window.__appInfo?.electron; +export const isElectron = !!globalThis.__appInfo?.electron; //#endregion export const DEFAULT_WORKSPACE_NAME = 'Demo Workspace'; export const UNTITLED_WORKSPACE_NAME = 'Untitled'; diff --git a/packages/common/env/src/global.ts b/packages/common/env/src/global.ts index d54362efc3..14743d5fc1 100644 --- a/packages/common/env/src/global.ts +++ b/packages/common/env/src/global.ts @@ -2,7 +2,7 @@ import { assertEquals } from '@blocksuite/global/utils'; import { z } from 'zod'; -import { isDesktop, isServer } from './constant.js'; +import { isElectron } from './constant.js'; import { UaHelper } from './ua-helper.js'; export const runtimeFlagsSchema = z.object({ @@ -10,6 +10,7 @@ export const runtimeFlagsSchema = z.object({ serverUrlPrefix: z.string(), appVersion: z.string(), editorVersion: z.string(), + distribution: z.enum(['browser', 'desktop', 'admin', 'mobile']), appBuildType: z.union([ z.literal('stable'), z.literal('beta'), @@ -35,18 +36,19 @@ export const runtimeFlagsSchema = z.object({ export type RuntimeConfig = z.infer; -type BrowserBase = { - /** - * @example https://app.affine.pro - * @example http://localhost:3000 - */ - origin: string; - isDesktop: boolean; - isBrowser: true; - isServer: false; +export type Environment = { isDebug: boolean; - // browser special properties + // Edition + isDesktopEdition: boolean; + isMobileEdition: boolean; + + // Platform/Entry + isElectron: boolean; + isDesktopWeb: boolean; + isMobileWeb: boolean; + + // Device isLinux: boolean; isMacOs: boolean; isIOS: boolean; @@ -55,37 +57,9 @@ type BrowserBase = { isFireFox: boolean; isMobile: boolean; isChrome: boolean; + chromeVersion?: number; }; -type NonChromeBrowser = BrowserBase & { - isChrome: false; -}; - -type ChromeBrowser = BrowserBase & { - isSafari: false; - isFireFox: false; - isChrome: true; - chromeVersion: number; -}; - -type Browser = NonChromeBrowser | ChromeBrowser; - -type Server = { - isDesktop: false; - isBrowser: false; - isServer: true; - isDebug: boolean; -}; - -interface Desktop extends ChromeBrowser { - isDesktop: true; - isBrowser: true; - isServer: false; - isDebug: boolean; -} - -export type Environment = Browser | Server | Desktop; - function setupRuntimeConfig() { if (!process.env.RUNTIME_CONFIG) { return; @@ -106,31 +80,43 @@ export function setupGlobal() { let environment: Environment; const isDebug = process.env.NODE_ENV === 'development'; - if (isServer) { + + if (!globalThis.navigator) { environment = { - isDesktop: false, - isBrowser: false, - isServer: true, + isDesktopEdition: false, + isMobileEdition: false, + isElectron: false, + isDesktopWeb: false, + isMobileWeb: false, + isMobile: false, isDebug, - } satisfies Server; + isLinux: false, + isMacOs: false, + isSafari: false, + isWindows: false, + isFireFox: false, + isChrome: false, + isIOS: false, + }; } else { - const uaHelper = new UaHelper(navigator); + const uaHelper = new UaHelper(globalThis.navigator); environment = { - origin: window.location.origin, - isDesktop, - isBrowser: true, - isServer: false, + isDesktopEdition: runtimeConfig.distribution !== 'mobile', + isMobileEdition: runtimeConfig.distribution === 'mobile', + isDesktopWeb: runtimeConfig.distribution === 'browser', + isMobileWeb: runtimeConfig.distribution === 'mobile', + isElectron, isDebug, + isMobile: uaHelper.isMobile, isLinux: uaHelper.isLinux, isMacOs: uaHelper.isMacOs, isSafari: uaHelper.isSafari, isWindows: uaHelper.isWindows, isFireFox: uaHelper.isFireFox, - isMobile: uaHelper.isMobile, isChrome: uaHelper.isChrome, isIOS: uaHelper.isIOS, - } as Browser; + }; // Chrome on iOS is still Safari if (environment.isChrome && !environment.isIOS) { assertEquals(environment.isSafari, false); @@ -141,9 +127,10 @@ export function setupGlobal() { isFireFox: false, isChrome: true, chromeVersion: uaHelper.getChromeVersion(), - } satisfies ChromeBrowser; + }; } } + globalThis.environment = environment; globalThis.$AFFINE_SETUP = true; diff --git a/packages/common/infra/src/atom/settings.ts b/packages/common/infra/src/atom/settings.ts index b85d5f34db..e926bf86e5 100644 --- a/packages/common/infra/src/atom/settings.ts +++ b/packages/common/infra/src/atom/settings.ts @@ -44,7 +44,7 @@ export const dateFormatOptions: DateFormats[] = [ ]; const appSettingBaseAtom = atomWithStorage('affine-settings', { - clientBorder: environment.isDesktop && !environment.isWindows, + clientBorder: environment.isElectron && !environment.isWindows, windowFrameStyle: 'frameless', dateFormat: dateFormatOptions[0], startWeekOnMonday: false, @@ -61,7 +61,7 @@ type SetStateAction = Value | ((prev: Value) => Value); const appSettingEffect = atomEffect(get => { const settings = get(appSettingBaseAtom); // some values in settings should be synced into electron side - if (environment.isDesktop) { + if (environment.isElectron) { logger.debug('sync settings to electron', settings); // this api type in @affine/electron-api, but it is circular dependency this package, use any here (window as any).apis?.updater diff --git a/packages/common/infra/src/modules/feature-flag/constant.ts b/packages/common/infra/src/modules/feature-flag/constant.ts index b90025929c..1e5889aa54 100644 --- a/packages/common/infra/src/modules/feature-flag/constant.ts +++ b/packages/common/infra/src/modules/feature-flag/constant.ts @@ -1,7 +1,7 @@ import type { FlagInfo } from './types'; const isNotStableBuild = runtimeConfig.appBuildType !== 'stable'; -const isDesktopEnvironment = environment.isDesktop; +const isDesktopEnvironment = environment.isElectron; const isCanaryBuild = runtimeConfig.appBuildType === 'canary'; export const AFFINE_FLAGS = { diff --git a/packages/frontend/component/src/components/affine-other-page-layout/layout.tsx b/packages/frontend/component/src/components/affine-other-page-layout/layout.tsx index 197a00c508..6899a07b9d 100644 --- a/packages/frontend/component/src/components/affine-other-page-layout/layout.tsx +++ b/packages/frontend/component/src/components/affine-other-page-layout/layout.tsx @@ -20,7 +20,7 @@ export const AffineOtherPageLayout = ({ return (
- {environment.isDesktop ? null : ( + {environment.isElectron ? null : (
diff --git a/packages/frontend/component/src/components/auth-components/onboarding-page.tsx b/packages/frontend/component/src/components/auth-components/onboarding-page.tsx index 82444b3b5f..cd948a8a87 100644 --- a/packages/frontend/component/src/components/auth-components/onboarding-page.tsx +++ b/packages/frontend/component/src/components/auth-components/onboarding-page.tsx @@ -119,8 +119,8 @@ export const OnboardingPage = ({ () => questions?.[questionIdx], [questionIdx, questions] ); - const isMacosDesktop = environment.isDesktop && environment.isMacOs; - const isWindowsDesktop = environment.isDesktop && environment.isWindows; + const isMacosDesktop = environment.isElectron && environment.isMacOs; + const isWindowsDesktop = environment.isElectron && environment.isWindows; if (!questions) { return null; diff --git a/packages/frontend/component/src/components/theme-provider/index.tsx b/packages/frontend/component/src/components/theme-provider/index.tsx index 1a4c1d9f5d..0a0b4c9fc0 100644 --- a/packages/frontend/component/src/components/theme-provider/index.tsx +++ b/packages/frontend/component/src/components/theme-provider/index.tsx @@ -10,7 +10,7 @@ const DesktopThemeSync = memo(function DesktopThemeSync() { const lastThemeRef = useRef(theme); const onceRef = useRef(false); if (lastThemeRef.current !== theme || !onceRef.current) { - if (environment.isDesktop && theme) { + if (environment.isElectron && theme) { apis?.ui .handleThemeChange(theme as 'dark' | 'light' | 'system') .catch(err => { diff --git a/packages/frontend/component/src/ui/menu/index.ts b/packages/frontend/component/src/ui/menu/index.ts index 2345af9ddd..e8ca01851d 100644 --- a/packages/frontend/component/src/ui/menu/index.ts +++ b/packages/frontend/component/src/ui/menu/index.ts @@ -1,5 +1,4 @@ export * from './menu.types'; -import { isMobile } from '../../utils/env'; import { DesktopMenuItem } from './desktop/item'; import { DesktopMenu } from './desktop/root'; import { DesktopMenuSeparator } from './desktop/separator'; @@ -10,10 +9,12 @@ import { MobileMenu } from './mobile/root'; import { MobileMenuSeparator } from './mobile/separator'; import { MobileMenuSub } from './mobile/sub'; -const MenuItem = isMobile() ? MobileMenuItem : DesktopMenuItem; -const MenuSeparator = isMobile() ? MobileMenuSeparator : DesktopMenuSeparator; -const MenuSub = isMobile() ? MobileMenuSub : DesktopMenuSub; -const Menu = isMobile() ? MobileMenu : DesktopMenu; +const MenuItem = environment.isMobileEdition ? MobileMenuItem : DesktopMenuItem; +const MenuSeparator = environment.isMobileEdition + ? MobileMenuSeparator + : DesktopMenuSeparator; +const MenuSub = environment.isMobileEdition ? MobileMenuSub : DesktopMenuSub; +const Menu = environment.isMobileEdition ? MobileMenu : DesktopMenu; export { DesktopMenu, diff --git a/packages/frontend/component/src/ui/menu/use-menu-item.tsx b/packages/frontend/component/src/ui/menu/use-menu-item.tsx index 23e0e3b9bc..3bf7b0a42f 100644 --- a/packages/frontend/component/src/ui/menu/use-menu-item.tsx +++ b/packages/frontend/component/src/ui/menu/use-menu-item.tsx @@ -1,7 +1,6 @@ import { DoneIcon } from '@blocksuite/icons/rc'; import clsx from 'clsx'; -import { isMobile } from '../../utils/env'; import type { MenuItemProps } from './menu.types'; import { mobileMenuItem } from './mobile/styles.css'; import * as styles from './styles.css'; @@ -27,7 +26,7 @@ export const useMenuItem = ({ checked, selected, block, - [mobileMenuItem]: isMobile(), + [mobileMenuItem]: environment.isMobileEdition, }, propsClassName ); diff --git a/packages/frontend/component/src/ui/modal/modal.tsx b/packages/frontend/component/src/ui/modal/modal.tsx index 6859e2c805..f8e589e24d 100644 --- a/packages/frontend/component/src/ui/modal/modal.tsx +++ b/packages/frontend/component/src/ui/modal/modal.tsx @@ -12,7 +12,6 @@ import clsx from 'clsx'; import type { CSSProperties, MouseEvent } from 'react'; import { forwardRef, useCallback, useEffect, useState } from 'react'; -import { isMobile } from '../../utils/env'; import type { IconButtonProps } from '../button'; import { IconButton } from '../button'; import * as styles from './styles.css'; @@ -151,9 +150,7 @@ export const ModalInner = forwardRef( children, contentWrapperClassName, contentWrapperStyle, - animation = environment.isBrowser && environment.isMobile - ? 'slideBottom' - : 'fadeScaleTop', + animation = environment.isMobileEdition ? 'slideBottom' : 'fadeScaleTop', fullScreen, ...otherProps } = props; @@ -225,7 +222,7 @@ export const ModalInner = forwardRef( `anim-${animation}`, styles.modalOverlay, overlayClassName, - { mobile: isMobile() } + { mobile: environment.isMobileEdition } )} style={{ ...overlayStyle, diff --git a/packages/frontend/component/src/utils/env.ts b/packages/frontend/component/src/utils/env.ts deleted file mode 100644 index acb11dec68..0000000000 --- a/packages/frontend/component/src/utils/env.ts +++ /dev/null @@ -1,3 +0,0 @@ -export const isMobile = () => { - return environment.isBrowser && environment.isMobile; -}; diff --git a/packages/frontend/core/src/commands/affine-creation.tsx b/packages/frontend/core/src/commands/affine-creation.tsx index 69d82498dc..8ef0e56639 100644 --- a/packages/frontend/core/src/commands/affine-creation.tsx +++ b/packages/frontend/core/src/commands/affine-creation.tsx @@ -23,7 +23,7 @@ export function registerAffineCreationCommands({ category: 'affine:creation', label: t['com.affine.cmdk.affine.new-page'](), icon: , - keyBinding: environment.isDesktop + keyBinding: environment.isElectron ? { binding: '$mod+N', skipRegister: true, @@ -73,7 +73,7 @@ export function registerAffineCreationCommands({ icon: , label: t['com.affine.cmdk.affine.import-workspace'](), preconditionStrategy: () => { - return environment.isDesktop; + return environment.isElectron; }, run() { track.$.cmdk.workspace.createWorkspace({ diff --git a/packages/frontend/core/src/commands/affine-settings.tsx b/packages/frontend/core/src/commands/affine-settings.tsx index ebc7af64bd..f5dd314969 100644 --- a/packages/frontend/core/src/commands/affine-settings.tsx +++ b/packages/frontend/core/src/commands/affine-settings.tsx @@ -183,7 +183,7 @@ export function registerAffineSettingsCommands({ `, category: 'affine:settings', icon: , - preconditionStrategy: () => environment.isDesktop, + preconditionStrategy: () => environment.isElectron, run() { track.$.cmdk.settings.changeAppSetting({ key: 'clientBorder', @@ -231,7 +231,7 @@ export function registerAffineSettingsCommands({ ]()}`, category: 'affine:settings', icon: , - preconditionStrategy: () => environment.isDesktop, + preconditionStrategy: () => environment.isElectron, run() { track.$.cmdk.settings.changeAppSetting({ key: 'enableNoisyBackground', @@ -257,7 +257,7 @@ export function registerAffineSettingsCommands({ ]()}`, category: 'affine:settings', icon: , - preconditionStrategy: () => environment.isDesktop && environment.isMacOs, + preconditionStrategy: () => environment.isElectron && environment.isMacOs, run() { track.$.cmdk.settings.changeAppSetting({ key: 'enableBlurBackground', diff --git a/packages/frontend/core/src/components/affine/app-container.tsx b/packages/frontend/core/src/components/affine/app-container.tsx index 6fbf36f246..fbac733a2d 100644 --- a/packages/frontend/core/src/components/affine/app-container.tsx +++ b/packages/frontend/core/src/components/affine/app-container.tsx @@ -16,7 +16,7 @@ export const AppContainer = (props: WorkspaceRootProps) => { useNoisyBackground={appSettings.enableNoisyBackground} useBlurBackground={ appSettings.enableBlurBackground && - environment.isDesktop && + environment.isElectron && environment.isMacOs } {...props} diff --git a/packages/frontend/core/src/components/affine/auth/oauth.tsx b/packages/frontend/core/src/components/affine/auth/oauth.tsx index 9eead3b41d..cedd60c22d 100644 --- a/packages/frontend/core/src/components/affine/auth/oauth.tsx +++ b/packages/frontend/core/src/components/affine/auth/oauth.tsx @@ -57,7 +57,7 @@ function OAuthProvider({ provider }: { provider: OAuthProviderType }) { try { setIsConnecting(true); const url = await authService.oauthPreflight(provider); - if (environment.isDesktop) { + if (environment.isElectron) { await apis?.ui.openExternal(url); } else { popupWindow(url); diff --git a/packages/frontend/core/src/components/affine/auth/send-email.tsx b/packages/frontend/core/src/components/affine/auth/send-email.tsx index 12674204c5..d882d46cca 100644 --- a/packages/frontend/core/src/components/affine/auth/send-email.tsx +++ b/packages/frontend/core/src/components/affine/auth/send-email.tsx @@ -122,7 +122,7 @@ const useSendEmail = (emailType: AuthPanelProps<'sendEmail'>['emailType']) => { return trigger({ email, callbackUrl: `/auth/${callbackUrl}?isClient=${ - environment.isDesktop ? 'true' : 'false' + environment.isElectron ? 'true' : 'false' }`, }); }, diff --git a/packages/frontend/core/src/components/affine/auth/use-captcha.tsx b/packages/frontend/core/src/components/affine/auth/use-captcha.tsx index b887e32ae8..8d8a2cd252 100644 --- a/packages/frontend/core/src/components/affine/auth/use-captcha.tsx +++ b/packages/frontend/core/src/components/affine/auth/use-captcha.tsx @@ -14,7 +14,7 @@ type Challenge = { }; const challengeFetcher = async (url: string) => { - if (!environment.isDesktop) { + if (!environment.isElectron) { return undefined; } @@ -31,7 +31,7 @@ const challengeFetcher = async (url: string) => { }; const generateChallengeResponse = async (challenge: string) => { - if (!environment.isDesktop) { + if (!environment.isElectron) { return undefined; } @@ -56,7 +56,7 @@ export const Captcha = () => { return null; } - if (environment.isDesktop) { + if (environment.isElectron) { if (response) { return
Making Challenge
; } else { @@ -87,7 +87,7 @@ export const useCaptcha = (): [string | undefined, string?] => { useEffect(() => { if ( hasCaptchaFeature && - environment.isDesktop && + environment.isElectron && challenge?.challenge && prevChallenge.current !== challenge.challenge ) { @@ -104,7 +104,7 @@ export const useCaptcha = (): [string | undefined, string?] => { return ['XXXX.DUMMY.TOKEN.XXXX']; } - if (environment.isDesktop) { + if (environment.isElectron) { if (response) { return [response, challenge?.challenge]; } else { diff --git a/packages/frontend/core/src/components/affine/onboarding/onboarding.tsx b/packages/frontend/core/src/components/affine/onboarding/onboarding.tsx index cd6c86512d..207332cd32 100644 --- a/packages/frontend/core/src/components/affine/onboarding/onboarding.tsx +++ b/packages/frontend/core/src/components/affine/onboarding/onboarding.tsx @@ -43,7 +43,7 @@ export const Onboarding = ({ onOpenApp }: OnboardingProps) => { return (
diff --git a/packages/frontend/core/src/components/affine/setting-modal/general-setting/about/index.tsx b/packages/frontend/core/src/components/affine/setting-modal/general-setting/about/index.tsx index 75d04af5c4..4a0c8b08d4 100644 --- a/packages/frontend/core/src/components/affine/setting-modal/general-setting/about/index.tsx +++ b/packages/frontend/core/src/components/affine/setting-modal/general-setting/about/index.tsx @@ -72,7 +72,7 @@ export const AboutAffine = () => { name={t['com.affine.aboutAFFiNE.version.editor.title']()} desc={runtimeConfig.editorVersion} /> - {environment.isDesktop ? ( + {environment.isElectron ? ( <> {
- {environment.isDesktop ? ( + {environment.isElectron ? ( { /> ) : null} - {runtimeConfig.enableNewSettingUnstableApi && environment.isDesktop ? ( + {runtimeConfig.enableNewSettingUnstableApi && environment.isElectron ? ( { ) : null} - {environment.isDesktop ? ( + {environment.isElectron ? ( diff --git a/packages/frontend/core/src/components/affine/setting-modal/general-setting/appearance/theme-editor-setting.tsx b/packages/frontend/core/src/components/affine/setting-modal/general-setting/appearance/theme-editor-setting.tsx index 387ab2f1d8..52d33927e5 100644 --- a/packages/frontend/core/src/components/affine/setting-modal/general-setting/appearance/theme-editor-setting.tsx +++ b/packages/frontend/core/src/components/affine/setting-modal/general-setting/appearance/theme-editor-setting.tsx @@ -13,7 +13,7 @@ export const ThemeEditorSetting = () => { const modified = useLiveData(themeEditor.modified$); const open = useCallback(() => { - if (environment.isDesktop) { + if (environment.isElectron) { apis?.ui.openThemeEditor().catch(console.error); } else { popupWindow('/theme-editor'); diff --git a/packages/frontend/core/src/components/affine/setting-modal/general-setting/editor/general.tsx b/packages/frontend/core/src/components/affine/setting-modal/general-setting/editor/general.tsx index e772c7179d..d3483436e2 100644 --- a/packages/frontend/core/src/components/affine/setting-modal/general-setting/editor/general.tsx +++ b/packages/frontend/core/src/components/affine/setting-modal/general-setting/editor/general.tsx @@ -85,7 +85,7 @@ const FontFamilySettings = () => { const radioItems = useMemo(() => { const items = getBaseFontStyleOptions(t); - if (!environment.isDesktop) return items; + if (!environment.isElectron) return items; // resolve custom fonts const customOption = fontStyleOptions.find(opt => opt.key === 'Custom'); @@ -274,7 +274,7 @@ const CustomFontFamilySettings = () => { }, [editorSettingService.editorSetting] ); - if (settings.fontFamily !== 'Custom' || !environment.isDesktop) { + if (settings.fontFamily !== 'Custom' || !environment.isElectron) { return null; } return ( diff --git a/packages/frontend/core/src/components/affine/setting-modal/workspace-setting/new-workspace-setting-detail/index.tsx b/packages/frontend/core/src/components/affine/setting-modal/workspace-setting/new-workspace-setting-detail/index.tsx index de4dcbaefe..632fbb526f 100644 --- a/packages/frontend/core/src/components/affine/setting-modal/workspace-setting/new-workspace-setting-detail/index.tsx +++ b/packages/frontend/core/src/components/affine/setting-modal/workspace-setting/new-workspace-setting-detail/index.tsx @@ -67,7 +67,7 @@ export const WorkspaceSettingDetail = ({ - {environment.isDesktop && ( + {environment.isElectron && ( { } }, [shareInfoService, t]); - const isMac = environment.isBrowser && environment.isMacOs; + const isMac = environment.isMacOs; const { onClickCopyLink } = useSharingUrl({ workspaceId, diff --git a/packages/frontend/core/src/components/affine/subscription-landing/notify.tsx b/packages/frontend/core/src/components/affine/subscription-landing/notify.tsx index 350c9fce83..a9f8450bc7 100644 --- a/packages/frontend/core/src/components/affine/subscription-landing/notify.tsx +++ b/packages/frontend/core/src/components/affine/subscription-landing/notify.tsx @@ -49,7 +49,7 @@ const SubscriptionChangedNotifyFooter = ({ ); }; -const isDesktop = environment.isDesktop; +const isDesktop = environment.isElectron; export const useUpgradeNotify = () => { const t = useI18n(); const prevNotifyIdRef = useRef(null); diff --git a/packages/frontend/core/src/components/app-sidebar/index.jotai.ts b/packages/frontend/core/src/components/app-sidebar/index.jotai.ts index 2d80e6a33f..f595467eb9 100644 --- a/packages/frontend/core/src/components/app-sidebar/index.jotai.ts +++ b/packages/frontend/core/src/components/app-sidebar/index.jotai.ts @@ -2,7 +2,7 @@ import { atom } from 'jotai'; import { atomWithStorage } from 'jotai/utils'; export const APP_SIDEBAR_OPEN = 'app-sidebar-open'; -export const isMobile = window.innerWidth < 768 && !environment.isDesktop; +export const isMobile = window.innerWidth < 768 && !environment.isElectron; export const appSidebarOpenAtom = atomWithStorage(APP_SIDEBAR_OPEN, !isMobile); export const appSidebarFloatingAtom = atom(isMobile); diff --git a/packages/frontend/core/src/components/app-sidebar/index.tsx b/packages/frontend/core/src/components/app-sidebar/index.tsx index 244926d1dc..cf544aeeda 100644 --- a/packages/frontend/core/src/components/app-sidebar/index.tsx +++ b/packages/frontend/core/src/components/app-sidebar/index.tsx @@ -49,7 +49,7 @@ export function AppSidebar({ useEffect(() => { // do not float app sidebar on desktop - if (environment.isDesktop) { + if (environment.isElectron) { return; } @@ -79,8 +79,8 @@ export function AppSidebar({ }; }, [open, setFloating, setOpen, width]); - const hasRightBorder = !environment.isDesktop && !clientBorder; - const isMacosDesktop = environment.isDesktop && environment.isMacOs; + const hasRightBorder = !environment.isElectron && !clientBorder; + const isMacosDesktop = environment.isElectron && environment.isMacOs; return ( <>