fix(web): just rebuild timeline on routing
basically don't delete draft when navigating
This commit is contained in:
parent
562dc22320
commit
9ffd5b6c4e
2 changed files with 49 additions and 49 deletions
|
@ -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"
|
||||||
/>
|
/>
|
||||||
|
|
|
@ -43,54 +43,54 @@ fn main() {
|
||||||
</nav>
|
</nav>
|
||||||
<hr class="sep" />
|
<hr class="sep" />
|
||||||
<div class="container mt-2 pt-2" >
|
<div class="container mt-2 pt-2" >
|
||||||
<Router // TODO maybe set base="/web" ?
|
<div class="two-col" >
|
||||||
trailing_slash=TrailingSlash::Redirect
|
<div class="col-side sticky" class:hidden=move || menu.get() >
|
||||||
fallback=move || view! {
|
<LoginBox
|
||||||
<div class="center">
|
token_tx=set_cookie
|
||||||
<h3>nothing to see here!</h3>
|
token=cookie
|
||||||
<p><a href="/web"><button type="button">back to root</button></a></p>
|
username_tx=set_username
|
||||||
</div>
|
username=username
|
||||||
}.into_view()
|
home_tl=home_tl
|
||||||
>
|
/>
|
||||||
// TODO this is kind of ugly: the whole router gets rebuilt every time we log in/out
|
<hr class="mt-1 mb-1" />
|
||||||
// in a sense it's what we want: refreshing the home tl is main purpose, but also
|
<TimelineNavigation />
|
||||||
// server tl may contain stuff we can no longer see, or otherwise we may now be
|
<hr class="mt-1 mb-1" />
|
||||||
// entitled to see new posts. so while being ugly it's techically correct ig?
|
<PostBox username=username />
|
||||||
{move || {
|
</div>
|
||||||
view! {
|
<div class="col-main" class:w-100=move || menu.get() >
|
||||||
<main>
|
<Router // TODO maybe set base="/web" ?
|
||||||
<div class="two-col" >
|
trailing_slash=TrailingSlash::Redirect
|
||||||
<div class="col-side sticky" class:hidden=move || menu.get() >
|
fallback=move || view! {
|
||||||
<LoginBox
|
<div class="center">
|
||||||
token_tx=set_cookie
|
<h3>nothing to see here!</h3>
|
||||||
token=cookie
|
<p><a href="/web"><button type="button">back to root</button></a></p>
|
||||||
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 />
|
|
||||||
|
|
||||||
<Route path="/web/home" view=move || view! { <TimelinePage name="home" tl=home_tl /> } />
|
|
||||||
<Route path="/web/server" view=move || view! { <TimelinePage name="server" tl=server_tl /> } />
|
|
||||||
|
|
||||||
<Route path="/web/users/:id" view=UserPage />
|
|
||||||
<Route path="/web/objects/:id" view=ObjectPage />
|
|
||||||
|
|
||||||
<Route path="/" view=move || view! { <Redirect path="/web" /> } />
|
|
||||||
</Routes>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</main>
|
}.into_view()
|
||||||
}
|
>
|
||||||
}}
|
// TODO this is kind of ugly: the whole router gets rebuilt every time we log in/out
|
||||||
</Router>
|
// in a sense it's what we want: refreshing the home tl is main purpose, but also
|
||||||
|
// server tl may contain stuff we can no longer see, or otherwise we may now be
|
||||||
|
// entitled to see new posts. so while being ugly it's techically correct ig?
|
||||||
|
{move || {
|
||||||
|
view! {
|
||||||
|
<main>
|
||||||
|
<Routes>
|
||||||
|
<Route path="/web" view=About />
|
||||||
|
|
||||||
|
<Route path="/web/home" view=move || view! { <TimelinePage name="home" tl=home_tl /> } />
|
||||||
|
<Route path="/web/server" view=move || view! { <TimelinePage name="server" tl=server_tl /> } />
|
||||||
|
|
||||||
|
<Route path="/web/users/:id" view=UserPage />
|
||||||
|
<Route path="/web/objects/:id" view=ObjectPage />
|
||||||
|
|
||||||
|
<Route path="/" view=move || view! { <Redirect path="/web" /> } />
|
||||||
|
</Routes>
|
||||||
|
</main>
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
</Router>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<footer>
|
<footer>
|
||||||
<div>
|
<div>
|
||||||
|
|
Loading…
Reference in a new issue