Skip to content

Commit 05d5b93

Browse files
committed
Improve profile header layout; lil bit of refactoring
1 parent 3cb292b commit 05d5b93

File tree

7 files changed

+150
-141
lines changed

7 files changed

+150
-141
lines changed

app/Http/Controllers/FrontendUserController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public function getProfilePage(string $username): View {
3030
$statuses = null;
3131
}
3232

33-
return view('profile', [
33+
return view('profile.profile', [
3434
'statuses' => $statuses,
3535
'user' => $user,
3636
]);

resources/sass/app.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ body {
8484
}
8585

8686
.profile-tag {
87-
font-size: map-get($font-sizes, 5);
87+
font-size: map-get($font-sizes, 6);
8888
}
8989

9090
@include media-breakpoint-up(md) {
@@ -102,7 +102,7 @@ body {
102102
}
103103

104104
.profile-tag {
105-
font-size: map-get($font-sizes, 2);
105+
font-size: map-get($font-sizes, 5);
106106
}
107107
}
108108

resources/views/profile.blade.php

Lines changed: 0 additions & 138 deletions
This file was deleted.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
@auth
2+
@include('includes.follow-button')
3+
@if(auth()->user()->id != $user->id)
4+
<x-mute-button :user="$user"/>
5+
<x-block-button :user="$user"/>
6+
@endif
7+
@if(auth()->user()->hasRole('admin'))
8+
<a href="{{ route('admin.users.user', ['id' => $user->id]) }}"
9+
class="btn btn-sm btn-outline-light">
10+
<i class="fa fa-tools"></i>
11+
</a>
12+
@endif
13+
@endauth
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<div class="row justify-content-center mt-4">
2+
@if($user->muted)
3+
<div class="col-md-8 col-lg-7 text-center mb-5">
4+
<header><h3>{{__('user.muted.heading')}}</h3></header>
5+
<h5>{{__('user.muted.text', ["username" => $user->username])}}</h5>
6+
7+
<x-mute-button :user="$user" :showText="true"/>
8+
</div>
9+
@elseif($user->isAuthUserBlocked)
10+
<div class="col-md-8 col-lg-7 text-center mb-5">
11+
<span class="fs-3">{{__('profile.youre-blocked-text')}}</span>
12+
<br/>
13+
<span class="fs-5">
14+
{{__('profile.youre-blocked-information-text', ['username' => $user->username])}}
15+
</span>
16+
</div>
17+
@elseif($user->isBlockedByAuthUser)
18+
<div class="col-md-8 col-lg-7 text-center mb-5">
19+
<span class="fs-3">{{__('profile.youre-blocking-text', ['username' => $user->username])}}</span>
20+
<br/>
21+
<span class="fs-5">
22+
{{__('profile.youre-blocking-information-text')}}
23+
</span>
24+
</div>
25+
@elseif($user->private_profile && !$user->following && (!auth()->check() || $user->id !== auth()->id()))
26+
<div class="col-md-8 col-lg-7 text-center mb-5">
27+
<span class="fs-3">{{__('profile.private-profile-text')}}</span>
28+
<br/>
29+
<span class="fs-5">
30+
{{__('profile.private-profile-information-text', ['username' => $user->username, 'request' => __('profile.follow_req')])}}
31+
</span>
32+
</div>
33+
@else
34+
@include('profile.partials.statuses')
35+
@endif
36+
</div>
37+
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
@if(isset($statuses) && $statuses->count() > 0)
2+
<div class="col-md-8 col-lg-7">
3+
<h1 class="fs-3">{{__('profile.last-journeys-of')}} {{ $user->name }}:</h1>
4+
@include('includes.statuses', ['statuses' => $statuses, 'showDates' => true])
5+
</div>
6+
7+
<div class="mt-5">
8+
{{ $statuses->onEachSide(1)->links() }}
9+
</div>
10+
@else
11+
<div class="col-md-8 col-lg-7">
12+
<span class="text-danger fs-3">
13+
@if($user->train_distance > 0)
14+
{{__('profile.no-visible-statuses', ['username' => $user->name])}}
15+
@else
16+
{{__('profile.no-statuses', ['username' => $user->name])}}
17+
@endif
18+
</span>
19+
</div>
20+
@endif
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
@extends('layouts.app')
2+
3+
@section('title', $user->name)
4+
@section('canonical', route('profile', ['username' => $user->username]))
5+
6+
@if($user->prevent_index)
7+
@section('meta-robots', 'noindex')
8+
@else
9+
@section('meta-description', __('description.profile', [
10+
'username' => $user->name,
11+
'kmAmount' => number($user->train_distance / 1000, 0),
12+
'hourAmount' => number($user->train_duration / 60, 0)
13+
]))
14+
@endif
15+
16+
@section('content')
17+
@php /** @var \App\Models\User $user */ @endphp
18+
<div class="px-md-4 py-md-5 py-4 mt-n4 profile-banner">
19+
<div class="container">
20+
<img alt="{{ __('settings.picture') }}"
21+
src="{{ \App\Http\Controllers\Backend\User\ProfilePictureController::getUrl($user) }}"
22+
class="float-end img-thumbnail rounded-circle img-fluid profile-picture"/>
23+
<div class="text-white px-md-4">
24+
<h1 class="card-title h1-responsive font-bold mb-0 profile-name">
25+
<strong>
26+
{{ $user->name }}
27+
@if($user->private_profile)
28+
<i class="fas fa-user-lock"></i>
29+
@endif
30+
</strong>
31+
</h1>
32+
<span
33+
class="d-flex flex-column flex-md-row justify-content-md-start align-items-md-center gap-md-2 gap-1 pt-1 pb-2 pb-md-0 small">
34+
<small class="font-weight-light profile-tag">
35+
{{ '@'. $user->username }}
36+
@if($user->followedBy)
37+
<span class="badge text-bg-success">
38+
{{__('profile.follows-you')}}
39+
</span>
40+
@endif
41+
</small>
42+
</span>
43+
<div class="d-flex py-3 flex-row justify-content-md-start align-items-md-center gap-1 ">
44+
@include('profile.partials.actions')
45+
</div>
46+
47+
@if(!$user->isAuthUserBlocked && !$user->isBlockedByAuthUser && !$user->muted)
48+
<span class="profile-stats">
49+
<span class="font-weight-bold"><i class="fa fa-route d-inline"></i>&nbsp;{{ number($user->train_distance / 1000) }}</span>
50+
<span class="small font-weight-lighter">km</span>
51+
<span class="font-weight-bold ps-sm-2"><i class="fa fa-stopwatch d-inline"></i>&nbsp;{!! durationToSpan(secondsToDuration($user->train_duration * 60)) !!}</span>
52+
@if($user->points_enabled || auth()->check() && auth()->user()->points_enabled)
53+
<span class="font-weight-bold ps-sm-2">
54+
<i class="fa fa-dice-d20 d-inline"></i>&nbsp;{{ $user->points }}
55+
</span>
56+
<span class="small font-weight-lighter">
57+
{{__('profile.points-abbr')}}
58+
</span>
59+
@endif
60+
@if($user->mastodonUrl)
61+
<span class="font-weight-bold ps-sm-2">
62+
<a href="{{ $user->mastodonUrl }}" rel="me" class="text-white" target="_blank">
63+
<i class="fab fa-mastodon d-inline"></i>
64+
</a>
65+
</span>
66+
@endif
67+
</span>
68+
@endif
69+
</div>
70+
</div>
71+
</div>
72+
<div class="container">
73+
@include('profile.partials.body')
74+
@include('includes.edit-modal')
75+
@include('includes.delete-modal')
76+
</div>
77+
@endsection

0 commit comments

Comments
 (0)