#![expect( unreachable_pub, reason = "leptos' component macro generates this warning" )] #![expect( clippy::must_use_candidate, reason = "Can't add it to leptos' components" )] #![expect( unused_extern_crates, reason = "Deependency needed to inject the `js` feature into uuid" )] extern crate uuid; // All of them are only used in the `main.rs` and not in the `lib.rs` part of this crate. extern crate console_error_panic_hook; extern crate console_log; extern crate log; mod api; mod components; mod pages; use leptos::{ prelude::{AddAnyAttr, IntoView, component, provide_context, view}, tachys::dom::document, }; use leptos_meta::{Html, Meta, Title, provide_meta_context}; use leptos_router::{ components::{Route, Router, Routes}, path, }; use log::error; use reactive_stores::Store; use rocie_client::apis::configuration::Configuration; use crate::pages::{ associate_barcode::AssociateBarcode, buy::Buy, create_product::CreateProduct, create_product_parent::CreateProductParent, create_recipe::CreateRecipe, home::Home, inventory::Inventory, login::Login, not_found::NotFound, product::Product, products::Products, provision::Provision, recipe::Recipe, recipies::Recipies, units::Units, }; #[derive(Debug, Clone, Store)] pub struct ConfigState { config: Configuration, } #[component] #[expect(clippy::too_many_lines)] pub fn App() -> impl IntoView { // Provides context that manages stylesheets, titles, meta tags, etc. provide_meta_context(); let config = { let mut config = Configuration::new(); config.user_agent = Some("rocie-mobile".to_owned()); let document = document(); format!( "{}/api", document .query_selector("div#location-storage") .expect("This part is defined in the index.html") .expect("This part is really defined in the index.html") .get_attribute("location") .expect("This was set in the index.html") .trim_end_matches('/') ) .clone_into(&mut config.base_path); config }; provide_context(Store::new(ConfigState { config })); view! {