Skip to content

Bring projects, wikis, and teams together with AI. AppFlowy is the AI collaborative workspace where you achieve more without losing control of your data. The leading open source Notion alternative.

feat: display no access page (#5941)

Lucas.Xu93f9a2cab1ec
diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/mention/mention_page_block.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/mention/mention_page_block.dart
index 6755be9690..34095e7512 100644
--- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/mention/mention_page_block.dart
+++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/mention/mention_page_block.dart
@@ -1,4 +1,5 @@
import 'package:appflowy/generated/flowy_svgs.g.dart';
+import 'package:appflowy/generated/locale_keys.g.dart';
import 'package:appflowy/mobile/application/mobile_router.dart';
import 'package:appflowy/plugins/base/emoji/emoji_text.dart';
import 'package:appflowy/plugins/document/application/document_bloc.dart';
@@ -21,6 +22,7 @@ import 'package:appflowy_editor/appflowy_editor.dart'
TextTransaction,
paragraphNode;
import 'package:collection/collection.dart';
+import 'package:easy_localization/easy_localization.dart';
import 'package:flowy_infra_ui/flowy_infra_ui.dart';
import 'package:flowy_infra_ui/style_widget/hover.dart';
import 'package:flutter/material.dart';
@@ -105,57 +107,69 @@ class _MentionPageBlockState extends State<MentionPageBlock> {
// memorize the result
pageMemorizer[widget.pageId] = view;
if (view == null) {
- return const SizedBox.shrink();
- }
-
- final iconSize = widget.textStyle?.fontSize ?? 16.0;
- final child = GestureDetector(
- onTap: handleTap,
- onDoubleTap: handleDoubleTap,
- behavior: HitTestBehavior.translucent,
- child: Row(
- mainAxisSize: MainAxisSize.min,
- children: [
- const HSpace(4),
- view.icon.value.isNotEmpty
- ? EmojiText(
- emoji: view.icon.value,
- fontSize: 12,
- textAlign: TextAlign.center,
- lineHeight: 1.3,
- )
- : FlowySvg(
- view.layout.icon,
- size: Size.square(iconSize + 2.0),
- ),
- const HSpace(2),
- FlowyText(
- view.name,
+ return FlowyHover(
+ child: Padding(
+ padding: const EdgeInsets.symmetric(horizontal: 4),
+ child: FlowyText(
+ LocaleKeys.document_mention_noAccess.tr(),
+ color: Theme.of(context).disabledColor,
decoration: TextDecoration.underline,
fontSize: widget.textStyle?.fontSize,
fontWeight: widget.textStyle?.fontWeight,
),
- const HSpace(2),
- ],
- ),
+ ),
+ );
+ }
+
+ final iconSize = widget.textStyle?.fontSize ?? 16.0;
+ Widget child = Row(
+ mainAxisSize: MainAxisSize.min,
+ children: [
+ const HSpace(4),
+ view.icon.value.isNotEmpty
+ ? EmojiText(
+ emoji: view.icon.value,
+ fontSize: 12,
+ textAlign: TextAlign.center,
+ lineHeight: 1.3,
+ )
+ : FlowySvg(
+ view.layout.icon,
+ size: Size.square(iconSize + 2.0),
+ ),
+ const HSpace(2),
+ FlowyText(
+ view.name,
+ decoration: TextDecoration.underline,
+ fontSize: widget.textStyle?.fontSize,
+ fontWeight: widget.textStyle?.fontWeight,
+ ),
+ const HSpace(4),
+ ],
);
- if (PlatformExtension.isMobile) {
- return child;
+ if (PlatformExtension.isDesktop) {
+ child = Padding(
+ padding: const EdgeInsets.symmetric(horizontal: 2),
+ child: FlowyHover(
+ cursor: SystemMouseCursors.click,
+ child: child,
+ ),
+ );
}
- return Padding(
- padding: const EdgeInsets.symmetric(horizontal: 2),
- child: FlowyHover(
- cursor: SystemMouseCursors.click,
- child: child,
- ),
+ return GestureDetector(
+ onTap: handleTap,
+ onDoubleTap: PlatformExtension.isMobile ? handleDoubleTap : null,
+ behavior: HitTestBehavior.opaque,
+ child: child,
);
},
);
}
Future<void> handleTap() async {
+ debugPrint('handleTap');
final view = await fetchView(widget.pageId);
if (view == null) {
Log.error('Page(${widget.pageId}) not found');
diff --git a/frontend/appflowy_flutter/lib/plugins/shared/share/_shared.dart b/frontend/appflowy_flutter/lib/plugins/shared/share/_shared.dart
index 2228e9bc19..23bcb88395 100644
--- a/frontend/appflowy_flutter/lib/plugins/shared/share/_shared.dart
+++ b/frontend/appflowy_flutter/lib/plugins/shared/share/_shared.dart
@@ -43,6 +43,7 @@ class ShareMenuButton extends StatelessWidget {
),
child: PrimaryRoundedButton(
text: LocaleKeys.shareAction_buttonText.tr(),
+ figmaLineHeight: 16,
),
),
),
diff --git a/frontend/appflowy_flutter/lib/plugins/shared/share/publish_tab.dart b/frontend/appflowy_flutter/lib/plugins/shared/share/publish_tab.dart
index d48ead7eaf..220cb92717 100644
--- a/frontend/appflowy_flutter/lib/plugins/shared/share/publish_tab.dart
+++ b/frontend/appflowy_flutter/lib/plugins/shared/share/publish_tab.dart
@@ -263,6 +263,8 @@ class _PublishButton extends StatelessWidget {
text: LocaleKeys.shareAction_publish.tr(),
useIntrinsicWidth: false,
margin: const EdgeInsets.symmetric(vertical: 9.0),
+ fontSize: 14.0,
+ figmaLineHeight: 18.0,
onTap: onPublish,
);
}
diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/home/menu/sidebar/workspace/_sidebar_workspace_menu.dart b/frontend/appflowy_flutter/lib/workspace/presentation/home/menu/sidebar/workspace/_sidebar_workspace_menu.dart
index a383caa082..97ee729e52 100644
--- a/frontend/appflowy_flutter/lib/workspace/presentation/home/menu/sidebar/workspace/_sidebar_workspace_menu.dart
+++ b/frontend/appflowy_flutter/lib/workspace/presentation/home/menu/sidebar/workspace/_sidebar_workspace_menu.dart
@@ -248,6 +248,7 @@ class _WorkspaceInfo extends StatelessWidget {
FlowyText.medium(
workspace.name,
fontSize: 14.0,
+ figmaLineHeight: 17.0,
overflow: TextOverflow.ellipsis,
withTooltip: true,
),
@@ -260,6 +261,7 @@ class _WorkspaceInfo extends StatelessWidget {
members.length,
),
fontSize: 10.0,
+ figmaLineHeight: 12.0,
color: Theme.of(context).hintColor,
),
],
diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/settings/shared/single_setting_action.dart b/frontend/appflowy_flutter/lib/workspace/presentation/settings/shared/single_setting_action.dart
index 5f2ecce277..95fd067265 100644
--- a/frontend/appflowy_flutter/lib/workspace/presentation/settings/shared/single_setting_action.dart
+++ b/frontend/appflowy_flutter/lib/workspace/presentation/settings/shared/single_setting_action.dart
@@ -113,6 +113,7 @@ class SingleSettingAction extends StatelessWidget {
fontSize: 12,
isDangerous: buttonType.isDangerous,
onPressed: onPressed,
+ lineHeight: 1.0,
),
),
],
diff --git a/frontend/appflowy_flutter/packages/flowy_infra_ui/lib/style_widget/button.dart b/frontend/appflowy_flutter/packages/flowy_infra_ui/lib/style_widget/button.dart
index fba47aa7d7..af5370dbfa 100644
--- a/frontend/appflowy_flutter/packages/flowy_infra_ui/lib/style_widget/button.dart
+++ b/frontend/appflowy_flutter/packages/flowy_infra_ui/lib/style_widget/button.dart
@@ -306,6 +306,7 @@ class FlowyTextButton extends StatelessWidget {
this.fontFamily,
this.isDangerous = false,
this.borderColor,
+ this.lineHeight,
});
factory FlowyTextButton.primary({
@@ -362,6 +363,7 @@ class FlowyTextButton extends StatelessWidget {
final String? fontFamily;
final bool isDangerous;
final Color? borderColor;
+ final double? lineHeight;
@override
Widget build(BuildContext context) {
@@ -375,6 +377,7 @@ class FlowyTextButton extends StatelessWidget {
overflow: overflow,
color: textColor,
textAlign: TextAlign.center,
+ lineHeight: lineHeight,
));
Widget child = Row(
@@ -411,7 +414,7 @@ class FlowyTextButton extends StatelessWidget {
fontSize: fontSize,
decoration: decoration,
fontFamily: fontFamily,
- height: 1.1,
+ height: lineHeight ?? 1.1,
),
),
backgroundColor: WidgetStateProperty.resolveWith(
diff --git a/frontend/appflowy_flutter/packages/flowy_infra_ui/lib/style_widget/primary_rounded_button.dart b/frontend/appflowy_flutter/packages/flowy_infra_ui/lib/style_widget/primary_rounded_button.dart
index 687715c826..4593ee1d22 100644
--- a/frontend/appflowy_flutter/packages/flowy_infra_ui/lib/style_widget/primary_rounded_button.dart
+++ b/frontend/appflowy_flutter/packages/flowy_infra_ui/lib/style_widget/primary_rounded_button.dart
@@ -15,6 +15,8 @@ class PrimaryRoundedButton extends StatelessWidget {
this.hoverColor,
this.backgroundColor,
this.useIntrinsicWidth = true,
+ this.lineHeight,
+ this.figmaLineHeight,
});
final String text;
@@ -27,6 +29,8 @@ class PrimaryRoundedButton extends StatelessWidget {
final Color? hoverColor;
final Color? backgroundColor;
final bool useIntrinsicWidth;
+ final double? lineHeight;
+ final double? figmaLineHeight;
@override
Widget build(BuildContext context) {
@@ -36,6 +40,8 @@ class PrimaryRoundedButton extends StatelessWidget {
text,
fontSize: fontSize ?? 14.0,
fontWeight: fontWeight ?? FontWeight.w500,
+ lineHeight: lineHeight ?? 1.0,
+ figmaLineHeight: figmaLineHeight,
color: Theme.of(context).colorScheme.onPrimary,
textAlign: TextAlign.center,
),
diff --git a/frontend/resources/translations/en.json b/frontend/resources/translations/en.json
index 58b2d7cc24..7196a64640 100644
--- a/frontend/resources/translations/en.json
+++ b/frontend/resources/translations/en.json
@@ -1766,7 +1766,8 @@
"tooltip": "Click to open page"
},
"deleted": "Deleted",
- "deletedContent": "This content does not exist or has been deleted"
+ "deletedContent": "This content does not exist or has been deleted",
+ "noAccess": "No Access"
},
"toolbar": {
"resetToDefaultFont": "Reset to default"