commit 0adbfdf84cd5836b280edd2b6f97acba5784d30b Author: aOK Date: Fri Feb 16 22:34:34 2024 +0300 first commi diff --git a/nimanyatta_v001/.gitignore b/nimanyatta_v001/.gitignore new file mode 100644 index 0000000..48c3ca4 --- /dev/null +++ b/nimanyatta_v001/.gitignore @@ -0,0 +1,3 @@ +/dist/ +/target/ +/Cargo.lock diff --git a/nimanyatta_v001/Cargo.toml b/nimanyatta_v001/Cargo.toml new file mode 100644 index 0000000..16a46d3 --- /dev/null +++ b/nimanyatta_v001/Cargo.toml @@ -0,0 +1,7 @@ +[package] +name = "nimanyatta_v001" +version = "0.1.0" +edition = "2021" + +[dependencies] +makepad-widgets = { git = "https://github.com/makepad/makepad", branch = "rik" } diff --git a/nimanyatta_v001/README.md b/nimanyatta_v001/README.md new file mode 100644 index 0000000..e69de29 diff --git a/nimanyatta_v001/resources/icons/add_contact.svg b/nimanyatta_v001/resources/icons/add_contact.svg new file mode 100644 index 0000000..f9508de --- /dev/null +++ b/nimanyatta_v001/resources/icons/add_contact.svg @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/nimanyatta_v001/resources/icons/arrow_back.svg b/nimanyatta_v001/resources/icons/arrow_back.svg new file mode 100644 index 0000000..1be18e9 --- /dev/null +++ b/nimanyatta_v001/resources/icons/arrow_back.svg @@ -0,0 +1,8 @@ + + + + + \ No newline at end of file diff --git a/nimanyatta_v001/resources/icons/arrow_back_FILL0_wght400_GRAD0_opsz24.svg b/nimanyatta_v001/resources/icons/arrow_back_FILL0_wght400_GRAD0_opsz24.svg new file mode 100644 index 0000000..07cd30b --- /dev/null +++ b/nimanyatta_v001/resources/icons/arrow_back_FILL0_wght400_GRAD0_opsz24.svg @@ -0,0 +1,11 @@ + + + + + + + + \ No newline at end of file diff --git a/nimanyatta_v001/resources/icons/back.svg b/nimanyatta_v001/resources/icons/back.svg new file mode 100644 index 0000000..235235b --- /dev/null +++ b/nimanyatta_v001/resources/icons/back.svg @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/nimanyatta_v001/resources/icons/chat.svg b/nimanyatta_v001/resources/icons/chat.svg new file mode 100644 index 0000000..afec143 --- /dev/null +++ b/nimanyatta_v001/resources/icons/chat.svg @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/nimanyatta_v001/resources/icons/contacts.svg b/nimanyatta_v001/resources/icons/contacts.svg new file mode 100644 index 0000000..0109396 --- /dev/null +++ b/nimanyatta_v001/resources/icons/contacts.svg @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/nimanyatta_v001/resources/icons/discover.svg b/nimanyatta_v001/resources/icons/discover.svg new file mode 100644 index 0000000..32831e9 --- /dev/null +++ b/nimanyatta_v001/resources/icons/discover.svg @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/nimanyatta_v001/resources/icons/icon_home.svg b/nimanyatta_v001/resources/icons/icon_home.svg new file mode 100644 index 0000000..65ae1f8 --- /dev/null +++ b/nimanyatta_v001/resources/icons/icon_home.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/nimanyatta_v001/resources/icons/me.svg b/nimanyatta_v001/resources/icons/me.svg new file mode 100644 index 0000000..f9508de --- /dev/null +++ b/nimanyatta_v001/resources/icons/me.svg @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/nimanyatta_v001/resources/icons/menu.svg b/nimanyatta_v001/resources/icons/menu.svg new file mode 100644 index 0000000..8d7f4ba --- /dev/null +++ b/nimanyatta_v001/resources/icons/menu.svg @@ -0,0 +1 @@ + ic_fluent_add_circle_28_regular Created with Sketch. \ No newline at end of file diff --git a/nimanyatta_v001/resources/icons/money.svg b/nimanyatta_v001/resources/icons/money.svg new file mode 100644 index 0000000..f5edd73 --- /dev/null +++ b/nimanyatta_v001/resources/icons/money.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/nimanyatta_v001/resources/icons/navbar_icons/phone.svg b/nimanyatta_v001/resources/icons/navbar_icons/phone.svg new file mode 100644 index 0000000..892830f --- /dev/null +++ b/nimanyatta_v001/resources/icons/navbar_icons/phone.svg @@ -0,0 +1,6 @@ + + + + + diff --git a/nimanyatta_v001/resources/icons/scan.svg b/nimanyatta_v001/resources/icons/scan.svg new file mode 100644 index 0000000..d1f3c12 --- /dev/null +++ b/nimanyatta_v001/resources/icons/scan.svg @@ -0,0 +1,7 @@ + + + + + + + diff --git a/nimanyatta_v001/resources/icons/search.svg b/nimanyatta_v001/resources/icons/search.svg new file mode 100644 index 0000000..52f7f3f --- /dev/null +++ b/nimanyatta_v001/resources/icons/search.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/nimanyatta_v001/resources/makepad.png b/nimanyatta_v001/resources/makepad.png new file mode 100644 index 0000000..052f301 Binary files /dev/null and b/nimanyatta_v001/resources/makepad.png differ diff --git a/nimanyatta_v001/resources/makepad.svg b/nimanyatta_v001/resources/makepad.svg new file mode 100644 index 0000000..5a2c8ef --- /dev/null +++ b/nimanyatta_v001/resources/makepad.svg @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/nimanyatta_v001/resources/me.svg b/nimanyatta_v001/resources/me.svg new file mode 100644 index 0000000..f9508de --- /dev/null +++ b/nimanyatta_v001/resources/me.svg @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/nimanyatta_v001/src/app.rs b/nimanyatta_v001/src/app.rs new file mode 100644 index 0000000..e08abca --- /dev/null +++ b/nimanyatta_v001/src/app.rs @@ -0,0 +1,298 @@ +use makepad_widgets::*; + +live_design! { + + import makepad_draw::shader::std::*; + import makepad_widgets::base::*; + import makepad_widgets::theme_desktop_dark::*; + + import crate::home::home_screen::HomeScreen; + import crate::default_choice::default_choice_screen::DefaultChoiceScreen; + import crate::two::two_screen::TwoScreen; + import crate::three::three_screen::ThreeScreen; + import crate::four::four_screen::FourScreen; + import crate::five::five_screen::FiveScreen; + import crate::shared::styles::*; + + REGULAR_TEXT = { + font_size: (12), + font: {path: dep("crate://makepad-widgets/resources/GoNotoKurrent-Regular.ttf")} + } + ICON_CHAT = dep("crate://self/resources/icons/chat.svg") + PHONE_CHAT = dep("crate://self/resources/icons/chat.svg") + + AppTab = { + width: Fit, + height: Fill, + flow: Right, + align: {x: 0.0, y: 0.0} + margin: {} + padding: {} + // color: #000 + draw_radio: { + radio_type: Tab, + color_active: #fff, + color_inactive: #fff, + } + draw_text: { + color_selected: #000, //#0b0, + color_unselected: #000, + color_unselected_hover: #111, + text_style: {} + } + } + App = {{App}} { + ui: { + caption_bar = { margin: {left: -100}, visible: true, caption_label = {label = {text: "NiManyatta"}} }, + + body = { + show_bg: true + flow: Down, + spacing: 20, + align: { + x: 0.5, + y: 1.0 + }, + width: Fill, + height: Fill + + draw_bg: { + fn pixel(self) -> vec4 { + return mix(#3, #1, self.pos.y); + } + } + navigation = { + root_view = { + width: Fill, + height: Fill, + padding: 0, align: {x: 1, y: 0.0}, spacing: 0., flow: Down + mobile_menu = { + width: Fill, + height: 80, + // flow: Down, + show_bg: true + spacing: 0.0, padding: 0 + draw_bg: { + instance radius: 0.0, + instance border_width: 0.0, + instance border_color: #000, + color: #fff + } + + mobile_modes = { + + home_tab = { + flow: Right, + align: {x: 0.0, y: 0.5} + animator: {selected = {default: on}} + label: "" + draw_icon: { + svg_file: (ICON_CHAT), + fn get_color(self) -> vec4 { + return mix( + #000, + #016def,//#0b0, + self.selected + ) + } + } + width: Fill, + icon_walk: {width: 20, height: 20} + flow: Right, spacing: 5.0, align: {x: 0.2, y: 0.5} + } + two_tab = { + flow: Right, + align: {x: 0.0, y: 0.5} + animator: {selected = {default: on}} + label: "2" + draw_icon: { + svg_file: (ICON_CHAT), + fn get_color(self) -> vec4 { + return mix( + #000, + #016def,//#0b0, + self.selected + ) + } + } + width: Fill, + icon_walk: {width: 20, height: 20} + flow: Down, spacing: 5.0, align: {x: 0.5, y: 0.5} + } + three_tab = { + flow: Right, + align: {x: 0.0, y: 0.5} + animator: {selected = {default: on}} + label: "3" + draw_icon: { + svg_file: (ICON_CHAT), + fn get_color(self) -> vec4 { + return mix( + #000, + #016def,//#0b0, + self.selected + ) + } + } + width: Fill, + icon_walk: {width: 20, height: 20} + flow: Down, spacing: 5.0, align: {x: 0.5, y: 0.5} + } + four_tab = { + flow: Right, + align: {x: 0.0, y: 0.5} + animator: {selected = {default: on}} + label: "4" + draw_icon: { + svg_file: (ICON_CHAT), + fn get_color(self) -> vec4 { + return mix( + #000, + #016def,//#0b0, + self.selected + ) + } + } + width: Fill, + icon_walk: {width: 20, height: 20} + flow: Down, spacing: 5.0, align: {x: 0.5, y: 0.5} + } + five_tab = { + flow: Right, + align: {x: 0.0, y: 0.5} + animator: {selected = {default: on}} + label: "" + draw_icon: { + svg_file: (PHONE_CHAT), + fn get_color(self) -> vec4 { + return mix( + #000, + #016def,//#0b0, + self.selected + ) + } + } + width: Fill, + icon_walk: {width: 20, height: 20} + flow: Right, spacing: 5.0, align: {x: 0.8, y: 0.5} + } + } + + } + application_pages = { + margin: 0.0, + padding: 0.0 + + home_frame = { visible: true } + kimanyatta_frame = {visible: false} + insurance_frame = {visible: false} + matatu_frame = {visible: false} + contactus_frame = {visible: false} + } + } + + default_choices_stack_view = { //default_choices_stack_view + header = { + content = { + title_container = { + title = { + text: "Help Me Choose" + } + } + } + } + body = { + {} + } + } + } + } + } + } +} + +app_main!(App); + +#[derive(Live)] +pub struct App { + #[live] + ui: WidgetRef, +} + +impl LiveRegister for App { + fn live_register(cx: &mut Cx) { + crate::makepad_widgets::live_design(cx); + crate::home::home_screen::live_design(cx); + crate::default_choice::default_choice_screen::live_design(cx); + crate::two::two_screen::live_design(cx); + crate::three::three_screen::live_design(cx); + crate::four::four_screen::live_design(cx); + crate::five::five_screen::live_design(cx); + + crate::shared::styles::live_design(cx); + crate::shared::custom_button::live_design(cx); + } +} + +impl LiveHook for App { + // fn after_new_from_doc(&mut self, _cx: &mut Cx) { + // // self.init_navigation_destinations(); + // } + fn after_new_from_doc(&mut self, _cx: &mut Cx) { + println!("after_new_from_doc(): starting some kind of a loop"); + // crate::sliding_sync::start_matrix_tokio().unwrap(); + } +} +impl MatchEvent for App { + fn handle_startup(&mut self, _cx: &mut Cx) { + log!("App::handle_startup(): starting nigig sdk loop"); + // crate::sliding_sync::start_matrix_tokio().unwrap(); + } + fn handle_shutdown(&mut self, _cx: &mut Cx) { + log!("App::handle_shutdown()"); + } + fn handle_pause(&mut self, _cx: &mut Cx) { + log!("App::handle_pause()"); + } + fn handle_resume(&mut self, _cx: &mut Cx) { + log!("App::handle_resume()"); + } + fn handle_app_got_focus(&mut self, _cx: &mut Cx) { + log!("App::handle_app_got_focus()"); + } + fn handle_app_lost_focus(&mut self, _cx: &mut Cx) { + log!("App::handle_app_lost_focus()"); + } + fn handle_actions(&mut self, cx: &mut Cx, actions: &Actions) { + self.ui + .radio_button_set(ids!( + mobile_modes.home_tab, + mobile_modes.two_tab, + mobile_modes.three_tab, + mobile_modes.four_tab, + mobile_modes.five_tab, + )) + .selected_to_visible( + cx, + &self.ui, + &actions, + ids!( + application_pages.home_frame, + application_pages.two_frame, + application_pages.three_frame, + application_pages.four_frame, + application_pages.five_frame, + ), + ); + + let mut navigation = self.ui.stack_navigation(id!(navigation)); + navigation.handle_stack_view_actions(cx, &actions); + } +} + +impl AppMain for App { + fn handle_event(&mut self, cx: &mut Cx, event: &Event) { + self.match_event(cx, event); + self.ui.handle_event(cx, event, &mut Scope::empty()); + } +} diff --git a/nimanyatta_v001/src/default_choice/default_choice_screen.rs b/nimanyatta_v001/src/default_choice/default_choice_screen.rs new file mode 100644 index 0000000..cd84f01 --- /dev/null +++ b/nimanyatta_v001/src/default_choice/default_choice_screen.rs @@ -0,0 +1,72 @@ +use makepad_widgets::widget::WidgetCache; +use makepad_widgets::*; +use std::collections::HashMap; + +// use crate::shared::steps::StepsNavSetWidgetExt; + +live_design! { + import makepad_draw::shader::std::*; + import makepad_widgets::base::*; + import makepad_widgets::theme_desktop_dark::*; + + import crate::shared::styles::*; + import crate::shared::custom_button::CustomButton; + + DefaultChoiceScreen = { + width: Fill, height: Fill flow: Down + { + flow: Down, + align: {x: 0.5, y: 0.3} + { + flow: Down, + spacing: (SSPACING_2), + align: {x: 0.5, y: 0.5} + label =