mirror of
https://github.com/YGGverse/YGGtracker.git
synced 2026-04-01 09:35:28 +00:00
draft activity feature #4
This commit is contained in:
parent
8ee25d3a30
commit
d73086231f
4 changed files with 65 additions and 26 deletions
|
|
@ -129,18 +129,6 @@ class UserController extends AbstractController
|
|||
);
|
||||
}
|
||||
|
||||
// Generate identicon
|
||||
$identicon = new \Jdenticon\Identicon();
|
||||
|
||||
$identicon->setValue($user->getAddress());
|
||||
$identicon->setSize(48);
|
||||
$identicon->setStyle(
|
||||
[
|
||||
'backgroundColor' => 'rgba(255, 255, 255, 0)',
|
||||
'padding' => 0
|
||||
]
|
||||
);
|
||||
|
||||
// Render template
|
||||
return $this->render(
|
||||
'default/user/profile.html.twig',
|
||||
|
|
@ -156,7 +144,10 @@ class UserController extends AbstractController
|
|||
'added' => $timeService->ago(
|
||||
$user->getAdded()
|
||||
),
|
||||
'identicon' => $identicon->getImageDataUri('webp'),
|
||||
'identicon' => $userService->identicon(
|
||||
$user->getAddress(),
|
||||
48
|
||||
),
|
||||
],
|
||||
'locales' => explode('|', $this->getParameter('app.locales'))
|
||||
]
|
||||
|
|
@ -185,18 +176,6 @@ class UserController extends AbstractController
|
|||
throw $this->createNotFoundException();
|
||||
}
|
||||
|
||||
// Generate identicon
|
||||
$identicon = new \Jdenticon\Identicon();
|
||||
|
||||
$identicon->setValue($user->getAddress());
|
||||
$identicon->setSize(48);
|
||||
$identicon->setStyle(
|
||||
[
|
||||
'backgroundColor' => 'rgba(255, 255, 255, 0)',
|
||||
'padding' => 0
|
||||
]
|
||||
);
|
||||
|
||||
// Render template
|
||||
return $this->render(
|
||||
'default/user/info.html.twig',
|
||||
|
|
@ -212,7 +191,10 @@ class UserController extends AbstractController
|
|||
'added' => $timeService->ago(
|
||||
$user->getAdded()
|
||||
),
|
||||
'identicon' => $identicon->getImageDataUri('webp'),
|
||||
'identicon' => $userService->identicon(
|
||||
$user->getAddress(),
|
||||
48
|
||||
),
|
||||
]
|
||||
]
|
||||
);
|
||||
|
|
|
|||
|
|
@ -40,4 +40,13 @@ class UserRepository extends ServiceEntityRepository
|
|||
->getOneOrNullResult()
|
||||
;
|
||||
}
|
||||
|
||||
public function findAllByAddedFieldDesc(): array
|
||||
{
|
||||
return $this->createQueryBuilder('u')
|
||||
->orderBy('u.added', 'DESC')
|
||||
->getQuery()
|
||||
->getResult()
|
||||
;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -58,6 +58,31 @@ class UserService
|
|||
return $this->userRepository->findOneByIdField($id);
|
||||
}
|
||||
|
||||
public function getAllByAddedFieldDesc(): array
|
||||
{
|
||||
return $this->userRepository->findAllByAddedFieldDesc();
|
||||
}
|
||||
|
||||
public function identicon(
|
||||
mixed $value,
|
||||
int $size = 16,
|
||||
array $style =
|
||||
[
|
||||
'backgroundColor' => 'rgba(255, 255, 255, 0)',
|
||||
'padding' => 0
|
||||
],
|
||||
string $format = 'webp'
|
||||
): string
|
||||
{
|
||||
$identicon = new \Jdenticon\Identicon();
|
||||
|
||||
$identicon->setValue($value);
|
||||
$identicon->setSize($size);
|
||||
$identicon->setStyle($style);
|
||||
|
||||
return $identicon->getImageDataUri($format);
|
||||
}
|
||||
|
||||
public function save(User $user) : void
|
||||
{
|
||||
$this->entityManager->persist($user);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue