Skip to content

Commit 619fca1

Browse files
committed
try temporary fix
1 parent 392f883 commit 619fca1

7 files changed

Lines changed: 20 additions & 6 deletions

File tree

.env

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
BASENAME=

.gh-pages.env

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
BASENAME=/sql-mermaid

.github/workflows/continuous_deployment.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ jobs:
1616
version: 'latest'
1717
- name: Build
1818
run: |
19+
cp .gh-pages.env .env
1920
npm install
2021
npm run build
2122
- name: Package
@@ -38,6 +39,6 @@ jobs:
3839
- name: Deploy demo
3940
uses: JamesIves/github-pages-deploy-action@v4.2.2
4041
with:
41-
branch: main
42+
branch: gh-pages
4243
folder: dist
4344
clean: true

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ web-sys = "0.3.60"
2727
gloo-utils = "0.1.5"
2828
clap = { version = "3.0.14", features = ["derive"] }
2929
material-yew = { version = "0.2.0" , features = ["button", "textarea", "top-app-bar", "tabs", "top-app-bar-fixed"] }
30+
dotenv_codegen = "0.15.0"
3031

3132
[dev-dependencies]
3233
wasm-bindgen-test = "0.3.14"

src/app.rs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,11 @@ use crate::routes::{switch, AppRoute};
88
#[function_component(App)]
99
pub fn app() -> Html {
1010
html! {
11-
<BrowserRouter>
12-
<Nav />
13-
<Switch<AppRoute> render={Switch::render(switch)} />
14-
</BrowserRouter>
15-
}
11+
// wait for yew 0.20
12+
// <BrowserRouter basename={dotenv!("BASENAME")}>
13+
<BrowserRouter>
14+
<Nav />
15+
<Switch<AppRoute> render={Switch::render(switch)} />
16+
</BrowserRouter>
17+
}
1618
}

src/lib.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
#[macro_use]
2+
extern crate dotenv_codegen;
3+
14
pub mod app;
25
pub mod components;
36
pub mod routes;

src/routes/mod.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ use about::About;
88
use home::Home;
99

1010
/// App routes
11+
// wait yew 0.20 to remove pages base name
1112
#[derive(Routable, Debug, Clone, PartialEq)]
1213
pub enum AppRoute {
1314
#[at("/about")]
@@ -17,12 +18,16 @@ pub enum AppRoute {
1718
PageNotFound,
1819
#[at("/")]
1920
Home,
21+
// remove when yew 0.20
22+
#[at("/sql-mermaid")]
23+
AlsoHome,
2024
}
2125

2226
/// Switch app routes
2327
pub fn switch(routes: &AppRoute) -> Html {
2428
match routes.clone() {
2529
AppRoute::Home => html! { <Home /> },
30+
AppRoute::AlsoHome => html! { <Home /> },
2631
AppRoute::About => html! { <About /> },
2732
AppRoute::PageNotFound => html! { "Page not found" },
2833
}

0 commit comments

Comments
 (0)