mirror of
https://github.com/YGGverse/YGGtracker.git
synced 2026-03-31 17:15:38 +00:00
move dashboard relations to the user controller
This commit is contained in:
parent
02e56e4d08
commit
8ee25d3a30
5 changed files with 59 additions and 48 deletions
|
|
@ -12,6 +12,62 @@ use App\Service\TimeService;
|
|||
|
||||
class UserController extends AbstractController
|
||||
{
|
||||
#[Route('/')]
|
||||
public function root(
|
||||
Request $request,
|
||||
UserService $userService
|
||||
): Response
|
||||
{
|
||||
$user = $userService->init(
|
||||
$request->getClientIp()
|
||||
);
|
||||
|
||||
return $this->redirectToRoute(
|
||||
'user_dashboard',
|
||||
[
|
||||
'_locale' => $user->getLocale()
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
#[Route(
|
||||
'/{_locale}',
|
||||
name: 'user_dashboard'
|
||||
)]
|
||||
public function index(
|
||||
Request $request,
|
||||
UserService $userService,
|
||||
TimeService $timeService
|
||||
): Response
|
||||
{
|
||||
$activities = [];
|
||||
foreach ($userService->getAllByAddedFieldDesc() as $user)
|
||||
{
|
||||
$activities[] =
|
||||
[
|
||||
'user' =>
|
||||
[
|
||||
'id' => $user->getId(),
|
||||
'identicon' => $userService->identicon(
|
||||
$user->getAddress(),
|
||||
24
|
||||
)
|
||||
],
|
||||
'type' => 'join',
|
||||
'added' => $timeService->ago(
|
||||
$user->getAdded()
|
||||
)
|
||||
];
|
||||
}
|
||||
|
||||
return $this->render(
|
||||
'default/user/dashboard.html.twig',
|
||||
[
|
||||
'activities' => $activities
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
#[Route(
|
||||
'/{_locale}/profile',
|
||||
name: 'user_profile',
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue