Skip to content

Commit 67159b4

Browse files
committed
WIP
1 parent 22c5682 commit 67159b4

File tree

8 files changed

+57
-42
lines changed

8 files changed

+57
-42
lines changed

app/Http/Controllers/PostController.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,13 +84,11 @@ public function list(Request $request)
8484
->orderBy('id', 'desc')
8585
->cursorPaginate(3);
8686

87-
$test = view('particles.posts.list', [
87+
return view('particles.posts.list', [
8888
'posts' => $posts,
8989
'isMyProfile' => $request->has('user_id') && $request->user()?->id == $request->get('user_id'),
9090
'action' => $this->action
9191
])->fragmentsIf(!$request->isMethodSafe());
92-
93-
return $test;
9492
}
9593

9694
}

app/Policies/OwnerPolicy.php renamed to app/Policies/HasOwner.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
use Illuminate\Auth\Access\Response;
88
use Illuminate\Database\Eloquent\Model;
99

10-
trait OwnerPolicy
10+
trait HasOwner
1111
{
1212
use HandlesAuthorization;
1313

app/Policies/PostPolicy.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,5 @@
44

55
class PostPolicy
66
{
7-
use OwnerPolicy;
8-
7+
use HasOwner;
98
}

resources/css/app.scss

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -543,3 +543,18 @@ main {
543543
display: block;
544544
}
545545

546+
547+
548+
@keyframes fade-in {
549+
0% {
550+
opacity: 0;
551+
}
552+
100% {
553+
opacity: 1;
554+
}
555+
}
556+
557+
.hotwire-frame {
558+
opacity: 0;
559+
animation: fade-in 0.5s ease-in-out forwards;
560+
}

resources/views/pages/profile/profile.blade.php

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
<div class="d-sm-flex align-items-start text-center text-sm-start">
1515
<div>
1616
<!-- Avatar -->
17-
<div class="avatar avatar-xxl mt-n5 mb-3">
17+
<div class="avatar avatar-xxl mt-n5 mb-3 mx-auto">
1818
<img class="avatar-img rounded-circle border border-tertiary-subtle border-3"
1919
src="{{ $user->avatar }}" alt="">
2020
</div>
@@ -28,28 +28,32 @@
2828
<small class="opacity-75">На проекте с 23 мая 2022</small>
2929
</div>
3030

31-
<div class="d-flex flex-column my-3 ms-sm-auto ">
31+
32+
<div class="d-flex flex-column my-3 ms-sm-auto">
3233

3334

3435
@if ($isMyAccount)
35-
<x-logout class="btn btn-link" formId="sign-out">
36-
<x-icon path="bs.logout" class="pe-1" />
37-
Выйти из профиля
38-
</x-logout>
39-
<a href="{{route('my.edit')}}" class="btn btn-danger">
40-
<x-icon path="bs.pencil-fill" class="pe-1"/>
41-
Редактировать
42-
</a>
36+
<div class="d-flex">
37+
<x-logout class="btn btn-link" formId="sign-out" title="Выйти">
38+
<x-icon path="bs.door-closed"/>
39+
</x-logout>
40+
<a href="{{route('my.edit')}}" class="btn btn-danger">
41+
<x-icon path="bs.pencil-fill" class="pe-1"/>
42+
Редактировать
43+
</a>
44+
</div>
4345
@else
44-
<a href="https://github.com/{{$user->nickname}}" class="d-block mb-2">
45-
<x-icon path="bs.github" width="1.5em" height="1.5em" class="pe-1"/>
46+
<a href="https://github.com/{{$user->nickname}}" class="d-block">
47+
<x-icon path="bs.github" width="2em" height="2em"/>
4648
</a>
47-
48-
4949
@endif
5050
</div>
5151
</div>
5252

53+
<div class="">
54+
{!! \Illuminate\Support\Str::of($user->about)->markdown() !!}
55+
</div>
56+
5357
</div>
5458
</div>
5559

resources/views/pages/profile/tabs/comments-tab.blade.php

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
@section('tab')
44
@if($comments->isEmpty())
55
@if ($isMyAccount)
6-
<div class="bg-body-tertiary rounded p-5">
6+
<div class="bg-body-tertiary rounded p-5 rounded">
77
<div class="p-5">
88
<div class="text-center mb-3">
99
Вы не написали ни одного комментария
@@ -14,7 +14,7 @@
1414
</div>
1515
</div>
1616
@else
17-
<div class="bg-body-tertiary rounded p-5">
17+
<div class="bg-body-tertiary rounded p-5 rounded">
1818
<div class="p-5">
1919
<div class="text-center mb-3">
2020
Этот пользователь не оставил ни одного комментария
@@ -24,20 +24,19 @@
2424
@endif
2525
@else
2626

27-
28-
<turbo-frame id="comments-frame">
29-
<x-stream target="comments">
30-
<div class="col-xl-8 col-md-12 mx-auto mt-5 mb-3">
31-
<div class="bg-body-tertiary overflow-hidden px-5 py-3">
32-
@foreach($comments as $comment)
33-
@include('pages.profile.tabs.particles.comments.comment', [
34-
'comment' => $comment,
35-
'edit' => $edit ?? null,
36-
])
37-
@endforeach
38-
</div>
27+
<turbo-frame id="comments-frame">
28+
<x-stream target="comments">
29+
<div class="col-xl-8 col-md-12 mx-auto mb-3">
30+
<div class="bg-body-tertiary overflow-hidden px-5 py-3 rounded">
31+
@foreach($comments as $comment)
32+
@include('pages.profile.tabs.particles.comments.comment', [
33+
'comment' => $comment,
34+
'edit' => $edit ?? null,
35+
])
36+
@endforeach
3937
</div>
40-
</x-stream>
41-
</turbo-frame>
38+
</div>
39+
</x-stream>
40+
</turbo-frame>
4241
@endif
4342
@endsection

resources/views/particles/posts/list.blade.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<turbo-frame id="posts-frame" data-turbo-temporary>
2-
<x-stream target="posts" action="{{$action}}" class="col-xl-8 col-md-12 mx-auto">
2+
<x-stream target="posts" action="{{$action}}" class="col-xl-8 col-md-12 mx-auto hotwire-frame">
33
@if($posts->isEmpty())
4-
<div class="bg-body-tertiary rounded p-5">
4+
<div class="bg-body-tertiary rounded p-5 rounded">
55
<div class="p-5">
66
@if ($isMyProfile)
77
<div class="text-center mb-3">
@@ -21,7 +21,7 @@
2121
</div>
2222
@else
2323
@foreach ($posts as $post)
24-
<div class="bg-body-tertiary mb-4 px-5 py-4">
24+
<div class="bg-body-tertiary mb-4 px-5 py-4 rounded">
2525

2626
<div class="d-flex align-items-center justify-content-between mb-3">
2727
<div class="d-flex align-items-center">
@@ -59,13 +59,13 @@ class="text-body-secondary text-decoration-none">{{ $post->user->name }}</a>
5959
</div>
6060
</div>
6161

62-
<div class="position-relative">
62+
<div class="position-relative post">
6363
<a href="{{ route('post.show', $post) }}"
6464
class="position-absolute start-0 end-0 top-0 bottom-0"></a>
6565

6666
<h4 class="mb-3">{{ $post->title }}</h4>
6767

68-
<p>{{ $post->preview() }} </p>
68+
<p>{!! \Illuminate\Support\Str::of($post->content)->markdown() !!}</p>
6969
</div>
7070

7171
<div class="d-flex align-items-center mt-4">

resources/views/post/list.blade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636

3737
<div class="container my-5">
3838
<div class="row">
39-
<turbo-frame id="posts-frame" target="_top" src="{{ route('feed.articles') }}"/>
39+
<turbo-frame id="posts-frame" target="_top" src="{{ route('posts') }}"/>
4040
</div>
4141
</div>
4242
@endsection

0 commit comments

Comments
 (0)