This commit is contained in:
Adrian Wozniak 2020-03-31 11:36:39 +02:00
parent 1f382d9ac6
commit 4ecba98a7a
4 changed files with 39 additions and 4 deletions

View File

@ -64,6 +64,13 @@
box-shadow: 0 0 0 2px #fff; box-shadow: 0 0 0 2px #fff;
} }
#projectPage > #projectBoardFilters .styledButton {
margin-left: 6px;
}
#projectPage > #projectBoardLists {
}
@media (max-width: 1100px) { @media (max-width: 1100px) {
#projectPage { #projectPage {
padding: 25px 20px 50px calc(var(--appNavBarLeftWidth) + var(--secondarySideBarWidth) + 20px); padding: 25px 20px 50px calc(var(--appNavBarLeftWidth) + var(--secondarySideBarWidth) + 20px);

View File

@ -26,6 +26,7 @@ pub enum Msg {
ProjectTextFilterChanged(String), ProjectTextFilterChanged(String),
ProjectAvatarFilterChanged(UserId, AvatarFilterActive), ProjectAvatarFilterChanged(UserId, AvatarFilterActive),
ProjectToggleOnlyMy, ProjectToggleOnlyMy,
ProjectToggleRecentlyUpdated,
} }
fn update(msg: Msg, model: &mut model::Model, orders: &mut impl Orders<Msg>) { fn update(msg: Msg, model: &mut model::Model, orders: &mut impl Orders<Msg>) {

View File

@ -53,6 +53,7 @@ pub struct ProjectPage {
pub text_filter: String, pub text_filter: String,
pub active_avatar_filters: Vec<i32>, pub active_avatar_filters: Vec<i32>,
pub only_my_filter: bool, pub only_my_filter: bool,
pub recenlty_updated_filter: bool,
} }
#[derive(Serialize, Deserialize, Debug)] #[derive(Serialize, Deserialize, Debug)]
@ -89,6 +90,7 @@ impl Default for Model {
text_filter: "".to_string(), text_filter: "".to_string(),
active_avatar_filters: vec![], active_avatar_filters: vec![],
only_my_filter: false, only_my_filter: false,
recenlty_updated_filter: false,
}, },
} }
} }

View File

@ -40,12 +40,21 @@ pub fn update(msg: Msg, model: &mut crate::model::Model, orders: &mut impl Order
Msg::ProjectToggleOnlyMy => { Msg::ProjectToggleOnlyMy => {
model.project_page.only_my_filter = !model.project_page.only_my_filter; model.project_page.only_my_filter = !model.project_page.only_my_filter;
} }
Msg::ProjectToggleRecentlyUpdated => {
model.project_page.recenlty_updated_filter =
!model.project_page.recenlty_updated_filter;
}
_ => (), _ => (),
} }
} }
pub fn view(model: &Model) -> Node<Msg> { pub fn view(model: &Model) -> Node<Msg> {
let project_section = vec![breadcrumbs(model), header(), project_board_filters(model)]; let project_section = vec![
breadcrumbs(model),
header(),
project_board_filters(model),
project_board_lists(model),
];
inner_layout(model, "projectPage", project_section) inner_layout(model, "projectPage", project_section)
} }
@ -101,17 +110,29 @@ fn project_board_filters(model: &Model) -> Node<Msg> {
icon_only: false, icon_only: false,
disabled: false, disabled: false,
active: model.project_page.only_my_filter, active: model.project_page.only_my_filter,
text: Some("Only my".to_string()), text: Some("Only My Issues".to_string()),
icon: None, icon: None,
on_click: Some(mouse_ev(Ev::Click, |_| Msg::ProjectToggleOnlyMy)), on_click: Some(mouse_ev(Ev::Click, |_| Msg::ProjectToggleOnlyMy)),
} }
.into_node(); .into_node();
let recently_updated = StyledButton {
variant: Variant::Empty,
icon_only: false,
disabled: false,
active: model.project_page.only_my_filter,
text: Some("Recently Updated".to_string()),
icon: None,
on_click: Some(mouse_ev(Ev::Click, |_| Msg::ProjectToggleRecentlyUpdated)),
}
.into_node();
div![ div![
id!["projectBoardFilters"], id!["projectBoardFilters"],
search_input, search_input,
avatars_filters(model), avatars_filters(model),
only_my, only_my,
recently_updated,
] ]
} }
@ -146,3 +167,7 @@ fn avatars_filters(model: &Model) -> Node<Msg> {
div![id!["avatars"], avatars] div![id!["avatars"], avatars]
} }
fn project_board_lists(model: &Model) -> Node<Msg> {
div![id!["projectBoardLists"]]
}