@use crate::ActixLoader; @use crate::comments::CommentView; @use crate::extensions::{CommentExt, ProfileExt}; @use crate::nav::NavState; @use crate::templates::layouts::home; @use crate::templates::comments::nodes; @use hyaenidae_toolkit::{templates::button_group, Button}; @use hyaenidae_toolkit::{templates::{card, card_title, card_body}, Card}; @use hyaenidae_toolkit::templates::nested; @use hyaenidae_toolkit::{templates::text_input}; @use i18n_embed_fl::fl; @(loader: &ActixLoader, view: &CommentView, nav_state: &NavState) @if let Some(comment) = view.comments.comment(&view.cache) { @:home(loader, &view.author().profile.name(), comment.body(), nav_state, {}, { @:card(&Card::full_width().dark(nav_state.dark()), {
@:card_title({ @fl!(loader, "update-comment-heading") }) @:card_body({ @:text_input(&view.input(loader).dark(nav_state.dark())) }) @:card_body({ @:button_group(&[ Button::primary(&fl!(loader, "update-comment-button")), Button::secondary(&fl!(loader, "back-to-submission-button")).href(&view.submission_path()), ]) })
}) @if view.comments.has_children() { @:card(&Card::full_width().dark(nav_state.dark()), { @:card_title({ @fl!(loader, "replies-section-heading") }) @:card_body({ @:nested(nav_state.dark(), { @for child in &view.comments.children { @:nodes(loader, child, &view.cache, &view.comments, view.logged_in, nav_state.dark()) } }) }) }) } }) } else { @:home(loader, &fl!(loader, "comment-missing-title"), &fl!(loader, "comment-missing-subtitle"), nav_state, {}, { @fl!(loader, "comment-missing-subtitle") }) }