mirror of
https://codeberg.org/vlw/vlw.se.git
synced 2025-09-13 21:13:40 +02:00
wip: 2024-11-23T06:05:10+0100 (1732338310)
This commit is contained in:
parent
30cbff10eb
commit
a595b0199b
6 changed files with 117 additions and 12 deletions
|
@ -15,6 +15,8 @@
|
|||
require_once Path::root("src/databases/VLWdb.php");
|
||||
require_once Path::root("src/databases/models/Work/Work.php");
|
||||
|
||||
const PARAM_LIMIT = "limit";
|
||||
|
||||
class GET_Work extends VLWdb {
|
||||
protected Ruleset $ruleset;
|
||||
|
||||
|
@ -49,17 +51,27 @@
|
|||
->max(parent::MYSQL_INT_MAX_LENGTH),
|
||||
|
||||
(new Rules(WorkModel::DATE_CREATED->value))
|
||||
->type(Type::NUMBER)
|
||||
->min(1)
|
||||
->max(parent::MYSQL_INT_MAX_LENGTH),
|
||||
|
||||
(new Rules(PARAM_LIMIT))
|
||||
->type(Type::NUMBER)
|
||||
->min(1)
|
||||
->max(parent::MYSQL_INT_MAX_LENGTH)
|
||||
->default(parent::MYSQL_INT_MAX_LENGTH)
|
||||
]);
|
||||
|
||||
parent::__construct(Databases::VLW, $this->ruleset);
|
||||
}
|
||||
|
||||
public function main(): Response {
|
||||
// Use copy of search paramters as filters
|
||||
// Use search parameters from model as filters
|
||||
$filters = $_GET;
|
||||
// Unset keys not included in database model from filter
|
||||
foreach (array_diff(array_keys($_GET), WorkModel::values()) as $k) {
|
||||
unset($filters[$k]);
|
||||
}
|
||||
|
||||
// Do a wildcard search on the title column if provided
|
||||
if (array_key_exists(WorkModel::TITLE->value, $_GET)) {
|
||||
|
@ -78,6 +90,7 @@
|
|||
$response = $this->db->for(WorkModel::TABLE)
|
||||
->where($filters)
|
||||
->order([WorkModel::DATE_CREATED->value => "DESC"])
|
||||
->limit($_GET[PARAM_LIMIT])
|
||||
->select([
|
||||
WorkModel::ID->value,
|
||||
WorkModel::TITLE->value,
|
||||
|
|
|
@ -2,7 +2,11 @@
|
|||
|
||||
namespace VLW\API\Databases\VLWdb\Models\Work;
|
||||
|
||||
use victorwesterlund\xEnum;
|
||||
|
||||
enum WorkModel: string {
|
||||
use xEnum;
|
||||
|
||||
const TABLE = "work";
|
||||
|
||||
case ID = "id";
|
||||
|
|
|
@ -56,7 +56,6 @@ section.hero .item {
|
|||
height: 300px;
|
||||
position: relative;
|
||||
border-radius: 6px;
|
||||
box-shadow: 0 0 0 2px white;
|
||||
}
|
||||
|
||||
section.hero .wrapper {
|
||||
|
@ -80,13 +79,23 @@ section.hero button {
|
|||
/* ### Vegivisr */
|
||||
|
||||
section.hero .item.vegvisir {
|
||||
background-color: rgb(var(--color-vegvisir));
|
||||
--color-accent: var(--color-vegvisir);
|
||||
|
||||
color: rgb(var(--color-vegvisir));
|
||||
background-color: rgba(var(--color-vegvisir), .1);
|
||||
}
|
||||
|
||||
section.hero .item.vegvisir .bg {
|
||||
opacity: .2;
|
||||
}
|
||||
|
||||
/* ### Reflect */
|
||||
|
||||
section.hero .item.reflect {
|
||||
background: linear-gradient(0deg, rgba(215,31,5,1) 0%, rgba(233,102,102,1) 49%, rgba(251,251,251,1) 49%, rgba(215,31,5,1) 50%, rgba(215,31,5,1) 100%);
|
||||
--color-accent: var(--color-reflect);
|
||||
|
||||
color: rgb(var(--color-reflect));
|
||||
background-color: rgba(var(--color-reflect), .2);
|
||||
}
|
||||
|
||||
/* ### Background */
|
||||
|
@ -122,6 +131,54 @@ section.heading svg {
|
|||
height: 2em;
|
||||
}
|
||||
|
||||
/* ## Featured */
|
||||
|
||||
section.featured {
|
||||
display: grid;
|
||||
gap: var(--padding);
|
||||
grid-template-columns: repeat(3, 1fr);
|
||||
}
|
||||
|
||||
section.featured featured-item {
|
||||
display: flex;
|
||||
fill: white;
|
||||
color: white;
|
||||
border-radius: 8px;
|
||||
flex-direction: column;
|
||||
padding: var(--padding);
|
||||
background-color: rgba(255, 255, 255, .1);
|
||||
}
|
||||
|
||||
section.featured featured-item > svg {
|
||||
width: 2em;
|
||||
}
|
||||
|
||||
/* ### Languages */
|
||||
|
||||
section.featured featured-item .langs {
|
||||
gap: 5px;
|
||||
display: flex;
|
||||
margin: 5px 0;
|
||||
}
|
||||
|
||||
section.featured featured-item .langs button {
|
||||
border-radius: 4px;
|
||||
background-color: rgba(255, 255, 255, .1);
|
||||
}
|
||||
|
||||
section.featured featured-item .langs button p::before {
|
||||
content: "● ";
|
||||
}
|
||||
|
||||
/* ### Actions */
|
||||
|
||||
section.featured featured-item .actions {
|
||||
gap: 5px;
|
||||
display: flex;
|
||||
padding-top: var(--padding);
|
||||
margin-top: auto;
|
||||
}
|
||||
|
||||
/* # Size queries */
|
||||
|
||||
@media (min-width: 460px) {
|
||||
|
|
1
public/assets/media/icons/repo.svg
Normal file
1
public/assets/media/icons/repo.svg
Normal file
File diff suppressed because one or more lines are too long
After Width: | Height: | Size: 12 KiB |
|
@ -1,3 +1,9 @@
|
|||
<?php
|
||||
|
||||
// Number of items from the timeline to display on this page
|
||||
const TIMELINE_PREVIEW_LIMIT = 10;
|
||||
|
||||
?>
|
||||
<style><?= VV::css("public/assets/css/pages/work") ?></style>
|
||||
<section class="git">
|
||||
<?= VV::embed("public/assets/media/icons/codeberg.svg") ?>
|
||||
|
@ -7,6 +13,11 @@
|
|||
<a href="https://git.vlw.se"><button class="inline">Forgejo</button></a>
|
||||
</div>
|
||||
</section>
|
||||
<section class="heading">
|
||||
<?= VV::embed("public/assets/media/icons/star.svg") ?>
|
||||
<h1>featured projects</h1>
|
||||
<?= VV::embed("public/assets/media/icons/star.svg") ?>
|
||||
</section>
|
||||
<section class="hero">
|
||||
<div class="item vegvisir">
|
||||
<div class="wrapper">
|
||||
|
@ -27,13 +38,31 @@
|
|||
<div class="bg"></div>
|
||||
</div>
|
||||
</section>
|
||||
<section class="heading">
|
||||
<?= VV::embed("public/assets/media/icons/star.svg") ?>
|
||||
<h1>Featured</h1>
|
||||
<?= VV::embed("public/assets/media/icons/star.svg") ?>
|
||||
<section class="featured">
|
||||
<featured-item>
|
||||
<?= VV::embed("public/assets/media/icons/repo.svg") ?>
|
||||
<h3>lorem</h3>
|
||||
<p>ipsuum</p>
|
||||
<div class="langs">
|
||||
<a href=""><button><p>PHP</p></button></a>
|
||||
</div>
|
||||
<div class="actions">
|
||||
<a href="PHP"><button class="inline">read more</button></a>
|
||||
</div>
|
||||
</featured-item>
|
||||
<featured-item>
|
||||
<?= VV::embed("public/assets/media/icons/star.svg") ?>
|
||||
<h3>lorem</h3>
|
||||
<p>ipsuum</p>
|
||||
<div class="actions">
|
||||
<a href=""><button class="inline">read more</button></a>
|
||||
</div>
|
||||
</featured-item>
|
||||
</section>
|
||||
<section class="heading">
|
||||
<a href="/work/timeline"><button class="inline">
|
||||
<p>View timeline</p>
|
||||
</button></a>
|
||||
<h1>latest projects</h1>
|
||||
</section>
|
||||
<?= VV::include("public/work/timeline?limit=" . TIMELINE_PREVIEW_LIMIT) ?>
|
||||
<section class="heading">
|
||||
<a href="/work/timeline"><button class="inline solid">view full timeline</button></a>
|
||||
</section>
|
|
@ -1,6 +1,7 @@
|
|||
<?php
|
||||
|
||||
use Vegvisir\Path;
|
||||
use Reflect\Response;
|
||||
|
||||
use VLW\Client\API;
|
||||
use VLW\API\Endpoints;
|
||||
|
@ -22,7 +23,7 @@
|
|||
$api = new API();
|
||||
|
||||
// Retreive rows from work endpoints
|
||||
$resp_work = $api->call(Endpoints::WORK->value)->get();
|
||||
$resp_work = $api->call(Endpoints::WORK->value)->params($_GET)->get();
|
||||
|
||||
// Resolve tags and actions if we got work results
|
||||
if ($resp_work->ok) {
|
||||
|
|
Loading…
Add table
Reference in a new issue