From 256d0159672b53d12e5af08ef0fc98b5fc9f127b Mon Sep 17 00:00:00 2001 From: "Kilu.He" <108015703+qinluhe@users.noreply.github.com> Date: Mon, 30 Dec 2024 15:46:39 +0800 Subject: [PATCH] fix: add tip for database page (#7090) --- .../_shared/notify/InfoSnackbar.tsx | 24 ++++--- .../blocks/database/DatabaseBlock.tsx | 10 +-- .../appflowy_web_app/src/pages/AppPage.tsx | 72 +++++++++++++++---- 3 files changed, 77 insertions(+), 29 deletions(-) diff --git a/frontend/appflowy_web_app/src/components/_shared/notify/InfoSnackbar.tsx b/frontend/appflowy_web_app/src/components/_shared/notify/InfoSnackbar.tsx index bc43e60c45..ee9dbe45f2 100644 --- a/frontend/appflowy_web_app/src/components/_shared/notify/InfoSnackbar.tsx +++ b/frontend/appflowy_web_app/src/components/_shared/notify/InfoSnackbar.tsx @@ -31,7 +31,10 @@ const InfoSnackbar = forwardRef( }; return ( - +
@@ -39,13 +42,18 @@ const InfoSnackbar = forwardRef(
{title}
- +
-
{message}
+
{message}
{showActions && (
-
- - Read-only: Use the AppFlowy app to create or edit database pages. This feature will be available soon. -
{t('publish.hasNotBeenPublished')} ) : ( - + )} )} diff --git a/frontend/appflowy_web_app/src/pages/AppPage.tsx b/frontend/appflowy_web_app/src/pages/AppPage.tsx index b3916c3205..d715c67a52 100644 --- a/frontend/appflowy_web_app/src/pages/AppPage.tsx +++ b/frontend/appflowy_web_app/src/pages/AppPage.tsx @@ -1,25 +1,24 @@ import { UIVariant, ViewComponentProps, ViewLayout, ViewMetaProps, YDoc } from '@/application/types'; import Help from '@/components/_shared/help/Help'; +import { notify } from '@/components/_shared/notify'; import { findView } from '@/components/_shared/outline/utils'; - -import { - AppContext, - useAppHandlers, - useAppOutline, - useAppViewId, -} from '@/components/app/app.hooks'; +import { ReactComponent as TipIcon } from '@/assets/warning.svg'; +import { AppContext, useAppHandlers, useAppOutline, useAppViewId } from '@/components/app/app.hooks'; import DatabaseView from '@/components/app/DatabaseView'; import { Document } from '@/components/document'; import RecordNotFound from '@/components/error/RecordNotFound'; import { getPlatform } from '@/utils/platform'; +import { desktopDownloadLink, openAppFlowySchema } from '@/utils/url'; +import { Button, Checkbox, FormControlLabel } from '@mui/material'; import React, { lazy, memo, Suspense, useCallback, useContext, useEffect, useMemo } from 'react'; const ViewHelmet = lazy(() => import('@/components/_shared/helmet/ViewHelmet')); -function AppPage() { +function AppPage () { const viewId = useAppViewId(); const outline = useAppOutline(); const ref = React.useRef(null); + const { toView, loadViewMeta, @@ -135,20 +134,69 @@ function AppPage() { localStorage.setItem('last_view_id', viewId); }, [View, viewId, doc]); + const layout = view?.layout; + + useEffect(() => { + if (layout !== undefined && layout !== ViewLayout.Document && !localStorage.getItem('open_edit_tip')) { + notify.clear(); + notify.info({ + autoHideDuration: null, + type: 'info', + title: 'Edit in app', + message:
+
{`Editing databases is supported in AppFlowy's desktop and mobile apps`} +
+
+ + Don't have AppFlowy? Download
+
+ { + if (value) { + localStorage.setItem('open_edit_tip', 'true'); + } else { + localStorage.removeItem('open_edit_tip'); + } + }} + control={} + label="Don't remind me again" + /> + +
+
, + showActions: false, + }); + } + }, [layout]); + if (!viewId) return null; return ( -
+
{helmet} {notFound ? ( - + ) : (
{viewDom}
)} - {view && doc && } - + {view && doc && }
); }