-
Notifications
You must be signed in to change notification settings - Fork 2
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
19 changed files
with
169 additions
and
437 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,51 @@ | ||
use hikari_boot::register_routes; | ||
|
||
register_routes!( | ||
app, | ||
crate::utils::routes::Route, | ||
crate::utils::routes::switch, | ||
crate::utils::contexts::app_props::AppPageProps, | ||
crate::utils::contexts::app_props::AppPropsContextShell, | ||
crate::utils::contexts::app_states::AppStatesContextShell | ||
); | ||
|
||
pub use app::{App, AppProps, ServerApp}; | ||
use serde::{Deserialize, Serialize}; | ||
|
||
use yew::prelude::*; | ||
use yew_router::prelude::*; | ||
|
||
use crate::pages::*; | ||
use hikari_boot::{DeclType, DeriveApplication, DeriveRoutes, RoutesOutsideProps}; | ||
|
||
use self::_HikariContextShellProps::states; | ||
|
||
#[derive(PartialEq, Clone, Debug, DeriveRoutes, Routable)] | ||
pub enum Routes { | ||
#[at("/")] | ||
#[component(Portal)] | ||
Portal, | ||
|
||
#[at("/t/:id")] | ||
#[component(Thread)] | ||
Thread { id: String }, | ||
|
||
#[at("/u/:id")] | ||
#[component(Personal)] | ||
Personal { id: String }, | ||
|
||
#[not_found] | ||
#[at("/404")] | ||
#[component(NotFound)] | ||
NotFound, | ||
} | ||
|
||
#[derive(PartialEq, Clone, Debug, Serialize, Deserialize)] | ||
pub struct AppStates { | ||
pub user: String, | ||
} | ||
|
||
#[derive(Clone, Debug, DeriveApplication)] | ||
pub struct App; | ||
|
||
impl DeclType for App { | ||
type Routes = Routes; | ||
type AppStates = AppStates; | ||
|
||
fn decl_render_outside(props: &RoutesOutsideProps) -> yew::Html { | ||
yew::html! { | ||
<> | ||
<h1>{"Hikari DEMO"}</h1> | ||
{props.children.clone()} | ||
</> | ||
} | ||
} | ||
} |
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,6 +1,5 @@ | ||
pub mod app; | ||
pub mod pages; | ||
pub mod utils; | ||
|
||
#[cfg(target_arch = "wasm32")] | ||
mod web_entry; | ||
|
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,9 +1,9 @@ | ||
mod page_not_found; | ||
mod not_found; | ||
mod personal; | ||
mod portal; | ||
mod thread; | ||
|
||
pub use page_not_found::PageNotFound; | ||
pub use not_found::NotFound; | ||
pub use personal::Personal; | ||
pub use portal::Portal; | ||
pub use thread::Thread; |
2 changes: 1 addition & 1 deletion
2
examples/web/src/pages/page_not_found.rs → examples/web/src/pages/not_found.rs
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 was deleted.
Oops, something went wrong.
Oops, something went wrong.