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: expand the view automatically upon opening (#5180)

Lucas.Xu0355ca5d73ee
diff --git a/frontend/appflowy_flutter/lib/user/application/sign_in_bloc.dart b/frontend/appflowy_flutter/lib/user/application/sign_in_bloc.dart
index f9527635bd..a317924216 100644
--- a/frontend/appflowy_flutter/lib/user/application/sign_in_bloc.dart
+++ b/frontend/appflowy_flutter/lib/user/application/sign_in_bloc.dart
@@ -224,21 +224,6 @@ class SignInBloc extends Bloc<SignInEvent, SignInState> {
}
SignInState _stateFromCode(FlowyError error) {
- // edge case: 429 is the rate limit error code
- // since the error code and error msg are saved in the msg field,
- // we need to check if the msg contains 429
- final msg = error.msg;
- if (msg.isNotEmpty) {
- if (msg.contains('429')) {
- return state.copyWith(
- isSubmitting: false,
- successOrFail: FlowyResult.failure(
- FlowyError(msg: LocaleKeys.signIn_limitRateError.tr()),
- ),
- );
- }
- }
-
switch (error.code) {
case ErrorCode.EmailFormatInvalid:
return state.copyWith(
diff --git a/frontend/appflowy_flutter/lib/user/presentation/screens/sign_in_screen/widgets/magic_link_sign_in_buttons.dart b/frontend/appflowy_flutter/lib/user/presentation/screens/sign_in_screen/widgets/magic_link_sign_in_buttons.dart
index b78197286c..1b2c463389 100644
--- a/frontend/appflowy_flutter/lib/user/presentation/screens/sign_in_screen/widgets/magic_link_sign_in_buttons.dart
+++ b/frontend/appflowy_flutter/lib/user/presentation/screens/sign_in_screen/widgets/magic_link_sign_in_buttons.dart
@@ -61,9 +61,9 @@ class _SignInWithMagicLinkButtonsState
);
return;
}
- if (context.read<SignInBloc>().state.isSubmitting) {
- return;
- }
+ // if (context.read<SignInBloc>().state.isSubmitting) {
+ // return;
+ // }
context.read<SignInBloc>().add(SignInEvent.signedWithMagicLink(email));
showSnackBarMessage(
context,
diff --git a/frontend/appflowy_flutter/lib/workspace/application/sidebar/folder/folder_bloc.dart b/frontend/appflowy_flutter/lib/workspace/application/sidebar/folder/folder_bloc.dart
index e82b54241a..4dd934f60b 100644
--- a/frontend/appflowy_flutter/lib/workspace/application/sidebar/folder/folder_bloc.dart
+++ b/frontend/appflowy_flutter/lib/workspace/application/sidebar/folder/folder_bloc.dart
@@ -39,7 +39,7 @@ class FolderBloc extends Bloc<FolderEvent, FolderState> {
},
expandOrUnExpand: (e) async {
final isExpanded = e.isExpanded ?? !state.isExpanded;
- await _setFolderExpandStatus(e.isExpanded ?? !state.isExpanded);
+ await _setFolderExpandStatus(isExpanded);
emit(state.copyWith(isExpanded: isExpanded));
},
);
diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/home/menu/sidebar/folder/_favorite_folder.dart b/frontend/appflowy_flutter/lib/workspace/presentation/home/menu/sidebar/folder/_favorite_folder.dart
index d61feb25de..82165b3518 100644
--- a/frontend/appflowy_flutter/lib/workspace/presentation/home/menu/sidebar/folder/_favorite_folder.dart
+++ b/frontend/appflowy_flutter/lib/workspace/presentation/home/menu/sidebar/folder/_favorite_folder.dart
@@ -52,14 +52,14 @@ class FavoriteFolder extends StatelessWidget {
isFeedback: false,
view: view,
level: 0,
- onSelected: (view) {
+ onSelected: (view, _) {
if (HardwareKeyboard.instance.isControlPressed) {
context.read<TabsBloc>().openTab(view);
}
context.read<TabsBloc>().openPlugin(view);
},
- onTertiarySelected: (view) =>
+ onTertiarySelected: (view, _) =>
context.read<TabsBloc>().openTab(view),
),
),
diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/home/menu/sidebar/folder/_section_folder.dart b/frontend/appflowy_flutter/lib/workspace/presentation/home/menu/sidebar/folder/_section_folder.dart
index 328b4a831f..1e05a29db2 100644
--- a/frontend/appflowy_flutter/lib/workspace/presentation/home/menu/sidebar/folder/_section_folder.dart
+++ b/frontend/appflowy_flutter/lib/workspace/presentation/home/menu/sidebar/folder/_section_folder.dart
@@ -3,6 +3,7 @@ import 'package:appflowy/workspace/application/menu/sidebar_sections_bloc.dart';
import 'package:appflowy/workspace/application/sidebar/folder/folder_bloc.dart';
import 'package:appflowy/workspace/application/tabs/tabs_bloc.dart';
import 'package:appflowy/workspace/application/user/user_workspace_bloc.dart';
+import 'package:appflowy/workspace/application/view/view_bloc.dart';
import 'package:appflowy/workspace/presentation/home/menu/sidebar/folder/_folder_header.dart';
import 'package:appflowy/workspace/presentation/home/menu/sidebar/rename_view_dialog.dart';
import 'package:appflowy/workspace/presentation/home/menu/view/view_item.dart';
@@ -84,14 +85,17 @@ class SectionFolder extends StatelessWidget {
level: 0,
leftPadding: 16,
isFeedback: false,
- onSelected: (view) {
+ onSelected: (view, viewContext) {
if (HardwareKeyboard.instance.isControlPressed) {
context.read<TabsBloc>().openTab(view);
}
context.read<TabsBloc>().openPlugin(view);
+ viewContext.read<ViewBloc>().add(
+ const ViewEvent.setIsExpanded(true),
+ );
},
- onTertiarySelected: (view) =>
+ onTertiarySelected: (view, viewContext) =>
context.read<TabsBloc>().openTab(view),
isHoverEnabled: isHoverEnabled,
),
@@ -110,8 +114,8 @@ class SectionFolder extends StatelessWidget {
level: 0,
leftPadding: 16,
isFeedback: false,
- onSelected: (_) {},
- onTertiarySelected: (_) {},
+ onSelected: (_, __) {},
+ onTertiarySelected: (_, __) {},
isHoverEnabled: isHoverEnabled,
isPlaceholder: true,
),
diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/home/menu/view/view_item.dart b/frontend/appflowy_flutter/lib/workspace/presentation/home/menu/view/view_item.dart
index ce4a8a3a0a..c9751d8ea9 100644
--- a/frontend/appflowy_flutter/lib/workspace/presentation/home/menu/view/view_item.dart
+++ b/frontend/appflowy_flutter/lib/workspace/presentation/home/menu/view/view_item.dart
@@ -27,7 +27,7 @@ import 'package:flowy_infra_ui/widget/flowy_tooltip.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
-typedef ViewItemOnSelected = void Function(ViewPB);
+typedef ViewItemOnSelected = void Function(ViewPB, BuildContext);
class ViewItem extends StatelessWidget {
const ViewItem({
@@ -408,8 +408,9 @@ class _SingleInnerViewItemState extends State<SingleInnerViewItem> {
final child = GestureDetector(
behavior: HitTestBehavior.translucent,
- onTap: () => widget.onSelected(widget.view),
- onTertiaryTapDown: (_) => widget.onTertiarySelected?.call(widget.view),
+ onTap: () => widget.onSelected(widget.view, context),
+ onTertiaryTapDown: (_) =>
+ widget.onTertiarySelected?.call(widget.view, context),
child: SizedBox(
height: widget.height,
child: Padding(