Skip to content

Commit

Permalink
Profile page
Browse files Browse the repository at this point in the history
  • Loading branch information
Spomky committed Nov 19, 2023
1 parent 028c4ab commit ad360a4
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/Controller/ProfileController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php

declare(strict_types=1);

namespace App\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;

final class ProfileController extends AbstractController
{
#[Route('/profile', name: 'app_profile')]
public function index(): Response
{
return $this->render('profile/index.html.twig');
}
}
4 changes: 4 additions & 0 deletions templates/homepage/index.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
Log in
</a>
{% else %}
<a href="{{ path('app_profile') }}" class="mx-auto lg:mx-0 hover:underline bg-white text-gray-800 font-bold rounded-full my-6 py-4 px-8 shadow-lg focus:outline-none focus:shadow-outline transform transition hover:scale-105 duration-300 ease-in-out">
Profile
</a>
<a href="{{ path('app_dashboard') }}" class="mx-auto lg:mx-0 hover:underline bg-white text-gray-800 font-bold rounded-full my-6 py-4 px-8 shadow-lg focus:outline-none focus:shadow-outline transform transition hover:scale-105 duration-300 ease-in-out">
Dashboard
</a>
Expand Down Expand Up @@ -174,6 +177,7 @@
{% if not is_granted('ROLE_USER') %}
<a href="{{ path('app_login') }}">Log in</a>
{% else %}
<a href="{{ path('app_profile') }}">Profile</a>
<a href="{{ path('app_dashboard') }}">Dashboard</a>
{% endif %}
</button>
Expand Down
5 changes: 5 additions & 0 deletions templates/nav.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@
<div class="items-center justify-between hidden w-full md:flex md:w-auto md:order-1" id="navbar-cta">
<ul class="flex flex-col font-medium p-4 md:p-0 mt-4 border border-gray-100 rounded-lg bg-gray-50 md:flex-row md:space-x-8 md:mt-0 md:border-0 md:bg-white">
{% if is_granted('ROLE_USER') %}
<li>
<a href="{{ path('app_profile') }}" class="block py-2 pl-3 pr-4 text-white bg-blue-700 rounded md:bg-transparent md:text-blue-700 md:p-0" aria-current="page">
Profile
</a>
</li>
<li>
<a href="{{ path('app_dashboard') }}" class="block py-2 pl-3 pr-4 text-white bg-blue-700 rounded md:bg-transparent md:text-blue-700 md:p-0" aria-current="page">
Dashboard
Expand Down
23 changes: 23 additions & 0 deletions templates/profile/index.html.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{% extends 'base.html.twig' %}

{% block title %}My profile{% endblock %}

{% block content %}
<section class="bg-white rounded-lg shadow m-4">
<div class="w-full max-w-screen-xl mx-auto p-4 md:py-8">
<h2 class="my-2 text-5xl font-bold leading-tight text-center text-gray-800">
My profile
</h2>
<div class="mb-4">
<div class="h-1 mx-auto gradient w-64 opacity-25 my-0 py-0 rounded-t"></div>
</div>
<div class="p-6 flex flex-col flex-grow flex-shrink">
<div class="flex-1 bg-white rounded-t rounded-b-none overflow-hidden">
<p class="text-gray-800 text-base px-6 mb-5">
{{ dump(app.user, app.token) }}
</p>
</div>
</div>
</div>
</section>
{% endblock %}

0 comments on commit ad360a4

Please sign in to comment.