feat: add kanban shortcuts (#5270)

* feat: add kanban shortcuts

* feat: new ux for creating new kanban cards

* chore: fix tests

* fix: open card after creation in mobile board

* chore: adjust code style according to launch review

* chore: update frontend/appflowy_flutter/test/bloc_test/board_test/create_card_test.dart

Co-authored-by: Mathias Mogensen <42929161+Xazin@users.noreply.github.com>

* chore: more review

* chore: implement move card to adjacent group

* chore: reset focus upon card drag start

* feat: N to start creating a row from bottom

* fix: text card update

* feat: shift + enter to create a new card after currently focused card

* fix: row detail title

* feat: shift + cmd + up to create card above

* fix: double dispose and code cleanup

* chore: code cleanup

* fix: widget rebuilds

* fix: build

* chore: update frontend/appflowy_flutter/lib/mobile/presentation/database/board/mobile_board_page.dart

Co-authored-by: Mathias Mogensen <42929161+Xazin@users.noreply.github.com>

* fix: ontapoutside for cards being edited

* fix: correct integration test

* fix: always build

* chore: code cleanup

* fix: mobile build and bugs

* fix: widget rebuilds

* fix: code cleanup and fix mobile open

* fix: disallow dragging when editing

---------

Co-authored-by: Mathias Mogensen <42929161+Xazin@users.noreply.github.com>
This commit is contained in:
Richard Shiue
2024-05-10 10:02:10 +08:00
committed by GitHub
parent 28a27d1b67
commit a490f34a61
48 changed files with 2192 additions and 990 deletions

View File

@ -338,6 +338,15 @@ impl TryInto<RowIdParams> for RowIdPB {
}
}
#[derive(Debug, Default, Clone, ProtoBuf)]
pub struct RepeatedRowIdPB {
#[pb(index = 1)]
pub view_id: String,
#[pb(index = 2)]
pub row_ids: Vec<String>,
}
#[derive(ProtoBuf, Default, Validate)]
pub struct CreateRowPayloadPB {
#[pb(index = 1)]

View File

@ -78,7 +78,7 @@ pub struct RepeatedRelatedRowDataPB {
}
#[derive(Debug, Default, Clone, ProtoBuf)]
pub struct RepeatedRowIdPB {
pub struct GetRelatedRowDataPB {
#[pb(index = 1)]
pub database_id: String,

View File

@ -385,14 +385,19 @@ pub(crate) async fn update_row_meta_handler(
}
#[tracing::instrument(level = "debug", skip(data, manager), err)]
pub(crate) async fn delete_row_handler(
data: AFPluginData<RowIdPB>,
pub(crate) async fn delete_rows_handler(
data: AFPluginData<RepeatedRowIdPB>,
manager: AFPluginState<Weak<DatabaseManager>>,
) -> Result<(), FlowyError> {
let manager = upgrade_manager(manager)?;
let params: RowIdParams = data.into_inner().try_into()?;
let params: RepeatedRowIdPB = data.into_inner();
let database_editor = manager.get_database_with_view_id(&params.view_id).await?;
database_editor.delete_row(&params.row_id).await;
let row_ids = params
.row_ids
.into_iter()
.map(RowId::from)
.collect::<Vec<_>>();
database_editor.delete_rows(&row_ids).await;
Ok(())
}
@ -1062,11 +1067,11 @@ pub(crate) async fn update_relation_cell_handler(
}
pub(crate) async fn get_related_row_datas_handler(
data: AFPluginData<RepeatedRowIdPB>,
data: AFPluginData<GetRelatedRowDataPB>,
manager: AFPluginState<Weak<DatabaseManager>>,
) -> DataResult<RepeatedRelatedRowDataPB, FlowyError> {
let manager = upgrade_manager(manager)?;
let params: RepeatedRowIdPB = data.into_inner();
let params: GetRelatedRowDataPB = data.into_inner();
let database_editor = manager.get_database(&params.database_id).await?;
let row_datas = database_editor
.get_related_rows(Some(&params.row_ids))

View File

@ -37,7 +37,7 @@ pub fn init(database_manager: Weak<DatabaseManager>) -> AFPlugin {
.event(DatabaseEvent::GetRow, get_row_handler)
.event(DatabaseEvent::GetRowMeta, get_row_meta_handler)
.event(DatabaseEvent::UpdateRowMeta, update_row_meta_handler)
.event(DatabaseEvent::DeleteRow, delete_row_handler)
.event(DatabaseEvent::DeleteRows, delete_rows_handler)
.event(DatabaseEvent::DuplicateRow, duplicate_row_handler)
.event(DatabaseEvent::MoveRow, move_row_handler)
// Cell
@ -223,8 +223,8 @@ pub enum DatabaseEvent {
#[event(input = "RowIdPB", output = "OptionalRowPB")]
GetRow = 51,
#[event(input = "RowIdPB")]
DeleteRow = 52,
#[event(input = "RepeatedRowIdPB")]
DeleteRows = 52,
#[event(input = "RowIdPB")]
DuplicateRow = 53,
@ -364,7 +364,7 @@ pub enum DatabaseEvent {
UpdateRelationCell = 171,
/// Get the names of the linked rows in a relation cell.
#[event(input = "RepeatedRowIdPB", output = "RepeatedRelatedRowDataPB")]
#[event(input = "GetRelatedRowDataPB", output = "RepeatedRelatedRowDataPB")]
GetRelatedRowDatas = 172,
/// Get the names of all the rows in a related database.

View File

@ -654,9 +654,10 @@ impl DatabaseEditor {
}
}
pub async fn delete_row(&self, row_id: &RowId) {
let row = self.database.lock().remove_row(row_id);
if let Some(row) = row {
pub async fn delete_rows(&self, row_ids: &[RowId]) {
let rows = self.database.lock().remove_rows(row_ids);
for row in rows {
tracing::trace!("Did delete row:{:?}", row);
for view in self.database_views.editors().await {
view.v_did_delete_row(&row).await;

View File

@ -148,8 +148,8 @@ impl DatabaseGroupTest {
row_index,
} => {
let row = self.row_at_index(group_index, row_index).await;
let row_id = RowId::from(row.id);
self.editor.delete_row(&row_id).await;
let row_ids = vec![RowId::from(row.id)];
self.editor.delete_rows(&row_ids).await;
},
GroupScript::UpdateGroupedCell {
from_group_index,