2018-12-06 17:54:16 +00:00
|
|
|
@use templates::{base, partials::*};
|
|
|
|
@use template_utils::*;
|
|
|
|
@use plume_models::instance::Instance;
|
|
|
|
@use plume_models::posts::Post;
|
2018-12-07 11:05:01 +00:00
|
|
|
@use routes::*;
|
2018-12-06 17:54:16 +00:00
|
|
|
|
2018-12-14 22:16:18 +00:00
|
|
|
@(ctx: BaseContext, instance: Instance, n_users: i64, n_articles: i64, local: Vec<Post>, federated: Vec<Post>, user_feed: Option<Vec<Post>>)
|
2018-12-06 17:54:16 +00:00
|
|
|
|
2019-02-02 14:23:50 +00:00
|
|
|
@:base(ctx, instance.name.clone(), {}, {}, {
|
2019-03-25 07:57:26 +00:00
|
|
|
<h1>@i18n!(ctx.1, "Welcome to {}"; instance.name.as_str())</h1>
|
2018-12-06 17:54:16 +00:00
|
|
|
|
|
|
|
@if ctx.2.is_some() {
|
|
|
|
@tabs(&[
|
2018-12-07 11:05:01 +00:00
|
|
|
(&uri!(instance::index).to_string(), i18n!(ctx.1, "Latest articles"), true),
|
2018-12-13 21:20:19 +00:00
|
|
|
(&uri!(instance::feed: _).to_string(), i18n!(ctx.1, "Your feed"), false),
|
|
|
|
(&uri!(instance::federated: _).to_string(), i18n!(ctx.1, "Federated feed"), false),
|
|
|
|
(&uri!(instance::local: _).to_string(), i18n!(ctx.1, "Local feed"), false),
|
2018-12-06 17:54:16 +00:00
|
|
|
])
|
|
|
|
|
2019-02-02 14:23:50 +00:00
|
|
|
@:home_feed(ctx, user_feed.unwrap_or_default(), &uri!(instance::feed: _).to_string(), i18n!(ctx.1, "Your feed"))
|
|
|
|
@:home_feed(ctx, federated, &uri!(instance::federated: _).to_string(), i18n!(ctx.1, "Federated feed"))
|
|
|
|
@:home_feed(ctx, local, &uri!(instance::local: _).to_string(), i18n!(ctx.1, "Local feed"))
|
2018-12-06 17:54:16 +00:00
|
|
|
@:instance_description(ctx, instance, n_users, n_articles)
|
|
|
|
} else {
|
|
|
|
@tabs(&[
|
2018-12-07 11:05:01 +00:00
|
|
|
(&uri!(instance::index).to_string(), i18n!(ctx.1, "Latest articles"), true),
|
2018-12-13 21:20:19 +00:00
|
|
|
(&uri!(instance::federated: _).to_string(), i18n!(ctx.1, "Federated feed"), false),
|
|
|
|
(&uri!(instance::local: _).to_string(), i18n!(ctx.1, "Local feed"), false),
|
2018-12-06 17:54:16 +00:00
|
|
|
])
|
|
|
|
|
2019-02-02 14:23:50 +00:00
|
|
|
@:home_feed(ctx, federated, &uri!(instance::federated: _).to_string(), i18n!(ctx.1, "Federated feed"))
|
|
|
|
@:home_feed(ctx, local, &uri!(instance::local: _).to_string(), i18n!(ctx.1, "Local feed"))
|
2018-12-06 17:54:16 +00:00
|
|
|
@:instance_description(ctx, instance, n_users, n_articles)
|
|
|
|
}
|
|
|
|
})
|