Browse Source

implement transaction page

master
ghost 10 months ago
parent
commit
66fd50005f
  1. 43
      src/Controller/MainController.php
  2. 25
      templates/default/layout.html.twig
  3. 23
      templates/default/main/index.html.twig
  4. 39
      templates/default/main/transaction.html.twig

43
src/Controller/MainController.php

@ -41,4 +41,47 @@ class MainController extends AbstractController @@ -41,4 +41,47 @@ class MainController extends AbstractController
]
);
}
#[Route(
'/{transaction}',
name: 'main_transaction',
requirements:
[
'transaction' => '^[A-f0-9]{64}$',
],
methods:
[
'GET'
]
)]
public function transaction(
?Request $request
): Response
{
$index = new \Kvazar\Index\Manticore();
$records = $index->get(
'',
[
'crc32transaction' => crc32(
$request->get('transaction')
)
]
);
if (empty($records))
{
throw $this->createNotFoundException();
}
return $this->render(
'default/main/transaction.html.twig',
[
'request' => $request,
'record' => reset(
$records
)
]
);
}
}

25
templates/default/layout.html.twig

@ -8,5 +8,30 @@ @@ -8,5 +8,30 @@
</head>
<body>
{% block body %}{% endblock %}
<footer>
{% block footer %}
<div class="t-center px-16 pb-27">
<form name="namespace" action="{{ path('main_index') }}" method="GET">
<input class="p-8"
type="text"
name="search"
value="{{ request.get('search') }}"
placeholder="{{ 'key, value, block, ns, txid' | trans }}"
autocomplete="off" />
{#<button class="p-8 cursor-pointer" type="submit">{{ 'Search' | trans }}</button>#}
</form>
</div>
<div class="t-center px-16 pb-27">
<div class="pb-16 f-s-12 c-1">
<a href="https://github.com/kvazar-network/webapp">{{ 'KVAZAR Webapp' | trans }}</a>
{{ 'is content explorer for' | trans }}
<a href="https://kevacoin.org">{{ 'Kevacoin Blockchain' | trans }}</a>.
</div>
<div class="f-s-12 c-1">
{{ 'Sources distributed under the MIT License. Ownership of all content belongs to the authors.' | trans }}
</div>
</div>
{% endblock %}
</footer>
</body>
</html>

23
templates/default/main/index.html.twig

@ -21,7 +21,7 @@ @@ -21,7 +21,7 @@
<img class="br-50" src="{{ record.namespace | jIdenticon }}" alt="{{ record.namespace }}" />
</a>
</div>
<a class="d-block" href="{{ path('main_index',{'transaction':record.transaction}) }}">
<a class="d-block" href="{{ path('main_transaction',{'transaction':record.transaction}) }}">
<div class="f-s-16 mb-16 of-a">
{{ record.key }}
</div>
@ -59,25 +59,4 @@ @@ -59,25 +59,4 @@
}
) }}">{{ 'newer' | trans }}</a>
</div>
<div class="t-center px-16 pb-27">
<form name="namespace" action="{{ path('main_index') }}" method="GET">
<input class="p-8"
type="text"
name="search"
value="{{ request.get('search') }}"
placeholder="{{ 'key, value, block, ns, txid' | trans }}"
autocomplete="off" />
{#<button class="p-8 cursor-pointer" type="submit">{{ 'Search' | trans }}</button>#}
</form>
</div>
<div class="t-center px-16 pb-27">
<div class="pb-16 f-s-12 c-1">
<a href="https://github.com/kvazar-network/webapp">{{ 'KVAZAR Webapp' | trans }}</a>
{{ 'is content explorer for' | trans }}
<a href="https://kevacoin.org">{{ 'Kevacoin Blockchain' | trans }}</a>.
</div>
<div class="f-s-12 c-1">
{{ 'Sources distributed under the MIT License. Ownership of all content belongs to the authors.' | trans }}
</div>
</div>
{% endblock %}

39
templates/default/main/transaction.html.twig

@ -0,0 +1,39 @@ @@ -0,0 +1,39 @@
{% extends 'default/layout.html.twig' %}
{% block body %}
<div class="t-center px-16 pt-54">
<div class="mx-a mw-560 px-16">
<div class="mb-20">
<a class="logo f-s-20 c-0" href="{{ path('main_index') }}">{{ app.name }}</a>
</div>
<div class="mx-a mw-560 px-16 pb-16">
<a href="{{ path('main_namespace',{'namespace':record.namespace}) }}">
<img class="br-50 shine" src="{{ record.namespace | jIdenticon }}" alt="{{ record.namespace }}" />
</a>
</div>
{# @TODO current namespace value
<div class="mb-36 c-1">
{{ 'Observe Kevacoin Universe' | trans }}
</div>
#}
</div>
</div>
<div class="t-center px-16 pb-36">
<div class="b-g"></div>
</div>
<div class="t-center px-16">
<div class="mx-a mw-560 px-16">
<div class="f-s-16 mb-16 of-a">
{{ record.key }}
</div>
<div class="mb-20 of-a">
{{ record.value | nl2br }}
</div>
<div class="f-s-12">
{{ record.time | format_date }} {{ 'in' | trans }} {{ record.block }}
</div>
</div>
</div>
<div class="t-center px-16 py-27">
<div class="b-g"></div>
</div>
{% endblock %}
Loading…
Cancel
Save