fix(web): just rebuild timeline on routing

basically don't delete draft when navigating
This commit is contained in:
əlemi 2024-04-17 06:51:21 +02:00
parent 562dc22320
commit 9ffd5b6c4e
Signed by: alemi
GPG key ID: A4895B84D311642C
2 changed files with 49 additions and 49 deletions

View file

@ -99,14 +99,14 @@ pub fn TimelineNavigation() -> impl IntoView {
<input class="w-100"
type="submit"
class:hidden=move || !auth.get().present()
class:active=move || use_location().pathname.get().ends_with("/home")
// class:active=move || use_location().pathname.get().ends_with("/home")
value="home timeline"
/>
</a>
<a href="/web/server" >
<input
class="w-100"
class:active=move || use_location().pathname.get().ends_with("/server")
// class:active=move || use_location().pathname.get().ends_with("/server")
type="submit"
value="server timeline"
/>

View file

@ -43,6 +43,21 @@ fn main() {
</nav>
<hr class="sep" />
<div class="container mt-2 pt-2" >
<div class="two-col" >
<div class="col-side sticky" class:hidden=move || menu.get() >
<LoginBox
token_tx=set_cookie
token=cookie
username_tx=set_username
username=username
home_tl=home_tl
/>
<hr class="mt-1 mb-1" />
<TimelineNavigation />
<hr class="mt-1 mb-1" />
<PostBox username=username />
</div>
<div class="col-main" class:w-100=move || menu.get() >
<Router // TODO maybe set base="/web" ?
trailing_slash=TrailingSlash::Redirect
fallback=move || view! {
@ -59,21 +74,6 @@ fn main() {
{move || {
view! {
<main>
<div class="two-col" >
<div class="col-side sticky" class:hidden=move || menu.get() >
<LoginBox
token_tx=set_cookie
token=cookie
username_tx=set_username
username=username
home_tl=home_tl
/>
<hr class="mt-1 mb-1" />
<TimelineNavigation />
<hr class="mt-1 mb-1" />
<PostBox username=username />
</div>
<div class="col-main" class:w-100=move || menu.get() >
<Routes>
<Route path="/web" view=About />
@ -85,13 +85,13 @@ fn main() {
<Route path="/" view=move || view! { <Redirect path="/web" /> } />
</Routes>
</div>
</div>
</main>
}
}}
</Router>
</div>
</div>
</div>
<footer>
<div>
<hr class="sep" />