Skip to content

Commit

Permalink
feat: support moving page to a space (#5665)
Browse files Browse the repository at this point in the history
* feat: support moving page to a space

* chore: update collab repo
  • Loading branch information
LucasXu0 authored Jul 2, 2024
1 parent f9fba6b commit 42dc601
Show file tree
Hide file tree
Showing 9 changed files with 123 additions and 67 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,15 @@ class _MovePageMenuState extends State<MovePageMenu> {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
SpacePopup(
useIntrinsicWidth: false,
expand: true,
height: 30,
showCreateButton: false,
child: CurrentSpace(
onTapBlankArea: () {
// move the page to current space
widget.onSelected(space);
},
space: space,
),
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ import 'package:appflowy_popover/appflowy_popover.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:flowy_infra_ui/flowy_infra_ui.dart';
import 'package:flowy_infra_ui/style_widget/decoration.dart';
import 'package:flowy_infra_ui/style_widget/hover.dart';
import 'package:flowy_infra_ui/widget/flowy_tooltip.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
Expand Down Expand Up @@ -277,17 +279,23 @@ class DeleteSpacePopup extends StatelessWidget {
class SpacePopup extends StatelessWidget {
const SpacePopup({
super.key,
this.height,
this.useIntrinsicWidth = true,
this.expand = false,
required this.showCreateButton,
required this.child,
});

final bool showCreateButton;
final bool useIntrinsicWidth;
final bool expand;
final double? height;
final Widget child;

@override
Widget build(BuildContext context) {
return SizedBox(
height: HomeSizes.workspaceSectionHeight,
height: height ?? HomeSizes.workspaceSectionHeight,
child: AppFlowyPopover(
constraints: const BoxConstraints(maxWidth: 260),
direction: PopoverDirection.bottomWithLeftAligned,
Expand All @@ -300,7 +308,8 @@ class SpacePopup extends StatelessWidget {
),
),
child: FlowyButton(
useIntrinsicWidth: true,
useIntrinsicWidth: useIntrinsicWidth,
expand: expand,
margin: const EdgeInsets.only(left: 3.0, right: 4.0),
iconPadding: 10.0,
text: child,
Expand All @@ -313,37 +322,68 @@ class SpacePopup extends StatelessWidget {
class CurrentSpace extends StatelessWidget {
const CurrentSpace({
super.key,
this.onTapBlankArea,
required this.space,
});

final ViewPB space;
final VoidCallback? onTapBlankArea;

@override
Widget build(BuildContext context) {
return Row(
mainAxisSize: MainAxisSize.min,
children: [
SpaceIcon(
dimension: 20,
space: space,
cornerRadius: 6.0,
),
const HSpace(10),
Flexible(
child: FlowyText.medium(
space.name,
fontSize: 14.0,
overflow: TextOverflow.ellipsis,
final child = FlowyTooltip(
message: LocaleKeys.space_switchSpace.tr(),
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
SpaceIcon(
dimension: 20,
space: space,
cornerRadius: 6.0,
),
),
const HSpace(4.0),
FlowySvg(
context.read<SpaceBloc>().state.isExpanded
? FlowySvgs.workspace_drop_down_menu_show_s
: FlowySvgs.workspace_drop_down_menu_hide_s,
),
],
const HSpace(10),
Flexible(
child: FlowyText.medium(
space.name,
fontSize: 14.0,
overflow: TextOverflow.ellipsis,
),
),
const HSpace(4.0),
FlowySvg(
context.read<SpaceBloc>().state.isExpanded
? FlowySvgs.workspace_drop_down_menu_show_s
: FlowySvgs.workspace_drop_down_menu_hide_s,
),
],
),
);

if (onTapBlankArea != null) {
return Row(
children: [
Expanded(
flex: 2,
child: FlowyHover(
child: Padding(
padding: const EdgeInsets.all(2.0),
child: child,
),
),
),
Expanded(
child: FlowyTooltip(
message: LocaleKeys.space_movePageToSpace.tr(),
child: GestureDetector(
onTap: onTapBlankArea,
),
),
),
],
);
}

return child;
}
}

Expand Down
14 changes: 7 additions & 7 deletions frontend/appflowy_tauri/src-tauri/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 7 additions & 7 deletions frontend/appflowy_tauri/src-tauri/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,10 @@ default = ["custom-protocol"]
custom-protocol = ["tauri/custom-protocol"]

[patch.crates-io]
collab = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "3a58d95" }
collab-entity = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "3a58d95" }
collab-folder = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "3a58d95" }
collab-document = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "3a58d95" }
collab-database = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "3a58d95" }
collab-plugins = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "3a58d95" }
collab-user = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "3a58d95" }
collab = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "5048762" }
collab-entity = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "5048762" }
collab-folder = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "5048762" }
collab-document = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "5048762" }
collab-database = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "5048762" }
collab-plugins = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "5048762" }
collab-user = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "5048762" }
21 changes: 14 additions & 7 deletions frontend/appflowy_web_app/src-tauri/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 7 additions & 7 deletions frontend/appflowy_web_app/src-tauri/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,10 @@ default = ["custom-protocol"]
custom-protocol = ["tauri/custom-protocol"]

[patch.crates-io]
collab = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "3a58d95" }
collab-entity = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "3a58d95" }
collab-folder = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "3a58d95" }
collab-document = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "3a58d95" }
collab-database = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "3a58d95" }
collab-plugins = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "3a58d95" }
collab-user = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "3a58d95" }
collab = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "5048762" }
collab-entity = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "5048762" }
collab-folder = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "5048762" }
collab-document = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "5048762" }
collab-database = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "5048762" }
collab-plugins = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "5048762" }
collab-user = { version = "0.2", git = "https://github.com/AppFlowy-IO/AppFlowy-Collab", rev = "5048762" }
4 changes: 3 additions & 1 deletion frontend/resources/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -2027,6 +2027,8 @@
"upgrade": "Update",
"upgradeYourSpace": "Create multiple Spaces",
"quicklySwitch": "Quickly switch to the next space",
"duplicate": "Duplicate Space"
"duplicate": "Duplicate Space",
"movePageToSpace": "Move page to space",
"switchSpace": "Switch space"
}
}
Loading

0 comments on commit 42dc601

Please sign in to comment.