Show status timestamps

Show how long ago the status was posted. Includes support for
Swatch Internet time if SHOW_BEATS=true.
This commit is contained in:
St John Karp 2018-08-12 16:53:59 -07:00
parent 3902114ac0
commit 50bf84c4e4
4 changed files with 17 additions and 2 deletions

View File

@ -9,6 +9,7 @@
"fideloper/proxy": "~3.3", "fideloper/proxy": "~3.3",
"laravel/framework": "5.5.*", "laravel/framework": "5.5.*",
"laravel/tinker": "~1.0", "laravel/tinker": "~1.0",
"nesbot/carbon": "^1.33",
"revolution/laravel-mastodon-api": "^1.5", "revolution/laravel-mastodon-api": "^1.5",
"revolution/socialite-mastodon": "^1.2" "revolution/socialite-mastodon": "^1.2"
}, },

4
composer.lock generated
View File

@ -4,8 +4,8 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"hash": "777e302fe64df7b4f6c3d53b0d67ca01", "hash": "c699abc4e7b0c1784938122332cc0b9b",
"content-hash": "99e2b15adf8ee6829bad59f44cae2cef", "content-hash": "d3b83177a4165b407a361c33e1deac23",
"packages": [ "packages": [
{ {
"name": "dnoegel/php-xdg-base-dir", "name": "dnoegel/php-xdg-base-dir",

View File

@ -54,6 +54,11 @@ div.actions span {
margin-right: 1em; margin-right: 1em;
} }
time {
font-size: smaller;
margin-left: 1em;
}
/* Tooltip container */ /* Tooltip container */
.tooltip { .tooltip {
position: relative; position: relative;

View File

@ -10,6 +10,15 @@
</a> </a>
<span class="tooltiptext">{{ $status['account']['acct'] }}</span> <span class="tooltiptext">{{ $status['account']['acct'] }}</span>
</div> </div>
<time datetime="{{ $status['created_at'] }}">
@php
$created_at = new Carbon\Carbon($status['created_at']);
@endphp
@if (env('SHOW_BEATS') === true)
{{ '@' . $created_at->format('B') }} |
@endif
{{ $created_at->diffForHumans(null, false, true) }}
</time>
@if ($status['reblog'] === null) @if ($status['reblog'] === null)
<p>{!! $status['content'] !!}</p> <p>{!! $status['content'] !!}</p>
@foreach ($status['media_attachments'] as $attachment) @foreach ($status['media_attachments'] as $attachment)