Add polls and urls

This commit is contained in:
Alessio 2023-08-18 15:18:31 -03:00
parent 57b72549c5
commit 0f9ba6b19b
6 changed files with 132 additions and 1 deletions

View File

@ -0,0 +1 @@
<svg width="24" height="24" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd"><path d="M14.851 11.923c-.179-.641-.521-1.246-1.025-1.749-1.562-1.562-4.095-1.563-5.657 0l-4.998 4.998c-1.562 1.563-1.563 4.095 0 5.657 1.562 1.563 4.096 1.561 5.656 0l3.842-3.841.333.009c.404 0 .802-.04 1.189-.117l-4.657 4.656c-.975.976-2.255 1.464-3.535 1.464-1.28 0-2.56-.488-3.535-1.464-1.952-1.951-1.952-5.12 0-7.071l4.998-4.998c.975-.976 2.256-1.464 3.536-1.464 1.279 0 2.56.488 3.535 1.464.493.493.861 1.063 1.105 1.672l-.787.784zm-5.703.147c.178.643.521 1.25 1.026 1.756 1.562 1.563 4.096 1.561 5.656 0l4.999-4.998c1.563-1.562 1.563-4.095 0-5.657-1.562-1.562-4.095-1.563-5.657 0l-3.841 3.841-.333-.009c-.404 0-.802.04-1.189.117l4.656-4.656c.975-.976 2.256-1.464 3.536-1.464 1.279 0 2.56.488 3.535 1.464 1.951 1.951 1.951 5.119 0 7.071l-4.999 4.998c-.975.976-2.255 1.464-3.535 1.464-1.28 0-2.56-.488-3.535-1.464-.494-.495-.863-1.067-1.107-1.678l.788-.785z"/></svg>

After

Width:  |  Height:  |  Size: 974 B

View File

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- Uploaded to: SVG Repo, www.svgrepo.com, Generator: SVG Repo Mixer Tools -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg fill="#000000" version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
width="800px" height="800px" viewBox="0 0 442.246 442.246"
xml:space="preserve">
<g>
<g>
<path d="M409.657,32.474c-43.146-43.146-113.832-43.146-156.978,0l-84.763,84.762c29.07-8.262,60.589-6.12,88.129,6.732
l44.063-44.064c17.136-17.136,44.982-17.136,62.118,0c17.136,17.136,17.136,44.982,0,62.118l-55.386,55.386l-36.414,36.414
c-17.136,17.136-44.982,17.136-62.119,0l-47.43,47.43c11.016,11.017,23.868,19.278,37.332,24.48
c36.415,14.382,78.643,8.874,110.467-16.219c3.06-2.447,6.426-5.201,9.18-8.262l57.222-57.222l34.578-34.578
C453.109,146.306,453.109,75.926,409.657,32.474z"/>
<path d="M184.135,320.114l-42.228,42.228c-17.136,17.137-44.982,17.137-62.118,0c-17.136-17.136-17.136-44.981,0-62.118
l91.8-91.799c17.136-17.136,44.982-17.136,62.119,0l47.43-47.43c-11.016-11.016-23.868-19.278-37.332-24.48
c-38.25-15.3-83.232-8.262-115.362,20.502c-1.53,1.224-3.06,2.754-4.284,3.978l-91.8,91.799
c-43.146,43.146-43.146,113.832,0,156.979c43.146,43.146,113.832,43.146,156.978,0l82.927-83.845
C230.035,335.719,220.243,334.496,184.135,320.114z"/>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

@ -0,0 +1 @@
<?xml version="1.0" ?><svg fill="none" height="20" viewBox="0 0 20 20" width="20" xmlns="http://www.w3.org/2000/svg"><path clip-rule="evenodd" d="M12.5858 4.58579C13.3668 3.80474 14.6331 3.80474 15.4142 4.58579C16.1952 5.36683 16.1952 6.63316 15.4142 7.41421L12.4142 10.4142C11.6331 11.1953 10.3668 11.1953 9.58577 10.4142C9.19524 10.0237 8.56208 10.0237 8.17156 10.4142C7.78103 10.8047 7.78103 11.4379 8.17156 11.8284C9.73365 13.3905 12.2663 13.3905 13.8284 11.8284L16.8284 8.82843C18.3905 7.26633 18.3905 4.73367 16.8284 3.17157C15.2663 1.60948 12.7337 1.60948 11.1716 3.17157L9.67156 4.67157C9.28103 5.0621 9.28103 5.69526 9.67156 6.08579C10.0621 6.47631 10.6952 6.47631 11.0858 6.08579L12.5858 4.58579ZM7.58579 9.58579C8.36683 8.80474 9.63316 8.80474 10.4142 9.58579C10.8047 9.97631 11.4379 9.97631 11.8284 9.58579C12.219 9.19526 12.219 8.5621 11.8284 8.17157C10.2663 6.60948 7.73367 6.60948 6.17157 8.17157L3.17157 11.1716C1.60948 12.7337 1.60948 15.2663 3.17157 16.8284C4.73367 18.3905 7.26633 18.3905 8.82843 16.8284L10.3284 15.3284C10.719 14.9379 10.719 14.3047 10.3284 13.9142C9.9379 13.5237 9.30474 13.5237 8.91421 13.9142L7.41421 15.4142C6.63316 16.1953 5.36684 16.1953 4.58579 15.4142C3.80474 14.6332 3.80474 13.3668 4.58579 12.5858L7.58579 9.58579Z" fill="#4A5568" fill-rule="evenodd"/></svg>

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

