-
-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
20 changed files
with
124 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
pub(crate) mod home; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ mod controller; | |
mod router; | ||
mod schedule; | ||
mod service; | ||
mod view; | ||
|
||
use zino::prelude::*; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,42 @@ | ||
use crate::controller::home::Homepage; | ||
use crate::view::{ | ||
dataset::{Dataset, DatasetList, DatasetView}, | ||
home::Home, | ||
layout::Wrapper, | ||
}; | ||
use dioxus::prelude::*; | ||
use dioxus_router::prelude::*; | ||
use zino::prelude::*; | ||
|
||
#[derive(Clone, PartialEq, Eq, Routable)] | ||
#[rustfmt::skip] | ||
pub enum Route { | ||
#[route("/")] | ||
Homepage {}, | ||
#[layout(Wrapper)] | ||
#[route("/")] | ||
Home {}, | ||
#[nest("/dataset")] | ||
#[layout(Dataset)] | ||
#[route("/list")] | ||
DatasetList {}, | ||
#[route("/:id/view")] | ||
DatasetView { id: Uuid }, | ||
#[end_layout] | ||
#[end_nest] | ||
#[end_layout] | ||
#[route("/:..segments")] | ||
PageNotFound { segments: Vec<String> }, | ||
} | ||
|
||
impl Default for Route { | ||
fn default() -> Self { | ||
Self::Homepage {} | ||
Self::Home {} | ||
} | ||
} | ||
|
||
#[inline_props] | ||
fn PageNotFound(cx: Scope, segments: Vec<String>) -> Element { | ||
let path = segments.join("/"); | ||
render! { | ||
h1 { "Page not found" } | ||
p { "The page `{path}` you requested doesn't exist." } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
use crate::router::Route; | ||
use dioxus::prelude::*; | ||
use dioxus_router::prelude::*; | ||
use zino::prelude::*; | ||
|
||
pub fn Dataset(cx: Scope) -> Element { | ||
render! { | ||
h1 { "Datasets" } | ||
Outlet::<Route> {} | ||
} | ||
} | ||
|
||
pub fn DatasetList(cx: Scope) -> Element { | ||
render! { | ||
ul { | ||
li { | ||
Link { | ||
to: Route::DatasetView { id: Uuid::new_v4() }, | ||
"View the first dataset" | ||
} | ||
} | ||
li { | ||
Link { | ||
to: Route::DatasetView { id: Uuid::new_v4() }, | ||
"View the second dataset" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
#[inline_props] | ||
pub fn DatasetView(cx: Scope, id: Uuid) -> Element { | ||
render! { | ||
h2 { "Dataset ID: {id}"} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
use dioxus::prelude::*; | ||
|
||
pub fn Home(cx: Scope) -> Element { | ||
render! { | ||
div {} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
use crate::router::Route; | ||
use dioxus::prelude::*; | ||
use dioxus_router::prelude::*; | ||
|
||
pub fn Wrapper(cx: Scope) -> Element { | ||
render! { | ||
header { | ||
nav { | ||
ul { | ||
li { Link { to: Route::Home {}, "Home" } } | ||
li { Link { to: Route::DatasetList {}, "Datasets" } } | ||
} | ||
} | ||
} | ||
Outlet::<Route> {} | ||
footer {} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
pub(crate) mod dataset; | ||
pub(crate) mod home; | ||
pub(crate) mod layout; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters