feat: sidebar UI Revamp on Desktop (#5343)

This commit is contained in:
Lucas.Xu
2024-05-27 08:51:49 +08:00
committed by GitHub
parent 13b3439bd6
commit a8f136eda2
138 changed files with 2678 additions and 1305 deletions

View File

@ -152,6 +152,20 @@ pub struct RepeatedViewPB {
pub items: Vec<ViewPB>,
}
#[derive(Eq, PartialEq, Debug, Default, ProtoBuf, Clone)]
pub struct RepeatedFavoriteViewPB {
#[pb(index = 1)]
pub items: Vec<FavoriteViewPB>,
}
#[derive(Eq, PartialEq, Debug, Default, ProtoBuf, Clone)]
pub struct FavoriteViewPB {
#[pb(index = 1)]
pub item: ViewPB,
#[pb(index = 2)]
pub timestamp: i64,
}
impl std::convert::From<Vec<ViewPB>> for RepeatedViewPB {
fn from(items: Vec<ViewPB>) -> Self {
RepeatedViewPB { items }

View File

@ -278,16 +278,19 @@ pub(crate) async fn duplicate_view_handler(
#[tracing::instrument(level = "debug", skip(folder), err)]
pub(crate) async fn read_favorites_handler(
folder: AFPluginState<Weak<FolderManager>>,
) -> DataResult<RepeatedViewPB, FlowyError> {
) -> DataResult<RepeatedFavoriteViewPB, FlowyError> {
let folder = upgrade_folder(folder)?;
let favorite_items = folder.get_all_favorites().await;
let mut views = vec![];
for item in favorite_items {
if let Ok(view) = folder.get_view_pb(&item.id).await {
views.push(view);
views.push(FavoriteViewPB {
item: view,
timestamp: item.timestamp,
});
}
}
data_result_ok(RepeatedViewPB { items: views })
data_result_ok(RepeatedFavoriteViewPB { items: views })
}
#[tracing::instrument(level = "debug", skip(folder), err)]

View File

@ -146,7 +146,7 @@ pub enum FolderEvent {
#[event(input = "MoveNestedViewPayloadPB")]
MoveNestedView = 32,
#[event(output = "RepeatedViewPB")]
#[event(output = "RepeatedFavoriteViewPB")]
ReadFavorites = 33,
#[event(input = "RepeatedViewIdPB")]