From 28bb00400453099b8c4727f2315c4867c84e0328 Mon Sep 17 00:00:00 2001 From: Victor Westerlund Date: Mon, 3 Feb 2025 17:38:29 +0100 Subject: [PATCH] wip: 2025-02-03T17:38:18+0100 (1738600698) --- api/.env.example.ini | 19 ----- api/composer.json | 8 -- api/composer.lock | 115 ----------------------------- api/install.sh | 2 - public/assets/css/pages/search.css | 28 ++++++- public/assets/css/shell.css | 18 +++-- public/assets/js/shell.js | 2 +- public/search.php | 65 ++++++++++++---- 8 files changed, 87 insertions(+), 170 deletions(-) delete mode 100755 api/.env.example.ini delete mode 100755 api/composer.json delete mode 100755 api/composer.lock delete mode 100644 api/install.sh diff --git a/api/.env.example.ini b/api/.env.example.ini deleted file mode 100755 index 2e6e01e..0000000 --- a/api/.env.example.ini +++ /dev/null @@ -1,19 +0,0 @@ -[connect] -database_host = "" -database_user = "" -database_pass = "" - -[databases] -vlw = "" -battlestation = "" - -; Forgejo instance config -[forgejo] -base_url = "" - -; Forgejo language chart endpoints config -[about_languages] -; CSV of Forgejo profiles to include public source repositories from -scan_profiles = "" -; Path to a JSON file to store cached language endpoint responses -cache_file = "" \ No newline at end of file diff --git a/api/composer.json b/api/composer.json deleted file mode 100755 index 16878b5..0000000 --- a/api/composer.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "require": { - "reflect/plugin-rules": "^1.5", - "victorwesterlund/xenum": "dev-master", - "vlw/mysql": "dev-master" - }, - "minimum-stability": "dev" -} diff --git a/api/composer.lock b/api/composer.lock deleted file mode 100755 index 3887c2d..0000000 --- a/api/composer.lock +++ /dev/null @@ -1,115 +0,0 @@ -{ - "_readme": [ - "This file locks the dependencies of your project to a known state", - "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", - "This file is @generated automatically" - ], - "content-hash": "f3f2b3cb3bd789eee6af4a93f4a6e0f9", - "packages": [ - { - "name": "reflect/plugin-rules", - "version": "1.5.1", - "source": { - "type": "git", - "url": "https://codeberg.org/reflect/reflect-rules-plugin", - "reference": "df150f0d860dbc2311e5e2fcb2fac36ee52db56b" - }, - "type": "library", - "autoload": { - "psr-4": { - "ReflectRules\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "GPL-3.0-only" - ], - "authors": [ - { - "name": "Victor Westerlund", - "email": "victor.vesterlund@gmail.com" - } - ], - "description": "Add request search paramter and request body constraints to an API built with Reflect", - "time": "2024-11-20T10:39:33+00:00" - }, - { - "name": "victorwesterlund/xenum", - "version": "dev-master", - "source": { - "type": "git", - "url": "https://github.com/VictorWesterlund/php-xenum.git", - "reference": "8972f06f42abd1f382807a67e937d5564bb89699" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/VictorWesterlund/php-xenum/zipball/8972f06f42abd1f382807a67e937d5564bb89699", - "reference": "8972f06f42abd1f382807a67e937d5564bb89699", - "shasum": "" - }, - "default-branch": true, - "type": "library", - "autoload": { - "psr-4": { - "victorwesterlund\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "GPL-3.0-only" - ], - "authors": [ - { - "name": "Victor Westerlund", - "email": "victor.vesterlund@gmail.com" - } - ], - "description": "PHP eXtended Enums. The missing quality-of-life features from PHP 8+ Enums", - "support": { - "issues": "https://github.com/VictorWesterlund/php-xenum/issues", - "source": "https://github.com/VictorWesterlund/php-xenum/tree/1.1.1" - }, - "time": "2023-11-20T10:10:39+00:00" - }, - { - "name": "vlw/mysql", - "version": "dev-master", - "source": { - "type": "git", - "url": "https://codeberg.org/vlw/php-mysql", - "reference": "619f43b3bfab9eb034dca3e54c7466055240c861" - }, - "default-branch": true, - "type": "library", - "autoload": { - "psr-4": { - "vlw\\MySQL\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "GPL-3.0-or-later" - ], - "authors": [ - { - "name": "Victor Westerlund", - "email": "victor@vlw.se" - } - ], - "description": "Abstraction library for common MySQL/MariaDB DML operations with php-mysqli", - "time": "2024-09-25T13:28:15+00:00" - } - ], - "packages-dev": [], - "aliases": [], - "minimum-stability": "dev", - "stability-flags": { - "victorwesterlund/xenum": 20, - "vlw/mysql": 20 - }, - "prefer-stable": false, - "prefer-lowest": false, - "platform": [], - "platform-dev": [], - "plugin-api-version": "2.3.0" -} diff --git a/api/install.sh b/api/install.sh deleted file mode 100644 index 0c7900a..0000000 --- a/api/install.sh +++ /dev/null @@ -1,2 +0,0 @@ -# Install dependencies -composer install --optimize-autoloader \ No newline at end of file diff --git a/public/assets/css/pages/search.css b/public/assets/css/pages/search.css index 13440a2..ba4df09 100644 --- a/public/assets/css/pages/search.css +++ b/public/assets/css/pages/search.css @@ -1,6 +1,7 @@ vv-shell[vv-page="/search"] { display: flex; flex-direction: column; + gap: calc(var(--padding) / 2); } /* # Search */ @@ -40,9 +41,9 @@ section.search select :is(option, optgroup) { color: black; } -/* # Start search */ +/* # Center */ -section.start-search { +section.center { display: flex; flex: 1 1 auto; align-items: center; @@ -52,13 +53,32 @@ section.start-search { gap: calc(var(--padding) / 2); } -section.start-search svg { +section.center svg { width: 60px; } /* # Result */ section.result { + display: flex; +} + +section.result button { + flex: 1 1 auto; + text-align: left; padding: var(--padding); - background-color: rgba(255, 255, 255, .1); +} + +/* # Stats */ + +section.stats { + min-height: calc(var(--padding) * 2); + display: flex; + align-items: center; + gap: calc(var(--padding) / 2); + justify-content: space-between; +} + +vv-shell[vv-page="/search"] section.stats button { + display: none; } \ No newline at end of file diff --git a/public/assets/css/shell.css b/public/assets/css/shell.css index c66c464..3f521a2 100644 --- a/public/assets/css/shell.css +++ b/public/assets/css/shell.css @@ -145,6 +145,7 @@ button.inline:not(.solid) { } button.inline svg { + flex: none; height: 1em; } @@ -309,6 +310,9 @@ vv-shell { search-results { transition: 500ms opacity, 300ms transform; position: fixed; + display: flex; + flex-direction: column; + gap: var(--padding); top: var(--running-size); right: 0; width: 100%; @@ -323,18 +327,16 @@ search-results { z-index: 50; } -search-results:not([vv-page]) { - display: grid; - align-items: center; - justify-items: center; -} - header.searchboxActive ~ search-results { opacity: 1; pointer-events: all; transform: scale(1); } +search-results section.search { + display: none; +} + /* ### "Start typing" prompt */ search-results .info { @@ -342,11 +344,11 @@ search-results .info { align-items: center; flex-direction: column; margin: auto; - gap: 3svh; + gap: var(--padding); } search-results .info :is(svg, img) { - width: 128px; + width: 60px; fill: var(--color-accent); } diff --git a/public/assets/js/shell.js b/public/assets/js/shell.js index 3b307c8..ae52040 100644 --- a/public/assets/js/shell.js +++ b/public/assets/js/shell.js @@ -47,7 +47,7 @@ globalThis.vegvisir.globalNavigationDelayMs = 100; clearTimeout(event.target._throttle); event.target._throttle = setTimeout(() => { // Navigate search-results element on user input - new vv.Navigation(`/search?q=${event.target.value}`).navigate(searchResultsElement); + new vv.Navigation(`/search?query=${event.target.value}`).navigate(searchResultsElement); }, 100); }); } diff --git a/public/search.php b/public/search.php index 0f85750..5e3bb1b 100644 --- a/public/search.php +++ b/public/search.php @@ -46,25 +46,64 @@ value, $_GET)): ?> - search() as $result): ?> -
- title()): ?> -

title() ?>

- + search()): ?> +
+

search()) ?> result(s)

+ +
-

summary() ?>

- - href()): ?> + search() as $result): ?> +
- -
- +
+ + + + +
+

0 result(s)

+ +
+
+ +

Nothing to see here, that's a bummer..

+
+ + + +
+ +

Start typing to search

+
+ + + +
+ +

Almost, type at least two letters to search

+
+ + + + + -