@ -58,7 +58,9 @@ input, select {
.quoted-tweet {
padding: 1.3em;
margin-top: 1em;
}
.rounded-gray-outline {
outline-color: lightgray;
outline-style: solid;
outline-width: 1px;
@ -144,6 +146,27 @@ a.entity {
max-width: 100%;
max-height: 40em;
}
.embedded-link {
padding: 1.3em;
margin-top: 1em;
display: flex;
flex-direction: column;
background-color: var(--color-twitter-off-white);
}
.embedded-link-description {
color: var(--color-twitter-text-gray);
font-size: 0.8em;
margin: 0;
}
.embedded-link-title {
margin: 0.5em 0;
}
.embedded-link-domain-container {
margin-top: 0.2em
}
.embedded-link-domain {
margin-left: 0.3em;
}
.thread-parent-tweet:first-child, .focused-tweet:first-child {
padding-top: 1em;
}
@ -413,3 +436,38 @@ input[type="submit"] {
margin-top: 1em;
gap: 4em;
}
.poll {
padding: 1em;
}
.poll-choice {
position: relative;
margin: 0.3em 0;
}
.poll-fill-bar {
position: absolute;
height: 100%;
z-index: -1;
background-color: var(--color-twitter-off-white-dark);
}
.poll-fill-bar.poll-winner {
background-color: var(--color-twitter-blue-light);
}
.poll-info-container {
width: 100%;
line-height: 2em;
margin: 0 0.5em;
}
.poll-choice-label {
/* flex-grow: 1;*/
width: 50%;
}
.poll-choice-votes {
width: 50%;
/* flex-grow: 1;*/
}
.poll-metadata {
color: var(--color-twitter-text-gray);
margin: 0;
font-size: 0.9em;
}

View File

@ -0,0 +1,36 @@
{{define "poll-choice"}}
<div class="row poll-choice">
<div class="poll-fill-bar {{if (.poll.IsWinner .votes)}}poll-winner{{end}}" style="width: {{printf "%.1f" (.poll.VotePercentage .votes)}}%"></div>
<div class="poll-info-container row">
<span class="poll-choice-label">{{.label}}</span>
<span class="poll-choice-votes">{{.votes}} ({{printf "%.1f" (.poll.VotePercentage .votes)}}%)</span>
</div>
</div>
{{end}}
{{define "poll"}}
<div class="poll rounded-gray-outline">
{{template "poll-choice" (dict "label" .Choice1 "votes" .Choice1_Votes "poll" .)}}
{{template "poll-choice" (dict "label" .Choice2 "votes" .Choice2_Votes "poll" .)}}
{{if (gt .NumChoices 2)}}
{{template "poll-choice" (dict "label" .Choice3 "votes" .Choice3_Votes "poll" .)}}
{{end}}
{{if (gt .NumChoices 3)}}
{{template "poll-choice" (dict "label" .Choice4 "votes" .Choice4_Votes "poll" .)}}
{{end}}
<p class="poll-metadata">
<span class="poll-state">
{{if .IsOpen}}
Poll open, voting ends at {{.FormatEndsAt}}
{{else}}
Poll ended {{.FormatEndsAt}}
{{end}}
</span>
-
<span class="poll-vote-count">{{.TotalVotes}} votes</span>
</p>
</div>
{{end}}

View File

@ -64,12 +64,26 @@
<source src="/content/videos/{{.LocalFilename}}">
</video>
{{end}}
{{range $main_tweet.Urls}}
<a class="embedded-link rounded-gray-outline unstyled-link" target="_blank" href="{{.Text}}" style="width: {{.ThumbnailWidth}}px">
<img src="/content/link_preview_images/{{.ThumbnailLocalPath}}"/>
<h3 class="embedded-link-title">{{.Title}}</h3>
<p class="embedded-link-description">{{.Description}}</p>
<span class="row embedded-link-domain-container">
<img class="svg-icon" src="/static/icons/link3.svg" />
<span class="embedded-link-domain">{{.Domain}}</span>
</span>
</a>
{{end}}
{{range $main_tweet.Polls}}
{{template "poll" .}}
{{end}}
{{if $main_tweet.QuotedTweetID}}
{{$quoted_tweet := (tweet $main_tweet.QuotedTweetID)}}
{{$quoted_author := (user $quoted_tweet.UserID)}}
<a href="/tweet/{{$quoted_tweet.ID}}">
<div class="quoted-tweet">
<div class="quoted-tweet rounded-gray-outline">
{{template "author-info" $quoted_author}}
<div class="quoted-tweet-content">
<a href="/tweet/{{$quoted_tweet.ID}}" class="unstyled-link tweet-text">