2018-12-06 18:54:16 +01:00
|
|
|
@use plume_models::instance::Instance;
|
|
|
|
@use plume_models::posts::Post;
|
2019-10-07 19:08:20 +02:00
|
|
|
@use plume_models::timeline::Timeline;
|
2020-01-21 07:02:03 +01:00
|
|
|
@use crate::templates::{base, partials::*};
|
|
|
|
@use crate::template_utils::*;
|
|
|
|
@use crate::routes::*;
|
2018-12-06 18:54:16 +01:00
|
|
|
|
2019-10-07 19:08:20 +02:00
|
|
|
@(ctx: BaseContext, instance: Instance, n_users: i64, n_articles: i64, all_tl: Vec<(Timeline, Vec<Post>)>)
|
2018-12-06 18:54:16 +01:00
|
|
|
|
2019-02-02 15:23:50 +01:00
|
|
|
@:base(ctx, instance.name.clone(), {}, {}, {
|
2019-03-25 08:57:26 +01:00
|
|
|
<h1>@i18n!(ctx.1, "Welcome to {}"; instance.name.as_str())</h1>
|
2018-12-06 18:54:16 +01:00
|
|
|
|
2019-10-07 19:08:20 +02:00
|
|
|
@tabs(&vec![(format!("{}", uri!(instance::index)), i18n!(ctx.1, "Latest articles"), true)]
|
|
|
|
.into_iter().chain(all_tl.clone()
|
|
|
|
.into_iter()
|
|
|
|
.map(|(tl, _)| {
|
|
|
|
let url = format!("{}", uri!(timelines::details: id = tl.id, page = _));
|
|
|
|
(url, i18n_timeline_name(ctx.1, &tl.name), false)
|
|
|
|
})
|
|
|
|
).collect::<Vec<_>>()
|
|
|
|
)
|
2018-12-06 18:54:16 +01:00
|
|
|
|
2019-10-07 19:08:20 +02:00
|
|
|
@for (tl, articles) in all_tl {
|
|
|
|
@if !articles.is_empty() {
|
|
|
|
<div class="h-feed">
|
|
|
|
<h2 dir="auto">
|
|
|
|
<span class="p-name">@i18n_timeline_name(ctx.1, &tl.name)</span>
|
|
|
|
—
|
|
|
|
<a href="@uri!(timelines::details: id = tl.id, page = _)">@i18n!(ctx.1, "View all")</a>
|
|
|
|
</h2>
|
|
|
|
<div class="cards">
|
|
|
|
@for article in articles {
|
|
|
|
@:post_card(ctx, article)
|
|
|
|
}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
}
|
2018-12-06 18:54:16 +01:00
|
|
|
}
|
2019-10-07 19:08:20 +02:00
|
|
|
|
|
|
|
@:instance_description(ctx, instance, n_users, n_articles)
|
2018-12-06 18:54:16 +01:00
|
|
|
})
|