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" <input class="w-100"
type="submit" type="submit"
class:hidden=move || !auth.get().present() 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" value="home timeline"
/> />
</a> </a>
<a href="/web/server" > <a href="/web/server" >
<input <input
class="w-100" 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" type="submit"
value="server timeline" value="server timeline"
/> />

View file

@ -43,6 +43,21 @@ fn main() {
</nav> </nav>
<hr class="sep" /> <hr class="sep" />
<div class="container mt-2 pt-2" > <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" ? <Router // TODO maybe set base="/web" ?
trailing_slash=TrailingSlash::Redirect trailing_slash=TrailingSlash::Redirect
fallback=move || view! { fallback=move || view! {
@ -59,21 +74,6 @@ fn main() {
{move || { {move || {
view! { view! {
<main> <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> <Routes>
<Route path="/web" view=About /> <Route path="/web" view=About />
@ -85,13 +85,13 @@ fn main() {
<Route path="/" view=move || view! { <Redirect path="/web" /> } /> <Route path="/" view=move || view! { <Redirect path="/web" /> } />
</Routes> </Routes>
</div>
</div>
</main> </main>
} }
}} }}
</Router> </Router>
</div> </div>
</div>
</div>
<footer> <footer>
<div> <div>
<hr class="sep" /> <hr class="sep" />