Skip to content

Commit

Permalink
try temporary fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ppecheux committed Oct 18, 2022
1 parent 392f883 commit 619fca1
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 6 deletions.
1 change: 1 addition & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
BASENAME=
1 change: 1 addition & 0 deletions .gh-pages.env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
BASENAME=/sql-mermaid
3 changes: 2 additions & 1 deletion .github/workflows/continuous_deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ jobs:
version: 'latest'
- name: Build
run: |
cp .gh-pages.env .env
npm install
npm run build
- name: Package
Expand All @@ -38,6 +39,6 @@ jobs:
- name: Deploy demo
uses: JamesIves/[email protected]
with:
branch: main
branch: gh-pages
folder: dist
clean: true
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ web-sys = "0.3.60"
gloo-utils = "0.1.5"
clap = { version = "3.0.14", features = ["derive"] }
material-yew = { version = "0.2.0" , features = ["button", "textarea", "top-app-bar", "tabs", "top-app-bar-fixed"] }
dotenv_codegen = "0.15.0"

[dev-dependencies]
wasm-bindgen-test = "0.3.14"
Expand Down
12 changes: 7 additions & 5 deletions src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@ use crate::routes::{switch, AppRoute};
#[function_component(App)]
pub fn app() -> Html {
html! {
<BrowserRouter>
<Nav />
<Switch<AppRoute> render={Switch::render(switch)} />
</BrowserRouter>
}
// wait for yew 0.20
// <BrowserRouter basename={dotenv!("BASENAME")}>
<BrowserRouter>
<Nav />
<Switch<AppRoute> render={Switch::render(switch)} />
</BrowserRouter>
}
}
3 changes: 3 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#[macro_use]
extern crate dotenv_codegen;

pub mod app;
pub mod components;
pub mod routes;
Expand Down
5 changes: 5 additions & 0 deletions src/routes/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ use about::About;
use home::Home;

/// App routes
// wait yew 0.20 to remove pages base name
#[derive(Routable, Debug, Clone, PartialEq)]
pub enum AppRoute {
#[at("/about")]
Expand All @@ -17,12 +18,16 @@ pub enum AppRoute {
PageNotFound,
#[at("/")]
Home,
// remove when yew 0.20
#[at("/sql-mermaid")]
AlsoHome,
}

/// Switch app routes
pub fn switch(routes: &AppRoute) -> Html {
match routes.clone() {
AppRoute::Home => html! { <Home /> },
AppRoute::AlsoHome => html! { <Home /> },
AppRoute::About => html! { <About /> },
AppRoute::PageNotFound => html! { "Page not found" },
}
Expand Down

0 comments on commit 619fca1

Please sign in to comment.