diff --git a/assets/icons/ph/warning.svg b/assets/icons/ph/warning.svg new file mode 100644 index 0000000..5f2ed8e --- /dev/null +++ b/assets/icons/ph/warning.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/styles/app.css b/assets/styles/app.css index 9ab5a45..b4344b0 100644 --- a/assets/styles/app.css +++ b/assets/styles/app.css @@ -1,10 +1,12 @@ -@import "tailwindcss"; -@import "../vendor/daisyui/daisyui.min.css"; -@import "./plumber-dark-theme.css"; -@import "./plumber-light-theme.css"; +@import 'tailwindcss'; +@import '../vendor/daisyui/daisyui.min.css'; +@import './plumber-dark-theme.css'; +@import './plumber-light-theme.css'; @plugin "../vendor/daisyui/daisyui.index.js" { - themes: plumber-light --default, plumber-dark --prefersdark; + themes: + plumber-light --default, + plumber-dark --prefersdark; } @source "../../templates/"; @@ -13,6 +15,10 @@ body { scroll-behavior: smooth; } +textarea { + width: 100%; +} + [data-report-upvote].upvoted .text-green-200 { @apply text-gray-400; } @@ -40,7 +46,8 @@ body { } @keyframes gradient-x { - 0%, 100% { + 0%, + 100% { background-size: 200% 200%; background-position: left center; } @@ -62,7 +69,8 @@ body { } @keyframes float { - 0%, 100% { + 0%, + 100% { transform: translateY(0px); } 50% { @@ -71,7 +79,8 @@ body { } @keyframes pulse-smooth { - 0%, 100% { + 0%, + 100% { opacity: 0.5; transform: scale(1); } @@ -97,7 +106,6 @@ body { animation: pulse-smooth 1.5s ease-in-out infinite; } - .line-clamp-5 { display: -webkit-box; -webkit-line-clamp: 5; diff --git a/src/Application/CommandHandler/Report/CreateReportCommentCommandHandler.php b/src/Application/CommandHandler/Report/CreateReportCommentCommandHandler.php index e77bbf8..8bb025f 100644 --- a/src/Application/CommandHandler/Report/CreateReportCommentCommandHandler.php +++ b/src/Application/CommandHandler/Report/CreateReportCommentCommandHandler.php @@ -12,8 +12,10 @@ use App\Domain\Model\Report\Report; use App\Domain\Repository\Report\ReportCommentRepositoryInterface; use Psr\Log\LoggerInterface; +use Symfony\Component\Messenger\Attribute\AsMessageHandler; use Symfony\Component\Messenger\MessageBusInterface; +#[AsMessageHandler] class CreateReportCommentCommandHandler { public function __construct( @@ -26,7 +28,9 @@ public function __construct( public function __invoke(CreateReportCommentCommand $command): void { - $reportEnvelope = $this->messageBus->dispatch(new GetReportByIdQuery($command->reportId)); + $reportEnvelope = $this->messageBus->dispatch( + new GetReportByIdQuery($command->reportId), + ); /** @var Report $report */ $report = $this->messageBusHelper->getContentFromEnvelope( envelope: $reportEnvelope, diff --git a/src/Application/EventListener/JsonExceptionListener.php b/src/Application/EventListener/JsonExceptionListener.php index 4bca66e..a7b61df 100644 --- a/src/Application/EventListener/JsonExceptionListener.php +++ b/src/Application/EventListener/JsonExceptionListener.php @@ -37,9 +37,7 @@ public function onKernelException(ExceptionEvent $event): void 'message' => $this->createMessage($exceptionCode), ]; - $event->setResponse( - new JsonResponse($content, $content['code']) - ); + $event->setResponse(new JsonResponse($content, $content['code'])); } private function createMessage(int $code): string diff --git a/src/Application/QueryHandler/Report/GetReportByIdQueryHandler.php b/src/Application/QueryHandler/Report/GetReportByIdQueryHandler.php index 7af86fc..7229083 100644 --- a/src/Application/QueryHandler/Report/GetReportByIdQueryHandler.php +++ b/src/Application/QueryHandler/Report/GetReportByIdQueryHandler.php @@ -7,7 +7,9 @@ use App\Application\Query\Report\GetReportByIdQuery; use App\Domain\Model\Report\Report; use App\Domain\Repository\Report\ReportRepositoryInterface; +use Symfony\Component\Messenger\Attribute\AsMessageHandler; +#[AsMessageHandler] class GetReportByIdQueryHandler { public function __construct( diff --git a/src/Presentation/Controller/CreateReportCommentController.php b/src/Presentation/Controller/CreateReportCommentController.php index c097892..d3f2006 100644 --- a/src/Presentation/Controller/CreateReportCommentController.php +++ b/src/Presentation/Controller/CreateReportCommentController.php @@ -15,17 +15,27 @@ class CreateReportCommentController extends AbstractController { - #[Route(path: '/reports/{reportId}/comment/new', name: 'create_report_comment', methods: [Request::METHOD_POST])] + #[ + Route( + path: '/reports/{reportId}/comment/new', + name: 'create_report_comment', + methods: [Request::METHOD_POST], + ), + ] public function __invoke( Request $request, string $reportId, MessageBusInterface $messageBus, ): Response { - $createReportCommentForm = $this->createForm(CreateReportCommentForm::class); + $createReportCommentForm = $this->createForm( + CreateReportCommentForm::class, + ); $createReportCommentForm->handleRequest($request); /** @var string $formDataGameSlug */ - $formDataGameSlug = $request->request->all()['create_report_comment_form']['gameSlug']; + $formDataGameSlug = $request->request->all()[ + 'create_report_comment_form' + ]['gameSlug']; if ( $createReportCommentForm->isSubmitted() @@ -34,13 +44,17 @@ public function __invoke( /** @var CreateReportCommentFormInputDto $createReportCommentFormInputDto */ $createReportCommentFormInputDto = $createReportCommentForm->getData(); - $messageBus->dispatch(new CreateReportCommentCommand( - $createReportCommentFormInputDto->comment, - $createReportCommentFormInputDto->ip, - $reportId, - )); + $messageBus->dispatch( + new CreateReportCommentCommand( + $createReportCommentFormInputDto->comment, + $createReportCommentFormInputDto->ip, + $reportId, + ), + ); } - return $this->redirectToRoute('reports_for_game', ['gameSlug' => $formDataGameSlug]); + return $this->redirectToRoute('reports_for_game', [ + 'gameSlug' => $formDataGameSlug, + ]); } } diff --git a/src/Presentation/Controller/ReportsController.php b/src/Presentation/Controller/ReportsController.php index 5517361..3ffca88 100644 --- a/src/Presentation/Controller/ReportsController.php +++ b/src/Presentation/Controller/ReportsController.php @@ -9,6 +9,7 @@ use App\Application\Query\Game\GetGameBySlugQuery; use App\Domain\Model\Game\Game; use App\Domain\Model\Report\Report; +use App\Presentation\Form\CreateReportCommentForm; use App\Presentation\Form\CreateReportForm; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\HttpFoundation\Request; @@ -88,6 +89,11 @@ class: Game::class, ] ); + $createReportCommentForm = $this->createForm( + CreateReportCommentForm::class, + null, + ); + return $this->render( '@app/reports/reports_for_game.html.twig', [ @@ -95,6 +101,7 @@ class: Game::class, 'reports' => $reports ?? [], 'gameSlug' => $game->getSlug(), 'createReportForm' => $createReportForm->createView(), + 'createReportCommentForm' => $createReportCommentForm->createView(), ] ); } diff --git a/src/Presentation/Form/CreateReportCommentForm.php b/src/Presentation/Form/CreateReportCommentForm.php index 1d61063..862ed20 100644 --- a/src/Presentation/Form/CreateReportCommentForm.php +++ b/src/Presentation/Form/CreateReportCommentForm.php @@ -25,7 +25,18 @@ public function buildForm( ): void { $builder ->add('comment', TextareaType::class, [ - 'label' => $this->translator->trans('form.create.comment.label', [], 'reportComment'), + 'label' => $this->translator->trans( + 'form.create.comment.label', + [], + 'reportComment', + ), + 'attr' => [ + 'placeholder' => $this->translator->trans( + 'form.create.comment.placeholder', + [], + 'reportComment', + ), + ], 'empty_data' => '', 'required' => true, ]) @@ -34,8 +45,7 @@ public function buildForm( ]) ->add('gameSlug', HiddenType::class, [ 'required' => true, - ]) - ; + ]); } public function configureOptions(OptionsResolver $resolver): void diff --git a/src/Presentation/Template/reports/partials/_reports_comment_modal.html.twig b/src/Presentation/Template/reports/partials/_reports_comment_modal.html.twig new file mode 100644 index 0000000..a395618 --- /dev/null +++ b/src/Presentation/Template/reports/partials/_reports_comment_modal.html.twig @@ -0,0 +1,39 @@ +{% trans_default_domain 'reportComment' %} + + diff --git a/src/Presentation/Template/reports/partials/_reports_list.html.twig b/src/Presentation/Template/reports/partials/_reports_list.html.twig index d42e402..feb8f5d 100644 --- a/src/Presentation/Template/reports/partials/_reports_list.html.twig +++ b/src/Presentation/Template/reports/partials/_reports_list.html.twig @@ -108,6 +108,15 @@ {% endif %} + +