mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-26 08:13:16 +00:00
Merge pull request #153 from dansup/improve-user-profile
Improve user profile
This commit is contained in:
commit
0928e80485
8 changed files with 174 additions and 93 deletions
|
@ -32,7 +32,12 @@ class ProfileController extends Controller
|
|||
// TODO: refactor this mess
|
||||
$owner = Auth::check() && Auth::id() === $user->user_id;
|
||||
$following = ($owner == false && Auth::check()) ? $user->followedBy(Auth::user()->profile) : false;
|
||||
$timeline = $user->statuses()->whereHas('media')->whereNull('in_reply_to_id')->orderBy('id','desc')->paginate(21);
|
||||
$timeline = $user->statuses()
|
||||
->whereHas('media')
|
||||
->whereNull('in_reply_to_id')
|
||||
->orderBy('id','desc')
|
||||
->withCount(['comments', 'likes'])
|
||||
->simplePaginate(21);
|
||||
|
||||
return view('profile.show', compact('user', 'owner', 'following', 'timeline'));
|
||||
}
|
||||
|
|
BIN
public/css/app.css
vendored
BIN
public/css/app.css
vendored
Binary file not shown.
Binary file not shown.
74
resources/assets/sass/custom.scss
vendored
74
resources/assets/sass/custom.scss
vendored
|
@ -56,9 +56,7 @@ body, button, input, textarea {
|
|||
}
|
||||
|
||||
.card.status-container .status-photo {
|
||||
display: -webkit-box !important;
|
||||
display: -ms-flexbox !important;
|
||||
display: flex !important;
|
||||
display: block !important;
|
||||
margin: auto !important;
|
||||
}
|
||||
|
||||
|
@ -105,3 +103,73 @@ body, button, input, textarea {
|
|||
.notification-page .list-group-item:first-child {
|
||||
border-top: none;
|
||||
}
|
||||
|
||||
.nav-topbar {
|
||||
border-top: 1px solid $gray-300;
|
||||
}
|
||||
.nav-topbar .nav-item {
|
||||
margin: -1px 1.5rem 0;
|
||||
}
|
||||
.nav-topbar .nav-link {
|
||||
border: 1px solid transparent;
|
||||
color: $gray-300;
|
||||
padding: 0.75rem 0;
|
||||
}
|
||||
.nav-topbar .nav-link:focus, .nav-topbar .nav-link:hover {
|
||||
border-top-color: $gray-300;
|
||||
}
|
||||
.nav-topbar .nav-link.disabled {
|
||||
color: $gray-300;
|
||||
background-color: transparent;
|
||||
border-color: transparent;
|
||||
}
|
||||
.nav-topbar .nav-item.show .nav-link, .nav-topbar .nav-link.active {
|
||||
color: $gray-600;
|
||||
border-top-color: $gray-600;
|
||||
}
|
||||
.nav-topbar .dropdown-menu {
|
||||
margin-top:-1px;
|
||||
}
|
||||
|
||||
.info-overlay {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.info-overlay .info-overlay-text {
|
||||
display: none;
|
||||
position: absolute;
|
||||
}
|
||||
|
||||
.info-overlay:hover .info-overlay-text {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.info-overlay-text {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background-color: rgba(0,0,0,0.5);
|
||||
}
|
||||
|
||||
.font-weight-ultralight {
|
||||
font-weight: 200 !important;
|
||||
}
|
||||
|
||||
.square {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.square::after {
|
||||
content: "";
|
||||
display: block;
|
||||
padding-bottom: 100%;
|
||||
}
|
||||
|
||||
.square-content {
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background-repeat: no-repeat;
|
||||
background-size: cover;
|
||||
background-position: 50%;
|
||||
}
|
||||
|
|
|
@ -4,16 +4,16 @@
|
|||
|
||||
<div class="container following-page" style="min-height: 60vh;">
|
||||
|
||||
<div class="profile-header row my-5 offset-md-1">
|
||||
<div class="col-12 col-md-3">
|
||||
<div class="profile-avatar">
|
||||
<div class="profile-header row my-5">
|
||||
<div class="col-12 col-md-4 d-flex">
|
||||
<div class="profile-avatar mx-auto">
|
||||
<img class="img-thumbnail" src="{{$profile->avatarUrl()}}" style="border-radius:100%;" width="172px">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-12 col-md-9 d-flex align-items-center">
|
||||
<div class="col-12 col-md-8 d-flex align-items-center">
|
||||
<div class="profile-details">
|
||||
<div class="username-bar pb-2 d-flex align-items-center">
|
||||
<span class="font-weight-light h1">{{$profile->username}}</span>
|
||||
<div class="username-bar pb-2 d-flex align-items-center">
|
||||
<span class="font-weight-ultralight h1">{{$profile->username}}</span>
|
||||
</div>
|
||||
<div class="profile-stats pb-3 d-inline-flex lead">
|
||||
<div class="font-weight-light pr-5">
|
||||
|
|
|
@ -4,16 +4,16 @@
|
|||
|
||||
<div class="container following-page" style="min-height: 60vh;">
|
||||
|
||||
<div class="profile-header row my-5 offset-md-1">
|
||||
<div class="col-12 col-md-3">
|
||||
<div class="profile-avatar">
|
||||
<div class="profile-header row my-5">
|
||||
<div class="col-12 col-md-4 d-flex">
|
||||
<div class="profile-avatar mx-auto">
|
||||
<img class="img-thumbnail" src="{{$profile->avatarUrl()}}" style="border-radius:100%;" width="172px">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-12 col-md-9 d-flex align-items-center">
|
||||
<div class="col-12 col-md-8 d-flex align-items-center">
|
||||
<div class="profile-details">
|
||||
<div class="username-bar pb-2 d-flex align-items-center">
|
||||
<span class="font-weight-light h1">{{$profile->username}}</span>
|
||||
<span class="font-weight-ultralight h1">{{$profile->username}}</span>
|
||||
</div>
|
||||
<div class="profile-stats pb-3 d-inline-flex lead">
|
||||
<div class="font-weight-light pr-5">
|
||||
|
|
|
@ -4,19 +4,19 @@
|
|||
|
||||
<div class="container">
|
||||
|
||||
<div class="profile-header row my-5 offset-md-1">
|
||||
<div class="col-12 col-md-3">
|
||||
<div class="profile-avatar">
|
||||
<div class="profile-header row my-5">
|
||||
<div class="col-12 col-md-4 d-flex">
|
||||
<div class="profile-avatar mx-auto">
|
||||
<img class="img-thumbnail" src="{{$user->avatarUrl()}}" style="border-radius:100%;" width="172px">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-12 col-md-9 d-flex align-items-center">
|
||||
<div class="col-12 col-md-8 d-flex align-items-center">
|
||||
<div class="profile-details">
|
||||
<div class="username-bar pb-2 d-flex align-items-center">
|
||||
<span class="font-weight-light h1">{{$user->username}}</span>
|
||||
<span class="font-weight-ultralight h1">{{$user->username}}</span>
|
||||
@if($owner == true)
|
||||
<span class="pl-4">
|
||||
<a class="btn btn-outline-secondary font-weight-bold px-4 py-0" href="{{route('settings')}}">Settings</a>
|
||||
<span class="h5 pl-2 b-0">
|
||||
<a class="icon-settings text-muted" href="{{route('settings')}}"></a>
|
||||
</span>
|
||||
@elseif ($following == true)
|
||||
<span class="pl-4">
|
||||
|
@ -80,8 +80,8 @@
|
|||
<div class="profile-timeline mt-5 row">
|
||||
@if($owner == true)
|
||||
<div class="col-12 mb-5">
|
||||
<ul class="nav nav-tabs d-flex justify-content-center">
|
||||
<li class="nav-item mr-3">
|
||||
<ul class="nav nav-topbar d-flex justify-content-center">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link {{request()->is('*/saved') ? '':'active'}} font-weight-bold text-uppercase" href="{{$user->url()}}">Posts</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
|
@ -100,8 +100,20 @@
|
|||
@if($timeline->count() > 0)
|
||||
@foreach($timeline as $status)
|
||||
<div class="col-12 col-md-4 mb-4">
|
||||
<a class="card" href="{{$status->url()}}">
|
||||
<img class="card-img-top" src="{{$status->thumb()}}" width="300px" height="300px">
|
||||
<a class="card info-overlay" href="{{$status->url()}}">
|
||||
<div class="square">
|
||||
<div class="square-content" style="background-image: url('{{$status->thumb()}}')"></div>
|
||||
<div class="info-overlay-text">
|
||||
<h5 class="text-white m-auto font-weight-bold">
|
||||
<span class="pr-4">
|
||||
<span class="icon-heart pr-1"></span> {{$status->likes_count}}
|
||||
</span>
|
||||
<span>
|
||||
<span class="icon-speech pr-1"></span> {{$status->comments_count}}
|
||||
</span>
|
||||
</h5>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
@endforeach
|
||||
|
@ -120,4 +132,4 @@
|
|||
|
||||
</div>
|
||||
|
||||
@endsection
|
||||
@endsection
|
||||
|
|
|
@ -2,86 +2,82 @@
|
|||
|
||||
@section('content')
|
||||
|
||||
<div class="container">
|
||||
<div class="col-12 mt-4">
|
||||
|
||||
<div class="card status-container orientation-{{$status->firstMedia()->orientation ?? 'unknown'}}">
|
||||
<div class="card-body p-0">
|
||||
<div class="row">
|
||||
<div class="col-12 col-md-8 status-photo">
|
||||
<img src="{{$status->mediaUrl()}}" width="100%">
|
||||
<div class="container px-0 mt-md-4">
|
||||
<div class="card status-container orientation-{{$status->firstMedia()->orientation ?? 'unknown'}}">
|
||||
<div class="row mx-0">
|
||||
<div class="col-12 col-md-8 status-photo px-0">
|
||||
<img src="{{$status->mediaUrl()}}" width="100%">
|
||||
</div>
|
||||
<div class="col-12 col-md-4 px-0 d-flex flex-column">
|
||||
<div class="d-flex align-items-center justify-content-between card-header">
|
||||
<div class="d-flex align-items-center status-username">
|
||||
<div class="status-avatar mr-2">
|
||||
<img class="img-thumbnail" src="{{$user->avatarUrl()}}" width="24px" height="24px" style="border-radius:12px;">
|
||||
</div>
|
||||
<div class="username">
|
||||
<a href="{{$user->url()}}" class="username-link font-weight-bold text-dark">{{$user->username}}</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-12 col-md-4" style="height:100%">
|
||||
<div class="status-username d-inline-flex align-items-center pr-3 pt-3">
|
||||
<div class="status-avatar mr-2">
|
||||
<img class="img-thumbnail" src="{{$user->avatarUrl()}}" width="50px" height="50px" style="border-radius:40px;">
|
||||
</div>
|
||||
<div class="username">
|
||||
<a href="{{$user->url()}}" class="username-link font-weight-bold text-dark">{{$user->username}}</a>
|
||||
</div>
|
||||
</div>
|
||||
<hr>
|
||||
<div class="pr-3 mb-2 status-comments">
|
||||
<div class="status-comment">
|
||||
<span class="font-weight-bold pr-1">{{$status->profile->username}}</span>
|
||||
<p class="mb-1">
|
||||
<span class="comment-text">{!! $status->rendered ?? e($status->caption) !!}</span>
|
||||
</p>
|
||||
<div class="comments">
|
||||
<div class="timestamp mb-0">
|
||||
<p class="small text-uppercase mb-0"><a href="{{$status->url()}}" class="text-muted">{{$status->created_at->diffForHumans()}}</a></p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body status-comments">
|
||||
<div class="status-comment">
|
||||
<p class="mb-1">
|
||||
<span class="font-weight-bold pr-1">{{$status->profile->username}}</span>
|
||||
<span class="comment-text">{!! $status->rendered ?? e($status->caption) !!}</span>
|
||||
</p>
|
||||
<div class="comments">
|
||||
@foreach($status->comments->reverse()->take(10) as $item)
|
||||
<p class="mb-0">
|
||||
<span class="font-weight-bold pr-1"><bdi><a class="text-dark" href="{{$item->profile->url()}}">{{$item->profile->username}}</a></bdi></span>
|
||||
<span class="comment-text">{!!$item->rendered!!} <a href="{{$item->url()}}" class="text-dark small font-weight-bold float-right">{{$item->created_at->diffForHumans(null, true, true ,true)}}</a></span>
|
||||
</p>
|
||||
<p class="mb-0">
|
||||
<span class="font-weight-bold pr-1"><bdi><a class="text-dark" href="{{$item->profile->url()}}">{{$item->profile->username}}</a></bdi></span>
|
||||
<span class="comment-text">{!!$item->rendered!!} <a href="{{$item->url()}}" class="text-dark small font-weight-bold float-right">{{$item->created_at->diffForHumans(null, true, true ,true)}}</a></span>
|
||||
</p>
|
||||
@endforeach
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<div class="reactions h3 pr-3 mb-0">
|
||||
<form class="like-form pr-3" method="post" action="/i/like" style="display: inline;" data-id="{{$status->id}}" data-action="like">
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body flex-grow-0">
|
||||
<div class="reactions h3 mb-0">
|
||||
<form class="d-inline-flex like-form pr-3" method="post" action="/i/like" style="display: inline;" data-id="{{$status->id}}" data-action="like">
|
||||
@csrf
|
||||
<input type="hidden" name="item" value="{{$status->id}}">
|
||||
<button class="btn btn-link text-dark p-0" type="submit"><span class="icon-heart" style="font-size:25px;"></span></button>
|
||||
<button class="btn btn-link text-dark p-0" type="submit"><h3 class="icon-heart mb-0"></h3></button>
|
||||
</form>
|
||||
<span class="icon-speech pr-3"></span>
|
||||
@if(Auth::check())
|
||||
@if(Auth::user()->profile->id === $status->profile->id || Auth::user()->is_admin == true)
|
||||
<form method="post" action="/i/delete" class="d-inline-flex">
|
||||
@csrf
|
||||
<input type="hidden" name="type" value="post">
|
||||
<input type="hidden" name="item" value="{{$status->id}}">
|
||||
<button type="submit" class="btn btn-link text-dark p-0"><span class="icon-trash" style="font-size:25px;"></span></button>
|
||||
</form>
|
||||
@endif
|
||||
@endif
|
||||
<span class="float-right">
|
||||
<form class="bookmark-form" method="post" action="/i/bookmark" style="display: inline;" data-id="{{$status->id}}" data-action="bookmark">
|
||||
@csrf
|
||||
<input type="hidden" name="item" value="{{$status->id}}">
|
||||
<button class="btn btn-link text-dark p-0" type="submit"><span class="icon-notebook" style="font-size:25px;"></span></button>
|
||||
</form>
|
||||
</span>
|
||||
</div>
|
||||
<div class="likes font-weight-bold mb-0">
|
||||
<span class="like-count">{{$status->likes()->count()}}</span> likes
|
||||
</div>
|
||||
<div class="timestamp mb-0">
|
||||
<p class="small text-uppercase mb-0"><a href="{{$status->url()}}" class="text-muted">{{$status->created_at->diffForHumans()}}</a></p>
|
||||
</div>
|
||||
<hr class="my-2">
|
||||
<div class="pr-3 pb-2">
|
||||
<form class="comment-form" method="post" action="/i/comment" data-id="{{$status->id}}" data-truncate="false">
|
||||
<span class="icon-speech pr-3"></span>
|
||||
@if(Auth::check())
|
||||
@if(Auth::user()->profile->id === $status->profile->id || Auth::user()->is_admin == true)
|
||||
<form method="post" action="/i/delete" class="d-inline-flex">
|
||||
@csrf
|
||||
<input type="hidden" name="type" value="post">
|
||||
<input type="hidden" name="item" value="{{$status->id}}">
|
||||
<button type="submit" class="btn btn-link text-dark p-0"><h3 class="icon-trash mb-0"></h3></button>
|
||||
</form>
|
||||
@endif
|
||||
@endif
|
||||
<span class="float-right">
|
||||
<form class="d-inline-flex bookmark-form" method="post" action="/i/bookmark" style="display: inline;" data-id="{{$status->id}}" data-action="bookmark">
|
||||
@csrf
|
||||
<input type="hidden" name="item" value="{{$status->id}}">
|
||||
<input class="form-control" name="comment" placeholder="Add a comment...">
|
||||
<button class="btn btn-link text-dark p-0" type="submit"><h3 class="icon-notebook mb-0"></h3></button>
|
||||
</form>
|
||||
</div>
|
||||
</span>
|
||||
</div>
|
||||
<div class="likes font-weight-bold mb-0">
|
||||
<span class="like-count">{{$status->likes()->count()}}</span> likes
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-footer">
|
||||
<form class="comment-form" method="post" action="/i/comment" data-id="{{$status->id}}" data-truncate="false">
|
||||
@csrf
|
||||
<input type="hidden" name="item" value="{{$status->id}}">
|
||||
<input class="form-control" name="comment" placeholder="Add a comment...">
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@endsection
|
||||
@endsection
|
||||
|
|
Loading…
Reference in a new issue