From b94e016a26892aac02ad06418ed77ddf1a2f24cc Mon Sep 17 00:00:00 2001 From: ghost Date: Tue, 13 Feb 2024 00:58:27 +0200 Subject: [PATCH] implement namespace page --- src/Controller/MainController.php | 39 +++++++++++++ templates/default/main/index.html.twig | 2 +- templates/default/main/namespace.html.twig | 64 ++++++++++++++++++++++ 3 files changed, 104 insertions(+), 1 deletion(-) create mode 100644 templates/default/main/namespace.html.twig diff --git a/src/Controller/MainController.php b/src/Controller/MainController.php index 597c060..1dee8f5 100644 --- a/src/Controller/MainController.php +++ b/src/Controller/MainController.php @@ -42,6 +42,45 @@ class MainController extends AbstractController ); } + #[Route( + '/{namespace}', + name: 'main_namespace', + requirements: + [ + 'transaction' => '^N[A-z0-9]{33}$', + ], + methods: + [ + 'GET' + ] + )] + public function namespace( + ?Request $request + ): Response + { + $index = new \Kvazar\Index\Manticore(); + + return $this->render( + 'default/main/namespace.html.twig', + [ + 'request' => $request, + 'records' => $index->get( + $request->get('search') ? (string) $request->get('search') : '', + [ + 'crc32namespace' => crc32( + $request->get('namespace') + ) + ], + [ + 'time' => 'desc' + ], + $request->get('part') > 1 ? (int) $request->get('part') * $this->getParameter('app.main.index.limit') : 0, + $this->getParameter('app.main.index.limit') + ) + ] + ); + } + #[Route( '/{transaction}', name: 'main_transaction', diff --git a/templates/default/main/index.html.twig b/templates/default/main/index.html.twig index 800309d..cddff76 100644 --- a/templates/default/main/index.html.twig +++ b/templates/default/main/index.html.twig @@ -17,7 +17,7 @@
diff --git a/templates/default/main/namespace.html.twig b/templates/default/main/namespace.html.twig new file mode 100644 index 0000000..54c648c --- /dev/null +++ b/templates/default/main/namespace.html.twig @@ -0,0 +1,64 @@ +{% extends 'default/layout.html.twig' %} +{% block body %} +
+
+ +
+ {{ request.get('namespace') }} +
+ {# @TODO current namespace value +
+ {{ 'Observe Kevacoin Universe' | trans }} +
+ #} +
+
+
+
+
+ {% for record in records %} + +
+
+
+ {% endfor %} +
+ {% if request.get('part') %} + {{ 'older' | trans }} + | + {% endif %} + {{ 'newer' | trans }} +
+{% endblock %} \ No newline at end of file