diff --git a/.env b/.env index 0676982..e67c5dc 100644 --- a/.env +++ b/.env @@ -21,4 +21,6 @@ APP_SECRET=EDIT_ME APP_VERSION="1.0.0" APP_THEME="default" -APP_NAME="KVAZAR" \ No newline at end of file +APP_NAME="KVAZAR" + +APP_MAIN_INDEX_LIMIT=10 \ No newline at end of file diff --git a/composer.json b/composer.json index d49ebff..3ea6536 100644 --- a/composer.json +++ b/composer.json @@ -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": { diff --git a/composer.lock b/composer.lock index e401793..0cd2cbf 100644 --- a/composer.lock +++ b/composer.lock @@ -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", diff --git a/config/services.yaml b/config/services.yaml index 099393f..2746228 100644 --- a/config/services.yaml +++ b/config/services.yaml @@ -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} \ No newline at end of file diff --git a/src/Controller/MainController.php b/src/Controller/MainController.php index b4d2915..8e71543 100644 --- a/src/Controller/MainController.php +++ b/src/Controller/MainController.php @@ -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') + ) ] ); } diff --git a/src/Twig/AppExtension.php b/src/Twig/AppExtension.php new file mode 100644 index 0000000..badb04b --- /dev/null +++ b/src/Twig/AppExtension.php @@ -0,0 +1,53 @@ + '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 + ); + } +} \ No newline at end of file diff --git a/templates/layout.html.twig b/templates/default/layout.html.twig similarity index 100% rename from templates/layout.html.twig rename to templates/default/layout.html.twig diff --git a/templates/default/main/index.html.twig b/templates/default/main/index.html.twig index aeafb00..a5e4b62 100644 --- a/templates/default/main/index.html.twig +++ b/templates/default/main/index.html.twig @@ -1,4 +1,83 @@ -{% extends 'layout.html.twig' %} +{% extends 'default/layout.html.twig' %} {% block body %} - {{ app.name }} +
+
+ +
+ {{ 'Observe Kevacoin Universe' | trans }} +
+
+
+
+
+
+ {% for record in records %} +
+
+
+ + {{ record.namespace }} + +
+ +
+ {{ record.key }} +
+
+ {{ record.value | nl2br }} +
+
+ {{ record.time | format_date }} {{ 'in' | trans }} {{ record.block }} +
+
+
+
+
+
+
+ {% endfor %} +
+ {% if request.get('part') %} + {{ 'older' | trans }} + | + {% endif %} + {{ 'newer' | trans }} +
+
+
+ + {##} +
+
+
+
+ {{ 'KVAZAR Webapp' | trans }} + {{ 'is content explorer for' | trans }} + {{ 'Kevacoin Blockchain' | trans }}. +
+
+ {{ 'Sources distributed under the MIT License. Ownership of all content belongs to the authors.' | trans }} +
+
{% endblock %} \ No newline at end of file