Compare commits

..

15 Commits

Author SHA1 Message Date
Savanni D'Gerinel 709f8064bf Save real data to the database. Load data on app start. 2023-12-28 10:28:51 -05:00
Savanni D'Gerinel e3cdc70b2c Record data to the database
This isn't recording real data. It's basically discarding all
information from the weight edit field. But it is creating a record.
2023-12-28 09:51:41 -05:00
Savanni D'Gerinel e2866e6ab8 Create placeholders in the historical view for days that are unpopulated. 2023-12-27 21:49:44 -05:00
Savanni D'Gerinel 434815ef43 Fix tests 2023-12-27 21:07:16 -05:00
Savanni D'Gerinel ddb72d71d4 Switch to an the updated emseries record type 2023-12-27 19:43:27 -05:00
Savanni D'Gerinel eae24ae313 Be able to respond to blur events and potentially be able to record weight 2023-12-27 19:36:26 -05:00
Savanni D'Gerinel 3e681dbffd Develop a pattern to detect clicking outside of a focused child 2023-12-27 18:27:39 -05:00
Savanni D'Gerinel 9e0cdb50ea Create a widget that can show the weight view and edit modes 2023-12-27 18:27:38 -05:00
Savanni D'Gerinel e00d0bdf51 Completely switch daydetail to navigation and remove the modal 2023-12-27 18:25:11 -05:00
Savanni D'Gerinel 7b851ba051 Update to adwaita 1.4, and switch to the navigation page stack 2023-12-27 18:22:58 -05:00
Savanni D'Gerinel aecd188151 Open and style the day detail modal 2023-12-27 18:22:56 -05:00
Savanni D'Gerinel 55e9805975 Move the modal into components 2023-12-27 18:20:18 -05:00
Savanni D'Gerinel 60d72bdb9b Set up a database selector row that can dispatch operations when a database file gets selected 2023-12-27 18:19:49 -05:00
Savanni D'Gerinel b2cb7fddd5 Elaborate a little more on the welcome dialog 2023-12-27 18:19:15 -05:00
Savanni D'Gerinel 43516ac58e Start setting up an app modal 2023-12-27 18:19:13 -05:00
3 changed files with 19 additions and 19 deletions

View File

@ -23,7 +23,6 @@ use adw::prelude::*;
use async_channel::Sender;
use chrono::{FixedOffset, NaiveDate, TimeZone};
use dimensioned::si::{KG, M, S};
use emseries::{Record, RecordId};
use ft_core::{Steps, TimeDistance, TraxRecord, Weight};
use gio::resources_lookup_data;
use gtk::STYLE_PROVIDER_PRIORITY_USER;
@ -80,13 +79,20 @@ impl AppWindow {
let navigation = adw::NavigationView::new();
/*
let header = adw::HeaderBar::builder()
.title_widget(&gtk::Label::new(Some("FitnessTrax")))
.build();
*/
let layout = gtk::Box::builder()
.orientation(gtk::Orientation::Vertical)
.build();
let initial_view = View::Placeholder(PlaceholderView::new().upcast());
layout.append(&initial_view.widget());
// layout.append(&header);
layout.append(initial_view.widget());
let nav_layout = gtk::Box::new(gtk::Orientation::Vertical, 0);
nav_layout.append(&adw::HeaderBar::new());
@ -145,9 +151,9 @@ impl AppWindow {
// position.
fn swap_main(&self, view: View) {
let mut current_widget = self.current_view.borrow_mut();
self.layout.remove(&current_widget.widget());
self.layout.remove(&*current_widget.widget());
*current_widget = view;
self.layout.append(&current_widget.widget());
self.layout.append(&*current_widget.widget());
}
fn construct_view(&self, view: ViewName) -> View {

View File

@ -14,8 +14,6 @@ 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/>.
*/
use gtk::prelude::*;
mod historical_view;
pub use historical_view::HistoricalView;
@ -35,17 +33,17 @@ pub enum ViewName {
}
pub enum View {
Placeholder(PlaceholderView),
Welcome(WelcomeView),
Historical(HistoricalView),
Placeholder(gtk::Widget),
Welcome(gtk::Widget),
Historical(gtk::Widget),
}
impl View {
pub fn widget(&self) -> gtk::Widget {
pub fn widget<'a>(&'a self) -> &'a gtk::Widget {
match self {
View::Placeholder(widget) => widget.clone().upcast::<gtk::Widget>(),
View::Welcome(widget) => widget.clone().upcast::<gtk::Widget>(),
View::Historical(widget) => widget.clone().upcast::<gtk::Widget>(),
View::Placeholder(widget) => widget,
View::Welcome(widget) => widget,
View::Historical(widget) => widget,
}
}
}

View File

@ -30,12 +30,8 @@ pub struct Steps {
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct TimeDistance {
/// The precise time (and the relevant timezone) of the workout. One of the edge cases that I
/// account for is that a ride which occurred at 11pm on one day in one timezone would then
/// count as 1am on the next day if the user moves two timezones to the east. While technically
/// correct, for most users this would throw off many years of metrics in ways that can be very
/// hard to understand. Keeping the fixed offset means that we can have the most precise time
/// in the database, but we can still get a Naive Date from the DateTime, which will still read
/// as the original day.
/// account for is that a ride which occurred at 11pm in one timezone would then count as 1am
/// if one moved two timezones to the east.
pub datetime: DateTime<FixedOffset>,
/// The distance travelled. This is optional because such a workout makes sense even without
/// the distance.