This commit is contained in:
Felix Ableitner 2024-10-02 14:35:32 +02:00
parent bb892571cb
commit 3e1d2a1d4a
19 changed files with 689 additions and 673 deletions

View File

@ -48,12 +48,16 @@ pub fn ArticleNav(article: Resource<Option<String>, ArticleView>) -> impl IntoVi
}> }>
<A href=format!("{article_link}/edit")>"Edit"</A> <A href=format!("{article_link}/edit")>"Edit"</A>
</Show> </Show>
<Show when=move || global_state.with(|state| state.my_profile.is_some())> <Show when=move || {
global_state.with(|state| state.my_profile.is_some())
}>
<A href=format!("{article_link_}/actions")>"Actions"</A> <A href=format!("{article_link_}/actions")>"Actions"</A>
{instance {instance
.get() .get()
.map(|i| { .map(|i| {
view! { <InstanceFollowButton instance=i.instance.clone()/> } view! {
<InstanceFollowButton instance=i.instance.clone() />
}
})} })}
</Show> </Show>

View File

@ -63,8 +63,7 @@ pub fn CreateArticle() -> impl IntoView {
let val = event_target_value(&ev); let val = event_target_value(&ev);
set_text.update(|p| *p = val); set_text.update(|p| *p = val);
} }
> ></textarea>
</textarea>
<div> <div>
<a href="https://commonmark.org/help/" target="blank_"> <a href="https://commonmark.org/help/" target="blank_">
Markdown Markdown
@ -90,7 +89,9 @@ pub fn CreateArticle() -> impl IntoView {
<button <button
prop:disabled=move || button_is_disabled.get() prop:disabled=move || button_is_disabled.get()
on:click=move |_| submit_action.dispatch((title.get(), text.get(), summary.get())) on:click=move |_| {
submit_action.dispatch((title.get(), text.get(), summary.get()))
}
> >
Submit Submit
</button> </button>

View File

@ -25,7 +25,9 @@ pub fn ReadArticle() -> impl IntoView {
view! { view! {
<div class="item-view"> <div class="item-view">
<h1>{article_title(&article.article)}</h1> <h1>{article_title(&article.article)}</h1>
<div inner_html=parser.parse(&article.article.text).render()></div> <div inner_html=parser
.parse(&article.article.text)
.render()></div>
</div> </div>
} }
}) })

View File

@ -18,10 +18,16 @@ pub fn Conflicts() -> impl IntoView {
.map(|c| { .map(|c| {
c.into_iter() c.into_iter()
.map(|c| { .map(|c| {
let link = format!("{}/edit/{}", article_link(&c.article), c.id); let link = format!(
"{}/edit/{}",
article_link(&c.article),
c.id,
);
view! { view! {
<li> <li>
<a href=link>{article_title(&c.article)} " - " {c.summary}</a> <a href=link>
{article_title(&c.article)} " - " {c.summary}
</a>
</li> </li>
} }
}) })

View File

@ -31,10 +31,14 @@ pub fn InstanceDetails() -> impl IntoView {
view! { view! {
<h1>{instance.domain}</h1> <h1>{instance.domain}</h1>
<Show when=move || global_state.with(|state| state.my_profile.is_some())> <Show when=move || {
global_state.with(|state| state.my_profile.is_some())
}>
<InstanceFollowButton instance=instance_.clone() /> <InstanceFollowButton instance=instance_.clone() />
</Show> </Show>
<p>Follow the instance so that new edits are federated to your instance.</p> <p>
Follow the instance so that new edits are federated to your instance.
</p>
<p> <p>
"TODO: show a list of articles from the instance. For now you can use the " "TODO: show a list of articles from the instance. For now you can use the "
<a href="/article/list">Article list</a>. <a href="/article/list">Article list</a>.

View File

@ -93,8 +93,7 @@ pub fn Search() -> impl IntoView {
] ]
} else { } else {
vec![] vec![]
}} }} // render articles from resolve/search
// render articles from resolve/search
{search_results {search_results
.articles .articles
.iter() .iter()