mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-12 12:28:42 +00:00
perf: getEnvironment() -> env (#2636)
This commit is contained in:
@@ -1,12 +1,11 @@
|
||||
import { DownloadTips } from '@affine/component/affine-banner';
|
||||
import { getEnvironment } from '@affine/env';
|
||||
import { env } from '@affine/env';
|
||||
import { useAtom } from 'jotai';
|
||||
import { useCallback } from 'react';
|
||||
|
||||
import { guideDownloadClientTipAtom } from '../../../atoms/guide';
|
||||
|
||||
export const DownloadClientTip = () => {
|
||||
const env = getEnvironment();
|
||||
const [showDownloadClientTips, setShowDownloadClientTips] = useAtom(
|
||||
guideDownloadClientTipAtom
|
||||
);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { getEnvironment } from '@affine/env';
|
||||
import { env } from '@affine/env';
|
||||
import { Trans } from '@affine/i18n';
|
||||
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
||||
import type React from 'react';
|
||||
@@ -7,7 +7,6 @@ import { useEffect, useState } from 'react';
|
||||
const minimumChromeVersion = 102;
|
||||
|
||||
export const shouldShowWarning = () => {
|
||||
const env = getEnvironment();
|
||||
if (env.isDesktop) {
|
||||
// even though desktop have compatibility issues, we don't want to show the warning
|
||||
return false;
|
||||
@@ -28,7 +27,6 @@ export const OSWarningMessage: React.FC = () => {
|
||||
const [notChrome, setNotChrome] = useState(false);
|
||||
const [notGoodVersion, setNotGoodVersion] = useState(false);
|
||||
useEffect(() => {
|
||||
const env = getEnvironment();
|
||||
setNotChrome(env.isBrowser && !env.isChrome);
|
||||
setNotGoodVersion(
|
||||
env.isBrowser && env.isChrome && env.chromeVersion < minimumChromeVersion
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { MuiFade, Tooltip } from '@affine/component';
|
||||
import { config, getEnvironment } from '@affine/env';
|
||||
import { config, env } from '@affine/env';
|
||||
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
||||
import { CloseIcon, NewIcon, UserGuideIcon } from '@blocksuite/icons';
|
||||
import { useAtom } from 'jotai';
|
||||
@@ -15,7 +15,6 @@ import {
|
||||
StyledIsland,
|
||||
StyledTriggerWrapper,
|
||||
} from './style';
|
||||
const env = getEnvironment();
|
||||
const ContactModal = lazy(() =>
|
||||
import('@affine/component/contact-modal').then(({ ContactModal }) => ({
|
||||
default: ContactModal,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Modal, ModalWrapper } from '@affine/component';
|
||||
import { getEnvironment } from '@affine/env';
|
||||
import { env } from '@affine/env';
|
||||
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
||||
import { Command } from 'cmdk';
|
||||
import type { NextRouter } from 'next/router';
|
||||
@@ -27,7 +27,6 @@ import {
|
||||
} from './style';
|
||||
|
||||
const isMac = () => {
|
||||
const env = getEnvironment();
|
||||
return env.isBrowser && env.isMacOs;
|
||||
};
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ import {
|
||||
MuiClickAwayListener,
|
||||
MuiSlide,
|
||||
} from '@affine/component';
|
||||
import { getEnvironment } from '@affine/env';
|
||||
import { env } from '@affine/env';
|
||||
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
||||
import { useEffect, useState } from 'react';
|
||||
|
||||
@@ -27,7 +27,6 @@ type ModalProps = {
|
||||
};
|
||||
|
||||
const checkIsMac = () => {
|
||||
const env = getEnvironment();
|
||||
return env.isBrowser && env.isMacOs;
|
||||
};
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { getEnvironment } from '@affine/env';
|
||||
import { env } from '@affine/env';
|
||||
import {
|
||||
rootCurrentWorkspaceIdAtom,
|
||||
rootWorkspacesMetadataAtom,
|
||||
@@ -56,7 +56,6 @@ export function CurrentWorkspaceModals() {
|
||||
openOnboardingModalAtom
|
||||
);
|
||||
|
||||
const env = getEnvironment();
|
||||
const onCloseOnboardingModal = useCallback(() => {
|
||||
setOpenOnboardingModal(false);
|
||||
}, [setOpenOnboardingModal]);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { getEnvironment } from '@affine/env';
|
||||
import { env } from '@affine/env';
|
||||
import createCache from '@emotion/cache';
|
||||
|
||||
const isBrowser = getEnvironment().isBrowser;
|
||||
const isBrowser = env.isBrowser;
|
||||
|
||||
export default function createEmotionCache() {
|
||||
let insertionPoint;
|
||||
|
||||
Reference in New Issue
Block a user