Skip to content

Commit

Permalink
Make viewers avatars link to user profile
Browse files Browse the repository at this point in the history
  • Loading branch information
danon committed Oct 9, 2024
1 parent 78d537b commit c113125
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 5 deletions.
1 change: 1 addition & 0 deletions app/Domain/Online/ViewerUser.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ public function __construct(
public string $name,
public ?string $groupName,
public ?string $avatarUrl,
public string $profileUrl,
)
{
}
Expand Down
1 change: 1 addition & 0 deletions app/Domain/Online/ViewersStore.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ private function viewerUser(User $user): ViewerUser
$user->name,
$user->group_name,
$user->photo->getFilename(),
\route('profile', [$user->id]),
);
}
}
8 changes: 4 additions & 4 deletions resources/views/components/viewers.twig
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<div class="viewers-online">
<div class="mb-1 viewers-users-group">
{% for user in usersWithGroup %}
<div class="viewer-pill d-inline-flex mb-1" title="{{ user.name }} (online)">
<a class="viewer-pill d-inline-flex mb-1" title="{{ user.name }} (online)" style="color:inherit;" href="{{ user.profileUrl }}">
<div class="viewer-pill-avatar d-inline-block">
{{ user_avatar(user.avatarUrl, user.name) }}
</div>
Expand All @@ -21,14 +21,14 @@
<br>
<small>{{ user.groupName }}</small>
</span>
</div>
</a>
{% endfor %}
</div>
<div class="viewers-users">
{% for user in usersWithoutGroup %}
<span class="circle d-inline-block" title="{{ user.name }} (online)">
<a class="circle d-inline-block" title="{{ user.name }} (online)" style="color:inherit;" href="{{ user.profileUrl }}">
{{ user_avatar(user.avatarUrl, user.name) }}
</span>
</a>
{% endfor %}
{% if superfluousCount > 0 %}
<span class="circle circle-number d-inline-block" title="Jeszcze {{ superfluousCount }} innych użytkowników (online)">
Expand Down
2 changes: 1 addition & 1 deletion tests/Unit/OnlineUsers/ViewersTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,6 @@ private function usersOfSize(int $size): array

private function user(string $name = null, string $group = null): ViewerUser
{
return new ViewerUser($name ?? '', $group, null);
return new ViewerUser($name ?? '', $group, null, '');
}
}

0 comments on commit c113125

Please sign in to comment.