diff --git a/assets/less/classes/index.less b/assets/less/classes/index.less index 7ab58af2..1e54cc69 100644 --- a/assets/less/classes/index.less +++ b/assets/less/classes/index.less @@ -39,4 +39,26 @@ } } } + + &__online { + display: flex; + flex-wrap: wrap; + justify-content: center; + overflow: hidden; + + &__user { + color: var(--user-colour); + text-decoration: none; + font-size: 0; + width: 30px; + height: 30px; + background-image: var(--avatar-url); + margin: 2px; + transition: box-shadow .2s; + + &:hover { + box-shadow: 0 1px 4px var(--user-colour); + } + } + } } diff --git a/public/index.php b/public/index.php index 973e0133..f1df5f66 100644 --- a/public/index.php +++ b/public/index.php @@ -55,9 +55,10 @@ $onlineUsers = cache_get('index:online:v1', function () { LEFT JOIN `msz_roles` as r ON r.`role_id` = u.`display_role` WHERE u.`user_active` >= DATE_SUB(NOW(), INTERVAL 5 MINUTE) - ORDER BY u.`user_active` DESC + ORDER BY RAND() + LIMIT 104 ')->fetchAll(PDO::FETCH_ASSOC); -}, 30); +}, -1); echo tpl_render('home.' . (user_session_active() ? 'home' : 'landing'), [ 'users_count' => $statistics['users'], diff --git a/templates/home/landing.twig b/templates/home/landing.twig index 5948e2a8..cb1f95eb 100644 --- a/templates/home/landing.twig +++ b/templates/home/landing.twig @@ -29,19 +29,19 @@ -
- {{ container_title('Online users') }} -
- {% if online_users < 1 %} - No one was online in the last 5 minutes. - {% else %} - Online users in the last 5 minutes:
+ {% if online_users > 0 %} +
+ {{ container_title('Online users') }} + +
{% for user in online_users %} - {{ user.username }} + + {{ user.username }} + {% endfor %} - {% endif %} +
-
+ {% endif %}
{{ container_title('Changelog', '/changelog.php') }}