Completely switch daydetail to navigation and remove the modal
This commit is contained in:
parent
84fe6fbd8f
commit
5b8b612758
|
@ -14,30 +14,6 @@
|
|||
.welcome__footer {
|
||||
}
|
||||
|
||||
.modal {
|
||||
background-color: @dialog_bg_color;
|
||||
border-radius: 8px;
|
||||
margin: 64px;
|
||||
}
|
||||
|
||||
.modal__header {
|
||||
}
|
||||
|
||||
.modal__title {
|
||||
font-size: larger;
|
||||
padding: 8px;
|
||||
}
|
||||
|
||||
.modal__content {
|
||||
background-color: @view_bg_color;
|
||||
margin: 16px;
|
||||
}
|
||||
|
||||
.modal__row {
|
||||
margin: 8px 0px 8px 0px;
|
||||
padding: 8px;
|
||||
}
|
||||
|
||||
.historical {
|
||||
margin: 32px;
|
||||
border-radius: 8px;
|
||||
|
|
|
@ -16,7 +16,7 @@ You should have received a copy of the GNU General Public License along with Fit
|
|||
|
||||
use crate::{
|
||||
app::{AppInvocation, AppResponse},
|
||||
components::day_detail,
|
||||
components::DayDetail,
|
||||
views::{HistoricalView, PlaceholderView, View, ViewName, WelcomeView},
|
||||
};
|
||||
use adw::prelude::*;
|
||||
|
@ -85,7 +85,6 @@ impl AppWindow {
|
|||
|
||||
let initial_view = View::Placeholder(PlaceholderView::new().upcast());
|
||||
|
||||
// layout.append(&header);
|
||||
layout.append(&initial_view.widget());
|
||||
|
||||
let nav_layout = gtk::Box::new(gtk::Orientation::Vertical, 0);
|
||||
|
@ -202,7 +201,7 @@ impl AppWindow {
|
|||
Rc::new(move |date, records| {
|
||||
let layout = gtk::Box::new(gtk::Orientation::Vertical, 0);
|
||||
layout.append(&adw::HeaderBar::new());
|
||||
layout.append(&day_detail(date, records));
|
||||
layout.append(&DayDetail::new(date, records));
|
||||
let page = &adw::NavigationPage::builder()
|
||||
.title(date.format("%Y-%m-%d").to_string())
|
||||
.child(&layout)
|
||||
|
|
|
@ -85,10 +85,16 @@ impl DaySummary {
|
|||
self.append(&label);
|
||||
*self.imp().weight.borrow_mut() = Some(label);
|
||||
}
|
||||
|
||||
self.append(
|
||||
>k::Label::builder()
|
||||
.halign(gtk::Align::Start)
|
||||
.label("15km of biking in 60 minutes")
|
||||
.build(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
pub struct DayDetailPrivate {
|
||||
date: gtk::Label,
|
||||
weight: RefCell<Option<gtk::Label>>,
|
||||
|
@ -121,39 +127,27 @@ glib::wrapper! {
|
|||
}
|
||||
|
||||
impl DayDetail {
|
||||
pub fn new() -> Self {
|
||||
pub fn new(date: chrono::NaiveDate, records: Vec<TraxRecord>) -> Self {
|
||||
let s: Self = Object::builder().build();
|
||||
s.set_orientation(gtk::Orientation::Vertical);
|
||||
s.set_css_classes(&["modal"]);
|
||||
|
||||
s.append(>k::Label::new(Some("abcdefg")));
|
||||
records.into_iter().for_each(|record| {
|
||||
let record_view = match record {
|
||||
TraxRecord::BikeRide(_) => gtk::Label::new(Some("BikeRide")),
|
||||
TraxRecord::Row(_) => gtk::Label::new(Some("Row")),
|
||||
TraxRecord::Run(_) => gtk::Label::new(Some("Run")),
|
||||
TraxRecord::Steps(_) => gtk::Label::new(Some("Steps")),
|
||||
TraxRecord::Swim(_) => gtk::Label::new(Some("Swim")),
|
||||
TraxRecord::Walk(_) => gtk::Label::new(Some("Walk")),
|
||||
TraxRecord::Weight(_) => gtk::Label::new(Some("Weight")),
|
||||
};
|
||||
|
||||
record_view.add_css_class("day-detail");
|
||||
record_view.set_halign(gtk::Align::Start);
|
||||
|
||||
s.append(&record_view);
|
||||
});
|
||||
|
||||
s
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
pub fn day_detail(date: chrono::NaiveDate, records: Vec<TraxRecord>) -> gtk::Widget {
|
||||
let content = gtk::Box::builder()
|
||||
.orientation(gtk::Orientation::Vertical)
|
||||
.build();
|
||||
|
||||
records.into_iter().for_each(|record| {
|
||||
let record_view = match record {
|
||||
TraxRecord::BikeRide(_) => gtk::Label::new(Some("BikeRide")),
|
||||
TraxRecord::Row(_) => gtk::Label::new(Some("Row")),
|
||||
TraxRecord::Run(_) => gtk::Label::new(Some("Run")),
|
||||
TraxRecord::Steps(_) => gtk::Label::new(Some("Steps")),
|
||||
TraxRecord::Swim(_) => gtk::Label::new(Some("Swim")),
|
||||
TraxRecord::Walk(_) => gtk::Label::new(Some("Walk")),
|
||||
TraxRecord::Weight(_) => gtk::Label::new(Some("Weight")),
|
||||
};
|
||||
|
||||
record_view.add_css_class("day-detail");
|
||||
record_view.set_halign(gtk::Align::Start);
|
||||
|
||||
content.append(&record_view);
|
||||
});
|
||||
|
||||
content.upcast()
|
||||
}
|
||||
|
|
|
@ -14,13 +14,13 @@ General Public License for more details.
|
|||
You should have received a copy of the GNU General Public License along with FitnessTrax. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
mod day;
|
||||
pub use day::{DayDetail, DaySummary};
|
||||
|
||||
use glib::Object;
|
||||
use gtk::{prelude::*, subclass::prelude::*};
|
||||
use std::{cell::RefCell, path::PathBuf, rc::Rc};
|
||||
|
||||
mod day;
|
||||
pub use day::{day_detail, DaySummary};
|
||||
|
||||
pub struct FileChooserRowPrivate {
|
||||
path: RefCell<Option<PathBuf>>,
|
||||
label: gtk::Label,
|
||||
|
|
Loading…
Reference in New Issue