mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
feat: sidebar UI Revamp on Desktop (#5343)
This commit is contained in:
@ -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 }
|
||||
|
@ -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)]
|
||||
|
@ -146,7 +146,7 @@ pub enum FolderEvent {
|
||||
#[event(input = "MoveNestedViewPayloadPB")]
|
||||
MoveNestedView = 32,
|
||||
|
||||
#[event(output = "RepeatedViewPB")]
|
||||
#[event(output = "RepeatedFavoriteViewPB")]
|
||||
ReadFavorites = 33,
|
||||
|
||||
#[event(input = "RepeatedViewIdPB")]
|
||||
|
Reference in New Issue
Block a user