mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-18 12:31:27 +00:00
Merge pull request #480 from pixelfed/frontend-ui-refactor
Frontend ui refactor
This commit is contained in:
commit
5f0913249b
2 changed files with 62 additions and 20 deletions
|
@ -19,8 +19,12 @@ class DiscoverController extends Controller
|
||||||
$this->middleware('auth');
|
$this->middleware('auth');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function home()
|
public function home(Request $request)
|
||||||
{
|
{
|
||||||
|
$this->validate($request, [
|
||||||
|
'page' => 'nullable|integer|max:50'
|
||||||
|
]);
|
||||||
|
|
||||||
$pid = Auth::user()->profile->id;
|
$pid = Auth::user()->profile->id;
|
||||||
|
|
||||||
$following = Cache::remember('feature:discover:following:'.$pid, 15, function() use($pid) {
|
$following = Cache::remember('feature:discover:following:'.$pid, 15, function() use($pid) {
|
||||||
|
@ -52,9 +56,11 @@ class DiscoverController extends Controller
|
||||||
->whereHas('profile', function($q) {
|
->whereHas('profile', function($q) {
|
||||||
$q->where('is_private', false);
|
$q->where('is_private', false);
|
||||||
})
|
})
|
||||||
|
->whereIsNsfw(false)
|
||||||
->whereVisibility('public')
|
->whereVisibility('public')
|
||||||
->where('profile_id', '!=', $pid)
|
->where('profile_id', '!=', $pid)
|
||||||
->whereNotIn('profile_id', $following)
|
->whereNotIn('profile_id', $following)
|
||||||
|
->withCount(['comments', 'likes'])
|
||||||
->orderBy('created_at', 'desc')
|
->orderBy('created_at', 'desc')
|
||||||
->simplePaginate(21);
|
->simplePaginate(21);
|
||||||
|
|
||||||
|
|
|
@ -36,26 +36,28 @@
|
||||||
</section>
|
</section>
|
||||||
<section class="pt-5 mt-5">
|
<section class="pt-5 mt-5">
|
||||||
<p class="lead text-muted font-weight-bold">Explore</p>
|
<p class="lead text-muted font-weight-bold">Explore</p>
|
||||||
<div class="profile-timeline row">
|
<div class="profile-timeline">
|
||||||
@foreach($posts as $status)
|
<div class="row">
|
||||||
<div class="col-4 p-0 p-sm-2 p-md-3">
|
@foreach($posts as $status)
|
||||||
<a class="card info-overlay card-md-border-0" href="{{$status->url()}}">
|
<div class="col-4 p-0 p-sm-2 p-md-3">
|
||||||
<div class="square {{$status->firstMedia()->filter_class}}">
|
<a class="card info-overlay card-md-border-0" href="{{$status->url()}}">
|
||||||
<div class="square-content" style="background-image: url('{{$status->thumb()}}')"></div>
|
<div class="square {{$status->firstMedia()->filter_class}}">
|
||||||
<div class="info-overlay-text">
|
<div class="square-content" style="background-image: url('{{$status->thumb()}}')"></div>
|
||||||
<h5 class="text-white m-auto font-weight-bold">
|
<div class="info-overlay-text">
|
||||||
<span class="pr-4">
|
<h5 class="text-white m-auto font-weight-bold">
|
||||||
<span class="far fa-heart fa-lg pr-1"></span> {{$status->likes_count}}
|
<span class="pr-4">
|
||||||
</span>
|
<span class="far fa-heart fa-lg pr-1"></span> {{$status->likes_count}}
|
||||||
<span>
|
</span>
|
||||||
<span class="far fa-comment fa-lg pr-1"></span> {{$status->comments_count}}
|
<span>
|
||||||
</span>
|
<span class="far fa-comment fa-lg pr-1"></span> {{$status->comments_count}}
|
||||||
</h5>
|
</span>
|
||||||
|
</h5>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</a>
|
||||||
</a>
|
</div>
|
||||||
|
@endforeach
|
||||||
</div>
|
</div>
|
||||||
@endforeach
|
|
||||||
|
|
||||||
@if($posts->count() == 0)
|
@if($posts->count() == 0)
|
||||||
<div class="col-12 text-center text-muted">
|
<div class="col-12 text-center text-muted">
|
||||||
|
@ -63,12 +65,46 @@
|
||||||
</div>
|
</div>
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
|
<div class="page-load-status" style="display: none;">
|
||||||
|
<div class="infinite-scroll-request" style="display: none;">
|
||||||
|
<div class="fixed-top loading-page"></div>
|
||||||
|
</div>
|
||||||
|
<div class="infinite-scroll-error" style="display: none;">
|
||||||
|
<h3>Whoops, an error</h3>
|
||||||
|
<p class="text-muted">
|
||||||
|
Try reloading the page
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
<div class="pagination-container">
|
||||||
|
<div class="d-flex justify-content-center">
|
||||||
|
{{$posts->links()}}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@endsection
|
@endsection
|
||||||
|
|
||||||
@push('meta')
|
@push('meta')
|
||||||
<meta property="og:description" content="Discover People!">
|
<meta property="og:description" content="Discover">
|
||||||
|
@endpush
|
||||||
|
|
||||||
|
@push('scripts')
|
||||||
|
<script type="text/javascript">
|
||||||
|
$(document).ready(function() {
|
||||||
|
$('.pagination-container').hide();
|
||||||
|
$('.pagination').hide();
|
||||||
|
let elem = document.querySelector('.profile-timeline');
|
||||||
|
let infScroll = new InfiniteScroll( elem, {
|
||||||
|
path: '.pagination__next',
|
||||||
|
append: '.profile-timeline',
|
||||||
|
status: '.page-load-status',
|
||||||
|
checkLastPage: '.pagination__next',
|
||||||
|
history: false,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
@endpush
|
@endpush
|
||||||
|
|
Loading…
Reference in a new issue