Basic profile.
This commit is contained in:
parent
aa9fbbe123
commit
7d74ebea27
4 changed files with 94 additions and 0 deletions
|
@ -2,6 +2,7 @@
|
|||
use Aitemu\Route;
|
||||
use Misuzu\Controllers\AuthController;
|
||||
use Misuzu\Controllers\HomeController;
|
||||
use Misuzu\Controllers\UserController;
|
||||
|
||||
return [
|
||||
Route::get('/', 'index', HomeController::class),
|
||||
|
@ -12,4 +13,6 @@ return [
|
|||
Route::get('/auth/register', 'register', AuthController::class),
|
||||
Route::post('/auth/register', 'register', AuthController::class),
|
||||
Route::get('/auth/logout', 'logout', AuthController::class),
|
||||
|
||||
Route::get('/user/{id:i}', 'view', UserController::class),
|
||||
];
|
||||
|
|
16
src/Controllers/UserController.php
Normal file
16
src/Controllers/UserController.php
Normal file
|
@ -0,0 +1,16 @@
|
|||
<?php
|
||||
namespace Misuzu\Controllers;
|
||||
|
||||
use Misuzu\Application;
|
||||
use Misuzu\Users\User;
|
||||
|
||||
class UserController extends Controller
|
||||
{
|
||||
public function view(int $userId): string
|
||||
{
|
||||
$app = Application::getInstance();
|
||||
$twig = $app->templating;
|
||||
$twig->vars(['profile' => User::findOrFail($userId)]);
|
||||
return $twig->render('user.view');
|
||||
}
|
||||
}
|
1
views/nova/user/master.twig
Normal file
1
views/nova/user/master.twig
Normal file
|
@ -0,0 +1 @@
|
|||
{% extends '@nova/master.twig' %}
|
74
views/nova/user/view.twig
Normal file
74
views/nova/user/view.twig
Normal file
|
@ -0,0 +1,74 @@
|
|||
{% extends '@nova/user/master.twig' %}
|
||||
|
||||
{% set title = 'profile / ' ~ profile.username %}
|
||||
{% set banner_large = true %}
|
||||
{% set wrapper_classes = 'profile' %}
|
||||
{% set banner_classes = 'profile__banner' %}
|
||||
|
||||
{% set hierarchies = {
|
||||
'founder': {
|
||||
'display': profile.user_id == 1,
|
||||
'icon': 'fa-cog',
|
||||
'text': 'Founder',
|
||||
},
|
||||
'staff': {
|
||||
'display': false,
|
||||
'icon': 'fa-gavel',
|
||||
'text': 'Staff',
|
||||
},
|
||||
'developer': {
|
||||
'display': false,
|
||||
'icon': 'fa-code',
|
||||
'text': 'Developer',
|
||||
},
|
||||
'contributor': {
|
||||
'display': false,
|
||||
'icon': 'fa-heart',
|
||||
'text': 'Contributor',
|
||||
},
|
||||
'premium': {
|
||||
'display': false,
|
||||
'icon': 'fa-heart',
|
||||
'text': 'Contributor',
|
||||
},
|
||||
'banned': {
|
||||
'display': false,
|
||||
'icon': 'fa-trash',
|
||||
'text': 'Banned',
|
||||
},
|
||||
} %}
|
||||
|
||||
{% block banner_content %}
|
||||
{% spaceless %}
|
||||
<div class="banner__bottom profile__header">
|
||||
<div class="profile__header-sub profile__names">
|
||||
<div class="profile__username">{{ profile.username }}</div>
|
||||
</div>
|
||||
<div class="profile__header-sub profile__dates">
|
||||
<div class="profile__date--joined">Joined {{ profile.user_registered|date('r') }}</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endspaceless %}
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<div class="profile__content">
|
||||
{% spaceless %}
|
||||
<div class="profile__container profile__container--left">
|
||||
<div class="profile__avatar" style="background-image: url('https://static.flash.moe/images/discord-logo.png');"></div>
|
||||
<div class="platform profile__platform profile__hierarchies">
|
||||
{% for id, data in hierarchies %}
|
||||
{% if data.display %}
|
||||
<div class="profile__hierarchy profile__hierarchy--{{ id }}">
|
||||
<div class="profile__hierarchy-icon {{ data.icon }}"></div>
|
||||
<div class="profile__hierarchy-text">{{ data.text }}</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
{% endspaceless %}
|
||||
<div class="profile__container profile__container--right">
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
Loading…
Add table
Reference in a new issue