File tree Expand file tree Collapse file tree 4 files changed +31
-17
lines changed
Expand file tree Collapse file tree 4 files changed +31
-17
lines changed Original file line number Diff line number Diff line change @@ -10,8 +10,8 @@ use dioxus::prelude::*;
1010use std:: rc:: Rc ;
1111
1212#[ component]
13- pub fn Mindmap ( ) -> Element {
14- let store = Store :: new ( ) ;
13+ pub fn Mindmap ( channel_id : String ) -> Element {
14+ let store = Store :: new ( channel_id ) ;
1515 let mut pane = store. pane ;
1616 let mut graph = store. graph ;
1717
Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ pub struct Connection {
1919}
2020
2121impl Connection {
22- pub fn new ( graph : Graph ) -> Self {
22+ pub fn new ( graph : Graph , channel_id : String ) -> Self {
2323 let doc = graph. get_doc ( ) ;
2424 let coroutine = use_coroutine ( move |mut rx : UnboundedReceiver < Message > | {
2525 let mut doc = doc;
Original file line number Diff line number Diff line change @@ -10,12 +10,12 @@ pub struct Store {
1010}
1111
1212impl Store {
13- pub fn new ( ) -> Self {
13+ pub fn new ( channel_id : String ) -> Self {
1414 let graph = Graph :: new ( ) ;
1515 Self {
1616 graph,
1717 pane : Pane :: new ( ) ,
18- connection : Connection :: new ( graph) ,
18+ connection : Connection :: new ( graph, channel_id ) ,
1919 }
2020 }
2121}
Original file line number Diff line number Diff line change @@ -21,27 +21,41 @@ pub enum Route {
2121#[ component]
2222fn Home ( ) -> Element {
2323 rsx ! {
24- document:: Style {
25- {
26- format!(
27- " @font-face {{ font-family: 'Roboto Light'; src: url({}) format('truetype');}} " ,
28- asset!( "/assets/fonts/Roboto-Light.ttf" ) ,
29- )
30- }
24+ default_style { }
25+ h1 {
26+ "Welcome! Create a mindmap by navigating to /channels/YOUR_CHANNEL_NAME"
3127 }
32- document:: Link { rel: "icon" , href: FAVICON }
33- document:: Link { rel: "stylesheet" , href: MAIN_CSS }
34- Mindmap { }
3528 }
3629}
3730
3831#[ component]
3932fn Channel ( channel_id : String ) -> Element {
40- rsx ! { "Channel page for channel with id: {channel_id}" }
33+ rsx ! {
34+ default_style { }
35+ Mindmap { channel_id: "root" }
36+ }
4137}
4238
4339#[ component]
4440fn NotFound ( any : String ) -> Element {
4541 // TODO: Return 404 status code
46- rsx ! { "Not found :(" }
42+ rsx ! {
43+ default_style { }
44+ p { "Not found :(" }
45+ }
46+ }
47+
48+ fn default_style ( ) -> Element {
49+ rsx ! {
50+ document:: Style {
51+ {
52+ format!(
53+ " @font-face {{ font-family: 'Roboto Light'; src: url({}) format('truetype');}} " ,
54+ asset!( "/assets/fonts/Roboto-Light.ttf" ) ,
55+ )
56+ }
57+ }
58+ document:: Link { rel: "icon" , href: FAVICON }
59+ document:: Link { rel: "stylesheet" , href: MAIN_CSS }
60+ }
4761}
You can’t perform that action at this time.
0 commit comments