2023-08-03 12:43:17 -03:00
|
|
|
{{define "tweet"}}
|
2023-08-13 15:57:58 -03:00
|
|
|
{{$main_tweet := (tweet .TweetID)}}
|
2023-08-10 12:36:28 -03:00
|
|
|
{{$author := (user $main_tweet.UserID)}}
|
|
|
|
<div class="tweet"
|
|
|
|
{{if (not (eq $main_tweet.ID (focused_tweet_id)))}}
|
2023-11-05 15:27:40 -04:00
|
|
|
hx-get="/tweet/{{$main_tweet.ID}}"
|
2023-08-27 15:46:57 -03:00
|
|
|
hx-trigger="click"
|
2023-08-10 12:36:28 -03:00
|
|
|
hx-target="body"
|
2023-10-14 20:08:15 -03:00
|
|
|
hx-swap="outerHTML show:#focused-tweet:top"
|
2023-08-10 12:36:28 -03:00
|
|
|
hx-push-url="true"
|
|
|
|
{{end}}
|
|
|
|
>
|
2023-08-13 15:57:58 -03:00
|
|
|
{{if (not (eq .RetweetID 0))}}
|
|
|
|
{{$retweet := (retweet .RetweetID)}}
|
|
|
|
{{$retweet_user := (user $retweet.RetweetedByID)}}
|
2024-04-05 15:49:19 -07:00
|
|
|
<div class="retweet-info" hx-trigger="click consume">
|
2024-03-22 21:37:34 -07:00
|
|
|
<img class="svg-icon" src="/static/icons/retweet.svg" width="24" height="24" />
|
2024-04-05 15:49:19 -07:00
|
|
|
<span class="retweet-info__retweeted-by-label">Retweeted by</span>
|
|
|
|
<a
|
|
|
|
class="retweet-info__retweeted-by-user"
|
|
|
|
hx-get="/{{$retweet_user.Handle}}"
|
|
|
|
hx-target="body"
|
|
|
|
hx-swap="outerHTML"
|
|
|
|
hx-push-url="true"
|
|
|
|
>
|
2023-08-13 15:57:58 -03:00
|
|
|
{{$retweet_user.DisplayName}}
|
|
|
|
</a>
|
|
|
|
</div>
|
|
|
|
{{end}}
|
2024-04-05 15:49:19 -07:00
|
|
|
<div class="tweet__header-container">
|
2023-08-10 12:36:28 -03:00
|
|
|
<div class="author-info-container" hx-trigger="click consume">
|
|
|
|
{{template "author-info" $author}}
|
|
|
|
</div>
|
2023-08-05 19:00:33 -03:00
|
|
|
{{if $main_tweet.ReplyMentions}}
|
2024-04-05 15:49:19 -07:00
|
|
|
<div class="reply-mentions" hx-trigger="click consume">
|
|
|
|
<span class="reply-mentions__dm-message__replying-to-label">Replying to</span>
|
|
|
|
<ul class="reply-mentions__list inline-dotted-list">
|
2023-08-05 19:00:33 -03:00
|
|
|
{{range $main_tweet.ReplyMentions}}
|
2023-08-13 05:19:13 -03:00
|
|
|
<li><a class="entity" href="/{{.}}">@{{.}}</a></li>
|
2023-08-05 19:00:33 -03:00
|
|
|
{{end}}
|
|
|
|
</ul>
|
|
|
|
</div>
|
2023-08-03 12:43:17 -03:00
|
|
|
{{end}}
|
2024-04-05 15:49:19 -07:00
|
|
|
<div class="posted-at">
|
|
|
|
<p class="posted-at__text">
|
2023-08-05 19:00:33 -03:00
|
|
|
{{$main_tweet.PostedAt.Time.Format "Jan 2, 2006"}}
|
|
|
|
<br/>
|
|
|
|
{{$main_tweet.PostedAt.Time.Format "3:04 pm"}}
|
|
|
|
</p>
|
|
|
|
</div>
|
2023-08-03 12:43:17 -03:00
|
|
|
</div>
|
2023-08-13 05:19:13 -03:00
|
|
|
<div class="row">
|
2024-04-05 15:49:19 -07:00
|
|
|
<span class="string-box">
|
|
|
|
<div class="string">
|
2023-08-05 19:00:33 -03:00
|
|
|
</div>
|
|
|
|
</span>
|
2024-04-05 15:49:19 -07:00
|
|
|
<span class="tweet__vertical-container">
|
2023-08-05 19:00:33 -03:00
|
|
|
<div class="tweet-content">
|
2023-08-29 12:27:31 -03:00
|
|
|
{{if (ne $main_tweet.TombstoneType "")}}
|
|
|
|
<div class="tombstone">
|
|
|
|
{{(get_tombstone_text $main_tweet)}}
|
|
|
|
</div>
|
|
|
|
{{end}}
|
2023-08-27 15:46:57 -03:00
|
|
|
{{template "text-with-entities" $main_tweet.Text}}
|
2023-08-05 19:00:33 -03:00
|
|
|
{{range $main_tweet.Images}}
|
2024-04-05 15:49:19 -07:00
|
|
|
<img class="tweet__embedded-image"
|
2023-11-26 22:13:47 -08:00
|
|
|
{{if .IsDownloaded}}
|
|
|
|
src="/content/images/{{.LocalFilename}}"
|
|
|
|
{{else}}
|
|
|
|
src="{{.RemoteURL}}"
|
|
|
|
{{end}}
|
2023-08-29 14:04:57 -03:00
|
|
|
width="{{.Width}}" height="{{.Height}}"
|
|
|
|
{{if (gt (len $main_tweet.Images) 1)}}
|
|
|
|
style="max-width: 45%"
|
|
|
|
{{end}}
|
2024-03-09 13:44:14 -08:00
|
|
|
hx-trigger="click consume"
|
|
|
|
onclick="image_carousel.querySelector('img').src = this.src; image_carousel.showModal();"
|
2024-04-05 15:49:19 -07:00
|
|
|
>
|
2023-08-05 19:00:33 -03:00
|
|
|
{{end}}
|
2023-08-17 18:45:55 -03:00
|
|
|
{{range $main_tweet.Videos}}
|
2024-04-19 21:45:54 -07:00
|
|
|
<div class="video">
|
|
|
|
{{if .IsGif}}
|
|
|
|
<div class="video__gif-controls labelled-icon">
|
|
|
|
<img class="svg-icon" src="/static/icons/play.svg" width="24" height="24" />
|
|
|
|
<label class="video__gif-label">GIF</label>
|
|
|
|
</div>
|
|
|
|
<script>
|
|
|
|
function gif_on_click(video) {
|
|
|
|
if (video.paused) {
|
|
|
|
video.play();
|
|
|
|
video.parentElement.querySelector(".svg-icon").src = "/static/icons/pause.svg";
|
|
|
|
} else {
|
|
|
|
video.pause();
|
|
|
|
video.parentElement.querySelector(".svg-icon").src = "/static/icons/play.svg";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
2023-11-26 22:13:47 -08:00
|
|
|
{{end}}
|
2024-04-19 21:45:54 -07:00
|
|
|
<video hx-trigger="click consume" width="{{.Width}}" height="{{.Height}}"
|
|
|
|
{{if .IsGif}}
|
|
|
|
loop muted playsinline onclick="gif_on_click(this)" class="gif"
|
|
|
|
{{else}}
|
|
|
|
controls class="video"
|
|
|
|
{{end}}
|
|
|
|
{{if .IsDownloaded}}
|
|
|
|
poster="/content/video_thumbnails/{{.ThumbnailLocalPath}}"
|
|
|
|
{{else}}
|
|
|
|
poster="{{.ThumbnailRemoteUrl}}"
|
|
|
|
{{end}}
|
|
|
|
>
|
|
|
|
{{if .IsDownloaded}}
|
|
|
|
<source src="/content/videos/{{.LocalFilename}}">
|
|
|
|
{{else}}
|
|
|
|
<source src="{{.RemoteURL}}">
|
|
|
|
{{end}}
|
|
|
|
</video>
|
|
|
|
</div>
|
2023-08-17 18:45:55 -03:00
|
|
|
{{end}}
|
2023-08-18 15:18:31 -03:00
|
|
|
{{range $main_tweet.Urls}}
|
2023-09-09 20:50:12 -03:00
|
|
|
<div class="click-eater" hx-trigger="click consume">
|
2024-04-05 15:49:19 -07:00
|
|
|
{{template "embedded-link" .}}
|
2023-09-09 20:50:12 -03:00
|
|
|
</div>
|
2023-08-18 15:18:31 -03:00
|
|
|
{{end}}
|
|
|
|
{{range $main_tweet.Polls}}
|
|
|
|
{{template "poll" .}}
|
|
|
|
{{end}}
|
2023-08-05 19:00:33 -03:00
|
|
|
|
2023-08-18 16:41:04 -03:00
|
|
|
{{if (and $main_tweet.QuotedTweetID (lt .QuoteNestingLevel 1))}}
|
2024-04-05 15:49:19 -07:00
|
|
|
<div class="tweet__quoted-tweet rounded-gray-outline" hx-trigger="click consume">
|
|
|
|
{{template "tweet" (dict
|
|
|
|
"TweetID" $main_tweet.QuotedTweetID
|
|
|
|
"RetweetID" 0
|
|
|
|
"QuoteNestingLevel" (add .QuoteNestingLevel 1)
|
|
|
|
) }}
|
2023-08-18 16:41:04 -03:00
|
|
|
</div>
|
2023-08-05 19:00:33 -03:00
|
|
|
{{end}}
|
2023-08-18 19:01:58 -03:00
|
|
|
{{if $main_tweet.SpaceID}}
|
|
|
|
{{template "space" (space $main_tweet.SpaceID)}}
|
|
|
|
{{end}}
|
2023-08-05 19:00:33 -03:00
|
|
|
</div>
|
2023-08-03 12:43:17 -03:00
|
|
|
|
2024-04-05 15:49:19 -07:00
|
|
|
<div class="interactions row">
|
|
|
|
<div class="interactions__stat">
|
2024-03-22 21:37:34 -07:00
|
|
|
<img class="svg-icon" src="/static/icons/quote.svg" width="24" height="24" />
|
2023-08-05 19:00:33 -03:00
|
|
|
<span>{{$main_tweet.NumQuoteTweets}}</span>
|
2023-08-27 22:55:24 -03:00
|
|
|
</div>
|
2024-04-05 15:49:19 -07:00
|
|
|
<div class="interactions__stat">
|
2024-03-22 21:37:34 -07:00
|
|
|
<img class="svg-icon" src="/static/icons/reply.svg" width="24" height="24" />
|
2023-08-05 19:00:33 -03:00
|
|
|
<span>{{$main_tweet.NumReplies}}</span>
|
|
|
|
</div>
|
2024-04-05 15:49:19 -07:00
|
|
|
<div class="interactions__stat">
|
2024-03-22 21:37:34 -07:00
|
|
|
<img class="svg-icon" src="/static/icons/retweet.svg" width="24" height="24" />
|
2023-08-05 19:00:33 -03:00
|
|
|
<span>{{$main_tweet.NumRetweets}}</span>
|
|
|
|
</div>
|
2023-10-13 00:18:31 -03:00
|
|
|
{{template "likes-count" $main_tweet}}
|
2024-04-05 15:49:19 -07:00
|
|
|
<div class="interactions__dummy"></div>
|
|
|
|
<div class="row" hx-trigger="click consume">
|
2024-05-03 13:51:02 -07:00
|
|
|
<a class="button" title="Copy link" onclick="navigator.clipboard.writeText('https://twitter.com/{{ $author.Handle }}/status/{{ $main_tweet.ID }}')">
|
2024-05-03 15:10:14 -07:00
|
|
|
<img class="svg-icon" src="/static/icons/copy.svg" width="24" height="24" />
|
2024-05-03 13:51:02 -07:00
|
|
|
</a>
|
2024-04-05 15:49:19 -07:00
|
|
|
<a
|
|
|
|
class="button"
|
|
|
|
target="_blank"
|
|
|
|
href="https://twitter.com/{{$author.Handle}}/status/{{$main_tweet.ID}}"
|
|
|
|
title="Open on twitter.com"
|
|
|
|
>
|
2024-03-22 21:37:34 -07:00
|
|
|
<img class="svg-icon" src="/static/icons/external-link.svg" width="24" height="24" />
|
2023-12-20 11:55:50 -08:00
|
|
|
</a>
|
2024-04-05 15:49:19 -07:00
|
|
|
<a
|
|
|
|
class="button"
|
|
|
|
hx-get="/tweet/{{$main_tweet.ID}}?scrape"
|
|
|
|
hx-target="body"
|
|
|
|
hx-indicator="closest .tweet"
|
|
|
|
title="Refresh"
|
|
|
|
>
|
2024-03-22 21:37:34 -07:00
|
|
|
<img class="svg-icon" src="/static/icons/refresh.svg" width="24" height="24" />
|
2023-12-20 11:55:50 -08:00
|
|
|
</a>
|
2023-08-22 13:52:58 -03:00
|
|
|
</div>
|
2023-08-05 19:00:33 -03:00
|
|
|
</div>
|
|
|
|
</span>
|
2023-08-03 12:43:17 -03:00
|
|
|
</div>
|
2024-04-05 15:49:19 -07:00
|
|
|
<div class="htmx-spinner">
|
|
|
|
<div class="htmx-spinner__background"></div>
|
|
|
|
<img class="svg-icon htmx-spinner__icon" src="/static/icons/spinner.svg" />
|
2023-12-31 22:27:35 -06:00
|
|
|
</div>
|
2023-08-03 12:43:17 -03:00
|
|
|
</div>
|
|
|
|
{{end}}
|