feat: immersive page style on mobile (#5135)

This commit is contained in:
Lucas.Xu
2024-04-30 16:55:15 +08:00
committed by GitHub
parent 6d0598b101
commit 33802fa62d
109 changed files with 3643 additions and 348 deletions

View File

@ -57,6 +57,9 @@ pub struct ViewPB {
#[pb(index = 8)]
pub is_favorite: bool,
#[pb(index = 9, one_of)]
pub extra: Option<String>,
}
pub fn view_pb_without_child_views(view: View) -> ViewPB {
@ -69,6 +72,7 @@ pub fn view_pb_without_child_views(view: View) -> ViewPB {
layout: view.layout.into(),
icon: view.icon.clone().map(|icon| icon.into()),
is_favorite: view.is_favorite,
extra: view.extra,
}
}
@ -82,6 +86,7 @@ pub fn view_pb_without_child_views_from_arc(view: Arc<View>) -> ViewPB {
layout: view.layout.clone().into(),
icon: view.icon.clone().map(|icon| icon.into()),
is_favorite: view.is_favorite,
extra: view.extra.clone(),
}
}
@ -99,6 +104,7 @@ pub fn view_pb_with_child_views(view: Arc<View>, child_views: Vec<Arc<View>>) ->
layout: view.layout.clone().into(),
icon: view.icon.clone().map(|icon| icon.into()),
is_favorite: view.is_favorite,
extra: view.extra.clone(),
}
}
@ -353,6 +359,20 @@ pub struct UpdateViewPayloadPB {
#[pb(index = 6, one_of)]
pub is_favorite: Option<bool>,
#[pb(index = 7, one_of)]
// this value used to store the extra data with JSON format
// for document:
// - cover: { type: "", value: "" }
// - type: "0" represents normal color,
// "1" represents gradient color,
// "2" represents built-in image,
// "3" represents custom image,
// "4" represents local image,
// "5" represents unsplash image
// - line_height_layout: "small" or "normal" or "large"
// - font_layout: "small", or "normal", or "large"
pub extra: Option<String>,
}
#[derive(Clone, Debug)]
@ -363,6 +383,7 @@ pub struct UpdateViewParams {
pub thumbnail: Option<String>,
pub layout: Option<ViewLayout>,
pub is_favorite: Option<bool>,
pub extra: Option<String>,
}
impl TryInto<UpdateViewParams> for UpdateViewPayloadPB {
@ -390,6 +411,7 @@ impl TryInto<UpdateViewParams> for UpdateViewPayloadPB {
thumbnail,
is_favorite,
layout: self.layout.map(|ty| ty.into()),
extra: self.extra,
})
}
}

View File

@ -714,6 +714,7 @@ impl FolderManager {
.set_desc_if_not_none(params.desc)
.set_layout_if_not_none(params.layout)
.set_favorite_if_not_none(params.is_favorite)
.set_extra_if_not_none(params.extra)
.done()
})
.await
@ -1275,7 +1276,7 @@ pub(crate) fn get_workspace_private_view_pbs(workspace_id: &str, folder: &Folder
}
/// The MutexFolder is a wrapper of the [Folder] that is used to share the folder between different
/// threads.
/// threads.
#[derive(Clone, Default)]
pub struct MutexFolder(Arc<RwLock<Option<Folder>>>);
impl Deref for MutexFolder {

View File

@ -130,5 +130,6 @@ pub(crate) fn create_view(uid: i64, params: CreateViewParams, layout: ViewLayout
created_by: Some(uid),
last_edited_time: 0,
last_edited_by: Some(uid),
extra: None,
}
}