Alessio d1edcbf363 Add tweet detail "/like" and "/unlike" URLs
- refactor TweetDetail to determine a bit more systematically whether scraping is required
2023-10-13 00:18:31 -03:00

11 lines
598 B
Smarty

{{define "likes-count"}}
<div class="interaction-stat" hx-trigger="click consume">
{{if .IsLikedByCurrentUser}}
<img class="svg-icon like-icon liked" src="/static/icons/like_filled.svg" hx-get="/tweet/{{.ID}}/unlike" hx-target="closest .interaction-stat" hx-push-url="false" hx-swap="outerHTML focus-scroll:false" />
{{else}}
<img class="svg-icon like-icon" src="/static/icons/like.svg" hx-get="/tweet/{{.ID}}/like" hx-target="closest .interaction-stat" hx-push-url="false" hx-swap="outerHTML focus-scroll:false" />
{{end}}
<span>{{.NumLikes}}</span>
</div>
{{end}}