misuzu/templates/home/home.twig
flash 383e2ed0e0 Rewrote the user information class.
This one took multiple days and it pretty invasive into the core of Misuzu so issue might (will) arise, there's also some features that have gone temporarily missing in the mean time and some inefficiencies introduced that will be fixed again at a later time.
The old class isn't gone entirely because I still have to figure out what I'm gonna do about validation, but for the most part this knocks out one of the "layers of backwards compatibility", as I've been referring to it, and is moving us closer to a future where Flashii actually gets real updates.
If you run into anything that's broken and you're inhibited from reporting it through the forum, do it through chat or mail me at flashii-issues@flash.moe.
2023-08-02 22:12:47 +00:00

130 lines
5.3 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">
{{ 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 %}