misuzu/templates/home/home.twig

129 lines
5.2 KiB
Twig
Raw Permalink Normal View History

2022-09-13 13:14:49 +00:00
{% extends 'home/master.twig' %}
{% from 'macros.twig' import container_title, avatar %}
{% from 'news/macros.twig' import news_preview %}
{% from 'changelog/macros.twig' import changelog_listing %}
{% set canonical_url = '/' %}
{% set landing_stats = [
{
icon: 'fas fa-users fa-fw',
name: 'Members',
value: statistics.count_users_all|number_format,
},
{
icon: 'fas fa-comment-dots fa-fw',
name: 'Comments',
value: statistics.count_comments|number_format,
},
{
icon: 'fas fa-user-check fa-fw',
name: 'Online',
value: statistics.count_users_online|number_format,
},
{
icon: 'fas fa-user-clock fa-fw',
name: 'Active (24 hr)',
value: statistics.count_users_active|number_format,
},
{
icon: 'fas fa-list fa-fw',
name: 'Topics',
value: statistics.count_forum_topics|number_format,
},
{
icon: 'fas fa-comments fa-fw',
name: 'Posts',
value: statistics.count_forum_posts|number_format,
},
] %}
{% block content %}
<div class="landing">
<div class="landing__sidebar">
<div class="container landing__container">
{{ container_title('<i class="fas fa-chart-bar fa-fw"></i> Statistics') }}
<div class="landing__statistics">
{% for stat in landing_stats %}
<div class="landing__statistic">
<div class="landing__statistic__name">
<i class="{{ stat.icon }}"></i> {{ stat.name }}
</div>
<div class="landing__statistic__value">
{{ stat.value }}
</div>
</div>
{% endfor %}
</div>
</div>
{% if online_users|length > 0 %}
<div class="container landing__container">
{{ container_title('<i class="fas fa-users fa-fw"></i> Currently Online') }}
<div class="landing__online">
{% for user in online_users %}
<a href="{{ url('user-profile', {'user': user.user_id}) }}" class="landing__online__user" title="{{ user.username }}">
{{ avatar(user.user_id, 30, user.username) }}
</a>
{% endfor %}
</div>
</div>
{% endif %}
{% if birthdays|length > 0 %}
<div class="container landing__container">
{{ container_title('<i class="fas fa-birthday-cake fa-fw"></i> Happy Birthday!') }}
{% for birthday in birthdays %}
<a class="landing__latest" style="--user-colour: {{ birthday.colour }}" href="{{ url('user-profile', {'user': birthday.id}) }}">
<div class="landing__latest__avatar">{{ avatar(birthday.id, 50, birthday.username) }}</div>
<div class="landing__latest__content">
<div class="landing__latest__username">
{{ birthday.username }}
</div>
{% if birthday.hasAge %}
<div class="landing__latest__joined">
Turned {{ birthday.age }} today!
</div>
{% endif %}
</div>
</a>
{% endfor %}
</div>
{% elseif latest_user is not null %}
<div class="container landing__container">
{{ container_title('<i class="fas fa-user-plus fa-fw"></i> Latest Member') }}
<a class="landing__latest" style="--user-colour: {{ latest_user.colour }}" href="{{ url('user-profile', {'user': latest_user.id}) }}">
<div class="landing__latest__avatar">{{ avatar(latest_user.id, 50, latest_user.username) }}</div>
<div class="landing__latest__content">
<div class="landing__latest__username">
{{ latest_user.username }}
</div>
<div class="landing__latest__joined">
Joined <time datetime="{{ latest_user.createdTime|date('c') }}" title="{{ latest_user.createdTime|date('r') }}">{{ latest_user.createdTime|time_diff }}</time>
</div>
</div>
</a>
</div>
{% endif %}
<div class="container landing__container">
{{ container_title('<i class="fas fa-wrench fa-fw"></i> Changelog', false, url('changelog-index')) }}
<div class="changelog__content">
{{ changelog_listing(featured_changelog, false, true) }}
</div>
</div>
</div>
<div class="landing__main">
{% for post in featured_news %}
{{ news_preview(post) }}
{% endfor %}
</div>
</div>
{% endblock %}