-
Notifications
You must be signed in to change notification settings - Fork 398
/
Copy pathcard.blade.php
151 lines (146 loc) · 6.82 KB
/
card.blade.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
@props([
'torrent',
'meta',
])
<article class="torrent-card">
<header class="torrent-card__header">
<div class="torrent-card__left-header">
<span class="torrent-card__category">{{ $torrent->category->name }}</span>
<span class="torrent-card__meta-seperator">•</span>
<span class="torrent-card__resolution">
{{ $torrent->resolution->name ?? 'No Res' }}
</span>
<span class="torrent-card__meta-seperator"></span>
<span class="torrent-card__type">{{ $torrent->type->name }}</span>
<span class="torrent-card__meta-seperator">•</span>
<span class="torrent-card__size">{{ $torrent->getSize() }}</span>
</div>
<div class="torrent-card__right-header">
<a class="torrent-card__seeds" href="{{ route('peers', ['id' => $torrent->id]) }}">
<i class="fas fa-arrow-up"></i>
{{ $torrent->seeders }}
</a>
<span class="torrent-card__meta-seperator">•</span>
<a class="torrent-card__leeches" href="{{ route('peers', ['id' => $torrent->id]) }}">
<i class="fas fa-arrow-down"></i>
{{ $torrent->leechers }}
</a>
<span class="torrent-card__meta-seperator">•</span>
<a
class="torrent-card__completed"
href="{{ route('history', ['id' => $torrent->id]) }}"
>
<i class="fas fa-check"></i>
{{ $torrent->times_completed }}
</a>
</div>
</header>
<aside class="torrent-card__aside">
<a
class="torrent-card__similar-link"
href="{{ route('torrents.similar', ['category_id' => $torrent->category_id, 'tmdb' => $torrent->tmdb]) }}"
>
<figure class="torrent-card__figure">
<img
class="torrent-card__image"
@switch(true)
@case($torrent->category->movie_meta || $torrent->category->tv_meta)
src="{{ isset($meta->poster) ? tmdb_image('poster_mid', $meta->poster) : 'https://via.placeholder.com/160x240' }}"
@break
@case($torrent->category->game_meta && isset($torrent->meta) && $meta->cover->image_id && $meta->name)
src="https://images.igdb.com/igdb/image/upload/t_cover_big/{{ $torrent->meta->cover->image_id }}.jpg"
@break
@case($torrent->category->music_meta) {{--Could combine music_meta||no_meta , left seperate to ease special handling if needed--}}
@php
$coverPath = 'files/img/torrent-cover_' . $torrent->id;
$coverFile = collect(glob(public_path($coverPath . '.*')))->first();
$imageSrc = $coverFile !== null
? asset(str_replace(public_path(), '', $coverFile))
: ($torrent->cover_url && filter_var($torrent->cover_url, FILTER_VALIDATE_URL)
? $torrent->cover_url
: 'https://via.placeholder.com/160x240');
@endphp
src="{{ $imageSrc }}"
@break
@case($torrent->category->no_meta)
@php
$coverPath = 'files/img/torrent-cover_' . $torrent->id;
$coverFile = collect(glob(public_path($coverPath . '.*')))->first();
$imageSrc = $coverFile !== null
? asset(str_replace(public_path(), '', $coverFile))
: ($torrent->cover_url && filter_var($torrent->cover_url, FILTER_VALIDATE_URL)
? $torrent->cover_url
: 'https://via.placeholder.com/160x240');
@endphp
src="{{ $imageSrc }}"
@break
@endswitch
alt="{{ __('torrent.similar') }}"
/>
</figure>
</a>
</aside>
<div class="torrent-card__body">
<h2 class="torrent-card__title">
<a
class="torrent-card__link"
href="{{ route('torrents.show', ['id' => $torrent->id]) }}"
>
{{ $torrent->name }}
</a>
</h2>
<div class="torrent-card__rating-and-genres">
<span
class="torrent-card__rating"
title="{{ $meta?->vote_average ?? 0 }}/10 ({{ $meta?->vote_count ?? 0 }} {{ __('torrent.votes') }})"
>
<i class="{{ \config('other.font-awesome') }} fa-star"></i>
{{ $meta?->vote_average ?? 0 }}
</span>
<span class="torrent-card__meta-seperator">•</span>
<ul class="torrent-card__genres">
@foreach ($meta?->genres ?? [] as $genre)
<li class="torrent-card__genre-item">
<a
class="torrent-card__genre"
href="{{ route('torrents.index', ['view' => 'group', 'genreIds' => [$genre->id]]) }}"
>
{{ $genre->name }}
</a>
</li>
@endforeach
</ul>
</div>
<p class="torrent-card__plot">
{{ Str::of($meta?->overview ?: $meta?->summary)->stripTags()->limit(350, '...') }}
</p>
</div>
<footer class="torrent-card__footer">
<div class="torrent-card__left-footer">
<address class="torrent-card__uploader">
<x-user_tag :anon="$torrent->anon" :user="$torrent->user" />
</address>
<span class="torrent-card__meta-seperator">•</span>
<time title="{{ $torrent->created_at }}" datetime="{{ $torrent->created_at }}">
{{ $torrent->created_at->diffForHumans() }}
</time>
</div>
<div class="torrent-card__right-footer">
@if (config('torrent.download_check_page'))
<a
class="form__standard-icon-button"
href="{{ route('download_check', ['id' => $torrent->id]) }}"
>
<i class="{{ \config('other.font-awesome') }} fa-download"></i>
</a>
@else
<a
class="form__standard-icon-button"
href="{{ route('download', ['id' => $torrent->id]) }}"
>
<i class="{{ \config('other.font-awesome') }} fa-download"></i>
</a>
@endif
</div>
</footer>
</article>