2024-04-14 06:45:51 +02:00
|
|
|
use leptos::*;
|
2024-04-15 01:56:33 +02:00
|
|
|
use leptos_router::*;
|
2024-04-14 06:45:51 +02:00
|
|
|
|
|
|
|
use leptos_use::{use_cookie, utils::FromToStringCodec};
|
|
|
|
use upub_web::{
|
2024-04-15 01:56:33 +02:00
|
|
|
LoginBox, PostBox, Timeline
|
2024-04-14 06:45:51 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
_ = console_log::init_with_level(log::Level::Debug);
|
|
|
|
console_error_panic_hook::set_once();
|
|
|
|
let (cookie, set_cookie) = use_cookie::<String, FromToStringCodec>("token");
|
|
|
|
mount_to_body(
|
|
|
|
move || view! {
|
|
|
|
<nav class="w-100">
|
|
|
|
<p>
|
|
|
|
<code>μpub</code>
|
2024-04-15 01:56:33 +02:00
|
|
|
<small class="ml-1 mr-1" ><a class="clean" href="/web" >micro social network, federated</a></small>
|
2024-04-14 06:45:51 +02:00
|
|
|
/* TODO kinda jank with the float but whatever, will do for now */
|
|
|
|
<small style="float: right" ><a href="https://git.alemi.dev/upub.git" >src</a></small>
|
|
|
|
</p>
|
|
|
|
</nav>
|
|
|
|
<hr />
|
|
|
|
<div class="container">
|
|
|
|
<div class="two-col">
|
|
|
|
<div class="col-side">
|
|
|
|
<LoginBox
|
|
|
|
tx=set_cookie
|
|
|
|
rx=cookie
|
|
|
|
/>
|
|
|
|
<hr />
|
|
|
|
<PostBox token=cookie />
|
|
|
|
<hr />
|
|
|
|
</div>
|
|
|
|
<div class="col-main">
|
2024-04-15 01:56:33 +02:00
|
|
|
<Router>
|
|
|
|
<main>
|
|
|
|
<Routes>
|
|
|
|
<Route path="/" view=move || view! { <Timeline token=cookie /> } />
|
|
|
|
// <Route path="/user/:id" view=Actor />
|
|
|
|
// <Route path="/object/:id" view=Object />
|
|
|
|
</Routes>
|
|
|
|
</main>
|
|
|
|
</Router>
|
2024-04-14 06:45:51 +02:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
}
|
|
|
|
);
|
|
|
|
}
|