misuzu/templates/home/home.twig

130 lines
5.3 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['users:active']|number_format,
2022-09-13 13:14:49 +00:00
},
{
icon: 'fas fa-comment-dots fa-fw',
name: 'Comments',
value: statistics['comments:posts:visible']|number_format,
2022-09-13 13:14:49 +00:00
},
{
icon: 'fas fa-user-check fa-fw',
name: 'Online',
value: statistics['users:online:recent']|number_format,
2022-09-13 13:14:49 +00:00
},
{
icon: 'fas fa-user-clock fa-fw',
name: 'Active (24 hr)',
value: statistics['users:online:today']|number_format,
2022-09-13 13:14:49 +00:00
},
{
icon: 'fas fa-list fa-fw',
name: 'Topics',
value: statistics['forum:topics:visible']|number_format,
2022-09-13 13:14:49 +00:00
},
{
icon: 'fas fa-comments fa-fw',
name: 'Posts',
value: statistics['forum:posts:visible']|number_format,
2022-09-13 13:14:49 +00:00
},
] %}
{% 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) }}
2022-09-13 13:14:49 +00:00
</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>
2022-09-13 13:14:49 +00:00
<div class="landing__latest__content">
<div class="landing__latest__username">
{{ birthday.info.name }}
2022-09-13 13:14:49 +00:00
</div>
{% if age > 0 %}
2022-09-13 13:14:49 +00:00
<div class="landing__latest__joined">
Turned {{ age }} today!
2022-09-13 13:14:49 +00:00
</div>
{% endif %}
</div>
</a>
{% endfor %}
</div>
{% elseif newest_member is not empty %}
2022-09-13 13:14:49 +00:00
<div class="container landing__container">
{{ container_title('<i class="fas fa-user-plus fa-fw"></i> Newest Member') }}
2022-09-13 13:14:49 +00:00
<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>
2022-09-13 13:14:49 +00:00
<div class="landing__latest__content">
<div class="landing__latest__username">
{{ newest_member.info.name }}
2022-09-13 13:14:49 +00:00
</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>
2022-09-13 13:14:49 +00:00
</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 %}