fix(channel): pluralise video counts, hide stray "0.0" from playlist meta
- Playlist cards on the channel page used Number::abbreviate for the view count, which prints "0.0" (precision=1) when the playlist has never been viewed. Hide the whole view-count row for zero-view playlists; still show "1.2K" / "2.3M" when there's traffic. - "N videos" counts (header meta row + per-playlist count) now use Str::plural so "1 video" renders correctly instead of "1 videos". Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
This commit is contained in:
1 parent
8812aaf336
commit
d5d35ab85e
1 file changed
+11
-4
@@ -122,7 +122,8 @@ $headerSocialMap = [
|
|||||||
<div class="ch-meta-row">
|
<div class="ch-meta-row">
|
||||||
<span class="ch-meta-item">
|
<span class="ch-meta-item">
|
||||||
<i class="bi bi-camera-video-fill"></i>
|
<i class="bi bi-camera-video-fill"></i>
|
||||||
{{ number_format($videos->count() + $shorts->count()) }} videos
|
@php $vidTotal = $videos->count() + $shorts->count(); @endphp
|
||||||
|
{{ number_format($vidTotal) }} {{ Str::plural('video', $vidTotal) }}
|
||||||
</span>
|
</span>
|
||||||
<span class="ch-meta-sep">·</span>
|
<span class="ch-meta-sep">·</span>
|
||||||
<span class="ch-meta-item">
|
<span class="ch-meta-item">
|
||||||
@@ -780,8 +781,8 @@ $headerSocialMap = [
|
|||||||
@endif
|
@endif
|
||||||
<div class="ch-playlist-overlay"></div>
|
<div class="ch-playlist-overlay"></div>
|
||||||
<div class="ch-playlist-count">
|
<div class="ch-playlist-count">
|
||||||
<i class="bi bi-play-fill"></i>
|
<i class="bi bi-play-fill" aria-hidden="true"></i>
|
||||||
{{ $playlist->video_count }} videos
|
{{ $playlist->video_count }} {{ Str::plural('video', $playlist->video_count) }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="ch-playlist-name">{{ $playlist->name }}</div>
|
<div class="ch-playlist-name">{{ $playlist->name }}</div>
|
||||||
@@ -795,7 +796,13 @@ $headerSocialMap = [
|
|||||||
@else
|
@else
|
||||||
<i class="bi bi-globe"></i> Public
|
<i class="bi bi-globe"></i> Public
|
||||||
@endif
|
@endif
|
||||||
· <i class="bi bi-eye"></i> {{ \Illuminate\Support\Number::abbreviate($playlist->view_count, precision: 1) }}
|
{{-- Hide the view-count row entirely when the playlist has
|
||||||
|
never been viewed. Previously showed "· eye 0.0" because
|
||||||
|
Number::abbreviate(0, precision: 1) prints "0.0". --}}
|
||||||
|
@if($playlist->view_count > 0)
|
||||||
|
· <i class="bi bi-eye" aria-hidden="true"></i>
|
||||||
|
{{ \Illuminate\Support\Number::abbreviate($playlist->view_count, precision: 1) }}
|
||||||
|
@endif
|
||||||
</div>
|
</div>
|
||||||
</a>
|
</a>
|
||||||
@endforeach
|
@endforeach
|
||||||
|
|||||||
Reference in new issue
Block a user