chore: increase the frequency of the banner (#3264)

This commit is contained in:
JimmFly
2023-07-17 17:45:02 +08:00
committed by GitHub
parent f21eb5f272
commit 9b32db9f62
7 changed files with 37 additions and 27 deletions
@@ -1,21 +1,27 @@
import { DownloadTips } from '@affine/component/affine-banner';
import { isDesktop } from '@affine/env/constant';
import { useAtom } from 'jotai';
import { useCallback } from 'react';
import { guideDownloadClientTipAtom } from '../../../atoms/guide';
export const DownloadClientTip = ({
show,
onClose,
}: {
// const [showDownloadClientTips, setShowDownloadClientTips] = useAtom(
// guideDownloadClientTipAtom
// );
// const onCloseDownloadClient = useCallback(() => {
// setShowDownloadClientTips(false);
// }, [setShowDownloadClientTips]);
export const DownloadClientTip = () => {
const [showDownloadClientTips, setShowDownloadClientTips] = useAtom(
guideDownloadClientTipAtom
);
const onCloseDownloadClient = useCallback(() => {
setShowDownloadClientTips(false);
}, [setShowDownloadClientTips]);
// if (!showDownloadClientTips || isDesktop) {
// return <></>;
// }
if (!showDownloadClientTips || isDesktop) {
return <></>;
show: boolean;
onClose: () => void;
}) => {
if (!show || isDesktop) {
return null;
}
return <DownloadTips onClose={onCloseDownloadClient} />;
return <DownloadTips onClose={onClose} />;
};
export default DownloadClientTip;
@@ -10,7 +10,7 @@ import { CloseIcon, MinusIcon, RoundedRectangleIcon } from '@blocksuite/icons';
import type { Page } from '@blocksuite/store';
import { affinePluginsAtom } from '@toeverything/plugin-infra/manager';
import type { PluginUIAdapter } from '@toeverything/plugin-infra/type';
import { useAtom, useAtomValue } from 'jotai';
import { useAtomValue } from 'jotai';
import type { FC, HTMLAttributes, PropsWithChildren, ReactNode } from 'react';
import {
forwardRef,
@@ -21,7 +21,6 @@ import {
useState,
} from 'react';
import { guideDownloadClientTipAtom } from '../../../atoms/guide';
import { contentLayoutAtom } from '../../../atoms/layout';
import { currentModeAtom } from '../../../atoms/mode';
import type { AffineOfficialWorkspace } from '../../../shared';
@@ -194,14 +193,13 @@ export const Header = forwardRef<
>((props, ref) => {
const [showWarning, setShowWarning] = useState(false);
const [showGuideDownloadClientTip, setShowGuideDownloadClientTip] =
useState(false);
const [shouldShowGuideDownloadClientTip] = useAtom(
guideDownloadClientTipAtom
);
useState(true);
// const [shouldShowGuideDownloadClientTip] = useAtom(
// guideDownloadClientTipAtom
// );
useEffect(() => {
setShowWarning(shouldShowWarning());
setShowGuideDownloadClientTip(shouldShowGuideDownloadClientTip);
}, [shouldShowGuideDownloadClientTip]);
}, []);
const open = useAtomValue(appSidebarOpenAtom);
const appSidebarFloating = useAtomValue(appSidebarFloatingAtom);
@@ -216,7 +214,12 @@ export const Header = forwardRef<
data-sidebar-floating={appSidebarFloating}
>
{showGuideDownloadClientTip ? (
<DownloadClientTip />
<DownloadClientTip
show={showGuideDownloadClientTip}
onClose={() => {
setShowGuideDownloadClientTip(false);
}}
/>
) : (
<BrowserWarning
show={showWarning}
@@ -20,7 +20,7 @@ export const DownloadTips = ({ onClose }: { onClose: () => void }) => {
<AffineLogoSBlue2_1Icon className={downloadTipIconStyle} />
<div className={downloadMessageStyle}>
<Trans i18nKey="com.affine.banner.content">
Enjoying the demo?
This demo is limited.
<a
className={linkStyle}
href="https://affine.pro/download"
@@ -29,7 +29,7 @@ export const DownloadTips = ({ onClose }: { onClose: () => void }) => {
>
Download the AFFiNE Client
</a>
for the full experience.
for the latest features and Performance.
</Trans>
</div>
</div>
+1 -1
View File
@@ -32,7 +32,7 @@
"com.affine.onboarding.title2": "Intuitive & robust block-based editing",
"com.affine.onboarding.videoDescription1": "Easily switch between Page mode for structured document creation and Whiteboard mode for the freeform visual expression of creative ideas.",
"com.affine.onboarding.videoDescription2": "Create structured documents with ease, using a modular interface to drag and drop blocks of text, images, and other content.",
"com.affine.banner.content": "Enjoying the demo? <1>Download the AFFiNE Client</1> for the full experience.",
"com.affine.banner.content": "This demo is limited. <1>Download the AFFiNE Client</1> for the latest features and Performance.",
"com.affine.helpIsland.gettingStarted": "Getting started",
"com.affine.updater.downloading": "Downloading",
"com.affine.updater.update-available": "Update available",
+1 -1
View File
@@ -57,7 +57,7 @@
"com.affine.emptyDesc": "这里还没有页面",
"com.affine.last7Days": "过去 7 天",
"com.affine.lastMonth": "上个月",
"com.affine.banner.content": "正在享受演示吗?<1>下载 AFFiNE 客户端</1>以获得完整体验。",
"com.affine.banner.content": "此演示有限。<1>下载 AFFiNE 客户端</1>以获取最新功能和表现。",
"com.affine.cloudTempDisable.title": "AFFiNE Cloud 正在进行升级。",
"com.affine.cloudTempDisable.description": "我们正在升级 AFFiNE Cloud 服务,客户端暂时不可启用它。如果您希望随时了解进度并收到关于云服务的可用性通知,您可以填写我们的<1>表单</1>。",
"com.affine.edgelessMode": "无界模式",
+1
View File
@@ -177,6 +177,7 @@ test('allow creation of filters by tags', async ({ page }) => {
await createPageWithTag(page, { title: 'Page A', tags: ['A'] });
await createPageWithTag(page, { title: 'Page B', tags: ['B'] });
await clickSideBarAllPageButton(page);
await closeDownloadTip(page);
await createFirstFilter(page, 'Tags');
await checkFilterName(page, 'is not empty');
await checkPagesCount(page, 2);
+1 -1
View File
@@ -40,5 +40,5 @@ test('Download client tip', async ({ page }) => {
const currentDownloadClientTipItem = page.locator(
'[data-testid=download-client-tip]'
);
await expect(currentDownloadClientTipItem).not.toBeVisible();
await expect(currentDownloadClientTipItem).toBeVisible();
});