81 lines
3.2 KiB
HTML
81 lines
3.2 KiB
HTML
@use crate::comments::CommentView;
|
|
@use crate::extensions::ProfileExt;
|
|
@use crate::nav::NavState;
|
|
@use crate::templates::button_js;
|
|
@use crate::templates::layouts::home;
|
|
@use crate::templates::comments::{nodes, profile_box};
|
|
@use hyaenidae_toolkit::templates::bbcode;
|
|
@use hyaenidae_toolkit::{templates::button_group, Button};
|
|
@use hyaenidae_toolkit::{templates::{card, card_title, card_body}, Card};
|
|
@use hyaenidae_toolkit::templates::link;
|
|
@use hyaenidae_toolkit::templates::{nested, nested_children};
|
|
@use hyaenidae_toolkit::templates::text_input;
|
|
|
|
@(view: &CommentView, nav_state: &NavState)
|
|
|
|
@if let Some(comment) = view.comments.comment(&view.cache) {
|
|
@:home(&view.author().profile.name(), comment.body(), nav_state, {
|
|
@:button_js()
|
|
}, {
|
|
@:card(&Card::full_width().dark(nav_state.dark()), {
|
|
@:card_title({ Comment })
|
|
@:card_body({
|
|
<div class="comment">
|
|
<div class="comment-body">
|
|
@:profile_box(&view.author(), comment.published(), &view.parent(), &view.cache, nav_state.dark(), {
|
|
@if let Some(state) = view.comments.edit_link(&view.cache) {
|
|
<div>
|
|
@:link(&state, { edit })
|
|
</div>
|
|
}
|
|
}, {
|
|
<div class="comment-text">
|
|
@:bbcode({
|
|
@Html(comment.body())
|
|
})
|
|
</div>
|
|
})
|
|
</div>
|
|
</div>
|
|
})
|
|
@:card_body({
|
|
@if view.logged_in {
|
|
<form method="POST" action="@crate::comments::reply_path(comment)">
|
|
@:text_input(&view.input)
|
|
<div class="button-section">
|
|
@:button_group(&[
|
|
Button::primary("Reply"),
|
|
Button::secondary("Back to Submission").href(&view.submission_path()),
|
|
Button::primary_outline("Report").href(&crate::comments::report_path(comment)),
|
|
])
|
|
</div>
|
|
</form>
|
|
} else {
|
|
@:button_group(&[
|
|
Button::secondary("Back to Submission").href(&view.submission_path()),
|
|
])
|
|
}
|
|
})
|
|
})
|
|
|
|
@if view.comments.has_children() {
|
|
@:card(&Card::full_width().dark(nav_state.dark()), {
|
|
@:card_title({ Replies })
|
|
@:card_body({
|
|
@:nested(nav_state.dark(), {
|
|
@:nested_children({
|
|
@for child in &view.comments.children {
|
|
@:nodes(child, &view.cache, &view.comments, view.logged_in, nav_state.dark())
|
|
}
|
|
})
|
|
})
|
|
})
|
|
})
|
|
}
|
|
})
|
|
} else {
|
|
@:home("Comment Gone", "Not sure where that comment went!", nav_state, {}, {
|
|
Not sure where that comment went!
|
|
})
|
|
}
|