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 => {