hyaenidae/templates/feed/index.rs.html

54 lines
1.9 KiB
HTML

@use crate::ActixLoader;
@use crate::extensions::ProfileExt;
@use crate::feed::ViewFeedState;
@use crate::nav::NavState;
@use crate::templates::layouts::wide;
@use hyaenidae_toolkit::{templates::button_group, Button};
@use hyaenidae_toolkit::{templates::{card, card_body, card_title}, Card};
@use hyaenidae_toolkit::templates::centered;
@use hyaenidae_toolkit::templates::{thumbnail, thumbnail_border, thumbnails};
@use i18n_embed_fl::fl;
@(loader: &ActixLoader, state: &ViewFeedState, nav_state: &NavState)
@:wide(loader, &fl!(loader, "feed-title"), &fl!(loader, "feed-subtitle", profile = state.profile.name()), nav_state, {}, {
@if state.has_submissions() {
@if state.has_nav() {
@:thumbnail_border({
@:button_group(&state.nav(loader))
})
}
@:thumbnails({
@for view in state.submissions() {
@if let Some(thumb) = view.thumbnail() {
@:thumbnail(&thumb)
}
}
})
@if state.has_nav() {
@:thumbnail_border({
@:button_group(&state.nav(loader))
})
}
} else {
@:centered(false, {
@:card(&Card::full_width().dark(nav_state.dark()), {
@:card_title({
@fl!(loader, "feed-empty-title")
})
@:card_body({
<div class="text-section">
<p>@fl!(loader, "feed-empty-subtitle")</p>
</div>
<div class="button-section">
@:button_group(&[
Button::secondary(&fl!(loader, "feed-empty-browse-users")).href("/discover"),
Button::secondary(&fl!(loader, "feed-empty-browse-submissions")).href("/browse"),
])
</div>
})
})
})
}
})