wip: 2025-02-03T17:38:18+0100 (1738600698)

This commit is contained in:
Victor Westerlund 2025-02-03 17:38:29 +01:00
parent a12c9bc792
commit 28bb004004
8 changed files with 87 additions and 170 deletions

View file

@ -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 = ""

View file

@ -1,8 +0,0 @@
{
"require": {
"reflect/plugin-rules": "^1.5",
"victorwesterlund/xenum": "dev-master",
"vlw/mysql": "dev-master"
},
"minimum-stability": "dev"
}

115
api/composer.lock generated
View file

@ -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"
}

View file

@ -1,2 +0,0 @@
# Install dependencies
composer install --optimize-autoloader

View file

@ -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 {
padding: var(--padding);
background-color: rgba(255, 255, 255, .1);
display: flex;
}
section.result button {
flex: 1 1 auto;
text-align: left;
padding: var(--padding);
}
/* # 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;
}

View file

@ -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);
}

View file

@ -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);
});
}

View file

@ -46,25 +46,64 @@
<?php if (array_key_exists(SearchTable::QUERY->value, $_GET)): ?>
<?php foreach ($search->search() as $result): ?>
<section class="result">
<?php if ($result->title()): ?>
<h2><?= $result->title() ?></h2>
<?php endif; ?>
<p><?= $result->summary() ?></p>
<?php if ($result->href()): ?>
<a href="<?= $result->href() ?>"><button class="inline">
<p>read more</p>
<?php if ($search->search()): ?>
<section class="stats">
<p><?= count($search->search()) ?> result(s)</p>
<a href="/search?query=<?= $search::get_query() ?>"><button class="inline solid">
<?= VV::embed(ICONS_DIR . "search.svg") ?>
<p>Advanced search</p>
<?= VV::embed(DEFAULT_BUTTON_ICON) ?>
</button></a>
</section>
<?php foreach ($search->search() as $result): ?>
<section class="result" data-id="<?= $result->id ?>">
<a href="<?= $result->href() ?>"><button class="inline">
<div>
<h2><?= $result->title() ?></h2>
<p><?= $result->summary() ?></p>
</div>
<?= VV::embed(DEFAULT_BUTTON_ICON) ?>
</button></a>
<?php endif; ?>
</section>
<?php endforeach; ?>
<?php else: ?>
<?php switch (strlen($search::get_query())): default: ?>
<section class="stats">
<p>0 result(s)</p>
<a href="/search?query=<?= $search::get_query() ?>"><button class="inline solid">
<?= VV::embed(ICONS_DIR . "search.svg") ?>
<p>Advanced search</p>
<?= VV::embed(DEFAULT_BUTTON_ICON) ?>
</button></a>
</section>
<section class="center">
<img src="/assets/media/travolta.gif">
<p>Nothing to see here, that's a bummer..</p>
</section>
<?php break; ?>
<?php case 0: ?>
<section class="center">
<?= VV::embed(ICONS_DIR . "search.svg") ?>
<p>Start typing to search</p>
</section>
<?php break; ?>
<?php case 1: ?>
<section class="center">
<?= VV::embed(ICONS_DIR . "search.svg") ?>
<p>Almost, type at least two letters to search</p>
</section>
<?php break; ?>
<?php endswitch; ?>
<?php endif; ?>
<?php else: ?>
<section class="start-search">
<section class="center">
<?= VV::embed(ICONS_DIR . "search.svg") ?>
<p>Start typing to search</p>
</section>