Fix empty spaces on community page when not logged in

This commit is contained in:
Bnyro 2023-06-27 12:24:45 +02:00
parent 43aed85726
commit b857219be2
1 changed files with 25 additions and 30 deletions

View File

@ -79,48 +79,43 @@ impl SimpleComponent for CommunityPage {
set_text: &format!("{} subscribers", model.info.counts.subscribers), set_text: &format!("{} subscribers", model.info.counts.subscribers),
set_margin_end: 10, set_margin_end: 10,
}, },
if settings::get_current_account().jwt.is_some() {
gtk::Box {
set_orientation: gtk::Orientation::Horizontal,
match model.info.subscribed {
SubscribedType::Subscribed => {
gtk::Button {
set_label: "Unsubscribe",
connect_clicked => CommunityInput::ToggleSubscription,
}
}
SubscribedType::NotSubscribed => {
gtk::Button {
set_label: "Subscribe",
connect_clicked => CommunityInput::ToggleSubscription,
}
}
SubscribedType::Pending => {
gtk::Label {
set_label: "Subscription pending",
}
}
},
}
} else {
gtk::Box {}
},
gtk::Label { gtk::Label {
#[watch] #[watch]
set_text: &format!("{} posts, {} comments", model.info.counts.posts, model.info.counts.comments), set_text: &format!("{} posts, {} comments", model.info.counts.posts, model.info.counts.comments),
set_margin_start: 10, set_margin_start: 10,
}, },
},
if settings::get_current_account().jwt.is_some() { if settings::get_current_account().jwt.is_some() {
gtk::Box {
set_orientation: gtk::Orientation::Horizontal,
match model.info.subscribed {
SubscribedType::Subscribed => {
gtk::Button {
set_label: "Unsubscribe",
connect_clicked => CommunityInput::ToggleSubscription,
}
}
SubscribedType::NotSubscribed => {
gtk::Button {
set_label: "Subscribe",
connect_clicked => CommunityInput::ToggleSubscription,
}
}
SubscribedType::Pending => {
gtk::Label {
set_label: "Subscription pending",
}
}
},
gtk::Button { gtk::Button {
set_label: "Create post", set_label: "Create post",
set_margin_start: 10, set_margin_start: 10,
connect_clicked => CommunityInput::OpenCreatePostDialog, connect_clicked => CommunityInput::OpenCreatePostDialog,
} }
} else {
gtk::Box {}
} }
} else {
gtk::Box {}
}, },
gtk::Separator {}, gtk::Separator {},