From 2fdcb7c79e8333c0fa9c14e34da5eaebe96e32b4 Mon Sep 17 00:00:00 2001 From: Vidhu Kant Sharma Date: Wed, 30 Aug 2023 01:06:39 +0530 Subject: first commit --- src/app/mod.rs | 85 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) create mode 100644 src/app/mod.rs (limited to 'src/app/mod.rs') diff --git a/src/app/mod.rs b/src/app/mod.rs new file mode 100644 index 0000000..671aac6 --- /dev/null +++ b/src/app/mod.rs @@ -0,0 +1,85 @@ +/* openbills-web - Web client for Libre Billing Software + * Copyright (C) 2023 Vidhu Kant Sharma + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +mod home; +mod manage; + +use yew::prelude::*; +use yew_router::prelude::*; + +use crate::components::navbar; + +#[derive(Clone, Routable, PartialEq)] +pub enum Route { + #[at("/")] + Home, + + #[at("/manage")] + ManageMenu, + #[at("/manage/clients")] + ManageClients, + #[at("/manage/brands")] + ManageBrands, + #[at("/manage/items")] + ManageItems, + #[at("/manage/invoices")] + ManageInvoices, + + #[at("/invoice/new")] + NewInvoice, + #[at("/invoice/all")] + ViewInvoices, + #[at("/invoice/one")] + ViewInvoice, + #[at("/settings")] + Settings, + + #[not_found] + #[at("/404")] + NotFound, +} + +pub fn switch(routes: Route) -> Html { + match routes { + Route::Home => html! {}, + + Route::ManageMenu => html! {}, + Route::ManageClients => html! {

{ "Edit Clients" }

}, + Route::ManageBrands => html! {

{ "Edit Brands" }

}, + Route::ManageItems => html! {

{ "Edit Items" }

}, + Route::ManageInvoices => html! {

{ "Edit Invoices" }

}, + + Route::NewInvoice => html! {

{ "Create New Invoice" }

}, + Route::ViewInvoices => html! {

{ "View All Invoices" }

}, + Route::ViewInvoice => html! {

{ "View a Single Invoice" }

}, + Route::Settings => html! {

{ "Settings Page" }

}, + + Route::NotFound => html! {

{"404 Page Not Found"}

}, + } +} + +#[function_component(App)] +pub fn app() -> Html { + html! { + + +
+ render={switch} /> +
+
+ } +} -- cgit v1.2.3