mirror of
https://codeberg.org/vlw/vlw.se.git
synced 2025-09-13 21:13:40 +02:00
wip: 2025-02-03T17:38:18+0100 (1738600698)
This commit is contained in:
parent
a12c9bc792
commit
28bb004004
8 changed files with 87 additions and 170 deletions
|
@ -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 = ""
|
|
|
@ -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
115
api/composer.lock
generated
|
@ -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"
|
|
||||||
}
|
|
|
@ -1,2 +0,0 @@
|
||||||
# Install dependencies
|
|
||||||
composer install --optimize-autoloader
|
|
|
@ -1,6 +1,7 @@
|
||||||
vv-shell[vv-page="/search"] {
|
vv-shell[vv-page="/search"] {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
|
gap: calc(var(--padding) / 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* # Search */
|
/* # Search */
|
||||||
|
@ -40,9 +41,9 @@ section.search select :is(option, optgroup) {
|
||||||
color: black;
|
color: black;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* # Start search */
|
/* # Center */
|
||||||
|
|
||||||
section.start-search {
|
section.center {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex: 1 1 auto;
|
flex: 1 1 auto;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
@ -52,13 +53,32 @@ section.start-search {
|
||||||
gap: calc(var(--padding) / 2);
|
gap: calc(var(--padding) / 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
section.start-search svg {
|
section.center svg {
|
||||||
width: 60px;
|
width: 60px;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* # Result */
|
/* # Result */
|
||||||
|
|
||||||
section.result {
|
section.result {
|
||||||
|
display: flex;
|
||||||
|
}
|
||||||
|
|
||||||
|
section.result button {
|
||||||
|
flex: 1 1 auto;
|
||||||
|
text-align: left;
|
||||||
padding: var(--padding);
|
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;
|
||||||
}
|
}
|
|
@ -145,6 +145,7 @@ button.inline:not(.solid) {
|
||||||
}
|
}
|
||||||
|
|
||||||
button.inline svg {
|
button.inline svg {
|
||||||
|
flex: none;
|
||||||
height: 1em;
|
height: 1em;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -309,6 +310,9 @@ vv-shell {
|
||||||
search-results {
|
search-results {
|
||||||
transition: 500ms opacity, 300ms transform;
|
transition: 500ms opacity, 300ms transform;
|
||||||
position: fixed;
|
position: fixed;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: var(--padding);
|
||||||
top: var(--running-size);
|
top: var(--running-size);
|
||||||
right: 0;
|
right: 0;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
@ -323,18 +327,16 @@ search-results {
|
||||||
z-index: 50;
|
z-index: 50;
|
||||||
}
|
}
|
||||||
|
|
||||||
search-results:not([vv-page]) {
|
|
||||||
display: grid;
|
|
||||||
align-items: center;
|
|
||||||
justify-items: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
header.searchboxActive ~ search-results {
|
header.searchboxActive ~ search-results {
|
||||||
opacity: 1;
|
opacity: 1;
|
||||||
pointer-events: all;
|
pointer-events: all;
|
||||||
transform: scale(1);
|
transform: scale(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
search-results section.search {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
/* ### "Start typing" prompt */
|
/* ### "Start typing" prompt */
|
||||||
|
|
||||||
search-results .info {
|
search-results .info {
|
||||||
|
@ -342,11 +344,11 @@ search-results .info {
|
||||||
align-items: center;
|
align-items: center;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
margin: auto;
|
margin: auto;
|
||||||
gap: 3svh;
|
gap: var(--padding);
|
||||||
}
|
}
|
||||||
|
|
||||||
search-results .info :is(svg, img) {
|
search-results .info :is(svg, img) {
|
||||||
width: 128px;
|
width: 60px;
|
||||||
fill: var(--color-accent);
|
fill: var(--color-accent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -47,7 +47,7 @@ globalThis.vegvisir.globalNavigationDelayMs = 100;
|
||||||
clearTimeout(event.target._throttle);
|
clearTimeout(event.target._throttle);
|
||||||
event.target._throttle = setTimeout(() => {
|
event.target._throttle = setTimeout(() => {
|
||||||
// Navigate search-results element on user input
|
// 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);
|
}, 100);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,25 +46,64 @@
|
||||||
|
|
||||||
<?php if (array_key_exists(SearchTable::QUERY->value, $_GET)): ?>
|
<?php if (array_key_exists(SearchTable::QUERY->value, $_GET)): ?>
|
||||||
|
|
||||||
<?php foreach ($search->search() as $result): ?>
|
<?php if ($search->search()): ?>
|
||||||
<section class="result">
|
<section class="stats">
|
||||||
<?php if ($result->title()): ?>
|
<p><?= count($search->search()) ?> result(s)</p>
|
||||||
<h2><?= $result->title() ?></h2>
|
<a href="/search?query=<?= $search::get_query() ?>"><button class="inline solid">
|
||||||
<?php endif; ?>
|
<?= VV::embed(ICONS_DIR . "search.svg") ?>
|
||||||
|
<p>Advanced search</p>
|
||||||
|
<?= VV::embed(DEFAULT_BUTTON_ICON) ?>
|
||||||
|
</button></a>
|
||||||
|
</section>
|
||||||
|
|
||||||
<p><?= $result->summary() ?></p>
|
<?php foreach ($search->search() as $result): ?>
|
||||||
|
<section class="result" data-id="<?= $result->id ?>">
|
||||||
<?php if ($result->href()): ?>
|
|
||||||
<a href="<?= $result->href() ?>"><button class="inline">
|
<a href="<?= $result->href() ?>"><button class="inline">
|
||||||
<p>read more</p>
|
<div>
|
||||||
|
<h2><?= $result->title() ?></h2>
|
||||||
|
<p><?= $result->summary() ?></p>
|
||||||
|
</div>
|
||||||
<?= VV::embed(DEFAULT_BUTTON_ICON) ?>
|
<?= VV::embed(DEFAULT_BUTTON_ICON) ?>
|
||||||
</button></a>
|
</button></a>
|
||||||
<?php endif; ?>
|
</section>
|
||||||
</section>
|
<?php endforeach; ?>
|
||||||
<?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: ?>
|
<?php else: ?>
|
||||||
<section class="start-search">
|
<section class="center">
|
||||||
<?= VV::embed(ICONS_DIR . "search.svg") ?>
|
<?= VV::embed(ICONS_DIR . "search.svg") ?>
|
||||||
<p>Start typing to search</p>
|
<p>Start typing to search</p>
|
||||||
</section>
|
</section>
|
||||||
|
|
Loading…
Add table
Reference in a new issue