fix: add platform selector to storybook (#4380)

This commit is contained in:
Peng Xiao
2023-09-15 16:59:29 +08:00
committed by GitHub
parent f730f2b242
commit eea38a08c5
12 changed files with 81 additions and 26 deletions
@@ -1,4 +1,3 @@
import { isDesktop } from '@affine/env/constant';
import { useAFFiNEI18N } from '@affine/i18n/hooks';
import {
DeletePermanentlyIcon,
@@ -66,7 +65,7 @@ export const OperationCell = ({
? t['com.affine.favoritePageOperation.remove']()
: t['com.affine.favoritePageOperation.add']()}
</MenuItem>
{!isDesktop && (
{!environment.isDesktop && (
<MenuItem
onClick={onOpenPageInNewTab}
preFix={
@@ -1,4 +1,3 @@
import { isDesktop } from '@affine/env/constant';
import { ThemeProvider as NextThemeProvider, useTheme } from 'next-themes';
import type { PropsWithChildren } from 'react';
import { memo, useRef } from 'react';
@@ -10,7 +9,7 @@ const DesktopThemeSync = memo(function DesktopThemeSync() {
const lastThemeRef = useRef(theme);
const onceRef = useRef(false);
if (lastThemeRef.current !== theme || !onceRef.current) {
if (isDesktop && theme) {
if (environment.isDesktop && theme) {
window.apis?.ui
.handleThemeChange(theme as 'dark' | 'light' | 'system')
.catch(err => {
+4 -4
View File
@@ -1,4 +1,4 @@
import { isBrowser, isDesktop } from '@affine/env/constant';
import { isBrowser } from '@affine/env/constant';
import type { BlockSuiteFeatureFlags } from '@affine/env/global';
import { WorkspaceFlavour } from '@affine/env/workspace';
import { createAffinePublicProviders } from '@affine/workspace/providers';
@@ -101,7 +101,7 @@ export function getOrCreateWorkspace(
if (isBrowser) {
blobStorages.push(createIndexeddbStorage);
blobStorages.push(createCloudBlobStorage);
if (isDesktop && runtimeConfig.enableSQLiteProvider) {
if (environment.isDesktop && runtimeConfig.enableSQLiteProvider) {
blobStorages.push(createSQLiteStorage);
}
providerCreators.push(...createAffineProviders());
@@ -111,7 +111,7 @@ export function getOrCreateWorkspace(
} else if (flavour === WorkspaceFlavour.LOCAL) {
if (isBrowser) {
blobStorages.push(createIndexeddbStorage);
if (isDesktop && runtimeConfig.enableSQLiteProvider) {
if (environment.isDesktop && runtimeConfig.enableSQLiteProvider) {
blobStorages.push(createSQLiteStorage);
}
}
@@ -119,7 +119,7 @@ export function getOrCreateWorkspace(
} else if (flavour === WorkspaceFlavour.AFFINE_PUBLIC) {
if (isBrowser) {
blobStorages.push(createIndexeddbStorage);
if (isDesktop && runtimeConfig.enableSQLiteProvider) {
if (environment.isDesktop && runtimeConfig.enableSQLiteProvider) {
blobStorages.push(createSQLiteStorage);
}
}