misuzu/templates/home/home.twig
2023-09-08 23:07:37 +00:00

133 lines
5.7 KiB
Twig

{% 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['users:active']|number_format,
},
{
icon: 'fas fa-comment-dots fa-fw',
name: 'Comments',
value: statistics['comments:posts:visible']|number_format,
},
{
icon: 'fas fa-user-check fa-fw',
name: 'Online',
value: statistics['users:online:recent']|number_format,
},
{
icon: 'fas fa-user-clock fa-fw',
name: 'Active (24 hr)',
value: statistics['users:online:today']|number_format,
},
{
icon: 'fas fa-list fa-fw',
name: 'Topics',
value: statistics['forum:topics:visible']|number_format,
},
{
icon: 'fas fa-comments fa-fw',
name: 'Posts',
value: statistics['forum:posts:visible']|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.id}) }}" class="landing__online__user" title="{{ user.name }}">
{{ avatar(user.id, 30, user.name) }}
</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 %}
{% set age = birthday.info.age %}
<a class="landing__latest" style="--user-colour: {{ birthday.colour }}" href="{{ url('user-profile', {'user': birthday.info.id}) }}">
<div class="landing__latest__avatar">{{ avatar(birthday.info.id, 50, birthday.info.name) }}</div>
<div class="landing__latest__content">
<div class="landing__latest__username">
{{ birthday.info.name }}
</div>
{% if age > 0 %}
<div class="landing__latest__joined">
Turned {{ age }} today!
</div>
{% endif %}
</div>
</a>
{% endfor %}
</div>
{% elseif newest_member is not empty %}
<div class="container landing__container">
{{ container_title('<i class="fas fa-user-plus fa-fw"></i> Newest Member') }}
<a class="landing__latest" style="--user-colour: {{ newest_member.colour }}" href="{{ url('user-profile', {'user': newest_member.info.id}) }}">
<div class="landing__latest__avatar">{{ avatar(newest_member.info.id, 50, newest_member.info.name) }}</div>
<div class="landing__latest__content">
<div class="landing__latest__username">
{{ newest_member.info.name }}
</div>
<div class="landing__latest__joined">
Joined <time datetime="{{ newest_member.info.createdTime|date('c') }}" title="{{ newest_member.info.createdTime|date('r') }}">{{ newest_member.info.createdTime|time_format }}</time>
</div>
</div>
</a>
</div>
{% endif %}
<div class="container landing__container">
<iframe width="300" height="169" src="https://www.youtube-nocookie.com/embed/hRW7uA2Iios?autoplay=1&amp;loop=1&amp;playlist=hRW7uA2Iios" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen style="vertical-align: middle;"></iframe>
</div>
<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 %}