mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
feat: sidebar UI Revamp on mobile (#5418)
* chore: replace settings icon and expand icon * feat: use tabbar view to control the spaces * feat: improve space UI design on mobile * feat: improve recent space UI design on mobile * feat: improve recent space UI design on mobile * feat: improve favorite space UI design on mobile * feat: improve header UI design on mobile * feat: expand header height * feat: update BottomNavigationBarItem icon * fix: recent views and favorite views doesn't reload after switching workspace * feat: improve recent view UI design on mobile * feat: improve recent/favorite view UI design on mobile * feat: add empty placeholder for recent/favorite space * feat: long press on recent card to show bottom sheet * feat: support removing page from recent * feat: add trash button * chore: remove recent top padding * feat: support user avatar * feat: support ... and + in space page * chore: disable user avatar * feat: optimize title display on mobile * feat: support ... menu on Space page * chore: add tab padding * chore: cache image * chore: optimize the mobile card view height * feat: reoder tab on mobile * fix: some emojis may not display correctly on Android devices * fix: ignore the last edit time on test
This commit is contained in:
@ -60,6 +60,18 @@ pub struct ViewPB {
|
||||
|
||||
#[pb(index = 9, one_of)]
|
||||
pub extra: Option<String>,
|
||||
|
||||
// user_id
|
||||
#[pb(index = 10, one_of)]
|
||||
pub created_by: Option<i64>,
|
||||
|
||||
// timestamp
|
||||
#[pb(index = 11)]
|
||||
pub last_edited: i64,
|
||||
|
||||
// user_id
|
||||
#[pb(index = 12, one_of)]
|
||||
pub last_edited_by: Option<i64>,
|
||||
}
|
||||
|
||||
pub fn view_pb_without_child_views(view: View) -> ViewPB {
|
||||
@ -73,6 +85,9 @@ pub fn view_pb_without_child_views(view: View) -> ViewPB {
|
||||
icon: view.icon.clone().map(|icon| icon.into()),
|
||||
is_favorite: view.is_favorite,
|
||||
extra: view.extra,
|
||||
created_by: view.created_by,
|
||||
last_edited: view.last_edited_time,
|
||||
last_edited_by: view.last_edited_by,
|
||||
}
|
||||
}
|
||||
|
||||
@ -87,6 +102,9 @@ pub fn view_pb_without_child_views_from_arc(view: Arc<View>) -> ViewPB {
|
||||
icon: view.icon.clone().map(|icon| icon.into()),
|
||||
is_favorite: view.is_favorite,
|
||||
extra: view.extra.clone(),
|
||||
created_by: view.created_by,
|
||||
last_edited: view.last_edited_time,
|
||||
last_edited_by: view.last_edited_by,
|
||||
}
|
||||
}
|
||||
|
||||
@ -105,6 +123,9 @@ pub fn view_pb_with_child_views(view: Arc<View>, child_views: Vec<Arc<View>>) ->
|
||||
icon: view.icon.clone().map(|icon| icon.into()),
|
||||
is_favorite: view.is_favorite,
|
||||
extra: view.extra.clone(),
|
||||
created_by: view.created_by,
|
||||
last_edited: view.last_edited_time,
|
||||
last_edited_by: view.last_edited_by,
|
||||
}
|
||||
}
|
||||
|
||||
@ -155,11 +176,17 @@ pub struct RepeatedViewPB {
|
||||
#[derive(Eq, PartialEq, Debug, Default, ProtoBuf, Clone)]
|
||||
pub struct RepeatedFavoriteViewPB {
|
||||
#[pb(index = 1)]
|
||||
pub items: Vec<FavoriteViewPB>,
|
||||
pub items: Vec<SectionViewPB>,
|
||||
}
|
||||
|
||||
#[derive(Eq, PartialEq, Debug, Default, ProtoBuf, Clone)]
|
||||
pub struct FavoriteViewPB {
|
||||
pub struct RepeatedRecentViewPB {
|
||||
#[pb(index = 1)]
|
||||
pub items: Vec<SectionViewPB>,
|
||||
}
|
||||
|
||||
#[derive(Eq, PartialEq, Debug, Default, ProtoBuf, Clone)]
|
||||
pub struct SectionViewPB {
|
||||
#[pb(index = 1)]
|
||||
pub item: ViewPB,
|
||||
#[pb(index = 2)]
|
||||
|
@ -284,7 +284,7 @@ pub(crate) async fn read_favorites_handler(
|
||||
let mut views = vec![];
|
||||
for item in favorite_items {
|
||||
if let Ok(view) = folder.get_view_pb(&item.id).await {
|
||||
views.push(FavoriteViewPB {
|
||||
views.push(SectionViewPB {
|
||||
item: view,
|
||||
timestamp: item.timestamp,
|
||||
});
|
||||
@ -296,16 +296,19 @@ pub(crate) async fn read_favorites_handler(
|
||||
#[tracing::instrument(level = "debug", skip(folder), err)]
|
||||
pub(crate) async fn read_recent_views_handler(
|
||||
folder: AFPluginState<Weak<FolderManager>>,
|
||||
) -> DataResult<RepeatedViewPB, FlowyError> {
|
||||
) -> DataResult<RepeatedRecentViewPB, FlowyError> {
|
||||
let folder = upgrade_folder(folder)?;
|
||||
let recent_items = folder.get_my_recent_sections().await;
|
||||
let mut views = vec![];
|
||||
for item in recent_items {
|
||||
if let Ok(view) = folder.get_view_pb(&item.id).await {
|
||||
views.push(view);
|
||||
views.push(SectionViewPB {
|
||||
item: view,
|
||||
timestamp: item.timestamp,
|
||||
});
|
||||
}
|
||||
}
|
||||
data_result_ok(RepeatedViewPB { items: views })
|
||||
data_result_ok(RepeatedRecentViewPB { items: views })
|
||||
}
|
||||
|
||||
#[tracing::instrument(level = "debug", skip(folder), err)]
|
||||
|
@ -155,7 +155,7 @@ pub enum FolderEvent {
|
||||
#[event(input = "UpdateViewIconPayloadPB")]
|
||||
UpdateViewIcon = 35,
|
||||
|
||||
#[event(output = "RepeatedViewPB")]
|
||||
#[event(output = "RepeatedRecentViewPB")]
|
||||
ReadRecentViews = 36,
|
||||
|
||||
// used for add or remove recent views, like history
|
||||
|
Reference in New Issue
Block a user