mirror of
https://github.com/kvazar-network/webapp.git
synced 2025-02-03 10:46:04 +00:00
implement main page
This commit is contained in:
parent
ec600ff014
commit
a1e5c724f8
4
.env
4
.env
@ -21,4 +21,6 @@ APP_SECRET=EDIT_ME
|
||||
|
||||
APP_VERSION="1.0.0"
|
||||
APP_THEME="default"
|
||||
APP_NAME="KVAZAR"
|
||||
APP_NAME="KVAZAR"
|
||||
|
||||
APP_MAIN_INDEX_LIMIT=10
|
@ -17,6 +17,7 @@
|
||||
"symfony/twig-bundle": "7.0.*",
|
||||
"symfony/yaml": "7.0.*",
|
||||
"twig/extra-bundle": "^2.12|^3.0",
|
||||
"twig/intl-extra": "^3.8",
|
||||
"twig/twig": "^2.12|^3.0"
|
||||
},
|
||||
"config": {
|
||||
|
156
composer.lock
generated
156
composer.lock
generated
@ -4,7 +4,7 @@
|
||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "428edf19e120c60b3d7a86ca14b80d9b",
|
||||
"content-hash": "7ad465aeec743bb2f013b7c7f7159038",
|
||||
"packages": [
|
||||
{
|
||||
"name": "jdenticon/jdenticon",
|
||||
@ -61,12 +61,12 @@
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/kvazar-network/index-php.git",
|
||||
"reference": "d5d793dfb5e82d764ea2d584b0cbca3e700f79e5"
|
||||
"reference": "7da0ac4a5eefd3b9b727a750b7c53866995ff09b"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/kvazar-network/index-php/zipball/d5d793dfb5e82d764ea2d584b0cbca3e700f79e5",
|
||||
"reference": "d5d793dfb5e82d764ea2d584b0cbca3e700f79e5",
|
||||
"url": "https://api.github.com/repos/kvazar-network/index-php/zipball/7da0ac4a5eefd3b9b727a750b7c53866995ff09b",
|
||||
"reference": "7da0ac4a5eefd3b9b727a750b7c53866995ff09b",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@ -88,7 +88,7 @@
|
||||
"issues": "https://github.com/kvazar-network/index-php/issues",
|
||||
"source": "https://github.com/kvazar-network/index-php/tree/main"
|
||||
},
|
||||
"time": "2024-02-12T01:50:47+00:00"
|
||||
"time": "2024-02-12T20:50:51+00:00"
|
||||
},
|
||||
{
|
||||
"name": "manticoresoftware/manticoresearch-php",
|
||||
@ -1678,6 +1678,88 @@
|
||||
],
|
||||
"time": "2024-01-31T07:32:56+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/intl",
|
||||
"version": "v7.0.3",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/intl.git",
|
||||
"reference": "295995df4acf6790a35b9ce6ec32b313efb11ff8"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/intl/zipball/295995df4acf6790a35b9ce6ec32b313efb11ff8",
|
||||
"reference": "295995df4acf6790a35b9ce6ec32b313efb11ff8",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=8.2"
|
||||
},
|
||||
"require-dev": {
|
||||
"symfony/filesystem": "^6.4|^7.0",
|
||||
"symfony/finder": "^6.4|^7.0",
|
||||
"symfony/var-exporter": "^6.4|^7.0"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Symfony\\Component\\Intl\\": ""
|
||||
},
|
||||
"exclude-from-classmap": [
|
||||
"/Tests/"
|
||||
]
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Bernhard Schussek",
|
||||
"email": "bschussek@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "Eriksen Costa",
|
||||
"email": "eriksen.costa@infranology.com.br"
|
||||
},
|
||||
{
|
||||
"name": "Igor Wiedler",
|
||||
"email": "igor@wiedler.ch"
|
||||
},
|
||||
{
|
||||
"name": "Symfony Community",
|
||||
"homepage": "https://symfony.com/contributors"
|
||||
}
|
||||
],
|
||||
"description": "Provides access to the localization data of the ICU library",
|
||||
"homepage": "https://symfony.com",
|
||||
"keywords": [
|
||||
"i18n",
|
||||
"icu",
|
||||
"internationalization",
|
||||
"intl",
|
||||
"l10n",
|
||||
"localization"
|
||||
],
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/intl/tree/v7.0.3"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://symfony.com/sponsor",
|
||||
"type": "custom"
|
||||
},
|
||||
{
|
||||
"url": "https://github.com/fabpot",
|
||||
"type": "github"
|
||||
},
|
||||
{
|
||||
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2024-01-23T15:02:46+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/polyfill-intl-grapheme",
|
||||
"version": "v1.29.0",
|
||||
@ -2894,6 +2976,70 @@
|
||||
],
|
||||
"time": "2023-11-21T14:02:01+00:00"
|
||||
},
|
||||
{
|
||||
"name": "twig/intl-extra",
|
||||
"version": "v3.8.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/twigphp/intl-extra.git",
|
||||
"reference": "7b3db67c700735f473a265a97e1adaeba3e6ca0c"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/twigphp/intl-extra/zipball/7b3db67c700735f473a265a97e1adaeba3e6ca0c",
|
||||
"reference": "7b3db67c700735f473a265a97e1adaeba3e6ca0c",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=7.2.5",
|
||||
"symfony/intl": "^5.4|^6.0|^7.0",
|
||||
"twig/twig": "^3.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"symfony/phpunit-bridge": "^6.4|^7.0"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Twig\\Extra\\Intl\\": ""
|
||||
},
|
||||
"exclude-from-classmap": [
|
||||
"/Tests/"
|
||||
]
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Fabien Potencier",
|
||||
"email": "fabien@symfony.com",
|
||||
"homepage": "http://fabien.potencier.org",
|
||||
"role": "Lead Developer"
|
||||
}
|
||||
],
|
||||
"description": "A Twig extension for Intl",
|
||||
"homepage": "https://twig.symfony.com",
|
||||
"keywords": [
|
||||
"intl",
|
||||
"twig"
|
||||
],
|
||||
"support": {
|
||||
"source": "https://github.com/twigphp/intl-extra/tree/v3.8.0"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://github.com/fabpot",
|
||||
"type": "github"
|
||||
},
|
||||
{
|
||||
"url": "https://tidelift.com/funding/github/packagist/twig/twig",
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2023-11-21T17:27:48+00:00"
|
||||
},
|
||||
{
|
||||
"name": "twig/twig",
|
||||
"version": "v3.8.0",
|
||||
|
@ -7,6 +7,7 @@ parameters:
|
||||
app.version: '%env(APP_VERSION)%'
|
||||
app.theme: '%env(APP_THEME)%'
|
||||
app.name: '%env(APP_NAME)%'
|
||||
app.main.index.limit: '%env(APP_MAIN_INDEX_LIMIT)%'
|
||||
|
||||
services:
|
||||
# default configuration for services in *this* file
|
||||
@ -25,3 +26,8 @@ services:
|
||||
|
||||
# add more service definitions when explicit configuration is needed
|
||||
# please note that last definitions always *replace* previous ones
|
||||
App\Twig\AppExtension:
|
||||
arguments:
|
||||
- '@service_container'
|
||||
tags:
|
||||
- { name: twig.extension}
|
@ -23,10 +23,21 @@ class MainController extends AbstractController
|
||||
?Request $request
|
||||
): Response
|
||||
{
|
||||
$index = new \Kvazar\Index\Manticore();
|
||||
|
||||
return $this->render(
|
||||
'default/main/index.html.twig',
|
||||
[
|
||||
'request' => $request
|
||||
'request' => $request,
|
||||
'records' => $index->get(
|
||||
$request->get('search') ? (string) $request->get('search') : '',
|
||||
[],
|
||||
[
|
||||
'time' => 'desc'
|
||||
],
|
||||
$request->get('part') > 1 ? (int) $request->get('part') * $this->getParameter('app.main.index.limit') : 0,
|
||||
$this->getParameter('app.main.index.limit')
|
||||
)
|
||||
]
|
||||
);
|
||||
}
|
||||
|
53
src/Twig/AppExtension.php
Normal file
53
src/Twig/AppExtension.php
Normal file
@ -0,0 +1,53 @@
|
||||
<?php
|
||||
|
||||
namespace App\Twig;
|
||||
|
||||
use Twig\Extension\AbstractExtension;
|
||||
use Twig\TwigFilter;
|
||||
|
||||
class AppExtension extends AbstractExtension
|
||||
{
|
||||
public function getFilters()
|
||||
{
|
||||
return
|
||||
[
|
||||
new TwigFilter(
|
||||
'jIdenticon',
|
||||
[
|
||||
$this,
|
||||
'jIdenticon'
|
||||
]
|
||||
)
|
||||
];
|
||||
}
|
||||
|
||||
public function jIdenticon(
|
||||
mixed $value,
|
||||
int $size = 48,
|
||||
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
|
||||
);
|
||||
}
|
||||
}
|
@ -1,4 +1,83 @@
|
||||
{% extends 'layout.html.twig' %}
|
||||
{% extends 'default/layout.html.twig' %}
|
||||
{% block body %}
|
||||
{{ app.name }}
|
||||
<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="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>
|
||||
{% for record in records %}
|
||||
<div class="t-center px-16">
|
||||
<div class="mx-a mw-560 px-16">
|
||||
<div class="mx-a mw-560 mb-16">
|
||||
<a href="{{ path('main_index',{'namespace':record.namespace}) }}">
|
||||
<img class="br-50" src="{{ record.namespace | jIdenticon }}" alt="{{ record.namespace }}" />
|
||||
</a>
|
||||
</div>
|
||||
<a class="d-block" href="{{ path('main_index',{'transaction':record.transaction}) }}">
|
||||
<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>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="t-center px-16 py-27">
|
||||
<div class="b-g"></div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
<div class="t-center pt-16 pb-27">
|
||||
{% if request.get('part') %}
|
||||
<a rel="nofollow" href="{{
|
||||
path(
|
||||
'main_index',
|
||||
{
|
||||
'part':request.get('part') - 1,
|
||||
'search':request.get('search')
|
||||
}
|
||||
) }}">{{ 'older' | trans }}</a>
|
||||
|
|
||||
{% endif %}
|
||||
<a rel="nofollow" href="{{
|
||||
path(
|
||||
'main_index',
|
||||
{
|
||||
'part':(request.get('part') ? request.get('part') : 1) + 1,
|
||||
'search':request.get('search')
|
||||
}
|
||||
) }}">{{ '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 %}
|
Loading…
x
Reference in New Issue
Block a user